local DragonArtery_Controller = {} local EventSystem = require('Event/EventSystem') local private = {} function DragonArtery_Controller.OnStartup() EventSystem.Regist(EventID.TimerWheelStartTimeOver, private.OnDragonArteryActivityStart) EventSystem.Regist(EventID.TimerWheelEndTimeOver, private.OnDragonArteryActivityEnd) EventSystem.Regist(EventID.UIBattle_DragonArtery_SummonRequest, private.OnSummonRequest) end --获取龙脉战报名区总时间 function DragonArtery_Controller.GetRegisterAreaTime() --读第一行数据 local data = DataSheetManager.DragonArtery:GetDataByID(1) return data.OfficerEnterTime + data.RatingEnterTime end --获取龙脉战报名区剩余时间 function DragonArtery_Controller.GetRegisterAreaLeftTime() local passedTime = CTL.Activities.GetOpenedActivityPassedTime(LuaConst.ActivityType.DragonArtery) if passedTime then return DragonArtery_Controller.GetRegisterAreaTime() - passedTime end return 0 end --活动时间开始 function private.OnDragonArteryActivityStart(timeId, activityId, timeIndex) if activityId == LuaConst.ActivityType.DragonArtery then if MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.DragonArtery) and MDL.Country.GetCurStage() ~= MDL.Country.Stage.CountryReset then MDL.DragonArtery.UpdateEntryRed(true) if not UIManager.IsViewOpened(Const_UI_Lua.UIEnum.UIDragonArteryMain) then if CTL.Activities.IsInActivitySpecificLevel() then UIManager.OpenView(Const_UI_Lua.UIEnum.UIActivitiesRemind, {LuaConst.ActivityType.DragonArtery}) else CTL.HomeMain.AddTownHomeDelayView(Const_UI_Lua.UIEnum.UIActivitiesRemind, {LuaConst.ActivityType.DragonArtery}) end end end end end function private.OnSummonRequest(summoner) if LogicUpdateManager._curEntity and not LevelManager.IsReplayBattle() and summoner ~= LogicUpdateManager._curEntity and LogicUpdateManager._curEntity:IsActive() and LogicUpdateManager._curEntity:IsAlive() and LogicUpdateManager._curEntity:GetCampID() == summoner:GetCampID() then UTL.MessageBox.ShowOKCancelBox("", string.FormatByIdsId(Const_IDS.IDS_DragonArtey_Ask, summoner._logicInitData.Name), function() LuaInputManager.EnqueueSpecialCommand(LuaConst.SpecialCommandType.AcceptSummon) end) end end --活动时间结束 function private.OnDragonArteryActivityEnd(timeId, activityId, timeIndex) if activityId == LuaConst.ActivityType.DragonArtery then MDL.DragonArtery.UpdateEntryRed(false) --活动结束请求国家结算 if MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.DragonArtery) then MDL.DragonArtery.TryGetDragonArteryCountryRankResult(true) end end end --获取龙脉战场数量 function DragonArtery_Controller.GetWarFieldNum(type) local data = DataSheetManager.DragonArtery:GetDataByID(type) if data then return math.max(1, data.WarfieldNum) end return 0 end --当前职位是否允许优先进入战场 function DragonArtery_Controller.IsJobAllowToEnterFirst(warFieldId) local fieldData = DataSheetManager.DragonArteryWarfield:GetDataByID(warFieldId) if fieldData then local typeData = DataSheetManager.DragonArtery:GetDataByID(fieldData.Belong) local isAllow = false local myJobId = MDL.Country.GetMyJobId() for i, v in ipairs(typeData.OfficerID) do if myJobId == v then isAllow = true break end end return isAllow end return false end --龙脉战优先权的官员文本,用顿号隔开 function DragonArtery_Controller.GetEnterFirstJobContent(typeData) local linkSym if Localization.IsAllChinese() then linkSym = "、" else linkSym = ", " end local content if typeData then for i, jobId in ipairs(typeData.OfficerID) do local jobName = MDL.Country.ForceGetJobName(jobId) if i == 1 then content = UIUtils.GetLocalizedTxt(Const_IDS[jobName]) else content = content .. linkSym .. UIUtils.GetLocalizedTxt(Const_IDS[jobName]) end end end return content end --当前职位是否允许设置战力 --取第一行数据判断即可 function DragonArtery_Controller.IsJobAllowToSetPower() local typeData = DataSheetManager.DragonArtery:GetDataByID(1) local isAllow = false local myJobId = MDL.Country.GetMyJobId() for i, v in ipairs(typeData.BROfficerID) do if myJobId == v then isAllow = true break end end return isAllow end --龙脉战可以设置战力的官员文本,用顿号隔开 function DragonArtery_Controller.GetSetPowerJobContent() local content = "" local linkSym if Localization.IsAllChinese() then linkSym = "、" else linkSym = ", " end local typeData = DataSheetManager.DragonArtery:GetDataByID(1) for i, jobId in ipairs(typeData.BROfficerID) do local jobName = MDL.Country.ForceGetJobName(jobId) if i == 1 then content = UIUtils.GetLocalizedTxt(Const_IDS[jobName]) else content = content .. linkSym .. UIUtils.GetLocalizedTxt(Const_IDS[jobName]) end end return content end --龙脉是否在活动结束到跨天5点之间 function DragonArtery_Controller.IsDragonArteryInEndAndRefreshTime() local serverDay = UTL.Time.GetServerWeekday() local data = DataSheetManager.ActivityData:GetDataByID(LuaConst.ActivityType.DragonArtery) for _, v in ipairs(data.Time_Table) do local timeCfg = DataSheetManager.TimeRefresh:GetDataByID(v.EndTime) if serverDay == timeCfg.Day then --在同一天判断活动是否结束 if UTL.Time.GetServerIntervalTimeByTimeId(v.EndTime) < 0 then return true end elseif serverDay == timeCfg.Day + 1 then --隔了一天判断是否在5点内 if UTL.Time.GetServerIntervalTimeByTimeId(1) > 0 then return true end end end return false end function DragonArtery_Controller.GetCurLimitKingdom() local lineUpCountryLimits = MDL.DragonArtery.GetLineUpCountryLimits() return MDL.FreeLineUp.GetMultiCountryId(lineUpCountryLimits) end return DragonArtery_Controller