引导顺序修改

dev_chengFeng
jiaoyangna 2021-06-03 16:51:36 +08:00
parent 4644de33a5
commit dd0518b9a0
1 changed files with 27 additions and 4 deletions

View File

@ -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
-- 初始化服务器数据