From 16c0fe71821858b43218b4418bab462e9db3a10d Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Sun, 25 Jun 2023 10:30:21 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AE=B9=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/bf/unity/character_spine_object.lua | 20 ++++++++++++++----- .../battle/component/battle_unit_comp.lua | 3 +++ 2 files changed, 18 insertions(+), 5 deletions(-) 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 -- 当前技能可以多次使用 From 6408b6c0287aa2ae722bb10742a25a10b8723018 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Thu, 29 Jun 2023 17:13:25 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=AF=8F=E6=97=A5=E6=8C=91=E6=88=98bug?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/module/battle/controller/battle_controller.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lua/app/module/battle/controller/battle_controller.lua b/lua/app/module/battle/controller/battle_controller.lua index a2651514..9d7cd2cb 100644 --- a/lua/app/module/battle/controller/battle_controller.lua +++ b/lua/app/module/battle/controller/battle_controller.lua @@ -145,12 +145,12 @@ end -- 怪物攻击力加成 function BattleController:getMonsterAtkAddition() - return BattleConst.DEFAULT_FACTOR + return 0 end -- 怪物血量加成 function BattleController:getMonsterHpAddition() - return BattleConst.DEFAULT_FACTOR + return 0 end -- 需要额外加载的资源 @@ -177,7 +177,7 @@ end function BattleController:initDefUnits(callback) local config = self:getChapterConfig()[self.chapterId] self.battleUI:loadBg(config.scene) - local unitEntity = DataManager.BattleData:addMonster(config.monster[1]) + local unitEntity = DataManager.BattleData:addMonster(config.monster[1], nil, self) local modelId = unitEntity:getModelId() BattleHelper:loadBattleHeroModel(modelId, self.battleUI:getBattleNode(), function(spineObject) local monsterComp = spineObject:addLuaComponent(GConst.BattleConst.TYPEOF_LUA_COMP.BATTLE_MONSTER_COMPONENT) @@ -195,7 +195,7 @@ function BattleController:generateNextMonster() return self:enterNextWave() end local isBoss = self.defTeam:getIsBoss() - local unitEntity = DataManager.BattleData:addMonster(monsterId, true) + local unitEntity = DataManager.BattleData:addMonster(monsterId, true, self) local modelId = unitEntity:getModelId() BattleHelper:loadBattleHeroModel(modelId, self.battleUI:getBattleNode(), function(spineObject) self.defTeam:removeAllUnits() @@ -2655,7 +2655,7 @@ function BattleController:findLinkLine(posId, posIdMap, hadSkill, mainElementTyp end function BattleController:generateMonsterById(monsterId, callback) - local unitEntity = DataManager.BattleData:addMonster(monsterId, true) + local unitEntity = DataManager.BattleData:addMonster(monsterId, true, self) local modelId = unitEntity:getModelId() BattleHelper:loadBattleHeroModel(modelId, self.battleUI:getBattleNode(), function(spineObject) self.defTeam:removeAllUnits()