local Activities_Controller = {} local private = {} local EventSystem = require 'Event/EventSystem' local ACTIVITY_ICON_PATH = ConstAssetPathConfig.ACTIVITY_ICON_PATH Activities_Controller.limitActivityTransferID = nil local GuildWarOpenDayLimit = DataSheetManager.ConstData:GetDataByID("GuildWarOpenDayLimit").IntValue function Activities_Controller.OnStartup() EventSystem.Regist(EventID.UI_UpdateServerDay, Activities_Controller.CalculateRedPoint) end function Activities_Controller.GetActivityIconPath(activityIcon) return string.format(ACTIVITY_ICON_PATH, activityIcon) end Activities_Controller.ActivityState = { Opening = 1, -- 开启中 NotOpen = 2, -- 未开启 End = 3, -- 已结束 } Activities_Controller.CrossType = { None = -1, WarZone = 0, CrossServer = 1, } Activities_Controller.CalendarType = { Normal = 1, Country = 2, Operation = 3, } Activities_Controller.SkipTownActivityTypeDic = { [LuaConst.ActivityType.GuildBoss] = true, } Activities_Controller.WeekFieldName = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday", } --赛事阶段枚举 Activities_Controller.ActivityEventState = { Activity = 3, --活动期 Display = 2, --展示期 Forecast = 1, --预告期 None = 0, --未开启 Lock = -1, --未解锁 } --活动页签 Activities_Controller.ActivityType = { Daily = 1, --日常 Challenge = 2, --挑战 Team = 3, --组队 LimitTime = 4, --限时 Competition = 5, --赛事 } local ActivityEventStateColor = { [Activities_Controller.ActivityEventState.Forecast] = "ff3c3c", [Activities_Controller.ActivityEventState.Activity] = "70C664", [Activities_Controller.ActivityEventState.Display] = "EEA11A", } local WeeklyCalendarTime = DataSheetManager.ConstData:GetDataByID("WeeklyCalendarTime").IntValue local function ActivityPreviewSort(a, b) local stateA = Activities_Controller.GetState(a, true) local stateB = Activities_Controller.GetState(b, true) if stateA == stateB then local dataA = DataSheetManager.WeeklyCalendar:GetDataByActivityID(a) local dataB = DataSheetManager.WeeklyCalendar:GetDataByActivityID(b) return dataA.Sort < dataB.Sort else return stateA < stateB end end --region-------------------------- 限时玩法活动提示相关 ------------------------------------------------------- local function QuitCancel() NotSyncBattleSetter.PauseLevel(false) Activities_Controller.limitActivityTransferID = nil end -- 在非同步关卡外直接进入活动,否则弹出二次确认框 function Activities_Controller.OpenRemindConfirmBox(activityData) Activities_Controller.limitActivityTransferID = activityData.ID if activityData.ID == LuaConst.ActivityType.GuildEscort then Activities_Controller.GoActivity(activityData.ID) Activities_Controller.limitActivityTransferID = nil else if BattleDataGetter.IsNoBattleLevel() then Activities_Controller.GoActivity(activityData.ID) Activities_Controller.limitActivityTransferID = nil else local content = string.FormatByIdsId(Const_IDS["IDS_ActivitiesRemind_QuitOfflineDungeon"], UIUtils.GetLocalizedTxt(Const_IDS[activityData.Activity])) UTL.MessageBox.ShowSettingOKCancelBox( Const_IDS.IDS_ExitBarrier, content, Activities_Controller.TryGoLimitedActivity, QuitCancel ) end end end function Activities_Controller.IsCanSkipTownActivtiyType(activityType) return Activities_Controller.SkipTownActivityTypeDic[activityType] end function Activities_Controller.TryGoLimitedActivity() NotSyncBattleSetter.PauseLevel(true) if not Activities_Controller.IsInActivitySpecificLevel() then Activities_Controller.GoActivity(Activities_Controller.limitActivityTransferID) Activities_Controller.limitActivityTransferID = nil else MDL.Level.SendRoleLeaveFubenFromSetting() end end -- 在非同步战斗关卡内 function Activities_Controller.IsInActivitySpecificLevel() local curLevelType = BattleDataGetter.GetCurLevelType() if not curLevelType then return false end local curLevelInfo = DataSheetManager.LevelFeatureData:GetDataByLevelFeatureID(curLevelType) if curLevelInfo and (not BattleDataGetter.IsNoBattleLevel()) and curLevelInfo.IsShowEventRemind then return true end return false end function Activities_Controller.IsLimitActivityTransferID() return Activities_Controller.limitActivityTransferID == LuaConst.ActivityType.GuildBoss or Activities_Controller.limitActivityTransferID == LuaConst.ActivityType.GuildWar or Activities_Controller.limitActivityTransferID == LuaConst.ActivityType.GuildParty end function Activities_Controller.SendFromLevelToLevelByActivityID(activityID) if activityID == LuaConst.ActivityType.GuildBoss then if MDL.Guild.IsHasGuild() then Activities_Controller.limitActivityTransferID = nil MDL.GuildBoss.EnterGuildBossReq() end end end -- 当活动开启, 通用活动跳转为打开界面 false -- 当活动开启, 通用活动跳转为进入副本 true function Activities_Controller.IsSkipTownScene(levelInfo) local levelType = levelInfo.LevelType if levelType and BattleDataGetter.IsNoBattleLevel(levelType) then if Activities_Controller.IsCanSkipTownActivtiyType(Activities_Controller.limitActivityTransferID) and Activities_Controller.IsActivityInOpeningTime(Activities_Controller.limitActivityTransferID) then Activities_Controller.SendFromLevelToLevelByActivityID(Activities_Controller.limitActivityTransferID) return true end end return false end --endregion--------------------------------------------------------------------------------- function Activities_Controller.GoActivity(activityId) if Activities_Controller.CheckGuildActivityStage(activityId) then return end if activityId == LuaConst.ActivityType.GuildBoss then if MDL.Guild.IsHasGuild() then MDL.GuildBoss.EnterGuildBossReq() else CTL.Sound.PlayGameSound("UI_invalid") CTL.Tips.AddTipsMsg(Const_IDS.IDS_ERRORCODE_1319_InfoCode_Guild_PlayerNotInGuild) CTL.Guild.OpenGuildMain() end elseif activityId == LuaConst.ActivityType.GuildParty then if MDL.Guild.IsHasGuild() then Activities_Controller.OpenActivityWindowByID(activityId) else CTL.Sound.PlayGameSound("UI_invalid") CTL.Tips.AddTipsMsg(Const_IDS.IDS_ERRORCODE_1319_InfoCode_Guild_PlayerNotInGuild) CTL.Guild.OpenGuildMain() end else return Activities_Controller.OpenActivityWindowByID(activityId) end end function Activities_Controller.OpenActivityWindowByID(ActivityId) if Activities_Controller.CheckGuildActivityStage(ActivityId) then return end if ActivityId == LuaConst.ActivityType.RingDaily then CTL.Task.GoToRingTask(MDL.Task.Enum_RingTaskType.RingDaily) elseif ActivityId == LuaConst.ActivityType.RingGuild then UIManager.OpenView(Const_UI_Lua.UIEnum.UITaskMainPanel) elseif ActivityId == LuaConst.ActivityType.RingWeekly then UIManager.OpenView(Const_UI_Lua.UIEnum.UITaskMainPanel) elseif ActivityId == LuaConst.ActivityType.TVT then UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UISyncTeamPVPMainPanel) elseif ActivityId == LuaConst.ActivityType.HeroBiography then UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIHeroBiographyMain) elseif ActivityId == LuaConst.ActivityType.ClimbTower then CTL.ClimbTower.OpenMainPanel() elseif ActivityId == LuaConst.ActivityType.BossChallenge then UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIBossChallengeMain) elseif ActivityId == LuaConst.ActivityType.MainlLine then UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UILevelSelectPanel) elseif ActivityId == LuaConst.ActivityType.BalanceBattle then UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIFairPlayMainPanel) elseif ActivityId == LuaConst.ActivityType.ThreeTeamFight then CTL.ThreeTeamFight.OpenMain(true) elseif ActivityId == LuaConst.ActivityType.OffLineSoloFight then CTL.SoloFight.OpenSoloFightView() elseif ActivityId == LuaConst.ActivityType.WorldBoss then -- 世界Boss UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIWorldBossMainPanel) elseif ActivityId == LuaConst.ActivityType.CountryWorldBoss then -- 战区世界Boss CTL.CountryWorldBoss.OpenCountryWorldBossPanel() elseif ActivityId == LuaConst.ActivityType.PersonalBoss then CTL.PersonalBoss.OpenPersonalBossPanelByArea() elseif ActivityId == LuaConst.ActivityType.TeamDungeon1 then CTL.TeamDungeon.FindTeamPVENPC(ActivityId) elseif ActivityId == LuaConst.ActivityType.TeamDungeon2 then CTL.TeamDungeon.FindTeamPVENPC(ActivityId) elseif ActivityId == LuaConst.ActivityType.TeamDungeon3 then CTL.TeamDungeon.FindTeamPVENPC(ActivityId) elseif ActivityId == LuaConst.ActivityType.TeamDungeon then UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIActivitiesTeamDungeonEntry) elseif ActivityId == LuaConst.ActivityType.ResourcesChapter then UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIMaterialLevelMainPanel) elseif ActivityId == LuaConst.ActivityType.GuildBoss then CTL.GuildBoss.OpenMainView() elseif ActivityId == LuaConst.ActivityType.RebelStrike then CTL.RebelStrike.OpenMain() elseif ActivityId == LuaConst.ActivityType.PetCatch then CTL.Pet.DoCatchPet() elseif ActivityId == LuaConst.ActivityType.FightThrone then UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIFightThroneMain) elseif ActivityId == LuaConst.ActivityType.DragonArtery then UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIDragonArteryMain) elseif ActivityId == LuaConst.ActivityType.GuildDonate then if MDL.Guild.IsHasGuild() then UIManager.OpenView(Const_UI_Lua.UIEnum.UIGuildContribute) end elseif ActivityId == LuaConst.ActivityType.GuildAllies then if MDL.Guild.IsHasGuild() then CTL.RedPoint.RemoveRedPoint(CTL.RedPoint.RedPointKey.Guild_Activity_Allies) UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIGuildAlliesMapView) end elseif ActivityId == LuaConst.ActivityType.GuildWar then CTL.GuildWar.OpenMainView() elseif ActivityId == LuaConst.ActivityType.MultiplayerDungeon then -- 多人副本 UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIMultiplayerDungeonEntrance) elseif ActivityId == LuaConst.ActivityType.GuildParty then CTL.GuildParty.OpenGuildPartyActivityEntry(); elseif ActivityId == LuaConst.ActivityType.TreasureDungeon then CTL.Tips.AddTipsMsg(Const_IDS.IDS_DigTreasure_ActivityTips) elseif ActivityId == LuaConst.ActivityType.TreasurePic then UIManager.OpenView(Const_UI_Lua.UIEnum.UIDigTreasureSelection) elseif ActivityId == LuaConst.ActivityType.GuildTarget then CTL.Guild.OpenGuildMain({ selectIndex = 2 }) elseif ActivityId == LuaConst.ActivityType.DemonGod then -- 魔神降世(将星临世) CTL.DemonGod.OpenDemonGodView() elseif ActivityId == LuaConst.ActivityType.GuildMine then -- 势力挖矿 CTL.GuildMine.OpenGuildMineMainView() elseif ActivityId == LuaConst.ActivityType.GuildEscort then CTL.GuildEscort.OpenMainPanel() elseif ActivityId == LuaConst.ActivityType.HeroMatch1v1 then -- 天地群雄 CTL.HeroMatch1v1.OpenHeroMatch1v1MainView() elseif ActivityId == LuaConst.ActivityType.HeroMatch3v3 then -- 天地群雄 CTL.HeroMatch3v3.OpenHeroMatch3v3MainView() elseif ActivityId == LuaConst.ActivityType.FairSoloTournament then -- 天地会武 CTL.FairSoloTournament.OpenMain() elseif ActivityId == LuaConst.ActivityType.WantedTask then --国战悬赏任务 CTL.CountryWantedTask.GoToNpc() elseif ActivityId == LuaConst.ActivityType.SceneQuizPreliminary or ActivityId == LuaConst.ActivityType.SceneQuizFinal then -- 一站到底 local info = MDL.OperationActivity.GetOperationActivityInfo(MDL.OperationActivity.ActivityType.NewYear) if info then for activityId, v in pairs(info) do if CTL.OperationActivity.IsOperationActivityOpen(v) then MDL.SceneQuiz.CurActivityID = activityId CTL.SceneQuiz.OpenMainPanel(activityId) return end end end elseif ActivityId == LuaConst.ActivityType.CountryNightBoss then UIManager.OpenView(Const_UI_Lua.UIEnum.UICountryNightBossMain) elseif ActivityId == LuaConst.ActivityType.Storm then UIManager.OpenView(Const_UI_Lua.UIEnum.UIStormEntrance) elseif ActivityId == LuaConst.ActivityType.GVGFight then CTL.GVGFight.OpenGVGFightMain() elseif ActivityId == LuaConst.ActivityType.GuildSalary then if MDL.Guild.IsHasGuild() == false then CTL.Guild.OpenGuildMain() return end UIManager.OpenView(Const_UI_Lua.UIEnum.UIGuildSalary) elseif ActivityId == LuaConst.ActivityType.SyncFourCountryWar then CTL.SyncFourCountryWar.OpenMainPanel() elseif ActivityId == LuaConst.ActivityType.SyncCityWar then CTL.ChangAnSiege.OpenMainView() elseif ActivityId == LuaConst.ActivityType.SlgGvE then CTL.SlgGvE.OpenSlgGvEMain() elseif ActivityId == LuaConst.ActivityType.TeamFairChampionship then CTL.TeamFairChampionship.OpenMainPanel() else logging.error(LTAG.LOG, "---Activities_Controller.OpenActivityWindowByID()--未定义活动,需要添加相关活动--- ", ActivityId) end end function Activities_Controller.IsNeedFindNPC(activityId) if activityId == LuaConst.ActivityType.TeamDungeon1 or activityId == LuaConst.ActivityType.TeamDungeon2 or activityId == LuaConst.ActivityType.RingDaily or activityId == LuaConst.ActivityType.WantedTask then return true else return false end end function Activities_Controller.IsOpen(activityID) local activityData = DataSheetManager.ActivityData:GetDataByID(activityID) if activityData == nil then logging.error(LTAG.LOG, "---Activities_Controller.IsOpen()--未定义活动,需要添加相关活动--- ", activityID) return false, "" end local isUnlock, content if activityID == LuaConst.ActivityType.MainlLine then isUnlock, content = true, "" else -- 攻城略地优先判断 if activityID == LuaConst.ActivityType.GVGFight then -- 攻城略地 开服前几天内 按照不解锁处理 isUnlock, content = CTL.GVGFight.IsOpenGVGFight() if not isUnlock then return isUnlock, content end end -- 群雄演武赛季没开放,表现按不解锁处理 if activityID == LuaConst.ActivityType.ThreeTeamFight then if MDL.ThreeTeamFight.IsSeasonOpen() == false then return false, CTL.ThreeTeamFight.GetActivityNotOpenTips(true) end end --龙脉战、国战晚间Boss休赛期按不解锁处理 if activityID == LuaConst.ActivityType.DragonArtery or activityID == LuaConst.ActivityType.CountryNightBoss or activityID == LuaConst.ActivityType.SyncCityWar then if MDL.Country.GetCurStage() == MDL.Country.Stage.CountryReset then return false, UTL.Color.FormatRedColor(UIUtils.GetLocalizedTxt(Const_IDS.IDS_DragonArtery_OpenCondition1)) end end isUnlock, content = MDL.Unlock.IsClientUnlockWithText(activityData.FuctionUnlockID, activityData.SheetShowConditionIDS) end return isUnlock, content end --活动是否已完成 function Activities_Controller.IsDone(activityID) local data = DataSheetManager.ActivityData:GetDataByID(activityID) if data.SheetType == Activities_Controller.ActivityType.LimitTime or data.SheetType == Activities_Controller.ActivityType.Competition then return false end local countData = MDL.Activities.GetCountInfo(activityID) local curCount = countData.curCount local isDone = false if activityID == LuaConst.ActivityType.GuildTarget then isDone = MDL.GuildTarget.IsCompleteAllDayTasks() else local curActive, sumActive = MDL.Activities.GetActiveInfo(activityID) if curCount > 0 then isDone = false elseif curCount == 0 then isDone = true else isDone = sumActive > 0 and curActive == sumActive end end return isDone end --活动大厅界面页签是否置灰 function Activities_Controller.IsActivityCellSetGray(activityID) local state local data = DataSheetManager.ActivityData:GetDataByID(activityID) if data.SheetType == Activities_Controller.ActivityType.Competition then --赛事活动:当日开启即不置灰 return Activities_Controller.GetActivityEventState(activityID,true) ~= Activities_Controller.ActivityEventState.Activity end if data.SheetType == Activities_Controller.ActivityType.LimitTime then --限时活动:今天时间已过或今天没有该活动,state即是end if Activities_Controller.GetState(activityID,true) == Activities_Controller.ActivityState.End then state = true elseif not Activities_Controller.IsTodayActivity(activityID) then state = true end end if state then return true end local isDone = CTL.Activities.IsDone(activityID) local isCanPlay = Activities_Controller.IsCanContinuePlay(activityID) return isDone and not isCanPlay end --活动页面cell是否表示可继续参加 --策划需求:有的玩法虽然可继续参加,但置灰表示 function Activities_Controller.IsCanContinuePlay(activityID) local isCanPlay = false local countData = MDL.Activities.GetCountInfo(activityID) --无次数限制或有剩余次数 if countData.curCount == -1 or countData.curCount > 0 then isCanPlay = true end --特殊逻辑处理 if activityID == LuaConst.ActivityType.HeroBiography then isCanPlay = isCanPlay or CTL.Biography.IsShowBiographyHeroRedPoint() elseif activityID == LuaConst.ActivityType.PetCatch then isCanPlay = isCanPlay or MDL.Bag.GetItemCount(DataSheetManager.ConstData:GetDataByID("PetCatchCost").IntValue) > 0 elseif activityID == LuaConst.ActivityType.GuildTarget then isCanPlay = not MDL.GuildTarget.IsCompleteAllDayTasks() elseif activityID == LuaConst.ActivityType.MainlLine then isCanPlay = CTL.Activities.IsDone(activityID) elseif activityID == LuaConst.ActivityType.PersonalBoss then isCanPlay = true elseif activityID == LuaConst.ActivityType.TreasurePic then local remainCount = MDL.Bag.GetItemCount(51) + MDL.Bag.GetItemCount(52) isCanPlay = remainCount > 0 end return isCanPlay end function Activities_Controller.CanOpenDetailView(activityID) -- 天地群雄/天地会武/四军之战 在未开放阶段可以显示活动侧边详情界面 if activityID == LuaConst.ActivityType.HeroMatch1v1 then -- 天地群雄 return MDL.HeroMatch1v1.CheckIsBattleStage(), false elseif activityID == LuaConst.ActivityType.FairSoloTournament then -- 天地会武 return MDL.FairSoloTournament.CheckIsBattleStage(), false elseif activityID == LuaConst.ActivityType.SyncFourCountryWar then -- 四军之战 return MDL.SyncFourCountryWar.IsOpen(), false end local isOpen = Activities_Controller.IsOpen(activityID) if not isOpen then if activityID == LuaConst.ActivityType.WorldBoss or activityID == LuaConst.ActivityType.TeamDungeon then return isOpen, true end end return isOpen, false end function Activities_Controller.IsOpeningTime(id) return Activities_Controller.GetState(id) == Activities_Controller.ActivityState.Opening end function Activities_Controller.IsShowUI(activityID) local activityData = DataSheetManager.ActivityData:GetDataByID(activityID) if activityData == nil then logging.error(LTAG.LOG, "---Activities_Controller.IsOpen()--未定义活动,需要添加相关活动--- ", activityID) return false end return activityData.IsShowInUI end --获取活动开启之后经过的时间 不在活动时间内返回空 function Activities_Controller.GetOpenedActivityPassedTime(activityId) local activityCfg = DataSheetManager.ActivityData:GetDataByID(activityId) local startTime for _, timeData in ipairs(activityCfg.Time_Table) do if UTL.Time.IsServerInOpeningTime(timeData.StartTime, timeData.EndTime) then startTime = timeData.StartTime break end end if startTime then local offset = UTL.Time.GetServerIntervalTimeByTimeId(startTime) --offset大于0 说明活动未开启 if offset < 0 then return -offset end end return nil end --获取活动动态 --isToday,只关注今天的活动,正在开启的不用处理,因为无论判断是不是今天的都在进行中 function Activities_Controller.GetState(id, isToday) local data = DataSheetManager.ActivityData:GetDataByID(id) --全天活动,但分开战/休战期 if id == LuaConst.ActivityType.SlgGvE then return private.GetSlgGvEState() elseif id == LuaConst.ActivityType.GVGFight then return private.GetGVGFightState() end --全天活动,无限制 if #data.Time_Table == 0 then return Activities_Controller.ActivityState.Opening end --特殊逻辑处理 if id == LuaConst.ActivityType.GuildWar then return private.GetGuildWarState() elseif id == LuaConst.ActivityType.FightThrone and MDL.GuildWar.GuildWarIsFirstSign() and CTL.FightThrone.IsWedOrSatDay() then local state, time = CTL.FightThrone.GetFightThroneFakeOpenState() return state, time elseif id == LuaConst.ActivityType.HeroMatch1v1 then return private.GetHeroMatch1v1State() elseif id == LuaConst.ActivityType.HeroMatch3v3 then return private.GetHeroMatch3v3State() elseif id == LuaConst.ActivityType.FairSoloTournament then return private.GetFairSoloTournamentState() elseif id == LuaConst.ActivityType.TeamFairChampionship then return private.GetTeamFairChampionshipState() elseif id == LuaConst.ActivityType.SceneQuizPreliminary or id == LuaConst.ActivityType.SceneQuizFinal then return CTL.SceneQuiz.GetActivityStateAndTime() elseif id == LuaConst.ActivityType.SyncCityWar then if not CTL.ChangAnSiege.IsOpen() then return Activities_Controller.ActivityState.End end elseif id == LuaConst.ActivityType.SyncFourCountryWar then return private.GetSyncFourCountryWarState() end if Activities_Controller.IsActivityInOpeningTime(id) then return Activities_Controller.ActivityState.Opening, Activities_Controller.GetTimeToClose(id) end if Activities_Controller.IsActivityTimeOver(id, isToday) then return Activities_Controller.ActivityState.End end return Activities_Controller.ActivityState.NotOpen, Activities_Controller.GetTimeToOpen(id) end function private.GetSlgGvEState() if MDL.SlgGvE.GetSeasonState() == MDL.SlgGvE.SeasonState.Playing then return Activities_Controller.ActivityState.Opening else return Activities_Controller.ActivityState.End end end function private.GetGVGFightState() if MDL.GVGFight.GetCurGVGFightState() == MDL.GVGFight.GVGFightStage.OffSeason then return Activities_Controller.ActivityState.End else return Activities_Controller.ActivityState.Opening end end function Activities_Controller.GetMatchActivityStateStr(id) if id == LuaConst.ActivityType.GVGFight then return UIUtils.GetLocalizedTxt(MDL.GVGFight.GetGVGFightStateIds(MDL.GVGFight.GetCurGVGFightState())) elseif id == LuaConst.ActivityType.SlgGvE then return MDL.SlgGvE.GetSeasonStateStr() end return UIUtils.GetLocalizedTxt(Const_IDS.IDS_NewActivityTab_Hint_7) end function private.GetGuildWarState() local info = MDL.GuildWar.GetWarInfo() if info then if info.battleEndTime > UTL.Time.GetServerTimestamp() and info.battleOpenTime <= UTL.Time.GetServerTimestamp() then return Activities_Controller.ActivityState.Opening, info.battleEndTime - UTL.Time.GetServerTimestamp() elseif info.battleEndTime <= UTL.Time.GetServerTimestamp() then return Activities_Controller.ActivityState.End end if Activities_Controller.IsActivityTimeOver(LuaConst.ActivityType.GuildWar, true) then return Activities_Controller.ActivityState.End end return Activities_Controller.ActivityState.NotOpen, info.battleOpenTime - UTL.Time.GetServerTimestamp() end return Activities_Controller.ActivityState.End end function private.GetHeroMatch1v1State() if MDL.HeroMatch1v1.GetCurStageID() > 0 then if MDL.HeroMatch1v1.GetCurStageID() == MDL.HeroMatch1v1.Stage.Join then return Activities_Controller.ActivityState.NotOpen else local MatchTime = DataSheetManager.MatchTime:GetDataByID(MDL.HeroMatch1v1.GetCurMatchTimeID()) if MDL.HeroMatch1v1.GetCurMatchTimeID() == MDL.HeroMatch1v1.Enum_BigStage.Display then return Activities_Controller.ActivityState.Opening elseif MatchTime.StartTime > 0 then if UTL.Time.IsServerInOpeningTime(MatchTime.StartTime, MatchTime.EndTime) then return Activities_Controller.ActivityState.Opening else return Activities_Controller.ActivityState.NotOpen end end end else return Activities_Controller.ActivityState.End end end function private.GetHeroMatch3v3State() if MDL.HeroMatch3v3.GetCurStageID() > 0 then if MDL.HeroMatch3v3.GetCurStageID() == MDL.HeroMatch3v3.Stage.Join then return Activities_Controller.ActivityState.NotOpen else local MatchTime = DataSheetManager.TeamMatchTime:GetDataByID(MDL.HeroMatch3v3.GetCurMatchTimeID()) if MDL.HeroMatch3v3.GetCurMatchTimeID() == MDL.HeroMatch3v3.Enum_BigStage.Display then return Activities_Controller.ActivityState.Opening elseif MatchTime.StartTime > 0 then if UTL.Time.IsServerInOpeningTime(MatchTime.StartTime, MatchTime.EndTime) then return Activities_Controller.ActivityState.Opening else return Activities_Controller.ActivityState.NotOpen end end end else return Activities_Controller.ActivityState.End end end function private.GetFairSoloTournamentState() if MDL.FairSoloTournament.GetCurStageID() > 0 then if MDL.FairSoloTournament.GetCurStageID() == MDL.FairSoloTournament.ConfigStage.Prepare then return Activities_Controller.ActivityState.NotOpen else local MatchTime = DataSheetManager.FairMatchTime:GetDataByID(MDL.FairSoloTournament.GetCurMatchTimeID()) if MDL.FairSoloTournament.GetCurMatchTimeID() == MDL.FairSoloTournament.Enum_BigStage.FairDisplay then return Activities_Controller.ActivityState.Opening elseif MatchTime.StartTime > 0 then if UTL.Time.IsServerInOpeningTime(MatchTime.StartTime, MatchTime.EndTime) then return Activities_Controller.ActivityState.Opening else return Activities_Controller.ActivityState.NotOpen end end end else return Activities_Controller.ActivityState.End end end function private.GetTeamFairChampionshipState() local curBigStageID = MDL.TeamFairChampionship.GetCurBigStageID() if curBigStageID > 0 then if curBigStageID == MDL.TeamFairChampionship.Enum_BigStage.Advance then return Activities_Controller.ActivityState.NotOpen else local MatchTime = DataSheetManager.TeamFairMatchTime:GetDataByID(curBigStageID) if curBigStageID == MDL.TeamFairChampionship.Enum_BigStage.Display then return Activities_Controller.ActivityState.Opening elseif MatchTime.StartTime > 0 then if UTL.Time.IsServerInOpeningTime(MatchTime.StartTime, MatchTime.EndTime) then return Activities_Controller.ActivityState.Opening else return Activities_Controller.ActivityState.NotOpen end end end else return Activities_Controller.ActivityState.End end end function private.GetSyncFourCountryWarState() if MDL.SyncFourCountryWar.IsForecast() then return Activities_Controller.ActivityState.NotOpen end if MDL.SyncFourCountryWar.IsOpen() and Activities_Controller.IsActivityInOpeningTime(LuaConst.ActivityType.SyncFourCountryWar) then return Activities_Controller.ActivityState.Opening end return Activities_Controller.ActivityState.NotOpen end --活动未开启前,获取距离活动开始的时间 function Activities_Controller.GetTimeToOpen(id) if id == LuaConst.ActivityType.GuildWar then local info = MDL.GuildWar.GetWarInfo() if info then if info.battleEndTime > UTL.Time.GetServerTimestamp() then return info.battleOpenTime - UTL.Time.GetServerTimestamp() end end return 0 elseif id == LuaConst.ActivityType.HeroMatch1v1 then local MatchTime = DataSheetManager.MatchTime:GetDataByID(MDL.HeroMatch1v1.GetCurMatchTimeID()) local openTime = 0 local offsetTime = UTL.Time.GetServerIntervalTimeByTimeId(MatchTime.StartTime) if offsetTime > 0 then openTime = offsetTime end return openTime elseif id == LuaConst.ActivityType.HeroMatch3v3 then local MatchTime = DataSheetManager.TeamMatchTime:GetDataByID(MDL.HeroMatch3v3.GetCurMatchTimeID()) local openTime = 0 local offsetTime = UTL.Time.GetServerIntervalTimeByTimeId(MatchTime.StartTime) if offsetTime > 0 then openTime = offsetTime end return openTime elseif id == LuaConst.ActivityType.FairSoloTournament then local openTime = 0 local MatchTime = DataSheetManager.FairMatchTime:GetDataByID(MDL.FairSoloTournament.GetCurMatchTimeID()) if MatchTime then local offsetTime = UTL.Time.GetServerIntervalTimeByTimeId(MatchTime.StartTime) if offsetTime > 0 then openTime = offsetTime end end return openTime elseif id == LuaConst.ActivityType.SceneQuizPreliminary or id == LuaConst.ActivityType.SceneQuizFinal then local state, openTime = CTL.SceneQuiz.GetActivityStateAndTime() return openTime else local data = DataSheetManager.ActivityData:GetDataByID(id) local openTime = 0 for _, v in ipairs(data.Time_Table) do local offsetTime = UTL.Time.GetServerIntervalTimeByTimeId(v.StartTime) if offsetTime > 0 then if openTime == 0 then openTime = offsetTime elseif openTime > offsetTime then openTime = offsetTime end end end return openTime end end --活动未开启前,获取距离活动开始的时间 --活动结束后,获取距离下一次活动开始的时间 function Activities_Controller.GetNextTimeToOpen(id) local data = DataSheetManager.ActivityData:GetDataByID(id) local openTime = 0 for _, v in ipairs(data.Time_Table) do local offsetTime = UTL.Time.GetServerIntervalNextTimeByTimeId(v.StartTime) if offsetTime > 0 then if openTime == 0 then openTime = offsetTime elseif openTime > offsetTime then openTime = offsetTime end end end return openTime end -- 获取下一个活动开启时间offset ---@param timeTb table ---@param includeToday bool 当天是否要开启 function Activities_Controller.GetTimeOrNextToOpen(timeTb, includeToday) local openTime = 0 for _, v in ipairs(timeTb) do local offsetTime = includeToday and UTL.Time.GetServerIntervalTimeByTimeId(v.StartTime) or UTL.Time.GetServerIntervalNextTimeByTimeId(v.StartTime) if offsetTime > 0 then if openTime == 0 then openTime = offsetTime elseif openTime > offsetTime then openTime = offsetTime end end end return openTime end --活动开启后,获取距离活动结束的时间 function Activities_Controller.GetTimeToClose(id) local data = DataSheetManager.ActivityData:GetDataByID(id) local closeTime = 0 for _, v in ipairs(data.Time_Table) do local offsetTime = UTL.Time.GetServerIntervalTimeByTimeId(v.EndTime) if offsetTime > 0 then if closeTime == 0 then closeTime = offsetTime elseif closeTime > offsetTime then closeTime = offsetTime end end end return closeTime end --根据服务器时间判断是否在活动时间内 function Activities_Controller.IsActivityInOpeningTime(activityId) local activityCfg = DataSheetManager.ActivityData:GetDataByID(activityId) if activityId == LuaConst.ActivityType.TVT then local time = MDL.SyncTeamPVP.GetCDTimer() if time / UTL.Time.TotalSecondsOneDay < 1 then return Activities_Controller.IsServerInOpeningTime("ThreeOnThreeSeasonDayStartTime", "ThreeOnThreeSeasonDayEndTime") end elseif activityId == LuaConst.ActivityType.SyncSolo then local time = MDL.SyncSolo.GetNextTime() if time / UTL.Time.TotalSecondsOneDay < 1 then return Activities_Controller.IsServerInOpeningTime("SyncSoloSeasonDayStartTime", "SyncSoloSeasonDayEndTime") end end for _, timeData in ipairs(activityCfg.Time_Table) do if UTL.Time.IsServerInOpeningTime(timeData.StartTime, timeData.EndTime) then return true end end return false end function Activities_Controller.IsServerInOpeningTime(startTimeId, endTimeId) local seasonDayStartTime = DataSheetManager.ConstData:GetDataByID(startTimeId).IntValue local seasonDayEndTime = DataSheetManager.ConstData:GetDataByID(endTimeId).IntValue return UTL.Time.IsServerInOpeningTime(seasonDayStartTime, seasonDayEndTime) end --整个活动没有可开启的时间段 function Activities_Controller.IsActivityTimeOver(activityId, isToday) local activityCfg = DataSheetManager.ActivityData:GetDataByID(activityId) if not isToday then for _, timeData in ipairs(activityCfg.Time_Table) do if not UTL.Time.IsServerInEndAndRefreshTime(timeData) then return false end end else local serverWeekday = UTL.Time.GetServerWeekday() for _, timeData in ipairs(activityCfg.Time_Table) do local timeRefreshCfg = DataSheetManager.TimeRefresh:GetDataByID(timeData.StartTime) if timeRefreshCfg.Timer == UTL.Time.TimeType.DAILY then return UTL.Time.IsServerInEndAndRefreshTime(timeData) elseif timeRefreshCfg.Timer == UTL.Time.TimeType.WEEKLY then if serverWeekday == timeRefreshCfg.Day then return UTL.Time.IsServerInEndAndRefreshTime(timeData) end end end end return true end --获取活动的剩余挑战次数 function Activities_Controller.GetLeftTimesByType(activityType, hasNum, officialPosNum) local purchaseNum = MDL.Purchase.GetPurchaseNumsByType(activityType) --购买次数 local configTimes = DataSheetManager.ActivityData:GetDataByID(activityType).DailyRefreshTimes --免费次数 local profitTimes = MDL.OfficialPosition.GetProfitFreeTimes(activityType) --当前官职的免费次数 local result --通过已使用的官职次数是否大于当前官职的免费次数来计算剩余次数 if officialPosNum >= profitTimes then --已使用的官职次数大于等于当前官职的免费次数,说明降品前官职免费次数用完了,剩余次数 = 总次数(已购买次数 + 免费次数)- (已使用次数 - 官职次数) result = (purchaseNum + configTimes) - (hasNum - officialPosNum) else --已使用的官职次数小于当前官职的免费次数,说明官职免费次数还有剩,可以原逻辑直接计算,剩余次数 = 总次数(已购买次数 + 免费次数 + 官职免费次数) - 已使用次数 result = (purchaseNum + configTimes + profitTimes) - hasNum end if result < 0 then logging.error(LTAG.ERROR, "get leftTimes error", activityType, purchaseNum, configTimes, hasNum, officialPosNum) return 0 end return result end --三个返回值 日期 时间 返回按钮点击后的显示文本 function Activities_Controller.GetDetailsTimeDesc(activityData, isDetailsView) local activityId = activityData.ID if activityId == LuaConst.ActivityType.GuildWar or activityId == LuaConst.ActivityType.FightThrone then local timeValue = MDL.GuildWar.GuildWarIsFirstSign() if timeValue and timeValue > 0 then local guildWarTime = UTL.Time.GetShowTimeBySeconds(timeValue) if activityId == LuaConst.ActivityType.GuildWar then if not isDetailsView then return string.FormatByIdsId(Const_IDS.IDS_GuildWar_SignTime, guildWarTime) end else return Activities_Controller.GetFightThroneFakeDesc(activityData) end end elseif activityId == LuaConst.ActivityType.HeroMatch1v1 then return private.GetHeroMatch1v1DetailsTimeDesc() elseif activityId == LuaConst.ActivityType.HeroMatch3v3 then return private.GetHeroMatch3v3DetailsTimeDesc() elseif activityId == LuaConst.ActivityType.FairSoloTournament then return private.GetFairSoloTournamentTimeDesc() elseif activityId == LuaConst.ActivityType.SyncFourCountryWar then return private.GetSyncFourCountryWarTimeDesc(activityData) elseif activityId == LuaConst.ActivityType.TeamFairChampionship then return private.GetTeamFairChampionshipTimeDesc() end if not private.IsDailyActivity(activityId) and Activities_Controller.IsTodayActivity(activityId) then local date, time = UTL.Time.GetDateDescAndTime(activityData.Time_Table) return UIUtils.GetLocalizedTxt(Const_IDS.IDS_GuildParty_Today), time end return UTL.Time.GetDateDescAndTime(activityData.Time_Table) end --是否是每日活动 function private.IsDailyActivity(activityId) local activityCfg = DataSheetManager.ActivityData:GetDataByID(activityId) for _, timeData in ipairs(activityCfg.Time_Table) do local timeRefreshCfg = DataSheetManager.TimeRefresh:GetDataByID(timeData.StartTime) if timeRefreshCfg.Timer == UTL.Time.TimeType.DAILY then return true end end return false end --活动今日是否开启(包括已开过) function Activities_Controller.IsTodayActivity(activityId) local activityCfg = DataSheetManager.ActivityData:GetDataByID(activityId) if activityId == LuaConst.ActivityType.GuildWar then local timeValue = MDL.GuildWar.GuildWarIsFirstSign() if timeValue and timeValue > 0 then return false end end local serverWeekday = UTL.Time.GetServerWeekday() for _, timeData in ipairs(activityCfg.Time_Table) do local timeRefreshCfg = DataSheetManager.TimeRefresh:GetDataByID(timeData.StartTime) if timeRefreshCfg.Timer == UTL.Time.TimeType.DAILY then return true elseif timeRefreshCfg.Timer == UTL.Time.TimeType.WEEKLY then if serverWeekday == timeRefreshCfg.Day then return true end end end return false end function private.GetFairSoloTournamentTimeDesc() if MDL.FairSoloTournament.IsShowEntry() then local allInfo = MDL.FairSoloTournament.GetModuleInfo() local advanceDay = DataSheetManager.FairMatchTime:GetDataByID(MDL.FairSoloTournament.Enum_BigStage.FairAdvance).Day --这里的开始时间不是活动开始时间,而是比赛开始时间 local startTimestamp = UTL.Time.GetServerZeroTimestampByTimestamp(allInfo.startTm) + advanceDay * UTL.Time.TotalSecondsOneDay + DataSheetManager.TimeRefresh:GetDataByID(allInfo.storeId).HMS local sumDays = 0 for k, v in DataSheetManager.FairMatchTime:GetEnumerator() do if v.ID >= MDL.FairSoloTournament.Enum_BigStage.FairScreening and v.ID < MDL.FairSoloTournament.Enum_BigStage.FairDisplay then sumDays = sumDays + v.Day end end local startDay = startTimestamp local endDay = startTimestamp + (sumDays - 1) * UTL.Time.TotalSecondsOneDay --计算时区是否跨天 local startTimeIdSeconds = DataSheetManager.TimeRefresh:GetDataByID(allInfo.storeId).HMS + UTL.Time.GetDisplayDiffLocalTimeZone() if startTimeIdSeconds < 0 then startDay = os.date(UTL.Time.FormatDateEnum.MD, startDay - UTL.Time.TotalSecondsOneDay) endDay = os.date(UTL.Time.FormatDateEnum.MD, endDay - UTL.Time.TotalSecondsOneDay) elseif startTimeIdSeconds - UTL.Time.TotalSecondsOneDay >= 0 then startDay = os.date(UTL.Time.FormatDateEnum.MD, startDay + UTL.Time.TotalSecondsOneDay) endDay = os.date(UTL.Time.FormatDateEnum.MD, endDay + UTL.Time.TotalSecondsOneDay) else startDay = os.date(UTL.Time.FormatDateEnum.MD, startDay) endDay = os.date(UTL.Time.FormatDateEnum.MD, endDay) end local cfg = DataSheetManager.FairMatchTime:GetDataByID(MDL.FairSoloTournament.Enum_BigStage.FairScreening) local _, refreshTime = UTL.Time.GetDateDescAndTime({ cfg }) local color local curMatchTimeID = MDL.FairSoloTournament.GetCurMatchTimeID() if curMatchTimeID == MDL.FairSoloTournament.Enum_BigStage.FairAdvance then color = ActivityEventStateColor[Activities_Controller.ActivityEventState.Forecast] elseif curMatchTimeID == MDL.FairSoloTournament.Enum_BigStage.FairDisplay then color = ActivityEventStateColor[Activities_Controller.ActivityEventState.Display] else color = ActivityEventStateColor[Activities_Controller.ActivityEventState.Activity] end return UTL.Color.FormatTextByColor(color, startDay .. "-" .. endDay), UTL.Color.FormatTextByColor(color, refreshTime), nil else return UIUtils.GetLocalizedTxt(Const_IDS.IDS_NotOpen) end end function private.GetSyncFourCountryWarTimeDesc(activityData) local stage = MDL.SyncFourCountryWar.GetCurStage() if stage > 1 then local startTime = MDL.SyncFourCountryWar.GetStageTime()[2] local endTime = MDL.SyncFourCountryWar.GetStageTime()[3] - CTL.SyncFourCountryWar.GetEndTimeOffset(activityData) local color = ActivityEventStateColor[stage - 1] local startDay = os.date(UTL.Time.FormatDateEnum.MD, startTime) local endDay = os.date(UTL.Time.FormatDateEnum.MD, endTime) local _, refreshTime = UTL.Time.GetDateDescAndTime(activityData.Time_Table) return UTL.Color.FormatTextByColor(color, startDay .. "-" .. endDay), UTL.Color.FormatTextByColor(color, refreshTime), nil else return UIUtils.GetLocalizedTxt(Const_IDS.IDS_NotOpen) end end function private.GetHeroMatch1v1DetailsTimeDesc() if MDL.HeroMatch1v1.IsShowHeroMatch1v1Entry() then local allInfo = MDL.HeroMatch1v1.GetHeroMatch1v1AllInfo() local advanceDay = DataSheetManager.MatchTime:GetDataByID(MDL.HeroMatch1v1.Enum_BigStage.Advance).Day local startTimestamp = allInfo.startTm + advanceDay * UTL.Time.TotalSecondsOneDay local startDay = os.date(UTL.Time.FormatDateEnum.MD, startTimestamp) local endDay local sumDays = 0 for k, v in DataSheetManager.MatchTime:GetEnumerator() do if v.ID >= MDL.HeroMatch1v1.Enum_BigStage.Screening and v.ID < MDL.HeroMatch1v1.Enum_BigStage.Display then sumDays = sumDays + v.Day end end endDay = os.date(UTL.Time.FormatDateEnum.MD, startTimestamp + (sumDays - 1) * UTL.Time.TotalSecondsOneDay) local cfg = DataSheetManager.MatchTime:GetDataByID(MDL.HeroMatch1v1.Enum_BigStage.Screening) local _, refreshTime = UTL.Time.GetDateDescAndTime({ cfg }) local curStageInfo = MDL.HeroMatch1v1.GetMatchStageInfo(MDL.HeroMatch1v1.GetCurStageID()) local StageCfg = DataSheetManager.MatchStage:GetDataByID(MDL.HeroMatch1v1.GetCurStageID()) local color = nil if StageCfg.ID == MDL.HeroMatch1v1.Stage.Join then color = ActivityEventStateColor[Activities_Controller.ActivityEventState.Forecast] elseif StageCfg.ID == MDL.HeroMatch1v1.Stage.ShowHero then color = ActivityEventStateColor[Activities_Controller.ActivityEventState.Display] else color = ActivityEventStateColor[Activities_Controller.ActivityEventState.Activity] end return UTL.Color.FormatTextByColor(color, startDay .. "-" .. endDay), UTL.Color.FormatTextByColor(color, refreshTime), nil else return UIUtils.GetLocalizedTxt(Const_IDS.IDS_NotOpen) end end function private.GetHeroMatch3v3DetailsTimeDesc() if MDL.HeroMatch3v3.IsShowHeroMatch3v3Entry() then local allInfo = MDL.HeroMatch3v3.GetHeroMatch3v3AllInfo() local advanceDay = DataSheetManager.TeamMatchTime:GetDataByID(MDL.HeroMatch3v3.Enum_BigStage.Advance).Day local startTimestamp = allInfo.startTm + advanceDay * UTL.Time.TotalSecondsOneDay local startDay = os.date(UTL.Time.FormatDateEnum.MD, startTimestamp) local endDay local sumDays = 0 for k, v in DataSheetManager.TeamMatchTime:GetEnumerator() do if v.ID >= MDL.HeroMatch3v3.Enum_BigStage.Screening and v.ID < MDL.HeroMatch3v3.Enum_BigStage.Display then sumDays = sumDays + v.Day end end endDay = os.date(UTL.Time.FormatDateEnum.MD, startTimestamp + (sumDays - 1) * UTL.Time.TotalSecondsOneDay) local cfg = DataSheetManager.TeamMatchTime:GetDataByID(MDL.HeroMatch3v3.Enum_BigStage.Screening) local _, refreshTime = UTL.Time.GetDateDescAndTime({ cfg }) local curStageInfo = MDL.HeroMatch3v3.GetMatchStageInfo(MDL.HeroMatch3v3.GetCurStageID()) local StageCfg = DataSheetManager.MatchStage:GetDataByID(MDL.HeroMatch3v3.GetCurStageID()) local color = nil if StageCfg.ID == MDL.HeroMatch3v3.Stage.Join then color = ActivityEventStateColor[Activities_Controller.ActivityEventState.Forecast] elseif StageCfg.ID == MDL.HeroMatch3v3.Stage.ShowHero then color = ActivityEventStateColor[Activities_Controller.ActivityEventState.Display] else color = ActivityEventStateColor[Activities_Controller.ActivityEventState.Activity] end return UTL.Color.FormatTextByColor(color, startDay .. "-" .. endDay), UTL.Color.FormatTextByColor(color, refreshTime), nil else return UIUtils.GetLocalizedTxt(Const_IDS.IDS_NotOpen) end end function private.GetTeamFairChampionshipTimeDesc() if CTL.TeamFairChampionship.IsShowEntry() then local matchStageStartTime = MDL.TeamFairChampionship.GetBigMatchStartTime(MDL.TeamFairChampionship.Enum_BigStage.Screening) local matchStageEndTime = MDL.TeamFairChampionship.GetBigMatchStartTime(MDL.TeamFairChampionship.Enum_BigStage.Finals) local startDay = os.date(UTL.Time.FormatDateEnum.MD, matchStageStartTime) local endDay = os.date(UTL.Time.FormatDateEnum.MD, matchStageEndTime) local color = ActivityEventStateColor[Activities_Controller.ActivityEventState.Forecast] local cfg = DataSheetManager.TeamMatchTime:GetDataByID(MDL.HeroMatch3v3.Enum_BigStage.Screening) local _, refreshTime = UTL.Time.GetDateDescAndTime({ cfg }) return UTL.Color.FormatTextByColor(color, startDay .. "-" .. endDay), UTL.Color.FormatTextByColor(color, refreshTime), nil else return UIUtils.GetLocalizedTxt(Const_IDS.IDS_NotOpen) end end function Activities_Controller.GetActivityEventState(activityId) local activityData = DataSheetManager.ActivityData:GetDataByID(activityId) local isUnlock, content = MDL.Unlock.IsClientUnlockWithText(activityData.FuctionUnlockID, activityData.SheetShowConditionIDS) if not isUnlock then return Activities_Controller.ActivityEventState.Lock end if activityId == LuaConst.ActivityType.HeroMatch1v1 then if MDL.HeroMatch1v1.IsShowHeroMatch1v1Entry() then local StageCfg = DataSheetManager.MatchStage:GetDataByID(MDL.HeroMatch1v1.GetCurStageID()) local color = nil if StageCfg.ID == MDL.HeroMatch1v1.Stage.Join then return Activities_Controller.ActivityEventState.Forecast elseif StageCfg.ID == MDL.HeroMatch1v1.Stage.ShowHero then return Activities_Controller.ActivityEventState.Display else return Activities_Controller.ActivityEventState.Activity end end elseif activityId == LuaConst.ActivityType.FairSoloTournament then if MDL.FairSoloTournament.IsShowEntry() then local curMatchTimeID = MDL.FairSoloTournament.GetCurMatchTimeID() if curMatchTimeID == MDL.FairSoloTournament.Enum_BigStage.FairAdvance then return Activities_Controller.ActivityEventState.Forecast elseif curMatchTimeID == MDL.FairSoloTournament.Enum_BigStage. FairDisplay then return Activities_Controller.ActivityEventState.Display else return Activities_Controller.ActivityEventState.Activity end end elseif activityId == LuaConst.ActivityType.SyncFourCountryWar then if Activities_Controller.IsOpeningTime(LuaConst.ActivityType.SyncFourCountryWar) then return Activities_Controller.ActivityEventState.Activity elseif MDL.SyncFourCountryWar.IsOpen() then return MDL.SyncFourCountryWar.GetCurStage() - 1 end elseif activityId == LuaConst.ActivityType.HeroMatch3v3 then if MDL.HeroMatch3v3.IsShowHeroMatch3v3Entry() then local StageCfg = DataSheetManager.MatchStage:GetDataByID(MDL.HeroMatch3v3.GetCurStageID()) local color = nil if StageCfg.ID == MDL.HeroMatch3v3.Stage.Join then return Activities_Controller.ActivityEventState.Forecast elseif StageCfg.ID == MDL.HeroMatch1v1.Stage.ShowHero then return Activities_Controller.ActivityEventState.Display else return Activities_Controller.ActivityEventState.Activity end end elseif activityId == LuaConst.ActivityType.SlgGvE then if not Activities_Controller.IsOpen(activityId) then return Activities_Controller.ActivityEventState.Lock end if MDL.SlgGvE.GetSeasonState() == MDL.SlgGvE.SeasonState.Playing then return Activities_Controller.ActivityEventState.Activity elseif MDL.SlgGvE.GetSeasonState() == MDL.SlgGvE.SeasonState.Showing then return Activities_Controller.ActivityEventState.Display else return Activities_Controller.ActivityEventState.None end elseif activityId == LuaConst.ActivityType.TeamFairChampionship then if CTL.TeamFairChampionship.IsShowEntry() then if MDL.TeamFairChampionship.GetCurBigStageID() == MDL.TeamFairChampionship.Enum_BigStage.Advance then return Activities_Controller.ActivityEventState.Forecast elseif MDL.TeamFairChampionship.GetCurBigStageID() == MDL.TeamFairChampionship.Enum_BigStage.Display then return Activities_Controller.ActivityEventState.Display else return Activities_Controller.ActivityEventState.Activity end end elseif activityId == LuaConst.ActivityType.GVGFight then isUnlock = CTL.GVGFight.IsOpenGVGFight() if not isUnlock then return Activities_Controller.ActivityEventState.Lock end local curGVGFightState = MDL.GVGFight.GetCurGVGFightState() if curGVGFightState == MDL.GVGFight.GVGFightStage.Struggle or curGVGFightState == MDL.GVGFight.GVGFightStage.Fierce then return Activities_Controller.ActivityEventState.Activity elseif curGVGFightState == MDL.GVGFight.GVGFightStage.SubGroup then return Activities_Controller.ActivityEventState.Forecast end end return Activities_Controller.ActivityEventState.None end function Activities_Controller.GetGuildActivityCrossStateAndType(activityID) if activityID == LuaConst.ActivityType.GuildBoss or activityID == LuaConst.ActivityType.GuildEscort then return CTL.WarZone.IsWarZoneOpen(), Activities_Controller.CrossType.WarZone elseif activityID == LuaConst.ActivityType.GuildWar then -- 势力战状态未跨服时显示 return CTL.GuildWar.IsCrossServerSettled(), Activities_Controller.CrossType.CrossServer end return false, Activities_Controller.CrossType.None end function Activities_Controller.GetFightThroneFakeDesc(activityData) local date, time = UTL.Time.GetDateDescAndTime(activityData.Time_Table) local fightThrone = activityData.Time_Table local guildWar = DataSheetManager.ActivityData:GetDataByID(LuaConst.ActivityType.GuildWar).Time_Table local timeTable = {} for i, v in ipairs(fightThrone) do table.insert(timeTable, v) end for i, v in ipairs(guildWar) do table.insert(timeTable, v) end table.sort(timeTable, private.SortGuildBossTime) local str = UTL.Time.GetDateDescAndTime(timeTable) local extra = string.FormatByIdsId(Const_IDS.IDS_GuildBoss_FakeOpenDateDesc, str, date) if Activities_Controller.IsTodayActivity(LuaConst.ActivityType.FightThrone) then str = UIUtils.GetLocalizedTxt(Const_IDS.IDS_GuildParty_Today) end return str, time, extra end function Activities_Controller.DealwithCalender(activityId, weekDay) if MDL.Player.HaveServerDay() then if activityId == LuaConst.ActivityType.GuildWar then local offsetTimestamp = (GuildWarOpenDayLimit - MDL.Player.GetPersonalServerDayCount() + 2) * UTL.Time.TotalSecondsOneDay local openTimestamp = UTL.Time.GetServerZeroTimestamp() + offsetTimestamp offsetTimestamp = (weekDay - UTL.Time.GetServerWeekday()) * UTL.Time.TotalSecondsOneDay local weekDayTimestamp = UTL.Time.GetServerZeroTimestamp() + offsetTimestamp if weekDayTimestamp < openTimestamp then return LuaConst.ActivityType.FightThrone end end end return activityId end function Activities_Controller.GetActivityPreviewIdList() local activityIdList = {} if MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.Guild) and MDL.Player.HaveServerDay() and MDL.Player.GetServerDayCount() <= WeeklyCalendarTime then -- 只有开服小于一定天数 才显示晚间预告 local weekDay = UTL.Time.GetServerWeekday() -- 计算固定活动 for _, v in DataSheetManager.ActivationCalendar:GetEnumerator() do if v.ActivaionType == Activities_Controller.CalendarType.Normal then -- 常规活动 local activityId = v[Activities_Controller.WeekFieldName[weekDay]] activityId = Activities_Controller.DealwithCalender(activityId, weekDay) local isSuccess, activityData = DataSheetManager.ActivityData:TryGetDataByID(activityId) if isSuccess and MDL.Unlock.IsServerUnlock(activityData.FuctionUnlockID) then table.insert(activityIdList, activityId) end end end end table.sort(activityIdList, ActivityPreviewSort) return activityIdList end function Activities_Controller.CalculateRedPoint() if #Activities_Controller.GetActivityPreviewIdList() > 0 then if not MDL.Activities.GetActivationCalenderSignUp() then CTL.RedPoint.AddRedPoint(CTL.RedPoint.RedPointKey.ActivityPreview) else CTL.RedPoint.RemoveRedPoint(CTL.RedPoint.RedPointKey.ActivityPreview) end else CTL.RedPoint.RemoveRedPoint(CTL.RedPoint.RedPointKey.ActivityPreview) end end function private.SortGuildBossTime(a, b) local aData = DataSheetManager.TimeRefresh:GetDataByID(a.StartTime) local bData = DataSheetManager.TimeRefresh:GetDataByID(b.StartTime) return aData.Day < bData.Day end -- 获取当日开启的势力活动 ---@return activityID 活动ID function Activities_Controller.GetOpenGuildActivitiesIDByWeek(week) local curDayWeek = week or UTL.Time.GetServerWeekday() if not UTL.Time.IsPassRefreshTime(UTL.Time.TimeType.DAILY) then curDayWeek = curDayWeek - 1 if curDayWeek == 0 then curDayWeek = 7 end end local calendarData = DataSheetManager.ActivationCalendar:GetDataByID(3) local activityId = calendarData[Activities_Controller.WeekFieldName[curDayWeek]] return Activities_Controller.DealwithCalender(activityId, curDayWeek) end --势力活动相关都放到了分包3 但是分包2其实是解锁了的 这里拦一下 function Activities_Controller.CheckGuildActivityStage(activityId) if CTL.HotFix.Get_IfAllDownload() then return false end for i,v in DataSheetManager.GuildActivity:GetEnumerator() do if v.ActivityId == activityId then if not CTL.HotFix.CheckAssetIsReady("GuildActivity") then CTL.Tips.AddTipsMsg(Const_IDS.IDS_DownloadNotFinish) return true end end end return false end return Activities_Controller