captureGauge.py (1954B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\factionalWarfare\captureGauge.py 2 from carbonui import uiconst 3 from carbonui.uianimations import animations 4 from eve.client.script.ui.control.gauge import Gauge 5 from eve.common.lib import appConst 6 from eve.common.script.util import facwarCommon 7 import localization 8 from factionwarfare.client.text import GetSystemCaptureStatusText, GetSystemCaptureStatusHint 9 COLOR_RED = (0.5, 0.0, 0.0, 1.0) 10 COLOR_WHITE = (0.5, 0.5, 0.5, 1.0) 11 12 class CaptureGauge(Gauge): 13 __notifyevents__ = ['OnSystemStatusChanged'] 14 15 def ApplyAttributes(self, attributes): 16 super(CaptureGauge, self).ApplyAttributes(attributes) 17 self.isGaugeInitialized = False 18 self.solarSystemID = attributes.get('solarSystemID', session.solarsystemid2) 19 self.fwVictoryPointSvc = sm.GetService('fwVictoryPointSvc') 20 sm.RegisterNotify(self) 21 22 def UpdateGauge(self, animate = True): 23 animate = animate and self.isGaugeInitialized 24 victoryPointState = self.fwVictoryPointSvc.GetVictoryPointState(self.solarSystemID) 25 if victoryPointState: 26 value = victoryPointState.contestedFraction 27 else: 28 value = 0.0 29 animations.StopAnimation(self, 'opacity') 30 self.opacity = 1.0 31 self.SetValue(value, animate=animate) 32 if value >= 1.0: 33 self.SetColor(COLOR_RED) 34 else: 35 self.SetColor(COLOR_WHITE) 36 self.isGaugeInitialized = True 37 38 def OnSystemStatusChanged(self): 39 self.UpdateGauge() 40 41 def GetHint(self): 42 victoryPointState = self.fwVictoryPointSvc.GetVictoryPointState(self.solarSystemID) 43 hint = GetSystemCaptureStatusText(victoryPointState) 44 captureStatusHint = GetSystemCaptureStatusHint(victoryPointState) 45 if captureStatusHint: 46 hint += '<br><color=gray>' + captureStatusHint 47 return hint