NovaBryan/EVE_Dump
Log | Files | 📦 下载最新源码 (.zip) | Refs | README

sidePanelShip.py (3455B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\login\charcreation_new\steps\empireSelection\sidePanelShip.py
      2 import math
      3 import evetypes
      4 import trinity
      5 import uthread
      6 from carbonui import uiconst
      7 from carbonui.primitives.container import Container
      8 from carbonui.primitives.containerAutoSize import ContainerAutoSize
      9 from carbonui.primitives.sprite import StreamingVideoSprite
     10 from carbonui.uianimations import animations
     11 from characterdata.races import get_race_name
     12 from eve.client.script.ui.control.eveLabel import EveLabelLarge, EveCaptionLarge
     13 from eve.client.script.ui.login.charcreation_new.steps.empireSelection.empireSelectionConst import FACTIONSELECT_ANIMATION_DURATION, COLOR_BY_FACTIONID, SHIP_VIDEO_BY_FACTIONID
     14 from eve.client.script.ui.login.charcreation_new.charCreationSignals import onEmpireFactionSelected
     15 from eve.common.lib import appConst
     16 from eveui import Sprite
     17 from localization import GetByLabel
     18 SHIP_TYPEID_BY_FACTIONID = {appConst.factionMinmatarRepublic: 588,
     19  appConst.factionGallenteFederation: 606,
     20  appConst.factionAmarrEmpire: 596,
     21  appConst.factionCaldariState: 601}
     22 
     23 class SidePanelShip(Container):
     24 
     25     def ApplyAttributes(self, attributes):
     26         super(SidePanelShip, self).ApplyAttributes(attributes)
     27         factionID = attributes.factionID
     28         onEmpireFactionSelected.connect(self.OnEmpireFactionSelected)
     29         x = 0.75
     30         self.videoSprite = StreamingVideoSprite(name='icon', parent=self, align=uiconst.CENTERTOP, pos=(0,
     31          -110,
     32          x * 896,
     33          x * 597), spriteEffect=trinity.TR2_SFX_COPY)
     34         textCont = ContainerAutoSize(parent=self, align=uiconst.TOBOTTOM, padLeft=30, top=30)
     35         self.shipNameLabel = EveCaptionLarge(parent=textCont, align=uiconst.TOTOP)
     36         self.factionShipHintLabel = EveLabelLarge(parent=textCont, align=uiconst.TOTOP, padTop=4)
     37         Sprite(name='bottomLine', parent=self, align=uiconst.TOBOTTOM, height=2, texturePath='res:/UI/Texture/Classes/CharacterSelection/EmpireSelection/selectionGradientLine.png', idx=0)
     38         Sprite(name='selectionNotch', parent=self, align=uiconst.CENTERBOTTOM, pos=(0, 2, 50, 4), texturePath='res:/UI/Texture/Classes/CharacterSelection/EmpireSelection/selectionNotch.png', rotation=math.pi)
     39         Sprite(name='shipBG', bgParent=self, texturePath='res:/UI/Texture/Classes/CharacterSelection/EmpireSelection/shipBG.png', color=(0, 0, 0, 0.8))
     40         if factionID:
     41             self._UpdateFaction(factionID)
     42             self.opacity = 1.0
     43 
     44     def OnEmpireFactionSelected(self, factionID):
     45         uthread.new(self._OnEmpireFactionSelected, factionID)
     46 
     47     def _OnEmpireFactionSelected(self, factionID):
     48         duration = FACTIONSELECT_ANIMATION_DURATION / 2
     49         animations.FadeTo(self, self.opacity, 0.0, duration=duration, sleep=True)
     50         self._UpdateFaction(factionID)
     51         animations.FadeIn(self, duration=duration, timeOffset=duration)
     52 
     53     def _UpdateFaction(self, factionID):
     54         typeID = SHIP_TYPEID_BY_FACTIONID[factionID]
     55         self.videoSprite.SetVideoPath(SHIP_VIDEO_BY_FACTIONID[factionID], videoLoop=True)
     56         self.shipNameLabel.text = evetypes.GetName(typeID)
     57         self.shipNameLabel.SetRGBA(*COLOR_BY_FACTIONID[factionID])
     58         raceName = get_race_name(appConst.raceByFaction[factionID])
     59         self.factionShipHintLabel.text = GetByLabel('UI/CharacterCreation/EmpireSelection/BeginnerShipHint', raceName=raceName)