From ffe01ddf1619a30414b28ce5e1f98270204da1be Mon Sep 17 00:00:00 2001 From: gaoxin Date: Thu, 9 Dec 2021 18:05:47 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=BC=95=E5=AF=BC=E6=88=98=E6=96=97?= =?UTF-8?q?=E3=80=91=E6=B7=BB=E5=8A=A0=E6=A0=B9=E6=8D=AE=E4=B8=BB=E8=A7=92?= =?UTF-8?q?=E9=87=8A=E6=94=BE=E6=8A=80=E8=83=BD=E6=AC=A1=E6=95=B0=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=AF=B9=E8=AF=9D=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../~Lua/Modules/Battle/View/BattleView.lua | 9 ++++ .../Modules/Battle/View/GuideBattleLogic.lua | 41 +++++++++++++++++++ .../Modules/Battle/View/GuideBattlePanel.lua | 6 +++ 3 files changed, 56 insertions(+) diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/View/BattleView.lua b/Assets/ManagedResources/~Lua/Modules/Battle/View/BattleView.lua index 0bf3d03cfb..0b011f8152 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/View/BattleView.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/View/BattleView.lua @@ -420,6 +420,7 @@ function this.InitBattleEvent() BattleLogic.Event:AddEvent(BattleEventName.BattleRoundEnd, this.BattleRoundEnd) BattleLogic.Event:AddEvent(BattleEventName.RoleTurnStart, this.RoleTurnChange) BattleLogic.Event:AddEvent(BattleEventName.BattleStart, this.OnBattleStart) + BattleLogic.Event:AddEvent(BattleEventName.SkillCastEnd, this.OnSkillCastEnd) end -- 清除战斗数据 @@ -435,6 +436,7 @@ function this.ClearBattleEvent() BattleLogic.Event:RemoveEvent(BattleEventName.BattleRoundEnd, this.BattleRoundEnd) BattleLogic.Event:RemoveEvent(BattleEventName.RoleTurnStart, this.RoleTurnChange) BattleLogic.Event:RemoveEvent(BattleEventName.BattleStart, this.OnBattleStart) + BattleLogic.Event:RemoveEvent(BattleEventName.SkillCastEnd, this.OnSkillCastEnd) end --敌军出现的表现 @@ -505,6 +507,13 @@ function this.OnBattleStart() this.root.OnBattleStart() end end +-- 技能释放完成 +function this.OnSkillCastEnd(skill) + -- 回调UI层 + if this.root.OnSkillCastEnd then + this.root.OnSkillCastEnd(skill) + end +end -- 角色轮转回调(不出手的位置不会回调) function this.RoleTurnChange(role) diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/View/GuideBattleLogic.lua b/Assets/ManagedResources/~Lua/Modules/Battle/View/GuideBattleLogic.lua index 215cae4a9d..b6a6b0695e 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/View/GuideBattleLogic.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/View/GuideBattleLogic.lua @@ -6,6 +6,7 @@ function GuideBattleLogic:Init(guideType) end self.guideType = guideType self.configList = ConfigManager.TryGetAllConfigsDataByKey(ConfigName.GuideBattleConfig, "GuideGroup", self.guideType) + self.PlayerSkillCount = {} -- 主角释放技能次数计数器 end @@ -140,4 +141,44 @@ function GuideBattleLogic:OnBattleEnd(func) end end +-- +function GuideBattleLogic:OnSkillCastEnd(skill) + -- 这里只判断主角技能 + if skill.owner.position ~= 100 then + return + end + if not self.PlayerSkillCount[skill.owner.camp] then + self.PlayerSkillCount[skill.owner.camp] = 0 + end + -- 释放技能次数+1 + self.PlayerSkillCount[skill.owner.camp] = self.PlayerSkillCount[skill.owner.camp] + 1 + + -- 没有就不引导了 + if not self.configList or #self.configList <= 0 then + return + end + local _config = nil + for _, con in ipairs(self.configList) do + -- 主角释放技能次数判断 + if con.Round == -4 and con.Camp == skill.owner.camp and con.Turn == self.PlayerSkillCount[skill.owner.camp] then + _config = con + break + end + end + if not _config then + return + end + -- 对话形式的引导 + if _config.TriggerType == 1 then + BattleManager.SetGuidePause(true) + local storyId = _config.TriggerId + StoryManager.EventTrigger(storyId, function() + BattleManager.SetGuidePause(false) + if func then + func() + end + end) + end +end + return GuideBattleLogic \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/View/GuideBattlePanel.lua b/Assets/ManagedResources/~Lua/Modules/Battle/View/GuideBattlePanel.lua index b6c5736a5b..91bb6d728e 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/View/GuideBattlePanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/View/GuideBattlePanel.lua @@ -170,6 +170,12 @@ function this.OnBattleStart(order) GuideBattleLogic:OnBattleStart() end +-- 技能释放完成 +function this.OnSkillCastEnd(skill) + -- + GuideBattleLogic:OnSkillCastEnd(skill) +end + function this.OnOrderChanged(order) --显示波次