diff --git a/lua/app/module/battle/battle_manager.lua b/lua/app/module/battle/battle_manager.lua index 77bcf10d..745333da 100644 --- a/lua/app/module/battle/battle_manager.lua +++ b/lua/app/module/battle/battle_manager.lua @@ -14,10 +14,6 @@ function BattleManager:showPauseUI() UIManager:showUI("app/ui/battle/battle_pause_ui") end -function BattleManager:showSelectSkillUI(skillList) - UIManager:showUI(UIManager.UI_PATH.ROGUE_SKILL_UI, {skillList = skillList}) -end - function BattleManager:showBattleResultUI(rewards, combatReport) UIManager:showUI("app/ui/battle/battle_result_ui", {rewards = rewards, combatReport = combatReport}) end diff --git a/lua/app/module/battle/controller/battle_controller.lua b/lua/app/module/battle/controller/battle_controller.lua index d8e25d2c..aac66dab 100644 --- a/lua/app/module/battle/controller/battle_controller.lua +++ b/lua/app/module/battle/controller/battle_controller.lua @@ -405,11 +405,11 @@ function BattleController:enterElimination(needDelay) if self.battleData:useAddlvCount() then if needDelay then self.showSelectSkillSid = ModuleManager.BattleManager:performWithDelayGlobal(function() - ModuleManager.BattleManager:showSelectSkillUI(self:getRandomSkillList()) + self.battleUI:showSelectSkillComp(self:getRandomSkillList()) self.showSelectSkillSid = nil end, 0.3) else - ModuleManager.BattleManager:showSelectSkillUI(self:getRandomSkillList()) + self.battleUI:showSelectSkillComp(self:getRandomSkillList()) end else -- 检查棋盘 diff --git a/lua/app/ui/battle/battle_skill_select_ui.lua b/lua/app/ui/battle/battle_skill_select_comp.lua similarity index 53% rename from lua/app/ui/battle/battle_skill_select_ui.lua rename to lua/app/ui/battle/battle_skill_select_comp.lua index 488b3b11..cf562d53 100644 --- a/lua/app/ui/battle/battle_skill_select_ui.lua +++ b/lua/app/ui/battle/battle_skill_select_comp.lua @@ -1,4 +1,4 @@ -local BattleSkillSelectUI = class("BattleSkillSelectUI", BaseUI) +local BattleSkillSelectComp = class("BattleSkillSelectComp", LuaComponent) local SELECT_SKILL_CELL = "app/ui/battle/cell/battle_select_skill_cell" local BATTLE_COMMON_PATH = "assets/arts/textures/background/battle_common/%s.png" @@ -9,31 +9,17 @@ local SKILL_ICON_POS = { {x =-240, y= -165} } -function BattleSkillSelectUI:isFullScreen() - return false -end - -function BattleSkillSelectUI:showCommonBG() - return false -end - -function BattleSkillSelectUI:getPrefabPath() - return "assets/prefabs/ui/battle/battle_skill_select_ui.prefab" -end - -function BattleSkillSelectUI:ctor(params) - self.skillList = params.skillList or {} -end - -function BattleSkillSelectUI:onLoadRootComplete() +function BattleSkillSelectComp:refresh(skillList) + self.skillList = skillList + self:_playPop() self:_display() self:_addListeners() end -function BattleSkillSelectUI:_display() - local uiMap = self.root:genAllChildren() - uiMap["battle_skill_select_ui.skill_node.ad_btn.tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_3)) - local bg = uiMap["battle_skill_select_ui.bg_1"] +function BattleSkillSelectComp:_display() + local uiMap = self:getUIMap() + uiMap["battle_select_skill_comp.skill_node.ad_btn.tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_3)) + local bg = uiMap["battle_select_skill_comp.bg_1"] if ModuleManager.BattleManager.battleController then bg:setVisible(false) bg:setTexture(string.format(BATTLE_COMMON_PATH, ModuleManager.BattleManager.battleController:getChessBoardBgName() .. "_1"), function() @@ -46,9 +32,9 @@ function BattleSkillSelectUI:_display() self:refreshRogueSkill() end -function BattleSkillSelectUI:_addListeners() - local uiMap = self.root:genAllChildren() - uiMap["battle_skill_select_ui.skill_node.ad_btn"]:addClickListener(function() +function BattleSkillSelectComp:_addListeners() + local uiMap = self:getUIMap() + uiMap["battle_select_skill_comp.skill_node.ad_btn"]:addClickListener(function() if not ModuleManager.BattleManager.battleController then return end @@ -59,10 +45,10 @@ function BattleSkillSelectUI:_addListeners() end) end) - self.canvasGroup = uiMap["battle_skill_select_ui.skill_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP) + self.canvasGroup = uiMap["battle_select_skill_comp.skill_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP) self.canvasGroup.alpha = 1 - self.bg = uiMap["battle_skill_select_ui.bg_1"] - uiMap["battle_skill_select_ui.look_btn"]:addTouchListener(function(eventType, x, y) + self.bg = uiMap["battle_select_skill_comp.bg_1"] + uiMap["battle_select_skill_comp.look_btn"]:addTouchListener(function(eventType, x, y) if eventType == GConst.TOUCH_EVENT.DOWN or eventType == GConst.TOUCH_EVENT.DRAG then self.canvasGroup.alpha = 0.3 self.bg:setVisible(false) @@ -73,12 +59,12 @@ function BattleSkillSelectUI:_addListeners() end) end -function BattleSkillSelectUI:refreshRogueSkill() - local uiMap = self.root:genAllChildren() +function BattleSkillSelectComp:refreshRogueSkill() + local uiMap = self:getUIMap() if not self.selectSkillCells then self.selectSkillCells = {} for i = 1, 3 do - self.selectSkillCells[i] = CellManager:addCellComp(uiMap["battle_skill_select_ui.skill_node.skill_select_cell_" .. i], SELECT_SKILL_CELL) + self.selectSkillCells[i] = CellManager:addCellComp(uiMap["battle_select_skill_comp.skill_node.skill_select_cell_" .. i], SELECT_SKILL_CELL) end end @@ -93,9 +79,32 @@ function BattleSkillSelectUI:refreshRogueSkill() end end -function BattleSkillSelectUI:onClickSkill(skillId, value, pos) - self:closeUI() +function BattleSkillSelectComp:onClickSkill(skillId, value, pos) + if self.isInAni then + return + end + self:hide() ModuleManager.BattleManager:onSelectSkill(skillId, value, pos) end -return BattleSkillSelectUI \ No newline at end of file +function BattleSkillSelectComp:hide() + self.baseObject:setVisible(false) +end + +function BattleSkillSelectComp:_playPop() + self.isInAni = true + self.popSequence = self.baseObject:createBindTweenSequence() + + local scaleTween1 = self.baseObject:getTransform():DOScale(1.05, 0.15) + self.popSequence:Append(scaleTween1) + + local scaleTween2 = self.baseObject:getTransform():DOScale(1, 0.2) + self.popSequence:Append(scaleTween2) + + self.popSequence:AppendCallback(function() + self.isInAni = false + self.popSequence = nil + end) +end + +return BattleSkillSelectComp \ No newline at end of file diff --git a/lua/app/ui/battle/battle_skill_select_ui.lua.meta b/lua/app/ui/battle/battle_skill_select_comp.lua.meta similarity index 86% rename from lua/app/ui/battle/battle_skill_select_ui.lua.meta rename to lua/app/ui/battle/battle_skill_select_comp.lua.meta index ade5667b..7f62c4de 100644 --- a/lua/app/ui/battle/battle_skill_select_ui.lua.meta +++ b/lua/app/ui/battle/battle_skill_select_comp.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 9489f9db09c66f74691dba45aa6ef6fa +guid: e9999623abbb58541a25612464750444 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/ui/battle/battle_ui.lua b/lua/app/ui/battle/battle_ui.lua index 4106f357..b24055b4 100644 --- a/lua/app/ui/battle/battle_ui.lua +++ b/lua/app/ui/battle/battle_ui.lua @@ -4,6 +4,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 SELECT_SKILL_CELL = "app/ui/battle/cell/select_skill_cell" +local BATTLE_SELECT_SKILL_COMP = "app/ui/battle/battle_skill_select_comp" local DEFAULT_X = 10000 local BOARD_POS_UP = BF.Vector2(0, 47) @@ -60,6 +61,7 @@ function BattleUI:_display() self:hideAllSfxSmoke() self:initSkillLineSfx() self:initGenerateSkillEffect() + self:initSelectSkillNode() end function BattleUI:_addListeners() @@ -1581,6 +1583,24 @@ function BattleUI:showTutorialFinger(posIdList) self.showTutorialFingerSeq:SetLoops(-1) end +function BattleUI:initSelectSkillNode() + if not self.selectSkillComp then + local uiMap = self.root:genAllChildren() + local obj = uiMap["battle_ui.bg_2.battle_select_skill_comp"] + obj:initPrefabHelper() + obj:genAllChildren() + self.selectSkillComp = obj:addLuaComponent(BATTLE_SELECT_SKILL_COMP) + self.selectSkillComp:hide() + end +end + +function BattleUI:showSelectSkillComp(skillList) + if not self.selectSkillComp then + return + end + self.selectSkillComp:refresh(skillList) +end + function BattleUI:clear() if self.alreadyClear then return