主界面
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 CHAPTER_COMP = "app/ui/main_city/component/chapter_comp"
|
||||||
local DAILY_CHALLENGE_COMP = "app/ui/main_city/component/daily_challenge_comp"
|
local DAILY_CHALLENGE_COMP = "app/ui/main_city/component/daily_challenge_comp"
|
||||||
|
|
||||||
|
local BOTTOM_HEIGHT = 120
|
||||||
|
|
||||||
function MainComp:init()
|
function MainComp:init()
|
||||||
self.uiMap = self:getBaseObject():genAllChildren()
|
self.uiMap = self:getBaseObject():genAllChildren()
|
||||||
|
|
||||||
@ -39,6 +41,11 @@ function MainComp:refreshModule(selectModule)
|
|||||||
for idx, cell in pairs(self.moduleMap) do
|
for idx, cell in pairs(self.moduleMap) do
|
||||||
cell:getBaseObject():setActive(self.curModuleType == idx)
|
cell:getBaseObject():setActive(self.curModuleType == idx)
|
||||||
end
|
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()
|
self:refreshBtns()
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -60,6 +67,7 @@ function MainComp:refreshFightBtn()
|
|||||||
end
|
end
|
||||||
|
|
||||||
self.uiMap["main_comp.fight_btn"]:addClickListener(moduleCell.onClickFight)
|
self.uiMap["main_comp.fight_btn"]:addClickListener(moduleCell.onClickFight)
|
||||||
|
self.uiMap["main_comp.fight_btn"]:setAnchoredPositionY(self.btnPosY)
|
||||||
|
|
||||||
local remainCount = moduleCell:getTodayRemainCount()
|
local remainCount = moduleCell:getTodayRemainCount()
|
||||||
if remainCount >= 0 then
|
if remainCount >= 0 then
|
||||||
@ -75,6 +83,7 @@ function MainComp:refreshLeftBtn()
|
|||||||
self.leftBtn = self.uiMap["main_comp.left_btn"]
|
self.leftBtn = self.uiMap["main_comp.left_btn"]
|
||||||
end
|
end
|
||||||
self.leftBtn:setActive(false)
|
self.leftBtn:setActive(false)
|
||||||
|
self.leftBtn:setAnchoredPositionY(self.btnPosY)
|
||||||
|
|
||||||
local leftIdx = self:getCurLeftModuleIdx()
|
local leftIdx = self:getCurLeftModuleIdx()
|
||||||
if leftIdx == nil then
|
if leftIdx == nil then
|
||||||
@ -104,6 +113,7 @@ function MainComp:refreshRightBtn()
|
|||||||
self.rightBtn = self.uiMap["main_comp.right_btn"]
|
self.rightBtn = self.uiMap["main_comp.right_btn"]
|
||||||
end
|
end
|
||||||
self.rightBtn:setActive(false)
|
self.rightBtn:setActive(false)
|
||||||
|
self.rightBtn:setAnchoredPositionY(self.btnPosY)
|
||||||
|
|
||||||
local rightIdx = self:getCurRightModuleIdx()
|
local rightIdx = self:getCurRightModuleIdx()
|
||||||
if rightIdx == nil then
|
if rightIdx == nil then
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user