主城资源栏
This commit is contained in:
parent
7005bd8c0f
commit
2a8dd6bbca
@ -272,6 +272,26 @@ function MainCityUI:initLeftRightBtns()
|
||||
if self.sideBarCellMap == nil then
|
||||
self.sideBarCellMap = {}
|
||||
end
|
||||
self:recycleSideBarCells(self.leftSideBar)
|
||||
self:recycleSideBarCells(self.rightSideBar)
|
||||
end
|
||||
|
||||
function MainCityUI:recycleSideBarCells(list)
|
||||
local childList = list:getChildList()
|
||||
if childList and #childList > 0 then
|
||||
local count = #childList
|
||||
for i = count, 1, -1 do
|
||||
local child = childList[i]
|
||||
local name = child:getName()
|
||||
if name and name ~= "" then
|
||||
child:setVisible(false)
|
||||
self.sideBarCellMap[name] = child:getLuaComponent(name)
|
||||
else
|
||||
child:destroy()
|
||||
table.remove(childList, i)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function MainCityUI:addSideBarCellComp(cellClassPath)
|
||||
@ -280,6 +300,7 @@ function MainCityUI:addSideBarCellComp(cellClassPath)
|
||||
prefabObject:initWithPrefab(GConst.EMPTY_STRING, prefab)
|
||||
prefabObject:initPrefabHelper()
|
||||
prefabObject:genAllChildren()
|
||||
prefabObject:setName(cellClassPath)
|
||||
return prefabObject:addLuaComponent(cellClassPath)
|
||||
end
|
||||
|
||||
@ -377,6 +398,7 @@ function MainCityUI:refreshRightBtns()
|
||||
else
|
||||
for k, v in ipairs(self.rightBarList) do
|
||||
v:setAnchoredPositionY(y)
|
||||
v:setVisible(true)
|
||||
v:refresh()
|
||||
y = y - self.sideBarHeight - 2
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user