主界面
This commit is contained in:
parent
4b621b0e07
commit
b33b241e53
@ -4,6 +4,7 @@ local CHAPTER_PATH = "assets/arts/textures/background/chapter/%s.png"
|
||||
function MainComp:init()
|
||||
self.uiMap = self:getBaseObject():genAllChildren()
|
||||
self:initChapter()
|
||||
self:initStageFormation()
|
||||
self:initGM()
|
||||
end
|
||||
|
||||
@ -28,6 +29,16 @@ function MainComp:initChapter()
|
||||
end)
|
||||
end
|
||||
|
||||
function MainComp:initStageFormation()
|
||||
self.heroCells = {
|
||||
self.uiMap["main_comp.hero_bg.hero_cell_1"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.HERO_CELL),
|
||||
self.uiMap["main_comp.hero_bg.hero_cell_2"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.HERO_CELL),
|
||||
self.uiMap["main_comp.hero_bg.hero_cell_3"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.HERO_CELL),
|
||||
self.uiMap["main_comp.hero_bg.hero_cell_4"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.HERO_CELL),
|
||||
self.uiMap["main_comp.hero_bg.hero_cell_5"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.HERO_CELL),
|
||||
}
|
||||
end
|
||||
|
||||
function MainComp:initGM()
|
||||
self.btnGM = self.uiMap["main_comp.gm_btn"]
|
||||
self.btnGM:setVisible(not Platform:getIsPublishChannel(), 2)
|
||||
@ -38,6 +49,7 @@ end
|
||||
|
||||
function MainComp:refresh()
|
||||
self:refreshChapter()
|
||||
self:refreshStageFormaion()
|
||||
end
|
||||
|
||||
function MainComp:onFightBtnClick()
|
||||
@ -59,4 +71,20 @@ function MainComp:refreshChapter()
|
||||
end
|
||||
end
|
||||
|
||||
function MainComp:refreshStageFormaion()
|
||||
local formation = DataManager.FormationData:getStageFormation()
|
||||
for i, heroCell in ipairs(self.heroCells) do
|
||||
if formation[i] then
|
||||
local heroEntity = DataManager.HeroData:getHeroById(formation[i])
|
||||
if heroEntity then
|
||||
heroCell:refresh(heroEntity)
|
||||
else
|
||||
heroCell:setVisible(false)
|
||||
end
|
||||
else
|
||||
heroCell:setVisible(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return MainComp
|
||||
Loading…
x
Reference in New Issue
Block a user