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

panelPhasedAsteroidMechanics.py (5548B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\info\panels\panelPhasedAsteroidMechanics.py
      2 import carbonui.const as uiconst
      3 from carbonui import Align
      4 from carbonui.text.styles import TextBody, TextDetail
      5 from carbonui.button.const import HEIGHT_NORMAL
      6 from carbonui.control.scrollContainer import ScrollContainer
      7 from carbonui.primitives.container import Container
      8 from carbonui.primitives.containerAutoSize import ContainerAutoSize
      9 from carbonui.primitives.fill import Fill
     10 from carbonui.primitives.frame import Frame
     11 from carbonui.primitives.line import Line
     12 from carbonui.primitives.sprite import Sprite
     13 from eve.client.script.ui import eveColor
     14 from eve.client.script.ui.control.eveLabel import EveLabelMedium
     15 from eve.client.script.ui.shared.agencyNew.contentGroups.contentGroupConst import contentGroupPhasedFields
     16 from inventorycommon.const import typeMobilePhaseAnchor
     17 from localization import GetByLabel
     18 from spacecomponents.common.componentConst import BREACH_POINT_ASTEROID
     19 from spacecomponents.common.data import get_space_component_for_type
     20 from uihighlighting.uniqueNameConst import UNIQUE_NAME_MINING_SCAN_BTN
     21 TEXT_PAD_SIDES = 8
     22 
     23 class PanelPhasedAsteroidMechanics(Container):
     24 
     25     def ApplyAttributes(self, attributes):
     26         super(PanelPhasedAsteroidMechanics, self).ApplyAttributes(attributes)
     27         self.itemID = attributes.itemID
     28         self.typeID = attributes.typeID
     29 
     30     def Load(self):
     31         self.Flush()
     32         self.scrollContainer = ScrollContainer(parent=self, padding=uiconst.defaultPadding)
     33         self.AddAvailability()
     34         self.AddAccessability()
     35         self.AddMiningEfficiency()
     36 
     37     def AddAvailability(self):
     38         AddHeader(self.scrollContainer, GetByLabel('UI/PhasedAsteroid/AvailabilityHeader'))
     39         agencyLink = '<a href="localsvc:contentGroupID=%s&method=AgencyOpenAndShow">%s</a>' % (contentGroupPhasedFields, GetByLabel('UI/Agency/ContentGroups/PhasedFields'))
     40         TextBody(parent=self.scrollContainer, align=Align.TOTOP, text=GetByLabel('UI/PhasedAsteroid/AvailabilityText', agencyLink=agencyLink), padding=8, state=uiconst.UI_NORMAL)
     41 
     42     def AddAccessability(self):
     43         AddHeader(self.scrollContainer, GetByLabel('UI/PhasedAsteroid/AccessibilityHeader'), 8)
     44         TextBody(parent=self.scrollContainer, align=Align.TOTOP, text=GetByLabel('UI/PhasedAsteroid/AccessibilityText', agencyLink='someAgencyLink', helpPointerLink=UNIQUE_NAME_MINING_SCAN_BTN), padding=8, state=uiconst.UI_NORMAL)
     45         textCont = self.AddAsteroidStateContainer(GetByLabel('UI/PhasedAsteroid/LatentHeader'), GetByLabel('UI/PhasedAsteroid/LatentText'), 'res:/UI/Texture/Classes/PhasedAsteroid/asteroidLatent.png')
     46         component = get_space_component_for_type(self.typeID, BREACH_POINT_ASTEROID)
     47         breachedText = GetByLabel('UI/PhasedAsteroid/BreachedText', phasedOutMiningEfficiency=100 * component.phasedOutMiningEfficiency, phasedInMiningEfficiency=100 * component.phasedInMiningEfficiency)
     48         textCont = self.AddAsteroidStateContainer(GetByLabel('UI/PhasedAsteroid/BreachedHeader'), breachedText, 'res:/UI/Texture/Classes/PhasedAsteroid/asteroidBreached.png')
     49         textCont = self.AddAsteroidStateContainer(GetByLabel('UI/PhasedAsteroid/CollapsedHeader'), GetByLabel('UI/PhasedAsteroid/CollapsedText'), 'res:/UI/Texture/Classes/PhasedAsteroid/asteroidCollapsed.png')
     50 
     51     def AddMiningEfficiency(self):
     52         AddHeader(self.scrollContainer, GetByLabel('UI/PhasedAsteroid/MiningEfficiencyHeader'), 8)
     53         component = get_space_component_for_type(self.typeID, BREACH_POINT_ASTEROID)
     54         text = GetByLabel('UI/PhasedAsteroid/MiningEfficiencyText', phaseAnchorTypeID=typeMobilePhaseAnchor, phasedOutMiningEfficiency=100 * component.phasedOutMiningEfficiency, phasedInMiningEfficiency=100 * component.phasedInMiningEfficiency)
     55         TextBody(parent=self.scrollContainer, align=Align.TOTOP, text=text, padding=8, state=uiconst.UI_NORMAL)
     56 
     57     def AddAsteroidStateContainer(self, nameText, posText, stateTexturePath, padTop = 8):
     58         stateCont = ContainerAutoSize(name='stateCont', parent=self.scrollContainer, align=uiconst.TOTOP, alignMode=uiconst.TOTOP, padding=(8,
     59          padTop,
     60          8,
     61          0), maxHeight=150, clipChildren=True)
     62         Sprite(parent=stateCont, Align=Align.CENTERLEFT, pos=(0, 0, 380, 104), state=uiconst.UI_DISABLED, texturePath=stateTexturePath)
     63         textCont = ContainerAutoSize(name='textCont', parent=stateCont, align=uiconst.TOTOP, alignMode=uiconst.TOTOP, padLeft=380, minHeight=103)
     64         Line(parent=textCont, align=uiconst.TOLEFT, opacity=0.75, weight=2)
     65         headerCont = ContainerAutoSize(name='haderCont', parent=textCont, align=uiconst.TOTOP, alignMode=uiconst.TOTOP)
     66         Frame(bgParent=headerCont, texturePath='res:/UI/Texture/classes/Button/background_cut_top_right.png', cornerSize=9, color=eveColor.WHITE, opacity=0.2)
     67         TextDetail(parent=headerCont, align=Align.TOTOP, text=nameText, padding=(TEXT_PAD_SIDES,
     68          4,
     69          8,
     70          4), bold=True)
     71         TextBody(parent=textCont, align=Align.TOTOP, padding=TEXT_PAD_SIDES, text=posText, state=uiconst.UI_NORMAL)
     72         return textCont
     73 
     74 
     75 def AddHeader(parent, headerText, padTop = 0):
     76     c = ContainerAutoSize(name='headerCont', parent=parent, align=uiconst.TOTOP, minHeight=HEIGHT_NORMAL, padTop=padTop)
     77     EveLabelMedium(text=headerText, parent=c, left=8, top=0, state=uiconst.UI_DISABLED, maxLines=1, align=uiconst.CENTERLEFT)
     78     Fill(bgParent=c, opacity=0.05, padBottom=1)