c1_lua/lua/app/ui/battle/battle_skill_select_ui.lua
2023-04-11 17:26:02 +08:00

47 lines
1.3 KiB
Lua

local BattleSkillSelectUI = class("BattleSkillSelectUI", BaseUI)
local SELECT_SKILL_CELL = "app/ui/battle/cell/battle_select_skill_cell"
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()
local uiMap = self.root:genAllChildren()
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)
end
end
for index, cell in ipairs(self.selectSkillCells) do
local skillId = self.skillList[index]
cell:getBaseObject():setActive(skillId ~= nil)
if skillId then
cell:refresh(skillId, function()
self:onClickSkill(skillId)
end)
end
end
end
function BattleSkillSelectUI:onClickSkill(skillId)
Logger.logHighlight(skillId)
ModuleManager.BattleManager:onSelectSkill(skillId)
self:closeUI()
end
return BattleSkillSelectUI