fwSystemBenefitIcon.py (2141B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\factionalWarfare\fwSystemBenefitIcon.py 2 import math 3 import localization 4 from carbonui import const as uiconst 5 from carbonui.primitives.container import Container 6 from carbonui.primitives.containerAutoSize import ContainerAutoSize 7 from carbonui.primitives.sprite import Sprite 8 from carbonui.util.color import Color 9 from eve.client.script.ui.control import eveLabel 10 from eve.common.lib import appConst as const 11 from eve.common.script.util import facwarCommon 12 13 class FWSystemBenefitIcon(ContainerAutoSize): 14 default_state = uiconst.UI_NORMAL 15 default_width = 22 16 17 def ApplyAttributes(self, attributes): 18 ContainerAutoSize.ApplyAttributes(self, attributes) 19 self.benefitType = attributes.benefitType 20 self.benefitValue = attributes.benefitValue 21 self.facwar = sm.GetService('facwar') 22 Sprite(parent=self, state=uiconst.UI_DISABLED, align=uiconst.TOTOP, texturePath=self.GetTexturePath(), height=self.width, opacity=0.75) 23 labelCont = Container(name='labelCont', parent=self, align=uiconst.TOTOP, height=12) 24 eveLabel.EveLabelSmall(parent=labelCont, align=uiconst.CENTER, padTop=3, text=self.GetLabel(), color=Color.WHITE) 25 26 def GetTexturePath(self): 27 return {facwarCommon.BENEFIT_MARKETREDUCTION: 'res:/ui/texture/classes/FWInfrastructureHub/marketReduction.png', 28 facwarCommon.BENEFIT_INDUSTRYCOST: 'res:/ui/texture/classes/FWInfrastructureHub/stationCopySlots.png'}.get(self.benefitType) 29 30 def GetLabel(self): 31 return {facwarCommon.BENEFIT_MARKETREDUCTION: '%s%%', 32 facwarCommon.BENEFIT_INDUSTRYCOST: '%s%%'}.get(self.benefitType) % self.benefitValue 33 34 def GetHint(self): 35 if self.benefitType == facwarCommon.BENEFIT_MARKETREDUCTION: 36 return localization.GetByLabel('UI/FactionWarfare/IHub/UpgradeHintMarketReduction', num=self.benefitValue) 37 if self.benefitType == facwarCommon.BENEFIT_INDUSTRYCOST: 38 return localization.GetByLabel('UI/FactionWarfare/IHub/UpgradeHintStationSlots', num=self.benefitValue)