local UIGoldenHeroStoryChapter = UIViewClass() local SHOW_DURATION = 7 local SHOW_CloseButton = 3 function UIGoldenHeroStoryChapter:OnOpened(context) self.chapterID = context.chapterID CTL.Sound.PlayGameSound("UI_kaiqi") UIUtils.SetActive(self.btn_Close, false) local taskData = DataSheetManager.TaskOpeaningData:GetDataByID(self.chapterID) UIUtils.SetLabelText(self.txt_ChapterTitle, Const_IDS[taskData.HeroChapterName]) -- 任务目标 UIUtils.SetLabelText(self.txt_ChapterName, Const_IDS[taskData.ChapterName]) -- 任务名称 UIUtils.SetLabelText(self.txt_ChapterDesc, Const_IDS[taskData.Description]) -- 任务描述 self:StartRepeatFunc(self.RepeatFunc, 1) end function UIGoldenHeroStoryChapter:OnBackButtonPressed() if self.btn_Close.gameObject.activeSelf then self:OnButtonClicked(self.btn_Close) end end function UIGoldenHeroStoryChapter:OnButtonClicked(comp) if comp == self.btn_Close then self:CloseView() end end function UIGoldenHeroStoryChapter:RepeatFunc(deltaTime, timeSinceUpdate) if timeSinceUpdate > SHOW_DURATION then self:CloseView() elseif timeSinceUpdate > SHOW_CloseButton then UIUtils.SetActive(self.btn_Close, true) end end return UIGoldenHeroStoryChapter