entosisTimer.py (4241B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\entosis\ui\entosisTimer.py 2 import math 3 from eve.client.script.ui.control.gaugeCircular import GaugeCircular 4 import carbonui.const as uiconst 5 import trinity 6 from carbonui.uicore import uicore 7 ARROW_TEXTURE_WIDTH = 15 8 LINE_WIDTH = 3 9 WHITE_COLOR = (1.0, 1.0, 1.0, 1.0) 10 NO_COLOR = (0.0, 0.0, 0.0, 0.0) 11 12 class EntosisTimer(GaugeCircular): 13 default_radius = 20 14 default_lineWidth = LINE_WIDTH 15 default_align = uiconst.CENTER 16 default_state = uiconst.UI_DISABLED 17 default_colorStart = WHITE_COLOR 18 default_colorEnd = WHITE_COLOR 19 default_colorBg = WHITE_COLOR 20 default_autoUpdate = False 21 default_moveMarker = True 22 default_name = 'entosisTimer' 23 stalemateTextureWidth = 18 24 gaugeArrowRightTexturePath = 'res:/UI/Texture/classes/Sov/gauge_arrow_right.png' 25 gaugeArrowLeftTexturePath = 'res:/UI/Texture/classes/Sov/gauge_arrow_left.png' 26 gaugeStalemateTexturePath = 'res:/UI/Texture/classes/Sov/gauge_arrow_stop.png' 27 28 def ApplyAttributes(self, attributes): 29 attributes['useRealTime'] = False 30 GaugeCircular.ApplyAttributes(self, attributes) 31 radius = attributes.get('radius', self.default_radius) 32 self.animatedGauge = GaugeCircular(parent=self, name='animatedGauge', radius=radius, lineWidth=LINE_WIDTH, showMarker=False, colorStart=WHITE_COLOR, colorEnd=WHITE_COLOR, colorBg=NO_COLOR, state=uiconst.UI_DISABLED, idx=0, useRealTime=False) 33 self.stalemateTextureWidth = 2 * math.pi * radius / 7 34 self.SetAnimatedGaugeTexture(self.gaugeArrowRightTexturePath, ARROW_TEXTURE_WIDTH) 35 self.animatedGauge.gauge.spriteEffect = trinity.TR2_SFX_COPY 36 self.animatedGauge.gauge.texture.useTransform = True 37 38 def SetAnimatedGaugeTexture(self, gaugeTexturePath, textureWidth): 39 self.animatedGauge.gauge.texturePath = gaugeTexturePath 40 self.animatedGauge.gauge.textureWidth = textureWidth 41 42 def SetEntosisValueImmediate(self, currentValue): 43 self.StopGaugeAnimations() 44 self.animatedGauge.StopGaugeAnimations() 45 self.animatedGauge.display = False 46 self.SetValueAndMarker(currentValue, False) 47 self.animatedGauge.SetValueAndMarker(currentValue, False) 48 49 def SetStalemate(self, currentValue): 50 self.StopGaugeAnimations() 51 self.animatedGauge.StopGaugeAnimations() 52 self.animatedGauge.display = True 53 uicore.animations.StopAnimation(self.animatedGauge.gauge.texture, 'translation') 54 self.SetAnimatedGaugeTexture(self.gaugeStalemateTexturePath, self.stalemateTextureWidth) 55 self.SetValueAndMarker(currentValue, False) 56 self.animatedGauge.SetValueAndMarker(currentValue, False) 57 58 def SetEntosisValueTimed(self, currentValue, targetValue, duration): 59 self.SetValueAndMarker(currentValue, False) 60 self.animatedGauge.SetValueAndMarker(currentValue, False) 61 self.SetValueAndMarkerTimed(targetValue, duration) 62 self.animatedGauge.SetValueAndMarkerTimed(targetValue, duration) 63 self.animatedGauge.display = True 64 if targetValue == 0.0: 65 self.SetAnimatedGaugeTexture(self.gaugeArrowLeftTexturePath, ARROW_TEXTURE_WIDTH) 66 uicore.animations.MorphVector2(self.animatedGauge.gauge.texture, 'translation', startVal=(0.0, 0.0), endVal=(1.0, 0.0), duration=1.5, curveType=uiconst.ANIM_LINEAR, loops=uiconst.ANIM_REPEAT) 67 else: 68 self.SetAnimatedGaugeTexture(self.gaugeArrowRightTexturePath, ARROW_TEXTURE_WIDTH) 69 uicore.animations.MorphVector2(self.animatedGauge.gauge.texture, 'translation', startVal=(0.0, 0.0), endVal=(-1.0, 0.0), duration=1.5, curveType=uiconst.ANIM_LINEAR, loops=uiconst.ANIM_REPEAT) 70 71 def SetTimerColor(self, foregroundColor, backgroundColor, arrowColor): 72 self.SetColorMarker(foregroundColor) 73 self.gauge.color = foregroundColor 74 self.bgGauge.color = backgroundColor 75 self.animatedGauge.gauge.color = arrowColor 76 77 def Close(self): 78 uicore.animations.StopAnimation(self.animatedGauge.gauge.texture, 'translation') 79 GaugeCircular.Close(self) 80 81 def SetDisplayValue(self, displayValue): 82 self.display = displayValue