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

omega_header.py (3606B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\omega\upsell\components\omega_header.py
      2 import carbonui
      3 import carbonui.text.styles
      4 import eveicon
      5 import uthread2
      6 from carbonui import Align, ButtonStyle, ButtonVariant, TextAlign, PickState
      7 from carbonui.control.button import Button
      8 from carbonui.primitives.container import Container
      9 from carbonui.primitives.sprite import Sprite
     10 from carbonui.primitives.stretchspritehorizontal import StretchSpriteHorizontal
     11 from carbonui.uianimations import animations
     12 from carbonui.uiconst import OutputMode
     13 from eve.client.script.ui import eveColor
     14 from localization import GetByLabel
     15 from omega.client.clone_grade_svc import get_clone_grade_svc
     16 from signals import Signal
     17 import omega.client.signal as omega_signals
     18 
     19 class OmegaHeader(Container):
     20     default_height = 188
     21 
     22     def __init__(self, **kwargs):
     23         super(OmegaHeader, self).__init__(**kwargs)
     24         self.on_close_btn = Signal('on_close_btn')
     25         self.on_back_btn = Signal('on_back_btn')
     26         self.construct_layout()
     27         uthread2.start_tasklet(self.update)
     28         self.connect_signals()
     29 
     30     def Close(self):
     31         super(OmegaHeader, self).Close()
     32         self.disconnect_signals()
     33 
     34     def disconnect_signals(self):
     35         omega_signals.on_omega_license_acquired.disconnect(self._on_omega_license_acquired)
     36 
     37     def connect_signals(self):
     38         omega_signals.on_omega_license_acquired.connect(self._on_omega_license_acquired)
     39 
     40     def _on_omega_license_acquired(self, *args):
     41         uthread2.start_tasklet(self.update)
     42 
     43     def construct_layout(self):
     44         top_cont = Container(parent=self, align=Align.TOTOP, height=88)
     45         decoration_cont = Container(parent=top_cont, align=Align.TOTOP, padTop=47, height=41)
     46         StretchSpriteHorizontal(parent=decoration_cont, align=Align.TOLEFT_PROP, width=0.5, padRight=86, texturePath='res:/UI/Texture/classes/OmegaUpsell/header_decoration_left.png', leftEdgeSize=32, rightEdgeSize=32)
     47         StretchSpriteHorizontal(parent=decoration_cont, align=Align.TOLEFT_PROP, width=0.5, padLeft=86, texturePath='res:/UI/Texture/classes/OmegaUpsell/header_decoration_right.png', leftEdgeSize=32, rightEdgeSize=32)
     48         Sprite(parent=self, texturePath=eveicon.omega, pos=(0, 0, 128, 128), align=Align.CENTERTOP, outputMode=OutputMode.COLOR_AND_GLOW, glowBrightness=0.6)
     49         self.label = carbonui.text.styles.TextDisplay(parent=self, align=Align.CENTERTOP, top=130, color=eveColor.OMEGA_YELLOW, textAlign=TextAlign.CENTER, width=450, uppercase=True)
     50         self.back_button = Button(name='Back', parent=self, align=Align.TOPLEFT, pos=(16, 112, 0, 0), func=self._on_back_btn, label=GetByLabel('UI/Commands/Back'), variant=ButtonVariant.GHOST, style=ButtonStyle.MONETIZATION, texturePath=eveicon.chevron_left, display=False, pickState=PickState.ON)
     51         Button(name='closeButton', parent=self, label=GetByLabel('UI/Generic/Close'), variant=ButtonVariant.GHOST, style=ButtonStyle.MONETIZATION, texturePath=eveicon.close, pos=(16, 112, 0, 0), align=Align.TOPRIGHT, func=self.on_close_btn)
     52 
     53     def update(self):
     54         if get_clone_grade_svc().is_omega_without_grace_period():
     55             text = GetByLabel('UI/OmegaUpsell/OmegaBenefits')
     56         else:
     57             text = GetByLabel('UI/OmegaUpsell/UpgradeToOmega')
     58         if self.label.text and text != self.label.text:
     59             self.label.opacity = 0.0
     60             animations.FadeTo(self.label, 0.0, 1.0, duration=1.0, timeOffset=0.6)
     61         self.label.text = text
     62 
     63     def _on_back_btn(self, *args):
     64         self.on_back_btn()