miduo_client/Assets/ManagedResources/~Lua/Modules/Guide/GuideManager.lua

670 lines
27 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

GuideManager = {}
local this = GuideManager
local GuideConfig = ConfigManager.GetConfig(ConfigName.GuideConfig)
local openDic = {}
local json = require 'cjson'
--local funOpenLevelList = {}--等级解锁
local funOpenQiList = {}--关卡解锁
local funOpenPool = {}
local _CarbonGuildList = {}
local _IsFuncGuild = false
--初始化
function this.Initialize()
for _, v in pairs(FunOpenIndexID) do
local funOpenInfo = ConfigManager.GetConfigData(ConfigName.GlobalSystemConfig, v)
--if funOpenInfo.OpenRules[2] == 1 then
table.insert(funOpenQiList, { Id = v, qi = funOpenInfo.OpenRules[2] })
--else
-- table.insert(funOpenLevelList, { Id = v, level = funOpenInfo.OpenRules[2] })
--end
end
--Game.GlobalEvent:AddEvent(GameEvent.Player.OnLevelChange, this.LevelUpChange)
Game.GlobalEvent:AddEvent(GameEvent.Mission.OnOpenFight, this.QiValueChange)
-- 初始化副本引导数据
_CarbonGuildList = ConfigManager.GetAllConfigsDataByKey(ConfigName.GuideConfig, "OpenType", 36)
end
--function this.LevelUpChange()
-- if AppConst.isGuide and ENABLE_FUNC_GUIDE == 1 then
-- local curLv = PlayerManager.level
-- local index = table.keyvalueindexof(funOpenLevelList, "level", curLv)
-- if index then
-- if table.nums(funOpenPool) > 0 then
-- table.insert(funOpenPool, funOpenLevelList[index].Id)
-- PlayerPrefs.SetString(PlayerManager.uid .. "_Guide", json.encode(funOpenPool))
-- else
-- table.insert(funOpenPool, funOpenLevelList[index].Id)
-- PlayerPrefs.SetString(PlayerManager.uid .. "_Guide", json.encode(funOpenPool))
-- this.GetGuideDataToContinue()
-- end
-- end
-- end
--end
function this.QiValueChange(value)
if AppConst.isGuide and ENABLE_FUNC_GUIDE == 1 then
local index = table.keyvalueindexof(funOpenQiList, "qi", value)
if index then
if table.nums(funOpenPool) > 0 then
table.insert(funOpenPool, funOpenQiList[index].Id)
PlayerPrefs.SetString(PlayerManager.uid .. "_Guide", json.encode(funOpenPool))
else
table.insert(funOpenPool, funOpenQiList[index].Id)
PlayerPrefs.SetString(PlayerManager.uid .. "_Guide", json.encode(funOpenPool))
this.GetGuideDataToContinue()
end
end
end
end
--- 外部调用检测副本引导的方法
function GuideManager.CheckCarbonGuild(carbonType)
-- 判断当前
if CarbonManager.difficulty ~= carbonType then return end
-- 判断是否时第一次进入某类型副本
if MapManager.IsPlayedByMapType(carbonType) then return end
-- 设置已经进入过此类型副本(感觉放在这里不好,但是为了统一处理先放在这里)
MapManager.SetMapTypePlayed(carbonType)
-- 找到符合条件的引导数据
for _, config in ipairs(_CarbonGuildList) do
if config.OpenArgs[1] == carbonType then
this.ShowGuide(config.Id)
end
end
end
function this.InitData(guideData)
--this.RefreshTriggerListen(1701, 35, { 17,})
--只有勾了新手引导,才会读取引导数据,否则置为-1
if not AppConst.isGuide then
openDic[GuideType.Force] = -1
NetManager.SaveGuideDataRequest(GuideType.Force, -1)
return
end
for i = 1, #guideData do
local guide = guideData[i]
Log("guide.type:" .. guide.type)
Log("guide.id:" .. guide.id)
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
end
if ENABLE_FUNC_GUIDE == 1 then
this.InitLocalGuideData()
end
end
function this.GetCurId(type)
return openDic[type]
end
--判定是否在强制引导阶段
function this.IsInMainGuide()
return openDic[1] and openDic[1] ~= -1
end
--判定是否在新手战阶段
function this.IsFirstBattle()
return this.GetCurId(1) and this.GetCurId(1) <= 5 and this.GetCurId(1) > 0
end
--更新下一步引导
function this.NextGuide(nextId)
if GuideConfig[nextId] then
local type = GuideConfig[nextId].Type
if openDic[type] then
openDic[type] = nextId
this.RefreshTriggerListen(nextId, GuideConfig[nextId].OpenType, GuideConfig[nextId].OpenArgs)
end
end
end
--更新触发监听
function this.RefreshTriggerListen(id, openType, openArgs)
if openType == 1 then
--进入新关卡界面
local trigger
trigger = function(panelType, panel)
if panelType == UIName.FightPointPassMainPanel then
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnOpen, trigger)
this.ShowGuide(id)
end
end
Game.GlobalEvent:AddEvent(GameEvent.UI.OnOpen, trigger)
elseif openType == 2 then
--地图走格子触发
local trigger
trigger = function(u, v, callList)
if MapManager.curMapId == 100 and u == openArgs[1] and v == openArgs[2] then
Game.GlobalEvent:RemoveEvent(GameEvent.Guide.MapPosTriggered, trigger)
this.ShowGuide(id)
callList:Push(function()
trigger = function(panelType)
if panelType == UIName.GuidePanel then
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnClose, trigger)
MapPanel.CallListPop()
end
end
Game.GlobalEvent:AddEvent(GameEvent.UI.OnClose, trigger)
end)
end
end
Game.GlobalEvent:AddEvent(GameEvent.Guide.MapPosTriggered, trigger)
elseif openType == 3 then
--监听指定怪物组id的战斗,战斗技能触发,显示对位敌人
local trigger
trigger = function(roleView)
if FightPointPassManager.curOpenFight == openArgs[1] then
Game.GlobalEvent:RemoveEvent(GameEvent.Guide.GuideBattleCDDone, trigger)
BattleManager.PauseBattle()
this.ShowGuide(id, roleView)
GuidePanel.upArrow.transform.position = roleView.GameObject.transform.position
local enemyView = roleView.RootPanel.GetRoleView(BattleLogic.GetAggro(roleView.role))
GuidePanel.upArrow.transform.up = Vector3.Normalize(enemyView.GameObject.transform.position - roleView.GameObject.transform.position)
-- Util.GetTransform(GuidePanel.upArrow, "1").localEulerAngles = -GuidePanel.upArrow.transform.localEulerAngles
GuidePanel.upArrow:SetActive(true)
local canGO1 = roleView.GameObject.transform.parent.parent.gameObject:GetComponent("Canvas")
local canGO2 = enemyView.GameObject.transform.parent.gameObject:GetComponent("Canvas")
local canGO3 = Util.GetGameObject(roleView.RootPanel.EnemyPanel, "live_"..canGO2.name):GetComponent("Canvas")
canGO1.overrideSorting = true
canGO2.overrideSorting = true
canGO3.overrideSorting = true
canGO1.sortingOrder = GuidePanel.sortingOrder
canGO2.sortingOrder = GuidePanel.sortingOrder
canGO3.sortingOrder = GuidePanel.sortingOrder
trigger = function(theId)
if id == theId then
Game.GlobalEvent:RemoveEvent(GameEvent.Guide.NextTrigger, trigger)
BattleManager.ResumeBattle()
GuidePanel.upArrow:SetActive(false)
canGO1.overrideSorting = false
canGO2.overrideSorting = false
canGO3.overrideSorting = false
end
end
Game.GlobalEvent:AddEvent(GameEvent.Guide.NextTrigger, trigger)
end
end
Game.GlobalEvent:AddEvent(GameEvent.Guide.GuideBattleCDDone, trigger)
elseif openType == 4 then
--序章完成进入主界面完成触发
local trigger
trigger = function(panelType, panel)
if panelType == UIName.MainPanel then
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnOpen, trigger)
this.ShowGuide(id)
end
end
Game.GlobalEvent:AddEvent(GameEvent.UI.OnOpen, trigger)
elseif openType == 5 then
--监听指定怪物组id的战斗,有敌方角色死亡时,我方对位角色技能触发
local trigger
trigger = function(roleView)
if FightPointPassManager.curOpenFight == openArgs[1] and roleView.RootPanel.GuideCheckEnemyDead(roleView.role) then
Game.GlobalEvent:RemoveEvent(GameEvent.Guide.GuideBattleCDDone, trigger)
BattleManager.PauseBattle()
this.ShowGuide(id, roleView)
GuidePanel.upArrow.transform.position = roleView.GameObject.transform.position
local enemyView = roleView.RootPanel.GetRoleView(BattleLogic.GetAggro(roleView.role))
GuidePanel.upArrow.transform.up = Vector3.Normalize(enemyView.GameObject.transform.position - roleView.GameObject.transform.position)
-- Util.GetTransform(GuidePanel.upArrow, "1").localEulerAngles = -GuidePanel.upArrow.transform.localEulerAngles
GuidePanel.upArrow:SetActive(true)
local canGO1 = roleView.GameObject.transform.parent.parent.gameObject:GetComponent("Canvas")
local canGO2 = enemyView.GameObject.transform.parent.gameObject:GetComponent("Canvas")
local canGO3 = Util.GetGameObject(roleView.RootPanel.EnemyPanel, "live_"..canGO2.name):GetComponent("Canvas")
canGO1.overrideSorting = true
canGO2.overrideSorting = true
canGO3.overrideSorting = true
canGO1.sortingOrder = GuidePanel.sortingOrder
canGO2.sortingOrder = GuidePanel.sortingOrder
canGO3.sortingOrder = GuidePanel.sortingOrder
trigger = function(theId)
if id == theId then
GuidePanel.upArrow:SetActive(false)
canGO1.overrideSorting = false
canGO2.overrideSorting = false
canGO3.overrideSorting = false
end
if GuideConfig[id].Next == theId then
Game.GlobalEvent:RemoveEvent(GameEvent.Guide.NextTrigger, trigger)
BattleManager.ResumeBattle()
end
end
Game.GlobalEvent:AddEvent(GameEvent.Guide.NextTrigger, trigger)
end
end
Game.GlobalEvent:AddEvent(GameEvent.Guide.GuideBattleCDDone, trigger)
elseif openType == 6 then
--监听指定怪物组id的战斗技能是否触发
local trigger
trigger = function(roleView)
if FightPointPassManager.curOpenFight == openArgs[1] then
Game.GlobalEvent:RemoveEvent(GameEvent.Guide.GuideBattleCDDone, trigger)
BattleManager.PauseBattle() --触发时暂停游戏逻辑
this.ShowGuide(id, roleView)
local canGO1 = roleView.GameObject.transform.parent.parent.gameObject:GetComponent("Canvas")
canGO1.overrideSorting = true
canGO1.sortingOrder = GuidePanel.sortingOrder
trigger = function(panelType)
if panelType == UIName.GuidePanel then
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnClose, trigger)
BattleManager.ResumeBattle()
canGO1.overrideSorting = false
end
end
Game.GlobalEvent:AddEvent(GameEvent.UI.OnClose, trigger)
end
end
Game.GlobalEvent:AddEvent(GameEvent.Guide.GuideBattleCDDone, trigger)
elseif openType == 7 then
--进入上阵选择界面,判定指定关卡通关
local trigger
trigger = function(panelType)
if panelType == UIName.FormationPanel and FightPointPassManager.curOpenFight == openArgs[1] then
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnOpen, trigger)
this.ShowGuide(id)
end
end
Game.GlobalEvent:AddEvent(GameEvent.UI.OnOpen, trigger)
elseif openType == 8 then
--监听指定怪物组id的战斗触发战场分割,显示战斗提示,切换到第二提示
local trigger
trigger = function(stage)
if FightPointPassManager.curOpenFight == openArgs[1] and stage == openArgs[2] then
Game.GlobalEvent:RemoveEvent(GameEvent.Guide.GuideBattleStageChange, trigger)
BattleManager.PauseBattle() --触发时暂停游戏逻辑
this.ShowGuide(id, stage)
trigger = function(theId)
if GuideConfig[id].Next == theId then
Game.GlobalEvent:RemoveEvent(GameEvent.Guide.NextTrigger, trigger)
BattleManager.ResumeBattle()
end
end
Game.GlobalEvent:AddEvent(GameEvent.Guide.NextTrigger, trigger)
end
end
Game.GlobalEvent:AddEvent(GameEvent.Guide.GuideBattleStageChange, trigger)
elseif openType == 9 then
--进入新关卡界面,判定指定关卡通关
local trigger
trigger = function(panelType, panel)
if panelType == UIName.FightPointPassMainPanel and FightPointPassManager.curOpenFight == openArgs[1] then
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnOpen, trigger)
this.ShowGuide(id)
end
end
Game.GlobalEvent:AddEvent(GameEvent.UI.OnOpen, trigger)
elseif openType == 10 then
--进入单抽界面
local trigger
trigger = function(panelType, panel)
if panelType == UIName.SingleRecruitPanel then
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnOpen, trigger)
this.ShowGuide(id)
end
end
Game.GlobalEvent:AddEvent(GameEvent.UI.OnOpen, trigger)
elseif openType == 11 then
--进入上阵选择界面
local trigger
trigger = function(panelType)
if panelType == UIName.FormationPanel then
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnOpen, trigger)
this.ShowGuide(id)
end
end
Game.GlobalEvent:AddEvent(GameEvent.UI.OnOpen, trigger)
elseif openType == 12 then
--进入副本引导界面
local trigger
trigger = function(panelType)
if panelType == UIName.CarbonMissionPopup then
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnOpen, trigger)
this.ShowGuide(id)
end
end
Game.GlobalEvent:AddEvent(GameEvent.UI.OnOpen, trigger)
elseif openType == 13 then
--战斗异妖能量条满
local trigger
trigger = function(teamSkillButton)
if this.IsFirstBattle() then
Game.GlobalEvent:RemoveEvent(GameEvent.Guide.GuideBattleTeamCDDone, trigger)
BattleManager.PauseBattle()
this.ShowGuide(id, teamSkillButton)
end
end
Game.GlobalEvent:AddEvent(GameEvent.Guide.GuideBattleTeamCDDone, trigger)
elseif openType == 14 then
--地图点option完成触发
local trigger
trigger = function(type, optionId)
Log("type:" .. type)
Log("optionId:" .. optionId)
Log("openArgs[1]:" .. openArgs[1])
if type == 1 and optionId == openArgs[1] then
Log("done!!!!!")
Game.GlobalEvent:RemoveEvent(GameEvent.Map.ProgressChange, trigger)
this.ShowGuide(id)
end
end
Game.GlobalEvent:AddEvent(GameEvent.Map.ProgressChange, trigger)
elseif openType == 15 then
--战斗胜利结算
local trigger
trigger = function(panelType)
if panelType == UIName.BattleEndPanel then
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnOpen, trigger)
this.ShowGuide(id)
end
end
Game.GlobalEvent:AddEvent(GameEvent.UI.OnOpen, trigger)
elseif openType == 16 then
--序章战开始
local trigger
trigger = function(panelType)
if MapManager.curMapId == 100 then
Game.GlobalEvent:RemoveEvent(GameEvent.Guide.GuideBattleStart, trigger)
BattleManager.PauseBattle()
this.ShowGuide(id)
trigger = function(panelType)
if panelType == UIName.GuidePanel then
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnClose, trigger)
BattleManager.ResumeBattle()
end
end
Game.GlobalEvent:AddEvent(GameEvent.UI.OnClose, trigger)
end
end
Game.GlobalEvent:AddEvent(GameEvent.Guide.GuideBattleStart, trigger)
elseif openType == 17 then
--序章探索完成
local trigger
trigger = function(panelType)
if MapManager.curMapId == 100 and panelType == UIName.MissionRewardPanel then
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnOpen, trigger)
this.ShowGuide(id)
end
end
Game.GlobalEvent:AddEvent(GameEvent.UI.OnOpen, trigger)
elseif openType == 18 then
--恭喜获得界面
local trigger
trigger = function(panelType)
if panelType == UIName.RewardItemPopup then
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnOpen, trigger)
this.ShowGuide(id)
end
end
Game.GlobalEvent:AddEvent(GameEvent.UI.OnOpen, trigger)
elseif openType == 19 then
--监听角色升级界面
local trigger
trigger = function(panelType)
if panelType == UIName.RoleUpLvBreakSuccessPanel then
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnClose, trigger)
this.ShowGuide(id)
end
end
Game.GlobalEvent:AddEvent(GameEvent.UI.OnClose, trigger)
elseif openType == 20 then
--监听地图任务界面
local trigger
trigger = function(panelType)
if panelType == UIName.CarbonMissionPopup then
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnOpen, trigger)
this.ShowGuide(id)
end
end
Game.GlobalEvent:AddEvent(GameEvent.UI.OnOpen, trigger)
elseif openType == 21 then
--进入地图
local trigger
trigger = function()
if MapManager.curMapId == openArgs[1] then
Game.GlobalEvent:RemoveEvent(GameEvent.Guide.MapInit, trigger)
this.ShowGuide(id)
end
end
Game.GlobalEvent:AddEvent(GameEvent.Guide.MapInit, trigger)
elseif openType == 22 then
--监听副本结算界面
local trigger
trigger = function(panelType)
if panelType == UIName.MapStatsPanel then
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnOpen, trigger)
this.ShowGuide(id)
end
end
Game.GlobalEvent:AddEvent(GameEvent.UI.OnOpen, trigger)
elseif openType == 23 then
--监听副本界面
local trigger
trigger = function(panelType)
if panelType == UIName.CarbonTypePanel then
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnOpen, trigger)
this.ShowGuide(id)
end
end
Game.GlobalEvent:AddEvent(GameEvent.UI.OnOpen, trigger)
elseif openType == 24 then
--恭喜获得界面弹出后
local trigger
trigger = function(panelType)
if panelType == UIName.RewardItemPopup then
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnClose, trigger)
this.ShowGuide(id)
end
end
Game.GlobalEvent:AddEvent(GameEvent.UI.OnClose, trigger)
elseif openType == 25 then
--升阶完成后
local trigger
trigger = function(panelType)
if panelType == UIName.RoleUpStarSuccessPanel then
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnClose, trigger)
this.ShowGuide(id)
end
end
Game.GlobalEvent:AddEvent(GameEvent.UI.OnClose, trigger)
--elseif openType == 26 then
-- --功能开启后
-- local trigger
-- trigger = function(panelType)
-- if panelType == UIName.MainPanel and ActTimeCtrlManager.IsQualifiled(openArgs[1]) then
-- Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnOpen, trigger)
-- this.ShowGuide(id)
-- end
-- end
-- Game.GlobalEvent:AddEvent(GameEvent.UI.OnOpen, trigger)
elseif openType == 27 then
--天赋收集完成
local trigger
trigger = function(panelType)
if panelType == UIName.MsgPanel then
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnOpen, trigger)
this.ShowGuide(id)
end
end
Game.GlobalEvent:AddEvent(GameEvent.UI.OnOpen, trigger)
elseif openType == 28 then
--首次进入试炼副本
local trigger
trigger = function()
if MapTrialManager.firstEnter then
Game.GlobalEvent:RemoveEvent(GameEvent.Guide.MapInit, trigger)
this.ShowGuide(id)
end
end
Game.GlobalEvent:AddEvent(GameEvent.Guide.MapInit, trigger)
elseif openType == 29 then
--工坊升级界面关闭
local trigger
trigger = function(panelType)
if panelType == UIName.WorkShopLevelUpNotifyPanel then
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnClose, trigger)
this.ShowGuide(id)
end
end
Game.GlobalEvent:AddEvent(GameEvent.UI.OnClose, trigger)
elseif openType == 30 then
--击败秘境的看守
local trigger
trigger = function(areaId)
if areaId then
Game.GlobalEvent:RemoveEvent(GameEvent.Adventure.MonsterSayInfo, trigger)
this.ShowGuide(id)
end
end
Game.GlobalEvent:AddEvent(GameEvent.Adventure.MonsterSayInfo, trigger)
elseif openType == 31 then
local trigger
trigger = function(panelType)
if panelType == UIName.ArenaMainPanel then
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnOpen, trigger)
this.ShowGuide(id)
end
end
Game.GlobalEvent:AddEvent(GameEvent.UI.OnOpen, trigger)
elseif openType == 32 then
local trigger
trigger = function(panelType)
if panelType == UIName.FightEndLvUpPanel then
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnClose, trigger)
this.ShowGuide(id)
end
end
Game.GlobalEvent:AddEvent(GameEvent.UI.OnClose, trigger)
elseif openType == 33 then
--local trigger
--trigger = function(panelType)
-- if panelType == UIName.TalentUpGradSuccessPanel then
-- Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnOpen, trigger)
-- this.ShowGuide(id)
-- end
--end
--Game.GlobalEvent:AddEvent(GameEvent.UI.OnOpen, trigger)
elseif openType == 34 then
--local trigger
--trigger = function(panelType)
-- if panelType == UIName.TalentUpGradSuccessPanel then
-- Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnClose, trigger)
-- this.ShowGuide(id)
-- end
--end
--Game.GlobalEvent:AddEvent(GameEvent.UI.OnClose, trigger)
elseif openType == 35 then
local trigger
trigger = function(panelType)
--close => BattlePanel
if panelType == UIName.FightPointPassMainPanel then
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnOpen, trigger)
this.ShowGuide(id)
end
end
Game.GlobalEvent:AddEvent(GameEvent.UI.OnOpen, trigger)
elseif openType == 36 then -- 第一次进入副本触发
local trigger
trigger = function(panelType)
--close => BattlePanel
if panelType == UIName.MapPanel then
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnOpen, trigger)
this.ShowGuide(id)
end
end
Game.GlobalEvent:AddEvent(GameEvent.UI.OnOpen, trigger)
end
end
function this.ShowGuide(id, ...)
--if GuideConfig[id].Type == GuideType.Function and id == FunOpenIndexID.SecretTerritory * 100 + 1 and AdventureManager.IsEnterAdventure() then
-- table.remove(funOpenPool, 1)
-- PlayerPrefs.SetString(PlayerManager.uid .. "_Guide", json.encode(funOpenPool))
-- --if table.nums(funOpenPool)>0 then
-- -- id = tonumber(funOpenPool[1]) * 100 + 1
-- --else
-- -- return
-- --end
-- return
--end
UIManager.OpenPanel(UIName.GuidePanel, id, ...)
DataCenterManager.CommitClickStatus("新手引导", tostring(id))
if GuideConfig[id].Next ~= 0 then
this.NextGuide(GuideConfig[id].Next)
if GuideConfig[id].Type == GuideType.Function then
local index = table.indexof(funOpenPool, math.floor(GuideConfig[id].Next / 100))
if index then
_IsFuncGuild = true -- 开始功能引导
this.GetGuideDataToContinue(true)
end
end
else
if GuideConfig[id].Type == GuideType.Function then
_IsFuncGuild = false
this.GetGuideDataToContinue()
end
end
end
function this.SyncServer(id) --同步到后端
Game.GlobalEvent:DispatchEvent(GameEvent.Guide.NextTrigger, id)
if GuideConfig[id].ServerNext ~= 0 then
if GuideConfig[id].Type == GuideType.Force then
openDic[GuideType.Force] = GuideConfig[id].ServerNext
NetManager.SaveGuideDataRequest(GuideConfig[id].Type, GuideConfig[id].ServerNext)
end
end
end
function this.InitLocalGuideData()
local str = PlayerPrefs.GetString(PlayerManager.uid .. "_Guide", "")
if str ~= "" then
local result = json.decode(str)
for _, v in ipairs(result) do
table.insert(funOpenPool, v)
end
this.GetGuideDataToContinue()
end
end
--本地拿取存储数据做引导
function this.GetGuideDataToContinue(flag)
if table.nums(funOpenPool) > 0 then
if flag then
table.remove(funOpenPool, 1)
PlayerPrefs.SetString(PlayerManager.uid .. "_Guide", json.encode(funOpenPool))
else
openDic[2] = tonumber(funOpenPool[1]) * 100 + 1
this.RefreshTriggerListen(openDic[2], 35, { tonumber(funOpenPool[1]), })
end
end
end
function this.IsFunctionGuideExist()
return table.nums(funOpenPool) > 0 or _IsFuncGuild
end
return this