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

extraBtnShipSlot.py (3454B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\inflight\shipModuleButton\extraBtnShipSlot.py
      2 import carbonui.uiconst as uiconst
      3 import trinity
      4 from carbon.client.script.environment.AudioUtil import PlaySound
      5 from carbonui.primitives.container import Container
      6 from carbonui.primitives.sprite import Sprite
      7 from carbonui.uicore import uicore
      8 from eve.client.script.ui.inflight.shipModuleButton.ramps import ShipModuleButtonRamps
      9 GLOWCOLOR = (0.24, 0.67, 0.16, 0.75)
     10 
     11 class ExtraBtnShipSlot(Container):
     12     default_pickRadius = 24
     13     default_width = 64
     14     default_height = 64
     15     default_align = uiconst.TOPLEFT
     16     default_state = uiconst.UI_NORMAL
     17 
     18     def ApplyAttributes(self, attributes):
     19         Container.ApplyAttributes(self, attributes)
     20         self.func = attributes.func
     21         self.btnDisabled = False
     22         self.buttonSprite = Sprite(name='buttonSprite', parent=self, align=uiconst.CENTER, state=uiconst.UI_DISABLED, pos=(0, 0, 42, 42))
     23         self.ramps = ShipModuleButtonRamps(parent=self)
     24         self.hilite = Sprite(parent=self, name='hilite', padding=(10, 10, 10, 10), align=uiconst.TOALL, state=uiconst.UI_DISABLED, texturePath='res:/UI/Texture/classes/ShipUI/slotHilite.png', blendMode=trinity.TR2_SBM_ADDX2)
     25         self.hilite.display = False
     26         self.mainShape = Sprite(parent=self, name='mainshape', pos=(0, 0, 0, 0), align=uiconst.TOALL, state=uiconst.UI_DISABLED, texturePath='res:/UI/Texture/classes/ShipUI/slotMainFull.png')
     27         self.glow = Sprite(parent=self, name='glow', padding=2, align=uiconst.TOALL, state=uiconst.UI_DISABLED, texturePath='res:/UI/Texture/classes/ShipUI/slotGlow.png', color=GLOWCOLOR)
     28 
     29     def OnClick(self, *args):
     30         if not self.btnDisabled and self.func:
     31             self.func()
     32 
     33     def OnMouseDown(self, *args):
     34         if self.btnDisabled:
     35             return
     36         Container.OnMouseDown(self, *args)
     37         self.top += 2
     38 
     39     def OnMouseUp(self, *args):
     40         if self.btnDisabled:
     41             return
     42         Container.OnMouseUp(self, *args)
     43         if self.destroyed:
     44             return
     45         self.top = 0
     46 
     47     def OnMouseEnter(self, *args):
     48         if self.destroyed:
     49             return
     50         PlaySound(uiconst.SOUND_BUTTON_HOVER)
     51         self.SetHilite()
     52 
     53     def OnMouseExit(self, *args):
     54         self.RemoveHilite()
     55         self.OnMouseUp(None)
     56 
     57     def SetHilite(self):
     58         self.hilite.display = True
     59 
     60     def RemoveHilite(self):
     61         self.hilite.display = False
     62 
     63     def ShowGlow(self, glowColor):
     64         self.glow.SetRGBA(*glowColor)
     65         self.glow.display = True
     66 
     67     def HideGlow(self):
     68         self.glow.display = False
     69 
     70     def SetRampValue(self, value):
     71         if value > 0:
     72             self.ramps.display = True
     73         else:
     74             self.ramps.display = False
     75         self.ramps.SetRampValues(value)
     76 
     77     def SetButtonIcon(self, texturePath):
     78         self.buttonSprite.SetTexturePath(texturePath)
     79 
     80     def BlinkGlow(self, glowColor):
     81         self.glow.SetRGBA(*glowColor)
     82         uicore.animations.BlinkIn(self.glow, startVal=0, endVal=0.75, duration=1.0, loops=uiconst.ANIM_REPEAT, curveType=uiconst.ANIM_WAVE)
     83         self.glow.display = True
     84 
     85     def StopBlinkGlow(self):
     86         uicore.animations.StopAnimation(self.glow, 'opacity')
     87         self.glow.display = False
     88 
     89     def DisableBtn(self):
     90         self.btnDisabled = True
     91 
     92     def EnableBtn(self):
     93         self.btnDisabled = False