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

button.py (2184B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\cloneGrade\button.py
      2 from carbon.client.script.environment.AudioUtil import PlaySound
      3 from carbonui import const as uiconst
      4 from carbonui.primitives.containerAutoSize import ContainerAutoSize
      5 from carbonui.primitives.stretchspritehorizontal import StretchSpriteHorizontal
      6 from carbonui.uianimations import animations
      7 from clonegrade.const import COLOR_OMEGA_ORANGE
      8 from eve.client.script.ui.control.eveLabel import EveLabelMediumBold
      9 from localization import GetByLabel
     10 
     11 class CloneGradeButtonMedium(ContainerAutoSize):
     12     default_state = uiconst.UI_NORMAL
     13     default_height = 21
     14 
     15     def ApplyAttributes(self, attributes):
     16         super(CloneGradeButtonMedium, self).ApplyAttributes(attributes)
     17         self.onClick = attributes.onClick
     18         self.onMouseEnter = attributes.onMouseEnter
     19         self.onMouseExit = attributes.onMouseExit
     20         text = attributes.text or GetByLabel('UI/CloneState/Upgrade')
     21         cont = ContainerAutoSize(parent=self, align=uiconst.TOLEFT)
     22         self.label = EveLabelMediumBold(parent=cont, align=uiconst.CENTERLEFT, state=uiconst.UI_DISABLED, text=text, color=COLOR_OMEGA_ORANGE, padding=(16, 0, 16, 0))
     23         self.bg = StretchSpriteHorizontal(bgParent=self, texturePath='res:/UI/Texture/Classes/CloneGrade/omegaBG_21.png', rightEdgeSize=8, leftEdgeSize=8, opacity=0.85)
     24 
     25     def OnMouseEnter(self, *args):
     26         PlaySound(uiconst.SOUND_BUTTON_HOVER)
     27         duration = 0.2
     28         animations.FadeTo(self.label, self.label.opacity, 1.5, duration=duration)
     29         animations.FadeTo(self.bg, self.bg.opacity, 1.5, duration=duration)
     30         if callable(self.onMouseEnter):
     31             self.onMouseEnter()
     32 
     33     def OnMouseExit(self, *args):
     34         duration = 0.3
     35         animations.FadeTo(self.label, self.label.opacity, 1.0, duration=duration)
     36         animations.FadeTo(self.bg, self.bg.opacity, 1.0, duration=duration)
     37         if callable(self.onMouseExit):
     38             self.onMouseExit()
     39 
     40     def OnClick(self, *args):
     41         if callable(self.onClick):
     42             PlaySound(uiconst.SOUND_BUTTON_CLICK)
     43             self.onClick()