diff --git a/lua/app/module/battle/battle_manager.lua b/lua/app/module/battle/battle_manager.lua index 4836122a..4d08da40 100644 --- a/lua/app/module/battle/battle_manager.lua +++ b/lua/app/module/battle/battle_manager.lua @@ -37,12 +37,12 @@ function BattleManager:_play(battleType, params) self.battleController:init(params) end -function BattleManager:onSelectSkill(skillId, value) +function BattleManager:onSelectSkill(skillId, value, pos) if not self.battleController then return end - self.battleController:onSelectSkill(skillId, value) + self.battleController:onSelectSkill(skillId, value, pos) end function BattleManager:endBattleAndExit() diff --git a/lua/app/module/battle/controller/battle_controller.lua b/lua/app/module/battle/controller/battle_controller.lua index 261940fe..01746edd 100644 --- a/lua/app/module/battle/controller/battle_controller.lua +++ b/lua/app/module/battle/controller/battle_controller.lua @@ -1488,7 +1488,7 @@ function BattleController:getRandomSkillList(getCount) return result end -function BattleController:onSelectSkill(skillId, value) +function BattleController:onSelectSkill(skillId, value, pos) self.battleData:addSkillCount(skillId, value) BATTLE_ROGUE_SKILL_HANDLE.takeEffect(skillId, self.battleData, self, value) @@ -1497,11 +1497,19 @@ function BattleController:onSelectSkill(skillId, value) entity:gotUpSKill(skillId) end - self:enterElimination() - - if self.battleUI then - self.battleUI:refreshBoard() - self.battleUI:refreshSkill() + local elementType = ModuleManager.HeroManager:getSkillRoguePosition(skillId) + if elementType then + if self.battleUI then + self.battleUI:gotOneSkillAni(skillId, elementType, function() + self:enterElimination() + self.battleUI:refreshBoard() + self.battleUI:refreshSkill() + end, pos) + else + self:enterElimination() + end + else + self:enterElimination() end end diff --git a/lua/app/module/hero/hero_manager.lua b/lua/app/module/hero/hero_manager.lua index f1129723..c59cf968 100644 --- a/lua/app/module/hero/hero_manager.lua +++ b/lua/app/module/hero/hero_manager.lua @@ -101,6 +101,11 @@ function HeroManager:getSkillRogueBg(skillId) return cfg and "frame_" .. cfg.qlt end +function HeroManager:getSkillRoguePosition(skillId) + local cfg = ConfigManager:getConfig("skill_rogue")[skillId] + return cfg and cfg.skill_position +end + function HeroManager:getActiveRogueLvs() if not self.activeRogueLvs then self.activeRogueLvs = {} diff --git a/lua/app/ui/battle/battle_skill_select_ui.lua b/lua/app/ui/battle/battle_skill_select_ui.lua index 63592abf..8582fa95 100644 --- a/lua/app/ui/battle/battle_skill_select_ui.lua +++ b/lua/app/ui/battle/battle_skill_select_ui.lua @@ -2,6 +2,12 @@ local BattleSkillSelectUI = class("BattleSkillSelectUI", BaseUI) local SELECT_SKILL_CELL = "app/ui/battle/cell/battle_select_skill_cell" +local SKILL_ICON_POS = { + {x =-240, y= 165}, + {x =-240, y= 0}, + {x =-240, y= -165} +} + function BattleSkillSelectUI:isFullScreen() return false end @@ -71,15 +77,15 @@ function BattleSkillSelectUI:refreshRogueSkill() cell:getBaseObject():setActive(skillId ~= nil) if skillId then cell:refresh(skillId, function(value) - self:onClickSkill(skillId, value) + self:onClickSkill(skillId, value, SKILL_ICON_POS[index]) end) end end end -function BattleSkillSelectUI:onClickSkill(skillId, value) +function BattleSkillSelectUI:onClickSkill(skillId, value, pos) self:closeUI() - ModuleManager.BattleManager:onSelectSkill(skillId, value) + ModuleManager.BattleManager:onSelectSkill(skillId, value, pos) end return BattleSkillSelectUI \ No newline at end of file diff --git a/lua/app/ui/battle/battle_ui.lua b/lua/app/ui/battle/battle_ui.lua index d4a59469..3c2264a0 100644 --- a/lua/app/ui/battle/battle_ui.lua +++ b/lua/app/ui/battle/battle_ui.lua @@ -4,6 +4,7 @@ local BattleUI = class("BattleUI", BaseUI) 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 SELECT_SKILL_CELL = "app/ui/battle/cell/select_skill_cell" local DEFAULT_X = 10000 local BOARD_POS_UP = BF.Vector2(0, 47) @@ -54,6 +55,7 @@ function BattleUI:_display() self:hideGenerateSkillGridCells() self:initTutorialNode() self:initUISfxs() + self:initSkillSelectCells() end function BattleUI:_addListeners() @@ -815,6 +817,42 @@ function BattleUI:hideGenerateSkillGridCells() end end +function BattleUI:gotOneSkillAni(skillId, elementType, callback, startPos) + if not skillId or not self.skillSelectCell then + if callback then + callback() + end + return + end + + self.skillSelectCell:refresh(skillId) + self.skillSelectCell:getBaseObject():setAnchoredPosition(startPos.x, startPos.y) + self.skillSelectCell:getBaseObject():setVisible(true) + if self.gotOneSkillAniSeq then + self.gotOneSkillAniSeq:Kill() + self.gotOneSkillAniSeq = nil + end + + self.gotOneSkillAniSeq = self.root:createBindTweenSequence() + local pos = self:getElementSkillPos(elementType) + self.gotOneSkillAniSeq:Append(self.skillSelectCell:getBaseObject():getTransform():DOAnchorPos(pos, 0.7)) + self.gotOneSkillAniSeq:Join(self.skillSelectCell:getBaseObject():getTransform():DOScale(0.76, 0.7)) + self.gotOneSkillAniSeq:AppendCallback(function() + self.skillSelectCell:getBaseObject():setAnchoredPositionX(DEFAULT_X) + if callback then + callback() + end + end) +end + +function BattleUI:initSkillSelectCells() + if not self.skillSelectCell then + local uiMap = self.root:genAllChildren() + self.skillSelectCell = CellManager:addCellComp(uiMap["battle_ui.bg_2.ani_node.skill_select_cell"], SELECT_SKILL_CELL) + self.skillSelectCell:getBaseObject():setAnchoredPositionX(DEFAULT_X) + end +end + function BattleUI:shuffleBoard(changeInfo, callback) if self.shuffleBoardSeq then self.shuffleBoardSeq:Kill()