diff --git a/lua/app/bf/unity/character_spine_object.lua b/lua/app/bf/unity/character_spine_object.lua index eca889db..a6d5a4ad 100644 --- a/lua/app/bf/unity/character_spine_object.lua +++ b/lua/app/bf/unity/character_spine_object.lua @@ -166,6 +166,9 @@ end function CharacterSpineObject:playAnimation(animName, loop, forceRefresh) if self.characterSpineHelper then + if not self:getAnimationExist(animName) then + return + end self.characterSpineHelper:PlayAnimation(animName, loop, forceRefresh) end end @@ -209,14 +212,21 @@ function CharacterSpineObject:getAnimationDuration(animationName) return 0 end +function CharacterSpineObject:getAnimationExist(animationName) + local animation = self:getSkeletonGraphic().skeletonDataAsset:GetAnimationStateData().SkeletonData:FindAnimation(animationName) + return animation ~= nil +end + function CharacterSpineObject:getAnimationKeyFrameTimes(animationName) local times = {} if self.characterSpineHelper then - local timeList = self.characterSpineHelper:GetAnimationKeyFrameTime(animationName) - local count = timeList.Count - if count > 0 then - for i = 1, count do - table.insert(times, timeList[i - 1]) + if self:getAnimationExist(animationName) then + local timeList = self.characterSpineHelper:GetAnimationKeyFrameTime(animationName) + local count = timeList.Count + if count > 0 then + for i = 1, count do + table.insert(times, timeList[i - 1]) + end end end end diff --git a/lua/app/module/battle/component/battle_unit_comp.lua b/lua/app/module/battle/component/battle_unit_comp.lua index cf093660..2d2f884c 100644 --- a/lua/app/module/battle/component/battle_unit_comp.lua +++ b/lua/app/module/battle/component/battle_unit_comp.lua @@ -996,6 +996,9 @@ function BattleUnitComp:updateSkillAttack(dt) self:doNextNormalAttack() end else + if self.currAttackDuration <= 0 and self.currActiveSkill then -- 当前动画异常 没有进入onSkillTakeEffect,不会攻击次数减一,所以手动调用一次 + self.currActiveSkill:endUse() + end local currActiveSkill = nil local skillCanUseTimes = self.currActiveSkill:getSkillCanUseTimes() if skillCanUseTimes and skillCanUseTimes > 0 then -- 当前技能可以多次使用