local UISuperGoldStoryEndingLibrary = UIViewClass() function UISuperGoldStoryEndingLibrary:OnOpened(context) self.activityId = context.activityId self.goldenHeroID = context.heroType self:RegistSystemEvent(EventID.UI_OperationActivity_CloseView, self.OnCloseActivitySelf) 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:RefreshView() end function UISuperGoldStoryEndingLibrary:OnCloseActivitySelf(viewClassPath, activityId) if viewClassPath == self.__viewClassPath then if self.activityId and activityId == self.activityId then self:CloseView() end end end function UISuperGoldStoryEndingLibrary:RefreshView() self.openEndingIDList = MDL.SuperGoldStory.GetOpenEndingIDListByActivityID(self.activityId) local endingCount = DataSheetManager.SuperGoldEndingRecord[self.goldenHeroID]:GetDataCount() for k,v in DataSheetManager.SuperGoldEndingRecord[self.goldenHeroID]:GetEnumerator() do local state = 1 for _,endingID in ipairs(self.openEndingIDList) do if endingID == v.EndingID then state = 0 end end self.loop_SuperGoldEnding:AddData({cfg = v, state = state}, 0) end UIUtils.SetLabel(self.txt_Progress, string.format("%s/%s", #self.openEndingIDList, endingCount)) -- 结局进度 end function UISuperGoldStoryEndingLibrary:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UISuperGoldStoryEndingLibrary:OnButtonClicked(comp) if comp == self.btn_Close then self:CloseView() elseif comp == self.btn_Reward then UIManager.OpenView(Const_UI_Lua.UIEnum.UISuperGoldStoryEndingTarget, {activityId = self.activityId, heroType = self.goldenHeroID}) end end function UISuperGoldStoryEndingLibrary:OnCellInit(scrollRect, index, cellTable, data) if scrollRect == self.loop_SuperGoldEnding then cellTable.state_img:SetState(data.state) if data.state == 0 then UIUtils.SetImageByAssetBundle(cellTable.img_Ending, data.cfg.Pic_Small) -- 结局图片 UIUtils.SetLabelText(cellTable.txt_Title, Const_IDS[data.cfg.EndingName]) -- 结局标题 end end end function UISuperGoldStoryEndingLibrary:OnCellClicked(scrollRect, index, cellTable, target, data) if scrollRect == self.loop_SuperGoldEnding and target == cellTable.btn_Ending then if data.state == 0 then CTL.SuperGoldStory.ShowEndingBigPicture(self.activityId, self.goldenHeroID, data.cfg) else CTL.Tips.AddTipsMsg(Const_IDS.IDS_SuperGoldHeroActivity_Level_Hint_6) end end end ---@public 秘闻录入口红点 function UISuperGoldStoryEndingLibrary:RefreshGoldenHeroStoryEndingRp(active) self.btn_Reward:SetRedPoint(active) end return UISuperGoldStoryEndingLibrary