local CountryWorldBoss_Controller = {} local private = {} function CountryWorldBoss_Controller.OpenCountryWorldBossPanel() if CTL.WarZone.IsWarZoneOpen() and MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.CountryWorldBoss) then if not UIManager.IsViewOpened(Const_UI_Lua.UIEnum.UICountryWorldBossMain) then --有时服务器会一个任务推送多次,比如共讨混沌×3的任务。客户端先判断只打开一次界面,如果有问题就让服务器改成只推一次 UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UICountryWorldBossMain) end else CTL.Tips.AddTipsMsg(Const_IDS.IDS_Country_CountryNotOpen) -- 玩法未开启 end end --打开购买奖励次数界面 function CountryWorldBoss_Controller.OpenPurchaseTimePanel() --不在活动时间内 local isInTime = false for _, config in DataSheetManager.WorldBoss:GetEnumerator() do if config.BossType == LuaConst.WorldBossType.WarZoneWorldBoss and CTL.WorldBoss.IsBossInOpenTime(config) == 1 then isInTime = true break end end if isInTime == false then CTL.Tips.AddTipsMsg(Const_IDS["IDS_WorldBoss_OutOfTime"]) -- 今日活动已结束,无法补充次数 return end if MDL.Purchase.GetAvailablePurchaseTimes(LuaConst.ActivityType.CountryWorldBoss) > 0 then UIManager.OpenView(Const_UI_Lua.UIEnum.UIItemBuyPanel, {type = LuaConst.ActivityType.CountryWorldBoss}) else local desc = MDL.OfficialPosition.GetPurchaseTimesDesc(LuaConst.ActivityType.CountryWorldBoss) if desc then CTL.Tips.AddTipsMsg(desc) else CTL.Tips.AddTipsMsg(Const_IDS.IDS_HeroBiography_NoPayTime) -- 今日购买次数已用尽 end end end --打开设置提醒界面 function CountryWorldBoss_Controller.OpenSettingNoticePanel() UIManager.OpenView(Const_UI_Lua.UIEnum.UIWorldBossSetting, { Type = LuaConst.ActivityType.CountryWorldBoss }) end function CountryWorldBoss_Controller.TryToEnterWorldBoss(bossID, helpGRoomID, helpAcid, enterType) local bossInfo = MDL.WorldBoss.CountryWorldBossInfoDic[bossID] if not bossInfo then return false end -- 判断当前是否有势力 if not MDL.Guild.IsHasGuild() then CTL.Tips.AddTipsMsg(Const_IDS.IDS_ERRORCODE_2820_InfoCode_Country_EntryRequirementTips1) return false end -- 判断当前是否加入了国家MDL.Country.IsHasCountry() if not MDL.Country.IsHasCountry() then CTL.Tips.AddTipsMsg(Const_IDS.IDS_ERRORCODE_2820_InfoCode_Country_EntryRequirementTips1) return false end -- 判断国战状态 local curStage = MDL.Country.GetCurStage() if curStage and curStage < MDL.Country.Stage.CountryBuild then -- 还未达到选国状态 local stageTimeDic = MDL.Country.GetAllStageTime() if stageTimeDic then local closeTime = stageTimeDic[MDL.Country.Stage.CountryBuild] local residueTime = UTL.Time.FormatTimeBySecondsToHour(closeTime.stageStart - UTL.Time.GetServerTimestamp()) CTL.Tips.AddTipsMsg(string.FormatByIdsId(Const_IDS.IDS_CountryWorldBoss_EntryRequirement3, residueTime)) end return false end local state = CTL.WorldBoss.GetBossStateAndLev(bossInfo) if state == CTL.WorldBoss.BossState.UnOpen then for i, v in ipairs(bossInfo.BossConfig.Unlock_Table) do if CTL.Unlock.JudgeUnlockByParameterTable(v) == false then CTL.Tips.AddTipsMsg(Const_IDS["IDS_Common_WorldBoss_NewConditonTips"]) return end end CTL.Tips.AddTipsMsg(Const_IDS["IDS_WorldBoss_Special_UnlockTips1"]) elseif state == CTL.WorldBoss.BossState.WaitToOpen then CTL.Tips.AddTipsMsg(Const_IDS["IDS_WorldBoss_Refuse_NotReborn"]) elseif state == CTL.WorldBoss.BossState.Opening then MDL.WorldBoss.EnterWorldBossRequest(bossID, helpGRoomID, helpAcid, enterType) return true elseif state == CTL.WorldBoss.BossState.Closed then CTL.Tips.AddTipsMsg(Const_IDS["IDS_WorldBoss_Refuse_RoomClose"]) else CTL.Tips.AddTipsMsg(Const_IDS["IDS_WorldBoss_Refuse_NotOpen"]) end return false end return CountryWorldBoss_Controller