congratsCont.py (4321B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\loginRewards\congratsCont.py 2 import gametime 3 from carbon.common.script.util.timerstuff import AutoTimer 4 from carbonui.primitives.container import Container 5 from carbonui.primitives.sprite import Sprite 6 from carbonui.primitives.stretchspritehorizontal import StretchSpriteHorizontal 7 from carbonui.uianimations import animations 8 from carbonui import uiconst 9 from eve.client.script.ui.control.eveLabel import EveLabelLargeBold, EveLabelMedium 10 from eve.client.script.ui.shared.loginRewards.rewardUiConst import GREEN_CHECKMARK, TODAYS_SIDE_PADDING, CAMPAIGN_STATUS_SUCCESSFULLY_COMPLETED 11 from localization import GetByLabel 12 13 class CongratsScreenInEntry(Container): 14 default_height = 0 15 default_align = uiconst.TOALL 16 17 def ApplyAttributes(self, attributes): 18 Container.ApplyAttributes(self, attributes) 19 self.panelController = attributes.panelController 20 pConst = self.panelController.GetPanelConstants() 21 self.innerCont = ContgratsCont(name='innerCont', parent=self, align=uiconst.TOALL, padTop=pConst.CONGRATS_OFFSET) 22 23 def LoadCongratsScreen(self, *args): 24 self.innerCont.LoadCongratsElements(self.GetHeaderText, self.GetBodyText) 25 26 def GetHeaderText(self): 27 return self.panelController.GetCongratsHeaderText() 28 29 def GetBodyText(self): 30 return self.panelController.GetCongratsBodyText() 31 32 33 class TwoTrackCongratsScreen(Container): 34 35 def ApplyAttributes(self, attributes): 36 Container.ApplyAttributes(self, attributes) 37 self.panelController = attributes.panelController 38 Sprite(bgParent=self, texturePath='res:/UI/Texture/classes/LoginCampaign/todaysReward_gradient_BG.png', color=(0, 0, 0, 1), padLeft=TODAYS_SIDE_PADDING, padRight=TODAYS_SIDE_PADDING) 39 self.innerCont = ContgratsCont(name='innerCont', parent=self, align=uiconst.TOTOP_NOPUSH, top=100, height=150, bgColor=(0.1, 0.1, 0.1, 1.0)) 40 41 def LoadCongratsScreen(self): 42 self.innerCont.LoadCongratsElements(self.GetHeaderText, self.GetBodyText, True) 43 44 def GetHeaderText(self): 45 return self.panelController.GetCongratsHeaderText() 46 47 def GetBodyText(self): 48 return self.panelController.GetCongratsBodyText() 49 50 51 class ContgratsCont(Container): 52 53 def LoadCongratsElements(self, headerFunc, textFunc, updateText = True): 54 self.updateThread = None 55 self.Flush() 56 animations.FadeTo(self, 0.0, 1.0, duration=0.5, curveType=uiconst.ANIM_OVERSHOT3, timeOffset=0.2) 57 doneIcon = Sprite(name='doneIcon', parent=self, align=uiconst.CENTERTOP, pos=(0, -26, 64, 64), texturePath='res:/ui/Texture/classes/LoginCampaign/claimedCheckNew.png', color=GREEN_CHECKMARK) 58 self.gradientCont = Container(name='gradientCont', parent=self, align=uiconst.TOTOP_NOPUSH, height=25, top=-6) 59 Sprite(name='headerGradientGlow', parent=self.gradientCont, texturePath='res:/UI/Texture/classes/LoginCampaign/campaignComplete_gradientGlow_2.png', align=uiconst.TOTOP_NOPUSH, height=25, color=GREEN_CHECKMARK) 60 Sprite(name='headerGradient', parent=self.gradientCont, texturePath='res:/UI/Texture/classes/LoginCampaign/campaignComplete_gradientGlow_1.png', align=uiconst.TOTOP, top=6, height=13, color=GREEN_CHECKMARK) 61 self.headerLabel = EveLabelLargeBold(parent=self, text=GetFormattedText(headerFunc()), align=uiconst.TOTOP, top=40, padding=(10, 0, 10, 0)) 62 self.textLabel = EveLabelMedium(parent=self, text=GetFormattedText(textFunc()), align=uiconst.TOTOP, top=10, opacity=0.75, padLeft=10, padRight=10) 63 lineTexture = 'res:/UI/Texture/classes/LoginCampaign/todaysRewardBracket.png' 64 self.todayBracket = StretchSpriteHorizontal(parent=self, align=uiconst.TOBOTTOM_NOPUSH, texturePath=lineTexture, height=12, rightEdgeSize=80, leftEdgeSize=80, opacity=0.1) 65 if updateText: 66 self.updateThread = AutoTimer(500, self.UpdateText, headerFunc, textFunc) 67 68 def UpdateText(self, headerFunc, textFunc): 69 self.headerLabel.text = GetFormattedText(headerFunc()) 70 self.textLabel.text = GetFormattedText(textFunc()) 71 72 def Close(self): 73 self.updateThread = None 74 Container.Close(self) 75 76 77 def GetFormattedText(text): 78 return '<center>%s</center>' % text