NovaBryan/EVE_Dump
Log | Files | 📦 下载最新源码 (.zip) | Refs | README

states.py (2555B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\spacecomponents\client\ui\jumpbridge\states.py
      2 import carbonui.const as uiconst
      3 from carbonui.primitives.container import Container
      4 from carbonui.uianimations import animations
      5 from dynamicresources.client.ess.bracket.state_machine import State, StateMachine, Transition
      6 from spacecomponents.client.ui.jumpbridge.bracketPanel import JumpBridgePanel
      7 CONTENT_WIDTH = 300
      8 DEFAULT_CONTENT_HEIGHT = 170
      9 
     10 class Online(State):
     11 
     12     def __init__(self, bracket):
     13         self._bracket = bracket
     14         self._state_machine = StateMachine()
     15 
     16     def enter(self):
     17         self._state_machine.move_to(InRange(self._bracket))
     18 
     19     def close(self):
     20         self._state_machine.close()
     21 
     22 
     23 class InRange(State):
     24     __notifyevents__ = []
     25 
     26     def __init__(self, bracket):
     27         self._bracket = bracket
     28         self._panel = None
     29 
     30     def enter(self):
     31         self._panel = JumpBridgePanel(parent=self._bracket.layer, camera=self._bracket.camera, root_transform=self._bracket.root, content_class=self._bracket.content_class, panel_name=self._bracket.panel_name, offset_y=self._bracket.offset_y, collapse_at_camera_distance=self._bracket.collapse_at_camera_distance, tether_name=self._bracket.tether_name, tether_width=self._bracket.tether_width, itemID=self._bracket.item_id, typeID=self._bracket.type_id)
     32 
     33     def close(self):
     34         self._panel.close()
     35 
     36 
     37 class Idle(State):
     38 
     39     def __init__(self, panel):
     40         self._panel = panel
     41         self._content = None
     42 
     43     def enter(self):
     44         content_class = self._panel.content_class
     45         height = getattr(content_class, 'CONTENT_HEIGHT', DEFAULT_CONTENT_HEIGHT)
     46         self._content = Container(name='idleCont', parent=self._panel.content, pos=(0,
     47          0,
     48          CONTENT_WIDTH,
     49          height), align=uiconst.TOPLEFT)
     50         content_class(parent=self._content, align=uiconst.TOBOTTOM, height=height, itemID=self._panel.item_id, typeID=self._panel.type_id, panel=self._panel)
     51         animations.FadeTo(self._content, duration=0.3)
     52 
     53     def exit(self):
     54         transition = Exit(self._content)
     55         self._content = None
     56         return transition
     57 
     58     def close(self):
     59         if self._content:
     60             self._content.Close()
     61 
     62 
     63 class Exit(Transition):
     64 
     65     def __init__(self, content):
     66         super(Exit, self).__init__()
     67         self._content = content
     68 
     69     def animation(self):
     70         animations.FadeOut(self._content, duration=0.2)
     71         self.sleep(0.2)
     72 
     73     def on_close(self):
     74         self._content.Close()