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

careerAgentEntry.py (6565B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\services\careerAgentEntry.py
      2 from carbonui import uiconst
      3 from carbonui.control.scrollentries import SE_BaseClassCore
      4 from carbonui.primitives.container import Container
      5 from carbonui.primitives.sprite import Sprite
      6 from eve.client.script.ui.control import eveLabel
      7 from carbonui.control.button import Button
      8 from eve.client.script.ui.control.themeColored import LineThemeColored
      9 from eve.common.lib import appConst as const
     10 import localization
     11 from eveservices.menu import StartMenuService
     12 from menu import MenuLabel
     13 from npcs.divisions import get_division_description, get_division_name
     14 
     15 class CareerAgentEntry(SE_BaseClassCore):
     16 
     17     def Startup(self, *etc):
     18         self.photoSvc = sm.StartService('photo')
     19         self.sr.cellContainer = Container(name='CellContainer', parent=self, padding=(2, 2, 2, 2))
     20         self.sr.agentContainer = Container(parent=self.sr.cellContainer, align=uiconst.TORIGHT, state=uiconst.UI_NORMAL, width=330)
     21         self.sr.careerContainer = Container(parent=self.sr.cellContainer, align=uiconst.TOALL, padding=(const.defaultPadding * 2,
     22          const.defaultPadding,
     23          const.defaultPadding,
     24          const.defaultPadding))
     25         LineThemeColored(parent=self, align=uiconst.TOBOTTOM)
     26 
     27     def Load(self, node):
     28         agent = node.agent
     29         agentID = agent.agentID
     30         career = node.career
     31         agentStation = node.agentStation
     32         agentStationID = agentStation.stationID
     33         agentSystemID = agentStation.solarSystemID
     34         agentConstellationID = sm.GetService('map').GetConstellationForSolarSystem(agentSystemID)
     35         agentRegionID = sm.GetService('map').GetRegionForSolarSystem(agentSystemID)
     36         agentNameText = cfg.eveowners.Get(agentID).name
     37         self.sr.agentContainer.Flush()
     38         agentSprite = Sprite(name='AgentSprite', parent=self.sr.agentContainer, align=uiconst.RELATIVE, width=128, height=128, state=uiconst.UI_NORMAL, top=6)
     39         agentTextContainer = Container(name='TextContainer', parent=self.sr.agentContainer, align=uiconst.TOPLEFT, width=190, height=77, left=140)
     40         eveLabel.EveLabelLarge(text=agentNameText, parent=agentTextContainer, state=uiconst.UI_DISABLED, align=uiconst.TOTOP, padTop=const.defaultPadding)
     41         self.photoSvc.GetPortrait(agentID, 128, agentSprite)
     42         menuContainer = agentSprite
     43         menuContainer.GetMenu = lambda *args: self.GetAgentMenu(agent, agentStation)
     44         menuContainer.id = agentID
     45         menuContainer.OnClick = self.TalkToAgent
     46         menuContainer.cursor = uiconst.UICURSOR_SELECT
     47         agentButton = Button(parent=self.sr.agentContainer, align=uiconst.BOTTOMRIGHT, label=localization.GetByLabel('UI/Generic/Unknown'), fixedwidth=196, left=const.defaultPadding, top=const.defaultPadding)
     48         agentButton.func = self.SetDestination
     49         agentButton.args = (agentStationID,)
     50         agentButton.SetLabel(localization.GetByLabel('UI/Commands/SetDestination'))
     51         agentButton.state = uiconst.UI_NORMAL
     52         if session.stationid is None and agentSystemID == session.solarsystemid:
     53             hint = menuContainer.hint = localization.GetByLabel('UI/Tutorial/AgentInSameSystem')
     54             agentButton.func = self.DockAtStation
     55             agentButton.args = (agentStationID,)
     56             agentButton.SetLabel(localization.GetByLabel('UI/Tutorial/WarpToAgentStation'))
     57         elif session.stationid == agentStationID:
     58             hint = menuContainer.hint = localization.GetByLabel('UI/Tutorial/AgentInSameStation')
     59             agentButton.func = self.TalkToAgent
     60             agentButton.args = (agentID,)
     61             agentButton.SetLabel(localization.GetByLabel('UI/Commands/StartConversation'))
     62         elif session.stationid is not None:
     63             hint = menuContainer.hint = localization.GetByLabel('UI/Tutorial/YouNeedToExitTheStation')
     64         else:
     65             hint = localization.GetByLabel('UI/Tutorial/ThisStationIsInADifferentSolarSystem', setDestination=localization.GetByLabel('UI/Commands/SetDestination'))
     66             if session.constellationid == agentConstellationID:
     67                 menuContainer.hint = localization.GetByLabel('UI/Tutorial/AgentInSameConstellation')
     68             elif session.regionid == agentRegionID:
     69                 menuContainer.hint = localization.GetByLabel('UI/Tutorial/AgentInSameRegion')
     70             else:
     71                 menuContainer.hint = localization.GetByLabel('UI/Tutorial/AgentNotInSameRegion')
     72         stationTypeID = agentStation.stationTypeID
     73         stationName = sm.GetService('ui').GetStationName(agentStationID)
     74         linktext = "<url=showinfo:%d//%d alt='%s'>%s</url>" % (stationTypeID,
     75          agentStationID,
     76          hint,
     77          stationName)
     78         eveLabel.EveLabelMedium(text=linktext, parent=agentTextContainer, state=uiconst.UI_NORMAL, align=uiconst.TOTOP, padTop=const.defaultPadding, padLeft=const.defaultPadding, padRight=const.defaultPadding)
     79         self.sr.careerContainer.Flush()
     80         careerText = localization.GetByLabel('UI/Generic/Unknown')
     81         careerDesc = localization.GetByLabel('UI/Generic/Unknown')
     82         if career in const.agentDivisionsCareer:
     83             careerText = get_division_name(career)
     84             careerDesc = get_division_description(career)
     85         eveLabel.EveCaptionMedium(text=careerText, parent=self.sr.careerContainer, state=uiconst.UI_DISABLED, align=uiconst.TOTOP)
     86         eveLabel.EveLabelMedium(text=careerDesc, parent=self.sr.careerContainer, state=uiconst.UI_DISABLED, align=uiconst.TOTOP)
     87 
     88     def GetHeight(self, *args):
     89         node, width = args
     90         node.height = 162
     91         return node.height
     92 
     93     def DockAtStation(self, *args):
     94         if len(args) > 0:
     95             stationID = args[0]
     96             StartMenuService().Dock(stationID)
     97 
     98     def GetAgentMenu(self, agent, station):
     99         m = StartMenuService().CharacterMenu(agent.agentID)
    100         if station.solarSystemID == session.solarsystemid:
    101             m += [None]
    102             m += [(MenuLabel('UI/Tutorial/WarpToAgentStation'), self.DockAtStation, (station[0],))]
    103         return m
    104 
    105     def TalkToAgent(self, *args):
    106         if len(args) > 0:
    107             if hasattr(args[0], 'id'):
    108                 agentID = args[0].id
    109             else:
    110                 agentID = args[0]
    111             sm.StartService('agents').OpenDialogueWindow(agentID)
    112 
    113     def SetDestination(self, stationID):
    114         if stationID is not None:
    115             sm.StartService('starmap').SetWaypoint(stationID, clearOtherWaypoints=True)