miduo_client/Assets/ManagedResources/~Lua/Modules/Battle/View/GuideBattleLogic.lua

67 lines
1.9 KiB
Lua
Raw Normal View History

2021-04-01 18:36:34 +08:00
local GuideBattleLogic = {}
2021-03-19 18:14:52 +08:00
-- 引导节点配置
local _GuideConfig = {
-- 轮数 = {阵营 = { 释放位置 = 对话id}}} 新手引导假战斗
[BattleGuideType.FakeBattle] = {
[1] = {
[0] = {
2021-04-12 18:11:37 +08:00
[2] = 300008,
[3] = 300010,
2021-03-19 18:14:52 +08:00
}
},
2021-04-12 18:11:37 +08:00
-- [2] = {
-- [0] = {
-- [1] = 300012,
-- [2] = 300014,
-- [3] = 300016,
-- }
-- }
2021-03-19 18:14:52 +08:00
},
[BattleGuideType.QuickFight] = {
-- 轮数 = {阵营 = { 释放位置 = 引导id}}}
[1] = {
[0] = {
[1] = 200000,
}
},
}
}
function GuideBattleLogic:Init(guideType)
self.guideType = guideType
end
function GuideBattleLogic:RoleTurnChange(curRound, role)
local curCamp = role.camp
local curPos = role.position
local _config = _GuideConfig[self.guideType]
if not _config
or not _config[curRound]
or not _config[curRound][curCamp]
or not _config[curRound][curCamp][curPos]
then
return
end
-- 对话形式的引导
if self.guideType == BattleGuideType.FakeBattle then
BattleManager.SetGuidePause(true)
local storyId = _config[curRound][curCamp][curPos]
StoryManager.EventTrigger(storyId, function()
BattleManager.SetGuidePause(false)
end)
-- 引导形式的引导
elseif self.guideType == BattleGuideType.QuickFight then
BattleManager.SetGuidePause(true)
local guideId = _config[curRound][curCamp][curPos]
GuideManager.ShowGuide(guideId)
local function _onGuideDone()
Game.GlobalEvent:RemoveEvent(GameEvent.Guide.BattleGuideDone, _onGuideDone)
BattleManager.SetGuidePause(false)
end
Game.GlobalEvent:AddEvent(GameEvent.Guide.BattleGuideDone, _onGuideDone)
end
end
return GuideBattleLogic