diff --git a/lua/app/module/battle/component/battle_unit_comp.lua b/lua/app/module/battle/component/battle_unit_comp.lua index cd0ced4c..394a523d 100644 --- a/lua/app/module/battle/component/battle_unit_comp.lua +++ b/lua/app/module/battle/component/battle_unit_comp.lua @@ -19,6 +19,7 @@ local TIME_FACTOR = BattleConst.TIME_FACTOR local HURT_ANI_NAME_LIST = {SPINE_ANIMATION_NAME.HIT, SPINE_ANIMATION_NAME.HIT_2} function BattleUnitComp:ctor() + self.hurtNameList = {} end function BattleUnitComp:initPosition() diff --git a/lua/app/module/battle/controller/battle_base_controller.lua b/lua/app/module/battle/controller/battle_base_controller.lua index ca34674b..a9c7b0a1 100644 --- a/lua/app/module/battle/controller/battle_base_controller.lua +++ b/lua/app/module/battle/controller/battle_base_controller.lua @@ -182,6 +182,10 @@ 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) @@ -197,12 +201,16 @@ function BattleBaseController:generateNextMonster() if count == 2 then self.atkTeam:stopRunAction() self:onRoundEnd(true) + if isBoss then + self:refreshBossSkill(unitEntity) + 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() @@ -212,11 +220,15 @@ function BattleBaseController:generateNextMonster() monsterComp:playEnterBattlefield(true, onFinish) end else + self:clearBossSkill() local count = 0 local function onFinish() count = count + 1 if count == 2 then self:onRoundEnd(true) + if isBoss then + self:refreshBossSkill(unitEntity) + end end end self.atkTeam:recoverHpOnWaveOver(onFinish) @@ -631,6 +643,15 @@ function BattleBaseController:refreshBuff(side, buffList) self.battleUI:refreshBuff(side, buffList) end +function BattleBaseController:refreshBossSkill(unitEntity) + local skillList = unitEntity:getSkillList() + self.battleUI:refreshBossSkill(skillList) +end + +function BattleBaseController:clearBossSkill() + self.battleUI:clearBossSkill() +end + function BattleBaseController:clearBuff(side) self.battleUI:clearBuff(side) end @@ -740,6 +761,7 @@ function BattleBaseController:initDefUnits(callback) monsterComp:initWithEntity(modelId, unitEntity, self) self.defTeam:addUnit(monsterComp, true) self.battleUI:refreshDefHp(unitEntity:getHp(), unitEntity:getHpPercent()) + self:refreshBossSkill(unitEntity) callback() end) end diff --git a/lua/app/ui/battle/battle_base_ui.lua b/lua/app/ui/battle/battle_base_ui.lua index f5026d04..78672865 100644 --- a/lua/app/ui/battle/battle_base_ui.lua +++ b/lua/app/ui/battle/battle_base_ui.lua @@ -5,6 +5,7 @@ local GRID_CELL = "app/ui/battle/cell/grid_cell" local GRID_CELL_PATH = "assets/prefabs/ui/battle/cell/grid_cell.prefab" local SKILL_NODE_CELL = "app/ui/battle/cell/skill_node_cell" local TINY_BUFF_CELL = "app/ui/battle/cell/tiny_buff_cell" +local BOSS_SKILL_CELL = "app/ui/battle/cell/boss_skill_cell" local BG_PATH = "assets/arts/textures/background/battle/%s.png" local BATTLE_COMMON_PATH = "assets/arts/textures/background/battle_common/%s.png" local GRID_EDGE_CELL = "app/ui/battle/cell/grid_edge_cell" @@ -71,6 +72,11 @@ function BattleBaseUI:initBuff() self:_initBuff(atkBuffPrefix, defBuffPrefix, battleBuffTipsRoot, battleBuffTipsMask, battleBuffTipsBg, battleBuffTipsBuff) end +function BattleBaseUI:initBossSkill() + local bossSkillPrefix = nil + self:_initBossSkill(bossSkillPrefix) +end + function BattleBaseUI:initBattlefield() self.battleNode = nil end @@ -263,6 +269,7 @@ function BattleBaseUI:_display() self:initBg() self:initSkill() self:initBuff() + self:initBossSkill() self:initBattlefield() self:initNumberNode() self:initComboNode() @@ -415,6 +422,46 @@ function BattleBaseUI:_initBuff(atkBuffPrefix, defBuffPrefix, battleBuffTipsRoot end end +function BattleBaseUI:_initBossSkill(bossSkillPrefix) + if self.bossSkillCells then + return + end + self.bossSkillCells = {} + for i = 1, 6 do + if bossSkillPrefix then + local obj = self.uiMap[bossSkillPrefix .. i] + if obj then + self.bossSkillCells[i] = CellManager:addCellComp(obj, BOSS_SKILL_CELL) + -- obj:addClickListener(function() + -- -- self.battleController:showBuffTips(SIDE_DEF) + -- end) + end + end + end + for index, cell in ipairs(self.bossSkillCells) do + cell:setActive(false) + end + -- buff的tips + -- self.battleBuffTipsRoot = battleBuffTipsRoot + -- self.battleBuffTipsRoot:setLocalScale(0, 0, 0) + -- battleBuffTipsMask:addClickListener(function() + -- if self.autoCloseBuffSid then + -- self:unscheduleGlobal(self.autoCloseBuffSid) + -- self.autoCloseBuffSid = nil + -- end + -- self.battleBuffTipsRoot:setLocalScale(0, 0, 0) + -- end) + -- self.battleBuffTipsBg = battleBuffTipsBg + -- self.battleBuffTipsBuff = battleBuffTipsBuff + -- self.battleBuffTipsBuffList = {} + -- local children = self.battleBuffTipsBg:getChildList() + -- if children then + -- for k, v in ipairs(children) do + -- table.insert(self.battleBuffTipsBuffList, v) + -- end + -- end +end + function BattleBaseUI:refreshBuff(side, buffList) if not self.tinyBuffCells then return @@ -455,6 +502,31 @@ function BattleBaseUI:clearBuff(side) end end +function BattleBaseUI:refreshBossSkill(skillList) + if not self.bossSkillCells then + return + end + local skillCellCount = #self.bossSkillCells + + for i = 1, skillCellCount do + if not skillList[i] then + self.bossSkillCells[i]:setActive(false) + else + self.bossSkillCells[i]:setActive(true) + self.bossSkillCells[i]:refresh(skillList[i]) + end + end +end + +function BattleBaseUI:clearBossSkill() + if not self.bossSkillCells then + return + end + for _, cell in ipairs(self.bossSkillCells) do + cell:setActive(false) + end +end + function BattleBaseUI:refreshChessBoard(boardBg) self.boardNode:setTexture(string.format(BATTLE_COMMON_PATH, boardBg), function() self.boardNode:setAnchoredPositionX(0) diff --git a/lua/app/ui/battle/battle_ui.lua b/lua/app/ui/battle/battle_ui.lua index 8cd422f9..9f6b8960 100644 --- a/lua/app/ui/battle/battle_ui.lua +++ b/lua/app/ui/battle/battle_ui.lua @@ -81,6 +81,11 @@ function BattleUI:initBuff() self:_initBuff(atkBuffPrefix, defBuffPrefix, battleBuffTipsRoot, battleBuffTipsMask, battleBuffTipsBg, battleBuffTipsBuff) end +function BattleUI:initBossSkill() + local bossSkillPrefix = "battle_ui.top_node.buff_boss.boss_skill_cell_" + self:_initBossSkill(bossSkillPrefix) +end + function BattleUI:initBattlefield() self.battleNode = self.uiMap["battle_ui.battle_root.battle_node"] end diff --git a/lua/app/ui/battle/cell/boss_skill_cell.lua b/lua/app/ui/battle/cell/boss_skill_cell.lua new file mode 100644 index 00000000..a99aeb69 --- /dev/null +++ b/lua/app/ui/battle/cell/boss_skill_cell.lua @@ -0,0 +1,26 @@ +local BossSkillCell = class("BossSkillCell", BaseCell) + +function BossSkillCell:init() + self.baseObject:addClickListener(function() + -- self.battleController:showBuffTips(SIDE_DEF) + -- ModuleManager.TipsManager:showBattleBoardSkillTips(self.battleData:getHeroEntity(elementType, side), self.battleController, side) + ModuleManager.TipsManager:showSkillTips(self.baseObject, nil, self.skillId) + end) + local uiMap = self:getUIMap() + self.icon = uiMap["boss_skill_cell.icon"] + local value = uiMap["boss_skill_cell.value"] + local count = uiMap["boss_skill_cell.count"] +end + +function BossSkillCell:refresh(skillId) + print("=============================== skillId = %s", skillId) + self.skillId = skillId + -- self.icon:setSprite(GConst.ATLAS_PATH.ICON_SKILL, self.lastSkillIcon) + self.icon:setSprite(GConst.ATLAS_PATH.ICON_SKILL, "14_3") +end + +function BossSkillCell:setActive(active) + self.baseObject:setActive(active) +end + +return BossSkillCell \ No newline at end of file diff --git a/lua/app/ui/battle/cell/boss_skill_cell.lua.meta b/lua/app/ui/battle/cell/boss_skill_cell.lua.meta new file mode 100644 index 00000000..d14fd225 --- /dev/null +++ b/lua/app/ui/battle/cell/boss_skill_cell.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: b93e542c122d8481396b8f8f28a31a04 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3} diff --git a/lua/app/userdata/battle/battle_base_data.lua b/lua/app/userdata/battle/battle_base_data.lua index 1ac1f6d9..66b3c50b 100644 --- a/lua/app/userdata/battle/battle_base_data.lua +++ b/lua/app/userdata/battle/battle_base_data.lua @@ -178,7 +178,6 @@ function BattleBaseData:initRogueSkills(side, formation) -- end -- end end - Logger.logHighlight("===========") end function BattleBaseData:refreshBoard(board, boardEdge, blockIcon, snapshot) diff --git a/lua/app/userdata/battle/team/battle_unit_entity.lua b/lua/app/userdata/battle/team/battle_unit_entity.lua index 3e2f4c99..89d9fecc 100644 --- a/lua/app/userdata/battle/team/battle_unit_entity.lua +++ b/lua/app/userdata/battle/team/battle_unit_entity.lua @@ -595,4 +595,15 @@ function BattleUnitEntity:onRoundEnd() end end +function BattleUnitEntity:getSkillList() + local list = {} + for _, v in ipairs(self.activeSkills or {}) do + table.insert(list, v.skillId) + end + for _, v in ipairs(self.passiveSkills or {}) do + table.insert(list, v.skillId) + end + return list +end + return BattleUnitEntity \ No newline at end of file