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

standingsHeader.py (8758B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\neocom\charsheet\standingsPanel\standingsHeader.py
      2 from carbonui import uiconst
      3 from carbonui.primitives.container import Container
      4 from carbonui.primitives.containerAutoSize import ContainerAutoSize
      5 from carbonui.primitives.sprite import Sprite
      6 from carbonui.uicore import uicore
      7 from eve.client.script.ui.control.eveIcon import OwnerIcon
      8 from eve.client.script.ui.control.eveLabel import EveLabelLarge
      9 from eve.client.script.ui.shared.info import infoConst
     10 from eve.client.script.ui.shared.neocom.charsheet.standingsPanel.standingsAssociationsTooltip import StandingsAssociationTooltip
     11 from eve.client.script.ui.shared.neocom.charsheet.standingsPanel.standingsHeaderButtons import StandingActionButton, StandingBenefitButton
     12 from eve.client.script.ui.shared.standings import standingUIConst
     13 from eve.client.script.ui.shared.standings.standingLabel import StandingLabel
     14 from eve.client.script.ui.shared.standings.standingsBonusTooltip import StandingBonusTooltip
     15 from eve.client.script.ui.shared.standings.standingsUIUtil import GetStandingActionIDs, GetStandingBenefitIDs
     16 from eve.client.script.ui.station.agents.agentConversationIcon import AgentConversationIcon
     17 from eve.common.script.sys import idCheckers
     18 ICONSIZE = 26
     19 
     20 class StandingsHeader(Container):
     21     default_name = 'StandingsHeader'
     22 
     23     def ApplyAttributes(self, attributes):
     24         Container.ApplyAttributes(self, attributes)
     25         self.standingData = None
     26         self.iconCont = Container(parent=self, align=uiconst.CENTERLEFT, pos=(0, 0, 64, 64))
     27         self.ownerIcon = OwnerIcon(parent=self.iconCont, align=uiconst.TOALL, size=64)
     28         self.mainCont = Container(name='mainCont', parent=self, padLeft=70, padTop=8)
     29         self.ConstructMainCont()
     30 
     31     def ConstructMainCont(self):
     32         topCont = Container(name='topCont', align=uiconst.TOTOP, parent=self.mainCont, height=20)
     33         self.helpIconCont = Container(name='helpIconCont', parent=topCont, align=uiconst.TORIGHT, width=16, padLeft=5)
     34         self.helpIcon = Sprite(name='helpIcon', parent=self.helpIconCont, align=uiconst.CENTER, width=16, height=16, texturePath='res:/UI/Texture/Icons/generic/more_info_16.png')
     35         self.standingLabel = StandingLabel(parent=topCont, align=uiconst.TORIGHT, isRightToLeft=True, standingData=self.standingData, fontSize=14)
     36         labelCont = Container(parent=topCont, clipChildren=True, padRight=4)
     37         self.captionAndStandingCont = ContainerAutoSize(name='captionAndStandingCont', parent=labelCont, align=uiconst.TOLEFT)
     38         bottomCont = Container(name='bottomCont', parent=self.mainCont, align=uiconst.TOBOTTOM, height=ICONSIZE, top=4, clipChildren=True)
     39         self.actionsCont = ContainerAutoSize(name='actionsCont', parent=bottomCont, align=uiconst.TOLEFT)
     40         self.benefitsCont = Container(name='benefitsCont', parent=bottomCont, align=uiconst.TOALL, clipChildren=True)
     41 
     42     def UpdateCaptionAndStandingCont(self):
     43         self.captionAndStandingCont.Flush()
     44         self.standingLabel.SetStandingData(self.standingData)
     45         if self.standingData and self.standingData.GetOwnerID1() == session.charid and not idCheckers.IsPlayerOwner(self.standingData.GetOwnerID2()):
     46             self.helpIcon.tooltipPanelClassInfo = StandingBonusTooltip(self.standingData)
     47         else:
     48             self.helpIconCont.Hide()
     49         self.ownerNameLabel = EveLabelLarge(parent=self.captionAndStandingCont, align=uiconst.TOLEFT, text=self.standingData.GetOwner2Name())
     50         self.agentConversationIcon = Container(name='iconCont', parent=self.captionAndStandingCont, align=uiconst.TOLEFT, width=16, padLeft=6)
     51         ownerID = self.standingData.GetOwnerID2()
     52         if idCheckers.IsNPCCharacter(ownerID):
     53             AgentConversationIcon(parent=self.agentConversationIcon, align=uiconst.CENTER, agentID=ownerID)
     54 
     55     def Update(self, standingData):
     56         self.standingData = standingData
     57         ownerID = self.standingData.ownerID2
     58         self.ownerIcon.SetOwnerID(ownerID)
     59         if sm.GetService('agents').IsAgent(ownerID):
     60             self.ownerIcon.tooltipPanelClassInfo = StandingsAssociationTooltip(ownerID)
     61         else:
     62             self.ownerIcon.tooltipPanelClassInfo = None
     63         self.UpdateCaptionAndStandingCont()
     64         self.UpdateActionsCont(ownerID)
     65         self.UpdateBenefitsCont(ownerID)
     66         self.agentConversationIcon.display = idCheckers.IsNPCCharacter(ownerID)
     67 
     68     def UpdateActionsCont(self, ownerID):
     69         self.actionsCont.Flush()
     70         for actionID in GetStandingActionIDs(ownerID):
     71             if not self.IsActionEnabled(actionID):
     72                 continue
     73             texturePath = standingUIConst.ICONS_BY_ACTIONID[actionID]
     74             func = self.GetFunctionByActionID(actionID)
     75             StandingActionButton(parent=self.actionsCont, align=uiconst.TOLEFT, width=ICONSIZE, state=uiconst.UI_NORMAL, texturePath=texturePath, padRight=4, func=func, actionID=actionID, standingData=self.standingData)
     76 
     77     def IsActionEnabled(self, actionID):
     78         if actionID == standingUIConst.ACTION_TRAINSKILL:
     79             return self.standingData.GetOwnerID1() == session.charid and self.standingData.GetSkillTypeID2To1() is not None
     80         return True
     81 
     82     def UpdateBenefitsCont(self, ownerID):
     83         self.benefitsCont.Flush()
     84         for benefitID in GetStandingBenefitIDs(ownerID):
     85             texturePath = standingUIConst.ICONS_BY_BENEFITID[benefitID]
     86             func = self.GetFunctionByBenefitID(benefitID)
     87             StandingBenefitButton(parent=self.benefitsCont, align=uiconst.TORIGHT, width=ICONSIZE, state=uiconst.UI_NORMAL, texturePath=texturePath, padLeft=4, func=func, benefitID=benefitID, standingData=self.standingData)
     88 
     89     def GetFunctionByActionID(self, actionID):
     90         if actionID == standingUIConst.ACTION_AGGRESSION:
     91             return self.OnActionAgression
     92         if actionID == standingUIConst.ACTION_DERIVEDOTHERFACTIONS:
     93             return self.OnActionDerivedOtherFactions
     94         if actionID == standingUIConst.ACTION_DERIVEDAGENTINFACTION:
     95             return self.OnActionDerivedAgentInFaction
     96         if actionID == standingUIConst.ACTION_DERIVEDAGENTINCORP:
     97             return self.OnActionDerivedAgentInCorp
     98         if actionID == standingUIConst.ACTION_FACTIONALWARFARE:
     99             return self.OnActionFactionalWarfare
    100         if actionID == standingUIConst.ACTION_FAILREJECTMISSION:
    101             return self.OnActionFailRejectMission
    102         if actionID == standingUIConst.ACTION_SPECIALMISSIONSFACTION:
    103             return self.OnActionSpecialMissionsFaction
    104         if actionID == standingUIConst.ACTION_SPECIALMISSIONSCORP:
    105             return self.OnActionSpecialMissionsCorp
    106         if actionID == standingUIConst.ACTION_COMPLETEMISSION:
    107             return self.OnActionCompleteMission
    108         if actionID == standingUIConst.ACTION_TRAINSKILL:
    109             return self.OnActionTrainSkill
    110 
    111     def GetFunctionByBenefitID(self, actionID):
    112         if actionID == standingUIConst.BENEFIT_REPROCESSINGTAX:
    113             return self.OnBenefitReprocessingTax
    114         if actionID == standingUIConst.BENEFIT_BROKERSFEE:
    115             return self.OnBenefitBrokersFee
    116 
    117     def OnActionTrainSkill(self):
    118         typeID = self.standingData.GetSkillTypeID2To1()
    119         sm.GetService('info').ShowInfo(typeID)
    120 
    121     def OnActionCompleteMission(self):
    122         sm.StartService('agents').OpenDialogueWindow(self.standingData.GetOwnerID2())
    123 
    124     def OnActionSpecialMissionsCorp(self):
    125         self._ShowInfoForThisOwner()
    126 
    127     def OnActionSpecialMissionsFaction(self):
    128         self._ShowInfoForThisOwner()
    129 
    130     def OnActionFailRejectMission(self):
    131         sm.StartService('agents').OpenDialogueWindow(self.standingData.GetOwnerID2())
    132 
    133     def OnActionFactionalWarfare(self):
    134         factionID = self.standingData.GetOwnerID2() if session.warfactionid is None else None
    135         uicore.cmd.OpenMilitia(faction_id=factionID)
    136 
    137     def OnActionDerivedAgentInCorp(self):
    138         self._ShowInfoForThisOwner(infoConst.TAB_AGENTS)
    139 
    140     def OnActionDerivedAgentInFaction(self):
    141         self._ShowInfoForThisOwner(infoConst.TAB_MEMBEROFCORPS)
    142 
    143     def OnActionDerivedOtherFactions(self):
    144         self._ShowInfoForThisOwner(infoConst.TAB_STANDINGS)
    145 
    146     def OnActionAgression(self):
    147         self._ShowInfoForThisOwner(infoConst.TAB_SYSTEMS)
    148 
    149     def OnBenefitBrokersFee(self):
    150         self._ShowInfoForThisOwner(infoConst.TAB_SYSTEMS)
    151 
    152     def OnBenefitReprocessingTax(self):
    153         self._ShowInfoForThisOwner(infoConst.TAB_SYSTEMS)
    154 
    155     def _ShowInfoForThisOwner(self, tabID = None):
    156         sm.GetService('info').ShowInfo(self.standingData.GetOwner2TypeID(), self.standingData.GetOwnerID2(), selectTabType=tabID)