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

epicArcBar.py (2793B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\epicArcs\epicArcBar.py
      2 from carbonui import uiconst
      3 from carbonui.primitives.container import Container
      4 from carbonui.primitives.containerAutoSize import ContainerAutoSize
      5 from carbonui.control.buttonIcon import ButtonIcon
      6 from eve.client.script.ui.control.eveLabel import EveLabelLarge
      7 from eve.client.script.ui.shared.epicArcs.epicArcNodeContainer import EpicArcNodeContainer
      8 from localization import GetByMessageID, GetByLabel
      9 
     10 class EpicArcBar(ContainerAutoSize):
     11 
     12     def ApplyAttributes(self, attributes):
     13         ContainerAutoSize.ApplyAttributes(self, attributes)
     14         self.epicArc = attributes.epicArc
     15         labelCont = Container(name='labelCont', parent=self, align=uiconst.TOTOP, height=20, padTop=4)
     16         self.prevChapterBtn = ButtonIcon(name='prevButton', parent=labelCont, align=uiconst.CENTERLEFT, width=12, texturePath='res:/UI/Texture/Shared/arrows/arrowLeft.png', iconSize=9, func=self.SelectPreviousChapter)
     17         self.nextChapterBtn = ButtonIcon(name='nextButton', parent=labelCont, align=uiconst.CENTERLEFT, width=12, left=12, texturePath='res:/UI/Texture/Shared/arrows/arrowRight.png', iconSize=9, func=self.SelectNextChapter)
     18         self.chapterLabel = EveLabelLarge(parent=labelCont, align=uiconst.CENTERLEFT, left=30)
     19         self.nodeContainer = EpicArcNodeContainer(parent=self, align=uiconst.TOTOP, epicArc=self.epicArc, padTop=6)
     20         self._SetChapter(self.epicArc.GetCurrentChapterID())
     21 
     22     def _SetChapter(self, chapterID, animate = False):
     23         self.nodeContainer.ConstructNodes(chapterID, animate)
     24         self.UpdateChapterLabel(chapterID)
     25         self.chapterID = chapterID
     26 
     27     def SelectPreviousChapter(self):
     28         chapterIDs = self.epicArc.GetChapterIDs()
     29         currIdx = chapterIDs.index(self.chapterID)
     30         idx = currIdx - 1
     31         self._TryChangeChapter(chapterIDs, idx)
     32 
     33     def _TryChangeChapter(self, chapterIDs, idx):
     34         try:
     35             chapterID = chapterIDs[idx]
     36             self._SetChapter(chapterID, animate=True)
     37         except IndexError:
     38             pass
     39 
     40     def SelectNextChapter(self):
     41         chapterIDs = self.epicArc.GetChapterIDs()
     42         currIdx = chapterIDs.index(self.chapterID)
     43         idx = currIdx + 1
     44         if idx > len(chapterIDs) - 1:
     45             idx = 0
     46         self._TryChangeChapter(chapterIDs, idx)
     47 
     48     def UpdateChapterLabel(self, chapterID):
     49         chapterName = GetByMessageID(chapterID)
     50         chapterIDs = self.epicArc.GetChapterIDs()
     51         chapterNum = chapterIDs.index(chapterID) + 1
     52         numChapters = len(chapterIDs)
     53         self.chapterLabel.text = GetByLabel('UI/Agency/EpicArcChapter', chapterNum=chapterNum, numChapters=numChapters, chapterName=chapterName)