local Storm_Controller = {} local EventSystem = require('Event/EventSystem') local private = {} local START_TIME_ID = DataSheetManager.ActivityData:GetDataByID(LuaConst.ActivityType.Storm).Time_Table[1].StartTime function Storm_Controller.OnStartup() EventSystem.Regist(EventID.FunctionUnlockUpdate, private.RefreshByFunctionUnlock) EventSystem.Regist(EventID.AcquireSystemRedAfterUnlock, Storm_Controller.RefreshRed) EventSystem.Regist(EventID.UI_Storm_FreeLineupClose, private.OnQuitFormationPanel) EventSystem.Regist(EventID.UI_Storm_RefreshMain, Storm_Controller.RefreshRed) private.notificationTimer = nil end function Storm_Controller.RefreshNotification() if private.notificationTimer then TimerUtil.Remove(private.notificationTimer) private.notificationTimer = nil end local nextRefreshTime if MDL.Storm.IsOpen() then nextRefreshTime = UTL.Time.TotalSecondsOneDay - UTL.Time.GetServerSecondsIntervalFromZero() + 1 else nextRefreshTime = UTL.Time.GetServerIntervalTimeByTimeId(START_TIME_ID) end if MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.Storm) then private.notificationTimer = TimerUtil.Interval(private.TriggerNotification, nextRefreshTime + 1, 1) end end function private.TriggerNotification() Storm_Controller.RefreshRed() Storm_Controller.RefreshNotification() -- 活动开始或者结束新的一天的时候更新一下暴风主信息 MDL.Storm.GetStormMainPanelInfoReq() end function Storm_Controller.PopNotInTimeTip() local activityData = DataSheetManager.ActivityData:GetDataByID(LuaConst.ActivityType.Storm) local date, time, extra = CTL.Activities.GetDetailsTimeDesc(activityData, true) CTL.Tips.AddTipsMsg(string.FormatByIdsId(Const_IDS["IDS_Storm_NotInTime"], time)) end function Storm_Controller.OpenNoteView() local activityData = DataSheetManager.ActivityData:GetDataByID(LuaConst.ActivityType.Storm) local date, time, extra = CTL.Activities.GetDetailsTimeDesc(activityData, true) UIManager.OpenView(Const_UI_Lua.UIEnum.UICommonNoteView, { id = LuaConst.NoteID.Storm, params = { time } }) end function Storm_Controller.ShowStormBattleSummary(msg) CTL.HomeMain.CloseOpenView() UIManager.OpenView(Const_UI_Lua.UIEnum.UIStormResult, { Time = msg.passTime, score = msg.stormResult.Score, maxScore = msg.stormResult.maxScore, } ) end function private.RefreshByFunctionUnlock(funcId, isUnlock) if funcId == LuaConst.ActivityType.Storm then if isUnlock == false then Storm_Controller.CloseAllRelatedUI() end -- GMS开关变重新检测活动计时器 Storm_Controller.RefreshNotification() end end function Storm_Controller.CloseAllRelatedUI() UIManager.CloseView(Const_UI_Lua.UIEnum.UIStormChooseSkill) UIManager.CloseView(Const_UI_Lua.UIEnum.UIStormEntrance) UIManager.CloseView(Const_UI_Lua.UIEnum.UIStormMain) UIManager.CloseView(Const_UI_Lua.UIEnum.UIStormRank) UIManager.CloseView(Const_UI_Lua.UIEnum.UIStormResult) UIManager.CloseView(Const_UI_Lua.UIEnum.UIStormRewardAchievement) UIManager.CloseView(Const_UI_Lua.UIEnum.UIStormRewardMain) UIManager.CloseView(Const_UI_Lua.UIEnum.UIStormRewardRank) private.OnQuitFormationPanel() end -- 退出布阵界面 function private.OnQuitFormationPanel() UIManager.CloseView(Const_UI_Lua.UIEnum.UIStormFreeLineupCustomDetailPanel) UIManager.CloseView(Const_UI_Lua.UIEnum.UIStormSelectOfficer) end -- 返回带有战力压制的战力显示值 -- 暴风关卡战力压制显示和实际关卡战力不同,所有传入战力需要 *3 function Storm_Controller.GetFormattedSubjugateGS(subjugateDataID, compareGS, showGS) return CTL.LevelSelect.GetSubjugateFreeLineGsText(subjugateDataID, compareGS * 3, showGS) end function Storm_Controller.RefreshRed() private.RefreshEntryRed() EventSystem.Dispatch(EventID.UI_Activity_Refresh_Single_RedPoint, LuaConst.ActivityType.Storm, CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.Storm)) end --- 入口红点、布阵红点刷新 function private.RefreshEntryRed() local time = MDL.RedPoint.GetRedPointTimeByType(MDL.RedPoint.RedPointType.Storm) if CTL.Activities.IsOpeningTime(LuaConst.ActivityType.Storm) then if time then if time > 0 and not UTL.Time.IsTimestampSameDay(time) then CTL.RedPoint.AddRedPoint(CTL.RedPoint.RedPointKey.Storm_Entry) else CTL.RedPoint.RemoveRedPoint(CTL.RedPoint.RedPointKey.Storm_Entry) end else CTL.RedPoint.AddRedPoint(CTL.RedPoint.RedPointKey.Storm_Entry) end else CTL.RedPoint.RemoveRedPoint(CTL.RedPoint.RedPointKey.Storm_Entry) end end return Storm_Controller