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

infoPanelOperations.py (7579B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\infoPanels\infoPanelOperations.py
      2 import carbonui.const as uiconst
      3 from monolith_task_tracker.common.const import TaskEventConst
      4 from carbonui.control.buttonIcon import ButtonIcon
      5 from eve.client.script.ui.shared.infoPanels.const.infoPanelConst import PANEL_OPERATIONS, MODE_HIDDEN
      6 from eve.client.script.ui.shared.infoPanels.infoPanelMissions import InfoPanelMissions, InfoPanelMissionData
      7 from eve.client.script.ui.shared.pointerTool.pointerToolConst import UNIQUE_NAME_TUTORIAL_INFO_PANEL
      8 from localization import GetByLabel, GetByMessageID
      9 from operations.client.UI import taskObjectiveData
     10 from operations.client.operationscontroller import GetOperationsController
     11 from operations.client.tutorialOperationsController import GetTutorialOperationsController
     12 from operations.client.util import are_operations_active
     13 from storylines.client.airnpe import skip_air_npe
     14 from uihider import UiHiderMixin
     15 import logging
     16 logger = logging.getLogger(__name__)
     17 CLOSE_ICON_SIZE = 12
     18 MINIMIZE_ICON_TEXTURE = 'res:/UI/Texture/icons/38_16_221.png'
     19 CLOSE_ICON_TEXTURE = 'res:/UI/Texture/classes/InfoPanels/quitOperation_Icon.png'
     20 MINIMIZE_LABEL = 'UI/Common/Collapse'
     21 SKIP_TUTORIAL_LABEL = 'UI/Operations/InfoPanel/SkipTutorialOption'
     22 SKIP_TUTORIAL_HINT_LABEL = 'UI/Operations/InfoPanel/SkipTutorialOptionHint'
     23 SKIP_TUTORIAL_WARNING_DIALOG_ID = 'SkipTutorialWarning'
     24 QUIT_OPERATION_LABEL = 'UI/Operations/InfoPanel/QuitOperationOption'
     25 QUIT_OPERATION_HINT_LABEL = 'UI/Operations/InfoPanel/QuitOperationOptionHint'
     26 CATEGORIES_THAT_SHOW_PAST_OBJECTIVES = []
     27 
     28 def GetOperationsTitle():
     29     tutorialOperationsController = GetTutorialOperationsController()
     30     if tutorialOperationsController.is_tutorial_active():
     31         return GetByLabel('UI/Agents/AuraAgentName')
     32     return GetByLabel('UI/Operations/InfoPanel/InfoPanelTitle')
     33 
     34 
     35 class InfoPanelOperationData(InfoPanelMissionData):
     36 
     37     def __init__(self, categoryID = None, operation = None, activeTasks = None):
     38         self.categoryID = categoryID or GetOperationsController().get_active_category_id()
     39         self.operation = operation or GetOperationsController().get_active_operation()
     40         self.activeTasks = activeTasks or GetOperationsController().get_active_task_tuples()
     41         operationTitle = GetByMessageID(self.operation.title)
     42         super(InfoPanelOperationData, self).__init__(title=operationTitle)
     43 
     44     def _InitializeObjectives(self):
     45         self.objectives = []
     46         objectives = []
     47         isCurrentObjective = False
     48         for task in self.operation.taskList:
     49             objective = self._GetObjective(task)
     50             isCurrentObjective = self._IsActiveTask(task.id)
     51             if isCurrentObjective or self._ShouldShowPastObjectives():
     52                 objectives.append(objective)
     53             if isCurrentObjective:
     54                 objective.SetActive()
     55                 break
     56 
     57         if not isCurrentObjective:
     58             return
     59         self.objectives.extend(objectives)
     60 
     61     def _GetObjective(self, task):
     62         category = GetOperationsController().get_category_by_id(self.categoryID)
     63         objectiveClass = self._GetObjectiveClass(task)
     64         objective = objectiveClass(category, self.operation, task)
     65         return objective
     66 
     67     def _GetObjectiveClass(self, task):
     68         if task.achievementEventType == TaskEventConst.TRAVEL_SET_DESTINATION_TO_CAREER_AGENTS:
     69             objectiveClass = taskObjectiveData.TaskTravelToCareerAgent
     70         elif self.operation.siteID and task.is_site_relevant:
     71             objectiveClass = taskObjectiveData.TaskWithSiteObjective
     72         else:
     73             objectiveClass = taskObjectiveData.TaskObjective
     74         return objectiveClass
     75 
     76     def _ShouldShowPastObjectives(self):
     77         return self.categoryID in CATEGORIES_THAT_SHOW_PAST_OBJECTIVES
     78 
     79     def _IsActiveTask(self, taskID):
     80         return taskID in [ activeTaskID for activeTaskID, _, _ in self.activeTasks ]
     81 
     82 
     83 class InfoPanelOperationRecommendationsData(InfoPanelOperationData):
     84 
     85     def __init__(self, categoryID = None, operation = None, activeTasks = None, includePrveviousTask = False):
     86         self.includePrveviousTask = includePrveviousTask
     87         super(InfoPanelOperationRecommendationsData, self).__init__(categoryID, operation, activeTasks)
     88 
     89     def _ShouldShowPastObjectives(self):
     90         return self.includePrveviousTask
     91 
     92     def _InitializeObjectives(self):
     93         self.objectives = []
     94         currentObjective = None
     95         previousObjective = None
     96         for task in self.operation.taskList:
     97             objective = self._GetObjective(task)
     98             isCurrentObjective = self._IsActiveTask(task.id)
     99             if isCurrentObjective:
    100                 currentObjective = objective
    101                 objective.SetActive()
    102                 break
    103             previousObjective = objective
    104 
    105         if not currentObjective:
    106             return
    107         objectives = [currentObjective]
    108         if self._ShouldShowPastObjectives() and previousObjective:
    109             objectives.insert(0, previousObjective)
    110         self.objectives.extend(objectives)
    111 
    112 
    113 class InfoPanelOperations(UiHiderMixin, InfoPanelMissions):
    114     default_name = 'InfoPanelOperations'
    115     uniqueUiName = UNIQUE_NAME_TUTORIAL_INFO_PANEL
    116     panelTypeID = PANEL_OPERATIONS
    117     label = ''
    118     default_iconTexturePath = 'res:/UI/Texture/Classes/InfoPanels/operationsIcon_Main.png'
    119     default_are_objectives_collapsable = False
    120 
    121     def ApplyAttributes(self, attributes):
    122         super(InfoPanelOperations, self).ApplyAttributes(attributes)
    123         self.closeButton = ButtonIcon(name='closeButton_InfoPanelOperations', parent=self.topCont, align=uiconst.CENTERRIGHT, width=CLOSE_ICON_SIZE, height=CLOSE_ICON_SIZE, iconSize=CLOSE_ICON_SIZE, texturePath=CLOSE_ICON_TEXTURE, left=5, state=uiconst.UI_NORMAL)
    124         self.UpdateCloseButton()
    125 
    126     def UpdateCloseButton(self):
    127         self.closeButton.hint = GetByLabel(SKIP_TUTORIAL_LABEL)
    128         self.closeButton.func = self.SkipTutorial
    129 
    130     def GetTitle(self):
    131         return GetOperationsTitle()
    132 
    133     @classmethod
    134     def GetClassHint(cls):
    135         if cls.mode != MODE_HIDDEN:
    136             return GetOperationsTitle()
    137 
    138     @staticmethod
    139     def IsAvailable():
    140         if are_operations_active() and GetOperationsController().is_any_operation_active():
    141             if not GetOperationsController().is_active_operation_a_recommendation():
    142                 return True
    143         return False
    144 
    145     def Update(self, oldMode = None):
    146         if self.header:
    147             self.header.text = self.GetTitle()
    148         super(InfoPanelOperations, self).Update(oldMode)
    149 
    150     def ConstructNormal(self):
    151         super(InfoPanelOperations, self).ConstructNormal()
    152         self.UpdateCloseButton()
    153 
    154     def _AnimFadeInSelf(self, duration):
    155         if self._is_hidden:
    156             return
    157         super(InfoPanelOperations, self)._AnimFadeInSelf(duration)
    158 
    159     def GetMissions(self):
    160         missions = []
    161         if GetOperationsController().is_any_operation_active():
    162             activeOperationData = InfoPanelOperationData()
    163             missions.append(activeOperationData)
    164         return missions
    165 
    166     def GetFirstActiveObjective(self):
    167         for mission in self.missions:
    168             for objective in mission.GetObjectives():
    169                 if objective.IsActive():
    170                     return objective
    171 
    172     def SkipTutorial(self):
    173         skip_air_npe('SkipTutorialOffer')
    174 
    175 
    176 class DummyInfoPanelMissionData(InfoPanelMissionData):
    177 
    178     def _InitializeObjectives(self):
    179         pass