diff --git a/Assets/ManagedResources/~Lua/Modules/GlobalActTimeCtrl/ActTimeCtrlManager.lua b/Assets/ManagedResources/~Lua/Modules/GlobalActTimeCtrl/ActTimeCtrlManager.lua index bd48c75073..79647e8d56 100644 --- a/Assets/ManagedResources/~Lua/Modules/GlobalActTimeCtrl/ActTimeCtrlManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/GlobalActTimeCtrl/ActTimeCtrlManager.lua @@ -8,6 +8,7 @@ local AllActSetConfig = ConfigManager.GetConfig(ConfigName.GlobalSystemConfig) local censorshipConfig = ConfigManager.GetConfig(ConfigName.MainLevelConfig) local gameSetConfig = ConfigManager.GetConfig(ConfigName.GameSetting) local vipConfig = ConfigManager.GetConfig(ConfigName.VipLevelConfig) +local GuideConfig = ConfigManager.GetConfig(ConfigName.GuideConfig) -- 整数的服务器时间 this.serTime = 0 @@ -40,30 +41,52 @@ function this.Initialize() --Log("关卡通关,id = "..fightId) this.CheckFuncActiveByType(1, fightId) end) - end -- 当功能解锁条件变化时检测 function this.CheckFuncActiveByType(activeType, params) + local ids = {} for id, funcData in pairs(this.serData) do local funcInfo = ConfigManager.GetConfigData(ConfigName.GlobalSystemConfig, id) if funcInfo.OpenRules[1] == activeType then local typeId = funcInfo.IsIDdSame local isActive = this.SingleFuncState(typeId) --Log("检测功能是否已解锁,id = "..id..", isActive = "..tostring(isActive)) - if not funcData.isActive and isActive then + local aGuideId = AllActSetConfig[typeId].GuideId + if AllActSetConfig[aGuideId] and AllActSetConfig[aGuideId].IsOpen > 0 then + if ActivityGiftManager.IsActivityTypeOpen(ActivityGiftManager.GetActivityTypeFromId(GuideConfig[aGuideId].IsOpen)) then + table.insert(ids,typeId) + end + elseif not funcData.isActive and isActive then --Log(">>>>>>功能解锁:id = "..funcInfo.Id..", name = "..funcInfo.Name) -- 未解锁,但是判断已解锁 - Game.GlobalEvent:DispatchEvent(GameEvent.FunctionCtrl.OnFunctionOpen, typeId) + --Game.GlobalEvent:DispatchEvent(GameEvent.FunctionCtrl.OnFunctionOpen, typeId) + table.insert(ids,typeId) elseif funcData.isActive and not isActive then --Log(">>>>>>功能关闭:id = "..funcInfo.Id..", name = "..funcInfo.Name) -- 已解锁但是判断未解锁 - Game.GlobalEvent:DispatchEvent(GameEvent.FunctionCtrl.OnFunctionClose, typeId) + --Game.GlobalEvent:DispatchEvent(GameEvent.FunctionCtrl.OnFunctionClose, typeId) + table.insert(ids,typeId) end -- 保存状态 funcData.isActive = isActive end end + table.sort(ids,function(a,b) + local aGuideId = AllActSetConfig[a].GuideId + local bGuideId = AllActSetConfig[b].GuideId + if (GuideConfig[aGuideId] and GuideConfig[bGuideId]) then + return GuideConfig[aGuideId].Sort < GuideConfig[bGuideId].Sort + elseif (not GuideConfig[aGuideId] and not GuideConfig[aGuideId]) then + return a < b + else + return GuideConfig[aGuideId] and not GuideConfig[bGuideId] + end + end) + + for i = 1 ,#ids do + Game.GlobalEvent:DispatchEvent(GameEvent.FunctionCtrl.OnFunctionOpen, ids[i]) + end end -- 初始化服务器数据