local UIActivitiesTeamDungeonEntry = UIViewClass() function UIActivitiesTeamDungeonEntry:OnOpened(context) self:RegistSystemEvent(EventID.FunctionUnlockUpdate, self.OnCloseGamePlay) -- 界面标题 UIUtils.SetLabelText(self.UITemplateTitlePanel.lab_Title, Const_IDS.IDS_ActivityName_TeamDungeon) UIUtils.SetActive(self.UITemplateTitlePanel.btn_Info, false) self:RefreshTeamDungeon() end function UIActivitiesTeamDungeonEntry:RefreshTeamDungeon() local activityData = DataSheetManager.ActivityData:GetDataByID(LuaConst.ActivityType.TeamDungeon) local dungeonActivityIds = activityData.childID for i, v in ipairs(self.group_TeamDungeon) do local id = dungeonActivityIds[i] if id then local dungeonData = CTL.TeamDungeon.GetDungeonDataByActivityID(id) UIUtils.SetLabelText(v.txt_Title, Const_IDS[dungeonData.DungeonName]) local isUnlock, content = CTL.Activities.IsOpen(id) if isUnlock then v.state:SetState(1) local curCount = MDL.TeamDungeon.LeftAwardCountDic[dungeonData.ID] or 0 local sumCount = DataSheetManager.ActivityData:GetDataByID(id).DailyRefreshTimes if curCount == 0 then curCount = UTL.Color.FormatRedColor(curCount) end v.txt_Times.text = curCount .. "/" .. sumCount UIUtils.SetActive(v.img_RedPoint, MDL.TeamDungeon.IsTimesLeft(id)) else v.state:SetState(2) v.txt_Lock.text = content UIUtils.SetActive(v.img_RedPoint, false) end else v.state:SetState(0) UIUtils.SetActive(v.img_RedPoint, false) end end end function UIActivitiesTeamDungeonEntry:OnBackButtonPressed() self:OnButtonClicked(self.UITemplateTitlePanel.btn_close) end function UIActivitiesTeamDungeonEntry:OnClosed() UIUtils.SetActive(self.UITemplateTitlePanel.btn_Info, true) end function UIActivitiesTeamDungeonEntry:OnButtonClicked(comp) if comp == self.UITemplateTitlePanel.btn_close then self:CloseView(true) elseif comp == self.UITemplateTitlePanel.btn_Home then CTL.HomeMain.CloseViewBackHomeMain() else for i, v in ipairs(self.group_TeamDungeon) do if comp == v.btn_Select then local activityData = DataSheetManager.ActivityData:GetDataByID(LuaConst.ActivityType.TeamDungeon) local dungeonActivityId = activityData.childID[i] if dungeonActivityId then local dungeonData = CTL.TeamDungeon.GetDungeonDataByActivityID(dungeonActivityId) local isUnlock, content = CTL.Activities.IsOpen(dungeonActivityId) if isUnlock then CTL.TeamDungeon.FindTeamPVENPC(dungeonActivityId) UIManager.RecoverTopView() CTL.HomeMain.CloseOpenView() else CTL.Tips.AddTipsMsg(Const_IDS.IDS_ActivityName_TeamDungeon_LockHint1) end else CTL.Tips.AddTipsMsg(Const_IDS.IDS_ActivityName_TeamDungeon_LockHint2) end end end end end --关闭玩法时,关闭界面 function UIActivitiesTeamDungeonEntry:OnCloseGamePlay() if not MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.TeamDungeon) or (not MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.TeamDungeon2)) then self:CloseView(true) end end return UIActivitiesTeamDungeonEntry