【引导战斗】添加根据主角释放技能次数显示对话的功能

dev_chengFeng
gaoxin 2021-12-09 18:05:47 +08:00
parent 6f3774c030
commit ffe01ddf16
3 changed files with 56 additions and 0 deletions

View File

@ -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)

View File

@ -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

View File

@ -170,6 +170,12 @@ function this.OnBattleStart(order)
GuideBattleLogic:OnBattleStart()
end
-- 技能释放完成
function this.OnSkillCastEnd(skill)
--
GuideBattleLogic:OnSkillCastEnd(skill)
end
function this.OnOrderChanged(order)
--显示波次