【新假战斗】

dev_chengFeng
gaoxin 2021-11-10 09:48:42 +08:00
parent 52475ee00b
commit c9e2ddcaf8
3 changed files with 48 additions and 56 deletions

View File

@ -233,6 +233,7 @@ ConfigName = {
RidingSwardResult = "RidingSwardResult", RidingSwardResult = "RidingSwardResult",
RidingSwardSence = "RidingSwardSence", RidingSwardSence = "RidingSwardSence",
WeekcardConfig = "WeekcardConfig", WeekcardConfig = "WeekcardConfig",
GuideBattleConfig = "GuideBattleConfig",
} }
require "Framework/GameDataBase" require "Framework/GameDataBase"

View File

@ -1,66 +1,39 @@
local GuideBattleLogic = {} local GuideBattleLogic = {}
-- 引导节点配置
local _GuideConfig = {
-- 轮数 = {阵营 = { 释放位置 = 对话id}}} 新手引导假战斗
[BattleGuideType.FakeBattle] = {
[-1] = {
-- [0] = {}, -- 战斗开始时
[1] = 300012, -- 战斗结束时
},
[1] = {
[0] = {
[2] = 300008,
[3] = 300010,
},
[1] = {
[1] = 300001,
},
},
-- [2] = {
-- [0] = {
-- [1] = 300001,
-- [2] = 300014,
-- [3] = 300016,
-- }
-- }
},
[BattleGuideType.QuickFight] = {
-- 轮数 = {阵营 = { 释放位置 = 引导id}}}
[1] = {
[0] = {
[1] = 200000,
}
},
}
}
function GuideBattleLogic:Init(guideType) function GuideBattleLogic:Init(guideType)
self.guideType = guideType self.guideType = guideType
self.configList = ConfigManager.GetAllConfigsDataByKey(ConfigName.GuideBattleConfig, "GuideGroup", self.guideType)
end end
function GuideBattleLogic:RoleTurnChange(curRound, role) function GuideBattleLogic:RoleTurnChange(curRound, role)
local curCamp = role.camp local curCamp = role.camp
local curPos = role.position local curPos = role.position
local _config = _GuideConfig[self.guideType] -- 没有就不引导了
if not _config if not self.configList or #self.configList <= 0 then
or not _config[curRound] return
or not _config[curRound][curCamp] end
or not _config[curRound][curCamp][curPos] local _config = nil
then for _, con in ipairs(self.configList) do
if con.Round == curRound and con.Camp == curCamp and con.Turn == curPos then
_config = con
break
end
end
if not _config then
return return
end end
-- 对话形式的引导 -- 对话形式的引导
if self.guideType == BattleGuideType.FakeBattle then if _config.TriggerType == 1 then
BattleManager.SetGuidePause(true) BattleManager.SetGuidePause(true)
local storyId = _config[curRound][curCamp][curPos] local storyId = _config.TriggerId
StoryManager.EventTrigger(storyId, function() StoryManager.EventTrigger(storyId, function()
BattleManager.SetGuidePause(false) BattleManager.SetGuidePause(false)
end) end)
-- 引导形式的引导 -- 引导形式的引导
elseif self.guideType == BattleGuideType.QuickFight then elseif _config.TriggerType == 2 then
BattleManager.SetGuidePause(true) BattleManager.SetGuidePause(true)
local guideId = _config[curRound][curCamp][curPos] local guideId = _config.TriggerId
GuideManager.ShowGuide(guideId) GuideManager.ShowGuide(guideId)
local function _onGuideDone() local function _onGuideDone()
Game.GlobalEvent:RemoveEvent(GameEvent.Guide.BattleGuideDone, _onGuideDone) Game.GlobalEvent:RemoveEvent(GameEvent.Guide.BattleGuideDone, _onGuideDone)
@ -71,16 +44,30 @@ function GuideBattleLogic:RoleTurnChange(curRound, role)
end end
function GuideBattleLogic:OnBattleEnd(func) function GuideBattleLogic:OnBattleEnd(func)
local _config = _GuideConfig[self.guideType] -- 没有就不引导了
if not _config if not self.configList or #self.configList <= 0 then
or not _config[-1] if func then
or not _config[-1][1] then func()
end
return
end
local _config = nil
for _, con in ipairs(self.configList) do
if con.Round == -1 then
_config = con
break
end
end
if not _config then
if func then
func()
end
return return
end end
-- 对话形式的引导 -- 对话形式的引导
if self.guideType == BattleGuideType.FakeBattle then if _config.TriggerType == 1 then
BattleManager.SetGuidePause(true) BattleManager.SetGuidePause(true)
local storyId = _config[-1][1] local storyId = _config.TriggerId
StoryManager.EventTrigger(storyId, function() StoryManager.EventTrigger(storyId, function()
BattleManager.SetGuidePause(false) BattleManager.SetGuidePause(false)
if func then if func then

View File

@ -51,7 +51,7 @@ function this.EventTrigger(eventId, callBack)
elseif showType == 10 then -- 起名字界面 elseif showType == 10 then -- 起名字界面
UIManager.OpenPanel(UIName.CreateNamePopup, showType, eventId, showValues, options) UIManager.OpenPanel(UIName.CreateNamePopup, showType, eventId, showValues, options)
elseif showType == 14 then -- 引导战斗 elseif showType == 14 then -- 引导战斗
local fdata, fseed = BattleManager.GetFakeBattleData(1017) local fdata, fseed = BattleManager.GetFakeBattleData(options[1])
local testFightData = { local testFightData = {
fightData = fdata, fightData = fdata,
fightSeed = fseed, fightSeed = fseed,
@ -59,14 +59,14 @@ function this.EventTrigger(eventId, callBack)
maxRound = 20 maxRound = 20
} }
local panel = UIManager.OpenPanel(UIName.GuideBattlePanel, testFightData, function() local panel = UIManager.OpenPanel(UIName.GuideBattlePanel, testFightData, function()
StoryManager.EventTrigger(100004) StoryManager.StoryJumpType(options[3])
end, BattleGuideType.FakeBattle) end, options[2])
elseif showType == 15 then -- 播放转场特效 elseif showType == 15 then -- 播放转场特效
SwitchPanel.PlayTransEffect(function() SwitchPanel.PlayTransEffect(function()
this.StoryJumpType(options[1]) this.StoryJumpType(options[1], nil, callBack)
end) end)
end end
else else
@ -97,7 +97,7 @@ function this.DialogueTrigger(eventId, callback)
end end
-- 剧情跳转 -- 剧情跳转
function this.StoryJumpType(optionId, panel,callBack) function this.StoryJumpType(optionId, panel, callBack)
local jumpType = chapterOptionData[optionId].JumpType local jumpType = chapterOptionData[optionId].JumpType
if jumpType then if jumpType then
if jumpType == 4 then -- 关闭所有界面,结束对话 if jumpType == 4 then -- 关闭所有界面,结束对话
@ -107,6 +107,10 @@ function this.StoryJumpType(optionId, panel,callBack)
if UIManager.IsOpen(UIName.StoryDialoguePanel) then if UIManager.IsOpen(UIName.StoryDialoguePanel) then
UIManager.ClosePanel(UIName.StoryDialoguePanel) UIManager.ClosePanel(UIName.StoryDialoguePanel)
end end
--
if callBack then
callBack()
end
elseif jumpType == 5 then elseif jumpType == 5 then
-- 打开主城 -- 打开主城
PatFaceManager.isLogin = true PatFaceManager.isLogin = true