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

status.py (5081B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\dynamicresources\client\ess\bracket\root\status.py
      2 import eveformat
      3 from carbonui import uiconst
      4 from carbonui.primitives.containerAutoSize import ContainerAutoSize
      5 from carbonui.primitives.fill import Fill
      6 from carbonui.primitives.frame import Frame
      7 from carbonui.primitives.layoutGrid import LayoutGrid
      8 from carbonui.primitives.sprite import Sprite
      9 from carbonui.uianimations import animations
     10 from eve.client.script.ui.control import eveLabel
     11 from dynamicresources.client import color, text
     12 from dynamicresources.client.ess.bracket.panel import BracketPanel, get_absolute_bounds
     13 from dynamicresources.client.ess.bracket.state_machine import State, Transition
     14 from dynamicresources.client.ess.bracket.transform import BankPanelTransformController
     15 
     16 class StatusBase(State):
     17 
     18     def __init__(self, bracket, message):
     19         self._bracket = bracket
     20         self._message = message
     21         self._panel = None
     22         self._transform = None
     23 
     24     def enter(self):
     25         self._transform = BankPanelTransformController(root=self._bracket.ess_root, camera=self._bracket.camera, offset_y=3300.0)
     26         self._panel = StatusPanel(parent=self._bracket.layer, transform=self._transform.transform, camera=self._bracket.camera, message=self._message)
     27 
     28     def exit(self):
     29         transition = Exit(self._panel, self._transform)
     30         self._panel = None
     31         self._transform = None
     32         return transition
     33 
     34     def close(self):
     35         if self._panel:
     36             self._panel.close()
     37         if self._transform:
     38             self._transform.close()
     39 
     40 
     41 class OutOfRange(StatusBase):
     42 
     43     def __init__(self, bracket):
     44         super(OutOfRange, self).__init__(bracket=bracket, message=text.status_out_of_range())
     45 
     46 
     47 class Offline(StatusBase):
     48 
     49     def __init__(self, bracket):
     50         super(Offline, self).__init__(bracket=bracket, message=text.status_offline())
     51 
     52 
     53 class Exit(Transition):
     54 
     55     def __init__(self, panel, transform):
     56         super(Exit, self).__init__()
     57         self._panel = panel
     58         self._transform = transform
     59 
     60     def animation(self):
     61         self._panel.play_exit_animation()
     62         self.sleep(0.3)
     63 
     64     def on_close(self):
     65         self._panel.close()
     66         self._transform.close()
     67 
     68 
     69 class StatusPanel(BracketPanel):
     70 
     71     def __init__(self, parent, transform, camera, message):
     72         self._first_expand = True
     73         super(StatusPanel, self).__init__(name='ess_status_panel', transform=transform, layer=parent, camera=camera, collapse_at_camera_distance=100000.0, clipping_dead_zone=25, collapsed=True)
     74         self._base = LayoutGrid(name='ess_status_panel', columns=1)
     75         self._message_cont = ContainerAutoSize(parent=self._base, align=uiconst.TOPLEFT, alignMode=uiconst.TOPLEFT, bgColor=color.black.with_alpha(0.5).rgba, opacity=0.0 if self.is_collapsed else 1.0)
     76         if self.is_collapsed:
     77             self._message_cont.DisableAutoSize()
     78         eveLabel.EveHeaderLarge(parent=self._message_cont, align=uiconst.TOPLEFT, text=eveformat.color(message, (1.0, 1.0, 1.0, 1.0)), padding=(24, 12, 24, 12))
     79         Frame(bgParent=self._message_cont, idx=0)
     80         self._stem = Fill(parent=self._base, align=uiconst.CENTER, width=1, height=0 if self.is_collapsed else 32, color=color.white.rgba)
     81         Sprite(parent=self._base, align=uiconst.CENTER, state=uiconst.UI_DISABLED, height=5, width=5, texturePath='res:/UI/Texture/classes/ess/bracket/dot_5px.png')
     82         self.tracker.add(self._base, anchor=(0.5, 1.0))
     83         if not self.is_collapsed:
     84             self._first_expand = False
     85             animations.FadeTo(self._base, duration=0.1, loops=3, curveType=uiconst.ANIM_LINEAR)
     86 
     87     @property
     88     def content_bounds(self):
     89         return get_absolute_bounds(self._message_cont)
     90 
     91     def close(self):
     92         self._base.Close()
     93         super(StatusPanel, self).close()
     94 
     95     def expand(self):
     96         if self._first_expand:
     97             self._first_expand = False
     98             animations.FadeTo(self._base, duration=0.1, loops=3, curveType=uiconst.ANIM_LINEAR)
     99         animations.MorphScalar(self._stem, 'height', startVal=self._stem.height, endVal=32, duration=0.2)
    100         animations.BlinkIn(self._message_cont, timeOffset=0.2)
    101         width, height = self._message_cont.GetAutoSize()
    102         self._message_cont.width = width
    103         animations.MorphScalar(self._message_cont, 'height', startVal=self._message_cont.height, endVal=height, duration=0.2, timeOffset=0.1, callback=self._message_cont.EnableAutoSize)
    104 
    105     def collapse(self, lock = False):
    106         self._message_cont.DisableAutoSize()
    107         animations.MorphScalar(self._message_cont, 'height', startVal=self._message_cont.height, endVal=0, duration=0.2)
    108         animations.FadeOut(self._message_cont, duration=0.1)
    109         animations.MorphScalar(self._stem, 'height', startVal=self._stem.height, endVal=0, duration=0.2, timeOffset=0.1)
    110 
    111     def play_exit_animation(self):
    112         animations.FadeOut(self._base, duration=0.2)
    113 
    114 
    115 from dynamicresources.client.ess.bracket.debug import __reload_update__