主界面
This commit is contained in:
parent
7151a033d7
commit
8b17dabbf1
@ -2,6 +2,8 @@ local MainComp = class("MainComp", LuaComponent)
|
||||
local CHAPTER_COMP = "app/ui/main_city/component/chapter_comp"
|
||||
local DAILY_CHALLENGE_COMP = "app/ui/main_city/component/daily_challenge_comp"
|
||||
|
||||
local BOTTOM_HEIGHT = 120
|
||||
|
||||
function MainComp:init()
|
||||
self.uiMap = self:getBaseObject():genAllChildren()
|
||||
|
||||
@ -39,6 +41,11 @@ function MainComp:refreshModule(selectModule)
|
||||
for idx, cell in pairs(self.moduleMap) do
|
||||
cell:getBaseObject():setActive(self.curModuleType == idx)
|
||||
end
|
||||
local heroBg = self.uiMap["main_comp.hero_bg"]
|
||||
local heroBgPosY = heroBg:fastGetAnchoredPositionY()
|
||||
local sWidth, sHeight = GFunc.getUIExpandScreenSize()
|
||||
local hSHeight = sHeight / 2
|
||||
self.btnPosY = (heroBgPosY + (BOTTOM_HEIGHT / 2 - hSHeight)) / 2
|
||||
self:refreshBtns()
|
||||
end
|
||||
|
||||
@ -60,6 +67,7 @@ function MainComp:refreshFightBtn()
|
||||
end
|
||||
|
||||
self.uiMap["main_comp.fight_btn"]:addClickListener(moduleCell.onClickFight)
|
||||
self.uiMap["main_comp.fight_btn"]:setAnchoredPositionY(self.btnPosY)
|
||||
|
||||
local remainCount = moduleCell:getTodayRemainCount()
|
||||
if remainCount >= 0 then
|
||||
@ -75,6 +83,7 @@ function MainComp:refreshLeftBtn()
|
||||
self.leftBtn = self.uiMap["main_comp.left_btn"]
|
||||
end
|
||||
self.leftBtn:setActive(false)
|
||||
self.leftBtn:setAnchoredPositionY(self.btnPosY)
|
||||
|
||||
local leftIdx = self:getCurLeftModuleIdx()
|
||||
if leftIdx == nil then
|
||||
@ -104,6 +113,7 @@ function MainComp:refreshRightBtn()
|
||||
self.rightBtn = self.uiMap["main_comp.right_btn"]
|
||||
end
|
||||
self.rightBtn:setActive(false)
|
||||
self.rightBtn:setAnchoredPositionY(self.btnPosY)
|
||||
|
||||
local rightIdx = self:getCurRightModuleIdx()
|
||||
if rightIdx == nil then
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user