skillInjectorBar.py (3577B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\skilltrading\skillInjectorBar.py 2 import localization 3 import trinity 4 import uthread 5 from carbonui import uiconst 6 from carbonui.primitives.container import Container 7 from carbonui.primitives.frame import Frame 8 from carbonui.primitives.gradientSprite import GradientSprite 9 from carbonui.primitives.sprite import Sprite 10 from carbonui.uianimations import animations 11 from carbonui.util.color import Color 12 from eve.client.script.ui.control.eveLabel import CaptionLabel 13 from eve.client.script.ui.control.gauge import Gauge 14 from eve.client.script.ui.shared.neocom.skillConst import COLOR_UNALLOCATED_1 15 from eve.client.script.ui.skilltrading.skillInjectorBarAmountLabel import InjectorBarAmountLabel 16 17 class SkillInjectorBar(Container): 18 default_width = 350 19 default_height = 52 20 21 def ApplyAttributes(self, attributes): 22 super(SkillInjectorBar, self).ApplyAttributes(attributes) 23 self.totalPoints = attributes.get('totalPoints', 0) 24 self.injectorItem = attributes.injectorItem 25 self.onComplete = attributes.onComplete 26 self.skillSvc = sm.GetService('skills') 27 self.ConstructLayout() 28 29 def ConstructLayout(self): 30 gaugeCont = Container(name='GaugeContainer', parent=self, align=uiconst.TOTOP, height=32) 31 Frame(parent=gaugeCont, texturePath='res:/UI/Texture/classes/skilltrading/frame.png', cornerSize=3, opacity=0.5) 32 self.gaugeBG = GradientSprite(bgParent=gaugeCont, align=uiconst.TOALL, rgbData=[(0.0, (1.0, 1.0, 1.0))], alphaData=[(0.0, 0.0), 33 (0.4, 0.9), 34 (0.6, 0.9), 35 (1.0, 0.0)], opacity=0.1) 36 arrowCont = Container(parent=gaugeCont, align=uiconst.TOALL) 37 self.frame = Frame(bgParent=arrowCont, texturePath='res:/UI/Texture/Classes/Industry/CenterBar/buttonBg.png', cornerSize=5, color=Color.GRAY2) 38 self.arrows = Sprite(bgParent=arrowCont, texturePath='res:/UI/Texture/Classes/Industry/CenterBar/arrowMask.png', textureSecondaryPath='res:/UI/Texture/Classes/Industry/CenterBar/arrows.png', translationSecondary=(-0.16, 0), spriteEffect=trinity.TR2_SFX_MODULATE, color=Color.GRAY2, opacity=0.2) 39 animations.MorphVector2(self.arrows, 'translationSecondary', startVal=(0.16, 0.0), endVal=(-0.16, 0.0), duration=2.0, curveType=uiconst.ANIM_LINEAR, loops=uiconst.ANIM_REPEAT) 40 self.label = CaptionLabel(parent=arrowCont, align=uiconst.CENTER) 41 self.gauge = Gauge(parent=gaugeCont, align=uiconst.TOTOP, state=uiconst.UI_DISABLED, height=30, gaugeHeight=30, top=1, color=COLOR_UNALLOCATED_1, backgroundColor=(1.0, 1.0, 0.0, 0.0)) 42 self.unallocatedPointsLabel = InjectorBarAmountLabel(parent=self, align=uiconst.TOTOP, top=2, amount=self.skillSvc.GetFreeSkillPoints()) 43 44 def SetTotalPoints(self, totalPoints): 45 self.totalPoints = totalPoints 46 47 def OnInjectionStarted(self): 48 self.FillGauge() 49 self.SetUnallocatedPointsLabel() 50 51 def FillGauge(self): 52 completeText = localization.GetByLabel('UI/SkillTrading/InjectionComplete') 53 self.gauge.SetValueTimed(1.0, duration=0.6, callback=lambda : self.AnimSetLabel(completeText)) 54 55 def SetUnallocatedPointsLabel(self): 56 self.unallocatedPointsLabel.AnimSetAmount(self.totalPoints) 57 58 def AnimSetLabel(self, text): 59 uthread.new(self._AnimSetLabel, text) 60 61 def _AnimSetLabel(self, text): 62 animations.FadeOut(self.label, duration=0.25, sleep=True) 63 self.label.SetText(text) 64 animations.FadeIn(self.label, duration=0.3)