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) --显示波次