技能选择界面改到战斗界面中

This commit is contained in:
xiekaidong 2023-04-25 23:27:19 +08:00
parent fd70f87d65
commit a6bf141658
5 changed files with 66 additions and 41 deletions

View File

@ -14,10 +14,6 @@ function BattleManager:showPauseUI()
UIManager:showUI("app/ui/battle/battle_pause_ui") UIManager:showUI("app/ui/battle/battle_pause_ui")
end end
function BattleManager:showSelectSkillUI(skillList)
UIManager:showUI(UIManager.UI_PATH.ROGUE_SKILL_UI, {skillList = skillList})
end
function BattleManager:showBattleResultUI(rewards, combatReport) function BattleManager:showBattleResultUI(rewards, combatReport)
UIManager:showUI("app/ui/battle/battle_result_ui", {rewards = rewards, combatReport = combatReport}) UIManager:showUI("app/ui/battle/battle_result_ui", {rewards = rewards, combatReport = combatReport})
end end

View File

@ -405,11 +405,11 @@ function BattleController:enterElimination(needDelay)
if self.battleData:useAddlvCount() then if self.battleData:useAddlvCount() then
if needDelay then if needDelay then
self.showSelectSkillSid = ModuleManager.BattleManager:performWithDelayGlobal(function() self.showSelectSkillSid = ModuleManager.BattleManager:performWithDelayGlobal(function()
ModuleManager.BattleManager:showSelectSkillUI(self:getRandomSkillList()) self.battleUI:showSelectSkillComp(self:getRandomSkillList())
self.showSelectSkillSid = nil self.showSelectSkillSid = nil
end, 0.3) end, 0.3)
else else
ModuleManager.BattleManager:showSelectSkillUI(self:getRandomSkillList()) self.battleUI:showSelectSkillComp(self:getRandomSkillList())
end end
else else
-- 检查棋盘 -- 检查棋盘

View File

@ -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 SELECT_SKILL_CELL = "app/ui/battle/cell/battle_select_skill_cell"
local BATTLE_COMMON_PATH = "assets/arts/textures/background/battle_common/%s.png" local BATTLE_COMMON_PATH = "assets/arts/textures/background/battle_common/%s.png"
@ -9,31 +9,17 @@ local SKILL_ICON_POS = {
{x =-240, y= -165} {x =-240, y= -165}
} }
function BattleSkillSelectUI:isFullScreen() function BattleSkillSelectComp:refresh(skillList)
return false self.skillList = skillList
end self:_playPop()
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()
self:_display() self:_display()
self:_addListeners() self:_addListeners()
end end
function BattleSkillSelectUI:_display() function BattleSkillSelectComp:_display()
local uiMap = self.root:genAllChildren() local uiMap = self:getUIMap()
uiMap["battle_skill_select_ui.skill_node.ad_btn.tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_3)) uiMap["battle_select_skill_comp.skill_node.ad_btn.tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_3))
local bg = uiMap["battle_skill_select_ui.bg_1"] local bg = uiMap["battle_select_skill_comp.bg_1"]
if ModuleManager.BattleManager.battleController then if ModuleManager.BattleManager.battleController then
bg:setVisible(false) bg:setVisible(false)
bg:setTexture(string.format(BATTLE_COMMON_PATH, ModuleManager.BattleManager.battleController:getChessBoardBgName() .. "_1"), function() bg:setTexture(string.format(BATTLE_COMMON_PATH, ModuleManager.BattleManager.battleController:getChessBoardBgName() .. "_1"), function()
@ -46,9 +32,9 @@ function BattleSkillSelectUI:_display()
self:refreshRogueSkill() self:refreshRogueSkill()
end end
function BattleSkillSelectUI:_addListeners() function BattleSkillSelectComp:_addListeners()
local uiMap = self.root:genAllChildren() local uiMap = self:getUIMap()
uiMap["battle_skill_select_ui.skill_node.ad_btn"]:addClickListener(function() uiMap["battle_select_skill_comp.skill_node.ad_btn"]:addClickListener(function()
if not ModuleManager.BattleManager.battleController then if not ModuleManager.BattleManager.battleController then
return return
end end
@ -59,10 +45,10 @@ function BattleSkillSelectUI:_addListeners()
end) end)
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.canvasGroup.alpha = 1
self.bg = uiMap["battle_skill_select_ui.bg_1"] self.bg = uiMap["battle_select_skill_comp.bg_1"]
uiMap["battle_skill_select_ui.look_btn"]:addTouchListener(function(eventType, x, y) 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 if eventType == GConst.TOUCH_EVENT.DOWN or eventType == GConst.TOUCH_EVENT.DRAG then
self.canvasGroup.alpha = 0.3 self.canvasGroup.alpha = 0.3
self.bg:setVisible(false) self.bg:setVisible(false)
@ -73,12 +59,12 @@ function BattleSkillSelectUI:_addListeners()
end) end)
end end
function BattleSkillSelectUI:refreshRogueSkill() function BattleSkillSelectComp:refreshRogueSkill()
local uiMap = self.root:genAllChildren() local uiMap = self:getUIMap()
if not self.selectSkillCells then if not self.selectSkillCells then
self.selectSkillCells = {} self.selectSkillCells = {}
for i = 1, 3 do 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
end end
@ -93,9 +79,32 @@ function BattleSkillSelectUI:refreshRogueSkill()
end end
end end
function BattleSkillSelectUI:onClickSkill(skillId, value, pos) function BattleSkillSelectComp:onClickSkill(skillId, value, pos)
self:closeUI() if self.isInAni then
return
end
self:hide()
ModuleManager.BattleManager:onSelectSkill(skillId, value, pos) ModuleManager.BattleManager:onSelectSkill(skillId, value, pos)
end end
return BattleSkillSelectUI 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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 9489f9db09c66f74691dba45aa6ef6fa guid: e9999623abbb58541a25612464750444
ScriptedImporter: ScriptedImporter:
internalIDToNameTable: [] internalIDToNameTable: []
externalObjects: {} externalObjects: {}

View File

@ -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 GRID_CELL_PATH = "assets/prefabs/ui/battle/cell/grid_cell.prefab"
local SKILL_NODE_CELL = "app/ui/battle/cell/skill_node_cell" local SKILL_NODE_CELL = "app/ui/battle/cell/skill_node_cell"
local SELECT_SKILL_CELL = "app/ui/battle/cell/select_skill_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 DEFAULT_X = 10000
local BOARD_POS_UP = BF.Vector2(0, 47) local BOARD_POS_UP = BF.Vector2(0, 47)
@ -60,6 +61,7 @@ function BattleUI:_display()
self:hideAllSfxSmoke() self:hideAllSfxSmoke()
self:initSkillLineSfx() self:initSkillLineSfx()
self:initGenerateSkillEffect() self:initGenerateSkillEffect()
self:initSelectSkillNode()
end end
function BattleUI:_addListeners() function BattleUI:_addListeners()
@ -1581,6 +1583,24 @@ function BattleUI:showTutorialFinger(posIdList)
self.showTutorialFingerSeq:SetLoops(-1) self.showTutorialFingerSeq:SetLoops(-1)
end 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() function BattleUI:clear()
if self.alreadyClear then if self.alreadyClear then
return return