local UISuperGoldStoryMain = UIViewClass() function UISuperGoldStoryMain:OnOpened(context) self.activityId = context.activityId self.heroType = context.heroType self:RegistSystemEvent(EventID.UI_OperationActivity_CloseView, self.OnCloseActivitySelf) self:RegistSystemEvent(EventID.UI_SuperGoldStory_RefreshInfo, self.RefreshView) -- 刷新界面 self.SuperGoldActivityModeData = DataSheetManager.SuperGoldActivityModeData:GetDataByHeroType(self.heroType) --标题 UIUtils.SetLabelText(self.UITemplateTitlePanel.lab_Title, Const_IDS[self.SuperGoldActivityModeData.LevelName]) self:RegistSystemEvent(CTL.SuperGoldMain.RpEventId[self.activityId].StoryEndingReward, self.RefreshGoldenHeroStoryEndingRp) -- 秘闻录可领奖红点 self:RefreshGoldenHeroStoryEndingRp(MDL.RedPoint.GetNodeStateByLogicParams(CTL.SuperGoldMain.RpEventId[self.activityId].TownHome, CTL.SuperGoldMain.RpEventId[self.activityId].StoryEndingReward)) -- 秘闻录可领奖红点 self:OpenPathPanel(context) end function UISuperGoldStoryMain:OnBackButtonPressed() self:OnButtonClicked(self.UITemplateTitlePanel.btn_close) end function UISuperGoldStoryMain:OnButtonClicked(comp) if comp == self.UITemplateTitlePanel.btn_close then self:CloseView(true) elseif comp == self.UITemplateTitlePanel.btn_Home then CTL.HomeMain.CloseViewBackHomeMain() elseif comp == self.UITemplateTitlePanel.btn_Info then UIManager.OpenView(Const_UI_Lua.UIEnum.UICommonNoteView, {id = LuaConst.NoteID.SuperGoldLevel}) elseif comp == self.btn_Ending then -- 结局图鉴 CTL.SuperGoldStory.OpenEndingViewLibrary(self.activityId, self.heroType) elseif comp == self.btn_Abort then -- 放弃任务 UTL.MessageBox.ShowOKCancelBox(Const_IDS["IDS_COMMON_PROMPT"], UIUtils.GetLocalizedTxt(Const_IDS.IDS_SuperGoldHeroActivity_Level_OpenTaskHint_3), self.QuitTask) end end function UISuperGoldStoryMain:QuitTask() MDL.SuperGoldStory.SuperGoldQuitTask() end function UISuperGoldStoryMain:RefreshView(comp) self:SetAbortActive(MDL.SuperGoldStory.GetDoingGroup(self.activityId) > 0) end ---@public 打开路线图界面 function UISuperGoldStoryMain:OpenPathPanel(contextData) self:SetAbortActive(MDL.SuperGoldStory.GetDoingGroup(self.activityId) > 0) if contextData.levelId then UIUtils.SetActive(self.btn_Abort, false) local levelCfg = DataSheetManager.SuperGoldStoryLevel:GetDataByLevelID(contextData.levelId) local levelState = MDL.SuperGoldStory.GetGoldHeroLevelStateByActivityID_LevelID(self.activityId, levelCfg.ID) -- 关卡状态 self.storyLevelInfo = {levelCfg = levelCfg, levelState = levelState} end if contextData.taskId then local taskCfg = DataSheetManager.SuperGoldStoryTask:GetDataByTaskID(contextData.taskId) local taskState = MDL.SuperGoldStory.GetTaskStateByActivityID_HeroType_TaskFatherID(self.activityId, self.heroType, taskCfg.TaskID) self.storyTaskInfo = {taskCfg = taskCfg, taskState = taskState} end self.pathView:CloseAll() self.pathView:OpenView(GetViewClass(Const_UI_Lua.UIEnum.UISuperGoldStoryPath), {parentView = self}, self.SuperGoldActivityModeData.ModePrefab) end ---@public 秘闻录入口红点 function UISuperGoldStoryMain:RefreshGoldenHeroStoryEndingRp(active) self.btn_Ending:SetRedPoint(active) end ---@public 放弃按钮显隐 function UISuperGoldStoryMain:SetAbortActive(active) UIUtils.SetActive(self.btn_Abort, active) end function UISuperGoldStoryMain:OnCloseActivitySelf(viewClassPath, activityId) if viewClassPath == self.__viewClassPath then if self.activityId and activityId == self.activityId then self:CloseView(true) end end end return UISuperGoldStoryMain