c1_lua/lua/app/ui/arena/arena_formation_ui.lua
2023-06-28 18:36:53 +08:00

67 lines
1.7 KiB
Lua

-- 竞技场:调整阵容
local ArenaFormationUI = class("ArenaFormationUI", BaseUI)
function ArenaFormationUI:isFullScreen()
return false
end
function ArenaFormationUI:showCommonBG()
return false
end
function ArenaFormationUI:getPrefabPath()
return "assets/prefabs/ui/arena/arena_formation_ui.prefab"
end
function ArenaFormationUI:onPressBackspace()
self:closeUI()
end
function ArenaFormationUI:ctor(params)
self.formationType = params
end
function ArenaFormationUI:onCover()
end
function ArenaFormationUI:onReshow()
end
function ArenaFormationUI:onClose()
end
function ArenaFormationUI:onLoadRootComplete()
local uiMap = self.root:genAllChildren()
uiMap["arena_formation_ui.banner.btn_ok.tx_ok"]:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_24))
uiMap["arena_formation_ui.banner.btn_ok"]:addClickListener(function()
ModuleManager.FormationManager:reqArenaFormation()
if self.isMatch then
UIManager:showUI("app/ui/arena/arena_match_ui", true)
end
self:closeUI()
end)
local heroUI = uiMap["arena_formation_ui.hero_ui"]
heroUI:initPrefabHelper()
heroUI:genAllChildren()
self.heroComp = heroUI:addLuaComponent("app/ui/hero/hero_comp")
self:bind(DataManager.HeroData, "isDirty", function()
self:onRefresh()
end)
self:bind(DataManager.BagData.ItemData, "dirty", function()
self:onRefresh()
end)
end
function ArenaFormationUI:onRefresh()
if self.formationType == GConst.BattleConst.FORMATION_TYPE.ARENA_ATTACK then
-- 从匹配界面进来的
self.isMatch = true
end
self.heroComp:refresh(self.formationType)
end
return ArenaFormationUI