diff --git a/Assets/ManagedResources/~Lua/Modules/Guide/GuideManager.lua b/Assets/ManagedResources/~Lua/Modules/Guide/GuideManager.lua index 47a5538714..26c03c3069 100644 --- a/Assets/ManagedResources/~Lua/Modules/Guide/GuideManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Guide/GuideManager.lua @@ -3,6 +3,7 @@ local this = GuideManager local GuideConfig = ConfigManager.GetConfig(ConfigName.GuideConfig) local GlobalSystemConfig = ConfigManager.GetConfig(ConfigName.GlobalSystemConfig) local openDic = {} +local funcDic = {} local json = require 'cjson' @@ -14,7 +15,7 @@ local _FuncGuideList = {} function this.Initialize() Game.GlobalEvent:AddEvent(GameEvent.FunctionCtrl.OnFunctionOpen, this.OnFunctionOpen) Game.GlobalEvent:AddEvent(GameEvent.Player.OnLevelChange, this.OnLevelChange) - + end function this.OnLevelChange() @@ -34,7 +35,7 @@ function this.OnFunctionOpen(funcId) end LogGreen(tostring(AppConst.isGuide)) local guideId = GlobalSystemConfig[funcId].GuideId - if guideId and guideId ~= 0 then + if guideId and guideId ~= 0 and not funcDic[guideId] then table.insert(_FuncGuideList, guideId) end -- @@ -43,6 +44,8 @@ end -- 初始化引导数据 function this.InitData(guideData) + openDic = {} + funcDic = {} --this.RefreshTriggerListen(1701, 35, { 17,}) --只有勾了新手引导,才会读取引导数据,否则置为-1 if not AppConst.isGuide then @@ -52,11 +55,18 @@ function this.InitData(guideData) end for i = 1, #guideData do local guide = guideData[i] - openDic[guide.type] = guide.id - if guide.id ~= -1 and guide.type ~= GuideType.Check then - local openType = GuideConfig[guide.id].OpenType - local openArgs = GuideConfig[guide.id].OpenArgs - this.RefreshTriggerListen(guide.id, openType, openArgs) + -- 强制引导只保存一条当前引导数据 + if guide.type == GuideType.Force then + openDic[guide.type] = guide.id + if guide.id ~= -1 then + local openType = GuideConfig[guide.id].OpenType + local openArgs = GuideConfig[guide.id].OpenArgs + this.RefreshTriggerListen(guide.id, openType, openArgs) + end + elseif guide.type == GuideType.Check then -- 用于检测引导的网络延时不需要检测 + elseif guide.type == GuideType.Function then -- 功能引导类型 不是按类型对应id的方式不需要检测 + else -- 功能引导会将所有功能引导的id通过type字段保存到后端 + funcDic[guide.type] = guide.id end end @@ -71,7 +81,10 @@ end function GuideManager.CheckFuncGuide() if not GuideManager.IsInMainGuide() and not _IsFuncGuild and #_FuncGuideList > 0 then local guideId = _FuncGuideList[1] - GuideManager.ShowGuide(guideId) + if not funcDic[guideId] then + this.SyncFuncGuideServer(guideId) + GuideManager.ShowGuide(guideId) + end table.remove(_FuncGuideList, 1) end end @@ -178,6 +191,14 @@ function this.CheckServer(func) NetManager.SaveGuideDataRequest(GuideType.Check, 0, func) end +-- 将功能引导同步到服务器 +function this.SyncFuncGuideServer(id) + if GuideConfig[id].Type == GuideType.Function then + funcDic[id] = 1 + NetManager.SaveGuideDataRequest(id, 1) + end +end + --更新触发监听 function this.RefreshTriggerListen(id, openType, openArgs) if openType == 1 then