empireSelectionMenu.py (3249B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\login\charcreation_new\steps\empireSelection\empireSelectionMenu.py 2 import math 3 from carbonui import uiconst 4 from carbonui.primitives.container import Container 5 from carbonui.primitives.gradientSprite import GradientSprite 6 from carbonui.uianimations import animations 7 from eve.client.script.ui.login.charcreation_new.steps.empireSelection.empireSelectionButton import EmpireSelectionButton 8 from eve.client.script.ui.login.charcreation_new.steps.empireSelection.empireSelectionConst import EMPIRE_FACTIONIDS, MINIMIZE_ANIMATION_DURATION 9 from eve.client.script.ui.login.charcreation_new.charCreationSignals import onEmpireFactionSelected 10 from eveui import Sprite 11 12 class EmpireSelectionMenu(Container): 13 default_height = 208 14 15 def ApplyAttributes(self, attributes): 16 super(EmpireSelectionMenu, self).ApplyAttributes(attributes) 17 onEmpireFactionSelected.connect(self.OnEmpireSelectionButton) 18 self.buttons = [] 19 self.isLarge = True 20 self.ConstructButtons() 21 self.ConstructionSelectionNotch() 22 self.bgCont = Container(name='bgCont', parent=self) 23 self.ConstructBackground() 24 25 def ConstructButtons(self): 26 for i, factionID in enumerate(EMPIRE_FACTIONIDS): 27 analyticID = 'empireSelectionButton_faction_%s' % factionID 28 button = EmpireSelectionButton(parent=self, align=uiconst.TOPLEFT_PROP, pos=(i / 3.0, 29 0, 30 0.25, 31 0.99), maxWidth=self.height, factionID=factionID, analyticID=analyticID) 32 self.buttons.append(button) 33 34 def OnEmpireSelectionButton(self, factionID): 35 x = EMPIRE_FACTIONIDS.index(factionID) 36 animations.MorphScalar(self.selectionNotch, 'left', self.selectionNotch.left, x / 3.0, duration=MINIMIZE_ANIMATION_DURATION) 37 if self.isLarge: 38 for button in self.buttons: 39 button.ReduceSize() 40 41 self.isLarge = False 42 43 def ConstructionSelectionNotch(self): 44 self.selectionNotch = Container(name='selectionNotch', parent=self, align=uiconst.TOPLEFT_PROP, pos=(0.5, 0.0, 0.25, 0.99), maxWidth=self.height) 45 Sprite(name='selectionNotch', parent=self.selectionNotch, align=uiconst.CENTERTOP, top=2, height=4, pos=(0, 2, 50, 4), texturePath='res:/UI/Texture/Classes/CharacterSelection/EmpireSelection/selectionNotch.png') 46 Sprite(name='selectionNotch', parent=self.selectionNotch, align=uiconst.CENTERBOTTOM, pos=(0, 2, 50, 4), texturePath='res:/UI/Texture/Classes/CharacterSelection/EmpireSelection/selectionNotch.png', rotation=math.pi) 47 48 def ConstructBackground(self): 49 Sprite(name='topLine', parent=self.bgCont, align=uiconst.TOTOP, height=2, texturePath='res:/UI/Texture/Classes/CharacterSelection/EmpireSelection/selectionGradientLine.png') 50 Sprite(name='bottomLine', parent=self.bgCont, align=uiconst.TOBOTTOM, height=2, texturePath='res:/UI/Texture/Classes/CharacterSelection/EmpireSelection/selectionGradientLine.png') 51 GradientSprite(name='bgGradient', bgParent=self.bgCont, rgbData=((0, (0.0, 0.0, 0.0)),), alphaData=((0.0, 0.0), 52 (0.25, 0.6), 53 (0.75, 0.6), 54 (1.0, 0.0)))