From c9e2ddcaf835dc33b331b8f1fe45da1c82e21955 Mon Sep 17 00:00:00 2001 From: gaoxin Date: Wed, 10 Nov 2021 09:48:42 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=96=B0=E5=81=87=E6=88=98=E6=96=97?= =?UTF-8?q?=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ManagedResources/~Lua/Data/ConfigData.lua | 1 + .../Modules/Battle/View/GuideBattleLogic.lua | 89 ++++++++----------- .../~Lua/Modules/Story/StoryManager.lua | 14 +-- 3 files changed, 48 insertions(+), 56 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Data/ConfigData.lua b/Assets/ManagedResources/~Lua/Data/ConfigData.lua index 8ef16cac5a..8158295a4c 100644 --- a/Assets/ManagedResources/~Lua/Data/ConfigData.lua +++ b/Assets/ManagedResources/~Lua/Data/ConfigData.lua @@ -233,6 +233,7 @@ ConfigName = { RidingSwardResult = "RidingSwardResult", RidingSwardSence = "RidingSwardSence", WeekcardConfig = "WeekcardConfig", + GuideBattleConfig = "GuideBattleConfig", } require "Framework/GameDataBase" diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/View/GuideBattleLogic.lua b/Assets/ManagedResources/~Lua/Modules/Battle/View/GuideBattleLogic.lua index d89d07b39f..4db57426b8 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/View/GuideBattleLogic.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/View/GuideBattleLogic.lua @@ -1,66 +1,39 @@ 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) self.guideType = guideType + self.configList = ConfigManager.GetAllConfigsDataByKey(ConfigName.GuideBattleConfig, "GuideGroup", self.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 + -- 没有就不引导了 + if not self.configList or #self.configList <= 0 then + return + end + local _config = nil + 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 end -- 对话形式的引导 - if self.guideType == BattleGuideType.FakeBattle then + if _config.TriggerType == 1 then BattleManager.SetGuidePause(true) - local storyId = _config[curRound][curCamp][curPos] + local storyId = _config.TriggerId StoryManager.EventTrigger(storyId, function() BattleManager.SetGuidePause(false) end) -- 引导形式的引导 - elseif self.guideType == BattleGuideType.QuickFight then + elseif _config.TriggerType == 2 then BattleManager.SetGuidePause(true) - local guideId = _config[curRound][curCamp][curPos] + local guideId = _config.TriggerId GuideManager.ShowGuide(guideId) local function _onGuideDone() Game.GlobalEvent:RemoveEvent(GameEvent.Guide.BattleGuideDone, _onGuideDone) @@ -71,16 +44,30 @@ function GuideBattleLogic:RoleTurnChange(curRound, role) end function GuideBattleLogic:OnBattleEnd(func) - local _config = _GuideConfig[self.guideType] - if not _config - or not _config[-1] - or not _config[-1][1] then - return + -- 没有就不引导了 + if not self.configList or #self.configList <= 0 then + if func 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 end -- 对话形式的引导 - if self.guideType == BattleGuideType.FakeBattle then + if _config.TriggerType == 1 then BattleManager.SetGuidePause(true) - local storyId = _config[-1][1] + local storyId = _config.TriggerId StoryManager.EventTrigger(storyId, function() BattleManager.SetGuidePause(false) if func then diff --git a/Assets/ManagedResources/~Lua/Modules/Story/StoryManager.lua b/Assets/ManagedResources/~Lua/Modules/Story/StoryManager.lua index 6a2f07e32c..589ff6ec51 100644 --- a/Assets/ManagedResources/~Lua/Modules/Story/StoryManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Story/StoryManager.lua @@ -51,7 +51,7 @@ function this.EventTrigger(eventId, callBack) elseif showType == 10 then -- 起名字界面 UIManager.OpenPanel(UIName.CreateNamePopup, showType, eventId, showValues, options) elseif showType == 14 then -- 引导战斗 - local fdata, fseed = BattleManager.GetFakeBattleData(1017) + local fdata, fseed = BattleManager.GetFakeBattleData(options[1]) local testFightData = { fightData = fdata, fightSeed = fseed, @@ -59,14 +59,14 @@ function this.EventTrigger(eventId, callBack) maxRound = 20 } local panel = UIManager.OpenPanel(UIName.GuideBattlePanel, testFightData, function() - StoryManager.EventTrigger(100004) - end, BattleGuideType.FakeBattle) + StoryManager.StoryJumpType(options[3]) + end, options[2]) elseif showType == 15 then -- 播放转场特效 SwitchPanel.PlayTransEffect(function() - this.StoryJumpType(options[1]) + this.StoryJumpType(options[1], nil, callBack) end) end else @@ -97,7 +97,7 @@ function this.DialogueTrigger(eventId, callback) end -- 剧情跳转 -function this.StoryJumpType(optionId, panel,callBack) +function this.StoryJumpType(optionId, panel, callBack) local jumpType = chapterOptionData[optionId].JumpType if jumpType then if jumpType == 4 then -- 关闭所有界面,结束对话 @@ -107,6 +107,10 @@ function this.StoryJumpType(optionId, panel,callBack) if UIManager.IsOpen(UIName.StoryDialoguePanel) then UIManager.ClosePanel(UIName.StoryDialoguePanel) end + -- + if callBack then + callBack() + end elseif jumpType == 5 then -- 打开主城 PatFaceManager.isLogin = true