添加容错
This commit is contained in:
parent
54242318ed
commit
16c0fe7182
@ -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,9 +212,15 @@ 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
|
||||
if self:getAnimationExist(animationName) then
|
||||
local timeList = self.characterSpineHelper:GetAnimationKeyFrameTime(animationName)
|
||||
local count = timeList.Count
|
||||
if count > 0 then
|
||||
@ -220,6 +229,7 @@ function CharacterSpineObject:getAnimationKeyFrameTimes(animationName)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return times
|
||||
end
|
||||
|
||||
|
||||
@ -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 -- 当前技能可以多次使用
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user