local UISuperGoldStoryTaskInfo = UIViewClass() function UISuperGoldStoryTaskInfo:OnOpened(context) self.activityId = context.activityId self.heroType = context.heroType self.storyTaskCfg = context.storyTaskInfo.taskCfg self.taskState = context.storyTaskInfo.taskState self:RegistSystemEvent(EventID.UI_OperationActivity_CloseView, self.OnCloseActivitySelf) self:RefreshTaskInfoPanel() end function UISuperGoldStoryTaskInfo:OnCloseActivitySelf(viewClassPath, activityId) if viewClassPath == self.__viewClassPath then if self.activityId and activityId == self.activityId then self:CloseView() end end end function UISuperGoldStoryTaskInfo:OnBackButtonPressed() self:OnButtonClicked(self.btn_Close) end function UISuperGoldStoryTaskInfo:OnButtonClicked(comp) if comp == self.btn_Close then self:CloseView() elseif comp == self.btn_GoTo then -- 前往任务 if self.taskState == MDL.GoldenHeroStory.Enum_TaskState.Doing then self:DoTask() else local hasEndingCount = MDL.SuperGoldStory.CheckHaveOpenEndingCount(self.activityId, self.heroType) if MDL.SuperGoldStory.GetDoingGroup(self.activityId) > 0 then if hasEndingCount then -- 当前有正在进行中的任务,是否放弃该任务并开启您选择的任务? UTL.MessageBox.ShowOKCancelBox(Const_IDS["IDS_COMMON_PROMPT"], UIUtils.GetLocalizedTxt(Const_IDS.IDS_SuperGoldHeroActivity_Level_OpenTaskHint_2), function () NotSyncBattleSetter.StopAutoFightPathInTown() CTL.SuperGoldStory.TaskTriggerReceive(tonumber(self.storyTaskCfg.TaskChainID)) UIManager.RecoverTopView() CTL.HomeMain.CloseOpenView() end ) else -- 当前已无可解锁的新结局,是否继续开启该任务? UTL.MessageBox.ShowOKCancelBox(Const_IDS["IDS_COMMON_PROMPT"], UIUtils.GetLocalizedTxt(Const_IDS.IDS_SuperGoldHeroActivity_Level_OpenTaskHint_1), function () -- 当前有正在进行中的任务,是否放弃该任务并开启您选择的任务? UTL.MessageBox.ShowOKCancelBox(Const_IDS["IDS_COMMON_PROMPT"], UIUtils.GetLocalizedTxt(Const_IDS.IDS_SuperGoldHeroActivity_Level_OpenTaskHint_2), function () NotSyncBattleSetter.StopAutoFightPathInTown() CTL.SuperGoldStory.TaskTriggerReceive(tonumber(self.storyTaskCfg.TaskChainID)) UIManager.RecoverTopView() CTL.HomeMain.CloseOpenView() end ) end ) end else if hasEndingCount then -- 这时没有进行中任务,并且有可达成的结局数量 self:GetTask() else -- 当前已无可解锁的新结局,是否继续开启该任务? UTL.MessageBox.ShowOKCancelBox(Const_IDS["IDS_COMMON_PROMPT"], UIUtils.GetLocalizedTxt(Const_IDS.IDS_SuperGoldHeroActivity_Level_OpenTaskHint_1), function () NotSyncBattleSetter.StopAutoFightPathInTown() CTL.SuperGoldStory.TaskTriggerReceive(tonumber(self.storyTaskCfg.TaskChainID)) UIManager.RecoverTopView() CTL.HomeMain.CloseOpenView() end ) end end end end end function UISuperGoldStoryTaskInfo:GetTask() NotSyncBattleSetter.StopAutoFightPathInTown() CTL.SuperGoldStory.TaskTriggerReceive(tonumber(self.storyTaskCfg.TaskChainID)) UIManager.RecoverTopView() CTL.HomeMain.CloseOpenView() end function UISuperGoldStoryTaskInfo:RefreshTaskInfoPanel() local taskList = MDL.Task.GetTaskList(MDL.Task.Enum_TaskType.SuperGoldHero) if taskList then for __, task in pairs(taskList) do if self.storyTaskCfg.TaskChainID == task.taskChildData[1].TaskLineID then self.taskServerData = task end end end local taskData = DataSheetManager.TaskFatherData:GetDataByID(self.storyTaskCfg.TaskChainID) UIUtils.SetLabelText(self.txt_Task, Const_IDS[taskData.Brief]) -- 任务目标 UIUtils.SetLabelText(self.txt_Desc, Const_IDS[taskData.Desc]) -- 任务描述 UIUtils.SetActive(self.btn_GoTo.gameObject, self.taskState ~= MDL.GoldenHeroStory.Enum_TaskState.Lock) -- 分支选择提示显隐 UIUtils.SetActive(self.lab_Notice.gameObject, false) for k,groupData in DataSheetManager.SuperGoldGroup[self.heroType]:GetEnumerator() do if groupData.TaskID == self.storyTaskCfg.TaskID and #groupData.NextGroupID > 1 then UIUtils.SetLabelText(self.lab_Notice, Const_IDS.IDS_GoldHeroActivity_ActivityLevel_BranchHint1) UIUtils.SetActive(self.lab_Notice.gameObject, true) end end if self.taskState == MDL.GoldenHeroStory.Enum_TaskState.Doing then UIUtils.SetLabelText(self.lab_Goto, Const_IDS.IDS_SuperGoldHeroActivity_Level_OpenTaskHint_4) -- 任务进行中 else UIUtils.SetLabelText(self.lab_Goto, Const_IDS.IDS_SuperGoldHeroActivity_Level_Button_4) -- 开启任务 end end function UISuperGoldStoryTaskInfo:DoTask() self:CloseView() if not MDL.Team.IsFollowing() then if self.taskServerData then CTL.Task.DoTask(self.taskServerData) UIManager.RecoverTopView() CTL.HomeMain.CloseOpenView() end else CTL.Tips.AddTipsMsg(Const_IDS.IDS_Team_FollowCanNotDoThis) end end return UISuperGoldStoryTaskInfo