local UIMultiplayerDungeonEntrance = UIViewClass() local DefaultWeeklyRefreshTimeID = 2 local ActivityState = { Lock = 1, NotReach = 2, WaitRotation = 3, OpenIng = 4, } local CONST_CONDITION_ID = 701 function UIMultiplayerDungeonEntrance:OnOpened(context) self:RegistSystemEvent(EventID.UI_UpdateMultiplayerDungeonRewardTimes, self.RefreshEntrancePanel) self.ActivityDataState = {} self.DifficultyLimit = DataSheetManager.ConstData:GetDataByID("MultiplayerDifficultyLimit").IntValue self.DifficultyLimit2 = DataSheetManager.ConstData:GetDataByID("MultiplayerDifficultyLimit703").IntValue local teamActivityData = DataSheetManager.ActivityData:GetDataByID(LuaConst.ActivityType.MultiplayerDungeon) self.DisplayActivity = teamActivityData.childID -- 界面标题 UIUtils.SetLabelText(self.UITemplateTitlePanel.lab_Title, Const_IDS[teamActivityData.Activity]) self:RefreshEntrancePanel() end function UIMultiplayerDungeonEntrance:InitCellInfo(cellTable, data) local unlockId = data.FuctionUnlockID if unlockId and unlockId > 0 and not MDL.Unlock.IsUnlock(unlockId) then -- 没有解锁 cellTable.state:SetState(0) UIUtils.SetActive(cellTable.img_RedPoint.gameObject, false) self.ActivityDataState[data.ID] = ActivityState.Lock return end -- 玩法标题 UIUtils.SetLabelText(cellTable.txt_Title, Const_IDS[data.Activity]) UIUtils.SetActive(cellTable.img_RedPoint.gameObject, MDL.MultiplayerDungeon.GetRedPointState(data.ID)) -- 设置图标 local bossData = DataSheetManager.MultiplayerDungeonBoss:GetDataByID(data.ID) UIUtils.SetImageByAssetBundle(cellTable.img_Frame_Task, bossData.BossPicture) -- 设置状态 local rotationTime = MDL.MultiplayerDungeon.GetRotationOrder(data.ID) if rotationTime then local serverTime = UTL.Time.GetServerTimestamp() if serverTime >= rotationTime then self.ActivityDataState[data.ID] = ActivityState.OpenIng cellTable.state:SetState(3) else self.ActivityDataState[data.ID] = ActivityState.WaitRotation cellTable.state:SetState(2) cellTable.obj_Timer:ResetAndBeginCustomTimer(false, rotationTime - serverTime, 0, UIUtils.GetLocalizedTxt(Const_IDS.IDS_GuildWar_Time2)) end -- 设置进度进度 local levelData = MDL.MultiplayerDungeon.GetConfigByActivitiesID(data.ID) local passFarthestId = MDL.MultiplayerDungeon.GetPassFarthestIDByActivitiesID(data.ID) if passFarthestId > 0 then for index, data in ipairs(levelData) do if data.ID == passFarthestId then UIUtils.SetLabel(cellTable.txt_State, string.FormatByIdsId(Const_IDS["IDS_ActivityName_Difficulty1"], UIUtils.GetLocalizedTxt(Const_IDS["IDS_Number_Written_"..levelData[index].Difficulty]))) break end end else UIUtils.SetLabel(cellTable.txt_State, string.FormatByIdsId(Const_IDS["IDS_ActivityName_Difficulty1"], UIUtils.GetLocalizedTxt(Const_IDS["IDS_Number_Written_"..levelData[1].Difficulty]))) end else self.ActivityDataState[data.ID] = ActivityState.NotReach cellTable.state:SetState(1) end end function UIMultiplayerDungeonEntrance:OnBackButtonPressed() self:OnButtonClicked(self.UITemplateTitlePanel.btn_close) end function UIMultiplayerDungeonEntrance: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 -- 玩法说明 local desc2,timeStr2 = UTL.Time.GetDateDescAndTime({[1]=2}) UIManager.OpenView(Const_UI_Lua.UIEnum.UICommonNoteView, {id = LuaConst.NoteID.MultiplayerDungeon, params = {desc2..timeStr2, UIUtils.GetLocalizedTxt(Const_IDS["IDS_Number_Written_" .. self.DifficultyLimit]), UIUtils.GetLocalizedTxt(Const_IDS["IDS_Number_Written_" .. self.DifficultyLimit2])}}) else for i = 1, #self.Content do if comp == self.Content[i].btn_Select then local activityID = self.DisplayActivity[i] local state = self.ActivityDataState[activityID] if state == ActivityState.Lock or not state then CTL.Tips.AddTipsMsg(Const_IDS.IDS_WorldBoss_Label_NotOpen) elseif state == ActivityState.NotReach then if i > 1 then -- 第一个副本默认开启 local activityData = DataSheetManager.ActivityData:GetDataByID(CONST_CONDITION_ID) local levelName = UIUtils.GetLocalizedTxt(Const_IDS[activityData.Activity]) local limit if activityID == LuaConst.ActivityType.MultiplayerDungeon3 then limit = UIUtils.GetLocalizedTxt(Const_IDS["IDS_Number_Written_" .. self.DifficultyLimit2]) else limit = UIUtils.GetLocalizedTxt(Const_IDS["IDS_Number_Written_" .. self.DifficultyLimit]) end CTL.Tips.AddTipsMsg(string.FormatByIdsId(Const_IDS.IDS_Multiplayer_WeiKaiQi, levelName, limit)) else logging.error(LTAG.ERROR, activityID, " 这个活动ID应当默认开启") end elseif state == ActivityState.WaitRotation then CTL.Tips.AddTipsMsg(Const_IDS.IDS_Multiplayer_DengDaiLunHuanTiShi) elseif state == ActivityState.OpenIng then MDL.MultiplayerDungeon.MultiplayerDungeonInfoRequest(activityID) end end end end end -- 刷新界面显示 function UIMultiplayerDungeonEntrance:RefreshEntrancePanel() -- 刷新子活动入口 for i = 1, #self.DisplayActivity do local activityData = DataSheetManager.ActivityData:GetDataByID(self.DisplayActivity[i]) self:InitCellInfo(self.Content[i], activityData) end for i = #self.DisplayActivity + 1, #self.Content do local cellTable = self.Content[i] cellTable.state:SetState(0) UIUtils.SetActive(cellTable.img_RedPoint.gameObject, false) end -- 刷新剩余奖励数量 local rewardCountInfo = MDL.MultiplayerDungeon.GetRewardCountLeft() if rewardCountInfo.curCount == 0 then rewardCountInfo.curCount = UTL.Color.FormatRedColor(rewardCountInfo.curCount) end local desc, time = UTL.Time.GetDateDescAndTime({[1] = DefaultWeeklyRefreshTimeID}) UIUtils.SetLabel(self.txt_Rule, string.FormatByIdsId(Const_IDS.IDS_MultiplayerDungeon_Tips1, desc .. time, string.format("%s/%s", rewardCountInfo.curCount, rewardCountInfo.sumCount))) end return UIMultiplayerDungeonEntrance