diff --git a/lua/app/module/battle/component/battle_unit_comp.lua b/lua/app/module/battle/component/battle_unit_comp.lua index 394a523d..38130a50 100644 --- a/lua/app/module/battle/component/battle_unit_comp.lua +++ b/lua/app/module/battle/component/battle_unit_comp.lua @@ -18,6 +18,10 @@ local EFFECT_TYPE = BattleConst.EFFECT_TYPE local TIME_FACTOR = BattleConst.TIME_FACTOR local HURT_ANI_NAME_LIST = {SPINE_ANIMATION_NAME.HIT, SPINE_ANIMATION_NAME.HIT_2} +function BattleUnitComp:setActive(active) + self.baseObject:setActive(active) +end + function BattleUnitComp:ctor() self.hurtNameList = {} end diff --git a/lua/app/module/battle/controller/battle_base_controller.lua b/lua/app/module/battle/controller/battle_base_controller.lua index 7230d940..a1786356 100644 --- a/lua/app/module/battle/controller/battle_base_controller.lua +++ b/lua/app/module/battle/controller/battle_base_controller.lua @@ -170,8 +170,8 @@ function BattleBaseController:getNextMonsterId(waveIndex) return monsterId end -function BattleBaseController:showBossEnterAni(bornTime, bossName, monsterComp, callback) - self.battleUI:showBossEnterAni(bornTime, bossName, monsterComp, callback) +function BattleBaseController:showBossEnterAni(modelId, bornTime, bossName, monsterComp, callback) + self.battleUI:showBossEnterAni(modelId, bornTime, bossName, monsterComp, callback) end function BattleBaseController:generateNextMonster() @@ -182,10 +182,6 @@ function BattleBaseController:generateNextMonster() local isBoss = self.defTeam:getIsBoss() local unitEntity = self.battleData:addMonster(monsterId, true, self) local modelId = unitEntity:getModelId() - Logger.logHighlight("=========================xxxx2 modelId = %s isBoss = %s", modelId, isBoss) - if isBoss then - modelId = "p0003" - end BattleHelper:loadBattleHeroModel(modelId, self.battleUI:getBattleNode(), function(spineObject) self.defTeam:removeAllUnits() local monsterComp = spineObject:addLuaComponent(GConst.BattleConst.TYPEOF_LUA_COMP.BATTLE_MONSTER_COMPONENT) @@ -206,14 +202,15 @@ function BattleBaseController:generateNextMonster() end end end - self.atkTeam:playRunAction() - self.atkTeam:recoverHpOnWaveOver(onFinish) isBoss = self.defTeam:getIsBoss() - Logger.logHighlight("=========================xxxx21 modelId = %s isBoss = %s", modelId, isBoss) if isBoss then local monsterInfo = ConfigManager:getConfig("monster")[monsterId] - self:showBossEnterAni(bornTime, ModuleManager.HeroManager:getMonsterName(monsterInfo.monster_base), monsterComp, function() + monsterComp:setActive(false) + self:showBossEnterAni(modelId, bornTime, ModuleManager.HeroManager:getMonsterName(monsterInfo.monster_base), monsterComp, function() + monsterComp:setActive(true) + self.atkTeam:playRunAction() + self.atkTeam:recoverHpOnWaveOver(onFinish) monsterComp:playEnterBattlefield(true, onFinish) end) else @@ -236,7 +233,9 @@ function BattleBaseController:generateNextMonster() isBoss = self.defTeam:getIsBoss() if isBoss then local monsterInfo = ConfigManager:getConfig("monster")[monsterId] - self:showBossEnterAni(bornTime, ModuleManager.HeroManager:getMonsterName(monsterInfo.monster_base), monsterComp, function() + monsterComp:setActive(false) + self:showBossEnterAni(modelId, bornTime, ModuleManager.HeroManager:getMonsterName(monsterInfo.monster_base), monsterComp, function() + monsterComp:setActive(true) monsterComp:playEnterBattlefield(false, onFinish) end) else diff --git a/lua/app/ui/battle/battle_base_ui.lua b/lua/app/ui/battle/battle_base_ui.lua index 0fd7ba6c..8e8ce5b8 100644 --- a/lua/app/ui/battle/battle_base_ui.lua +++ b/lua/app/ui/battle/battle_base_ui.lua @@ -2433,7 +2433,7 @@ function BattleBaseUI:showCommonSkillTips(skillId) end, 1.5) end -function BattleBaseUI:showBossEnterAni(bornTime, bossName, monsterComp, callback) +function BattleBaseUI:showBossEnterAni(modelId, bornTime, bossName, monsterComp, callback) if not self.bossEnterNode then if callback then callback() @@ -2441,8 +2441,19 @@ function BattleBaseUI:showBossEnterAni(bornTime, bossName, monsterComp, callback self.battleController:showBuffTips(SIDE_DEF, true) return end + self.bossSpineObj:setActive(false) + SpineManager:loadHeroSpineAssetAsync(modelId, self.root, function(spineAssets) + self.bossSpineObj:refreshAssets(spineAssets) + self:_showBossEnterAni(bornTime, bossName, monsterComp, callback) + end) +end + +function BattleBaseUI:_showBossEnterAni(bornTime, bossName, monsterComp, callback) AudioManager:playEffect(AudioManager.EFFECT_ID.BOSS_WARNING) self.bossEnterNode:setVisible(true) + self.bossSpineObj:setActive(true) + -- self.bossSpineObj:setTimeScale(1) + self.bossSpineObj:playAnim("idle", true, true) self.bossEnterImg:setVisible(false) self.bossName:setText(bossName) self.bossName:setAnchoredPositionX(-756) @@ -2462,17 +2473,24 @@ function BattleBaseUI:showBossEnterAni(bornTime, bossName, monsterComp, callback self.bossEnterNodeAnimator:Play(1155742626, -1, 0) monsterComp:initPosition() monsterComp:getBaseObject():setParent(self.maxLayerNode, false) - if callback then - callback() - end + -- if callback then + -- callback() + -- end end) self.bossEnterAniSeq:AppendInterval(2) + -- self.bossEnterAniSeq:AppendCallback(function() + -- self.bossSpineObj:setTimeScale(0) + -- end) self.bossEnterAniSeq:Append(self.bossEnterNodeCanvasGroup:DOFade(0, 0.2)) self.bossEnterAniSeq:AppendCallback(function() monsterComp:getBaseObject():setParent(self:getBattleNode(), false) self.bossEnterNode:setVisible(false) self.battleController:showBuffTips(SIDE_DEF, true) self.bossEnterNodeAnimator.enabled = false + self.bossSpineObj:setActive(false) + if callback then + callback() + end end) end diff --git a/lua/app/ui/battle/battle_ui.lua b/lua/app/ui/battle/battle_ui.lua index a32aed26..9aaf8489 100644 --- a/lua/app/ui/battle/battle_ui.lua +++ b/lua/app/ui/battle/battle_ui.lua @@ -204,10 +204,12 @@ function BattleUI:initBossEnterAni() self.bossEnterNode = uiMap["battle_ui.bg_2.boss_enter_node"] self.bossEnterImg = uiMap["battle_ui.bg_2.boss_enter_node.ui_spine_obj"] self.bossName = uiMap["battle_ui.bg_2.boss_enter_node.boss_name"] + self.bossSpineObj = uiMap["battle_ui.battle_root.boss_enter_node.boss_spine_obj"] self.bossEnterNodeAnimator = self.bossEnterNode:getComponent(GConst.TYPEOF_UNITY_CLASS.ANIMATOR) self.bossEnterNodeAnimator.enabled = false self.bossEnterNodeCanvasGroup = self.bossEnterNode:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP) self.bossEnterNode:setVisible(false) + self.bossSpineObj:setActive(false) end function BattleUI:initSkillSelectCells()