Merge branch 'dev' of http://git.juzugame.com/b6-client/b6-lua into dev
This commit is contained in:
commit
e3420eeb8a
@ -634,6 +634,13 @@ function UIPrefabObject:setClickAnimation(enable)
|
||||
end
|
||||
end
|
||||
|
||||
function UIPrefabObject:stopClickAnimation()
|
||||
local eventListener = self:getComponent(BF_UI_TOUCH_EVENT)
|
||||
if eventListener then
|
||||
eventListener:StopTouchAnimation()
|
||||
end
|
||||
end
|
||||
|
||||
function UIPrefabObject:setTouchEnable(enable)
|
||||
local maskableGraphic = self:getComponent(UI_MASKABLE_GRAPHIC)
|
||||
if maskableGraphic then
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
local MainCityConst = {}
|
||||
|
||||
MainCityConst.SIDE_BAR_MIN_COUNT = 3
|
||||
|
||||
MainCityConst.BOTTOM_PAGE = {
|
||||
MAIN = 1,
|
||||
HERO = 2,
|
||||
|
||||
@ -440,20 +440,26 @@ function MainCityUI:refreshLeftBtns()
|
||||
table.insert(self.leftBarList, cell)
|
||||
end
|
||||
end
|
||||
if #self.leftBarList <= 0 then
|
||||
local sideBarShowCount = #self.leftBarList
|
||||
if sideBarShowCount <= 0 then
|
||||
self.leftNode:setAnchoredPositionX(GConst.NOT_VISIBLE_POS)
|
||||
return
|
||||
end
|
||||
self.leftNode:setAnchoredPositionX(0)
|
||||
local y = -SIDE_BAR_BORDER_OFFSET - self.sideBarHeight/2
|
||||
if isClose then -- 只显示一个
|
||||
local first = self.leftBarList[1]
|
||||
first:setAnchoredPositionY(y)
|
||||
first:refresh()
|
||||
first:setActive(true)
|
||||
first:setVisible(true)
|
||||
y = y - self.sideBarHeight - SIDE_BAR_INTERVAL
|
||||
for i = 2, #self.leftBarList do
|
||||
if isClose then -- 只显示3个
|
||||
local minCount = GConst.MainCityConst.SIDE_BAR_MIN_COUNT
|
||||
for i = 1, minCount do
|
||||
local sideBarBtn = self.leftBarList[i]
|
||||
if i <= sideBarShowCount then
|
||||
sideBarBtn:setAnchoredPositionY(y)
|
||||
sideBarBtn:refresh()
|
||||
sideBarBtn:setActive(true)
|
||||
sideBarBtn:setVisible(true)
|
||||
y = y - self.sideBarHeight - SIDE_BAR_INTERVAL
|
||||
end
|
||||
end
|
||||
for i = minCount + 1, sideBarShowCount do
|
||||
self.leftBarList[i]:refresh()
|
||||
self.leftBarList[i]:setActive(true)
|
||||
self.leftBarList[i]:setVisible(false)
|
||||
@ -467,11 +473,18 @@ function MainCityUI:refreshLeftBtns()
|
||||
y = y - self.sideBarHeight - SIDE_BAR_INTERVAL
|
||||
end
|
||||
end
|
||||
local arrowHeight = self.leftArrowBtn:getRectHeight()
|
||||
y = y + self.sideBarHeight/2 - SIDE_BAR_ARROW_INTERVAL - arrowHeight
|
||||
self.leftSideBar:setSizeDeltaY(-y)
|
||||
self.leftArrowImg:setLocalScale(1, isClose and -1 or 1, 1)
|
||||
self.leftArrowBtn:setAnchoredPositionY(self.leftSideBar:fastGetAnchoredPositionY() + y + arrowHeight/2 + SIDE_BAR_BORDER_OFFSET)
|
||||
if sideBarShowCount <= GConst.MainCityConst.SIDE_BAR_MIN_COUNT then -- 小于3个不显示箭头
|
||||
y = y + self.sideBarHeight / 2
|
||||
self.leftSideBar:setSizeDeltaY(-y)
|
||||
self.leftArrowBtn:stopClickAnimation()
|
||||
self.leftArrowBtn:setVisible(false)
|
||||
else
|
||||
local arrowHeight = self.leftArrowBtn:getRectHeight()
|
||||
y = y + self.sideBarHeight/2 - SIDE_BAR_ARROW_INTERVAL - arrowHeight
|
||||
self.leftSideBar:setSizeDeltaY(-y)
|
||||
self.leftArrowImg:setLocalScale(1, isClose and -1 or 1, 1)
|
||||
self.leftArrowBtn:setAnchoredPositionY(self.leftSideBar:fastGetAnchoredPositionY() + y + arrowHeight/2 + SIDE_BAR_BORDER_OFFSET)
|
||||
end
|
||||
end
|
||||
|
||||
function MainCityUI:openOrCloseRightSideBar()
|
||||
@ -506,6 +519,7 @@ function MainCityUI:refreshRightBtns()
|
||||
table.insert(self.rightBarList, cell)
|
||||
end
|
||||
end
|
||||
local sideBarShowCount = #self.rightBarList
|
||||
if #self.rightBarList <= 0 then
|
||||
self.rightNode:setAnchoredPositionX(GConst.NOT_VISIBLE_POS)
|
||||
return
|
||||
@ -513,13 +527,18 @@ function MainCityUI:refreshRightBtns()
|
||||
self.rightNode:setAnchoredPositionX(0)
|
||||
local y = -SIDE_BAR_BORDER_OFFSET - self.sideBarHeight/2
|
||||
if isClose then -- 只显示一个
|
||||
local first = self.rightBarList[1]
|
||||
first:setAnchoredPositionY(y)
|
||||
first:refresh()
|
||||
first:setActive(true)
|
||||
first:setVisible(true)
|
||||
y = y - self.sideBarHeight - SIDE_BAR_INTERVAL
|
||||
for i = 2, #self.rightBarList do
|
||||
local minCount = GConst.MainCityConst.SIDE_BAR_MIN_COUNT
|
||||
for i = 1, minCount do
|
||||
local sideBarBtn = self.rightBarList[i]
|
||||
if i <= sideBarShowCount then
|
||||
sideBarBtn:setAnchoredPositionY(y)
|
||||
sideBarBtn:refresh()
|
||||
sideBarBtn:setActive(true)
|
||||
sideBarBtn:setVisible(true)
|
||||
y = y - self.sideBarHeight - SIDE_BAR_INTERVAL
|
||||
end
|
||||
end
|
||||
for i = minCount + 1, sideBarShowCount do
|
||||
self.rightBarList[i]:refresh()
|
||||
self.rightBarList[i]:setActive(true)
|
||||
self.rightBarList[i]:setVisible(false)
|
||||
@ -533,11 +552,18 @@ function MainCityUI:refreshRightBtns()
|
||||
y = y - self.sideBarHeight - SIDE_BAR_INTERVAL
|
||||
end
|
||||
end
|
||||
local arrowHeight = self.rightArrowBtn:getRectHeight()
|
||||
y = y + self.sideBarHeight / 2 - SIDE_BAR_ARROW_INTERVAL - arrowHeight
|
||||
self.rightSideBar:setSizeDeltaY(-y)
|
||||
self.rightArrowImg:setLocalScale(1, isClose and -1 or 1, 1)
|
||||
self.rightArrowBtn:setAnchoredPositionY(self.rightSideBar:fastGetAnchoredPositionY() + y + arrowHeight/2 + SIDE_BAR_BORDER_OFFSET)
|
||||
if sideBarShowCount <= GConst.MainCityConst.SIDE_BAR_MIN_COUNT then
|
||||
y = y + self.sideBarHeight / 2
|
||||
self.rightSideBar:setSizeDeltaY(-y)
|
||||
self.rightArrowBtn:stopClickAnimation()
|
||||
self.rightArrowBtn:setVisible(false)
|
||||
else
|
||||
local arrowHeight = self.rightArrowBtn:getRectHeight()
|
||||
y = y + self.sideBarHeight / 2 - SIDE_BAR_ARROW_INTERVAL - arrowHeight
|
||||
self.rightSideBar:setSizeDeltaY(-y)
|
||||
self.rightArrowImg:setLocalScale(1, isClose and -1 or 1, 1)
|
||||
self.rightArrowBtn:setAnchoredPositionY(self.rightSideBar:fastGetAnchoredPositionY() + y + arrowHeight/2 + SIDE_BAR_BORDER_OFFSET)
|
||||
end
|
||||
end
|
||||
|
||||
function MainCityUI:clearSideBarList(sideBarList)
|
||||
@ -712,15 +738,21 @@ end
|
||||
|
||||
function MainCityUI:updateSideBarStatus()
|
||||
if self.leftBarList then
|
||||
local first = self.leftBarList[1]
|
||||
if first then
|
||||
if first:getIsShowRedPoint() then
|
||||
first:showRedPoint()
|
||||
else
|
||||
first:hideRedPoint()
|
||||
local minCount = GConst.MainCityConst.SIDE_BAR_MIN_COUNT
|
||||
for i = 1, minCount do
|
||||
local sideBarBtn = self.leftBarList[i]
|
||||
if sideBarBtn then
|
||||
if sideBarBtn:getIsShowRedPoint() then
|
||||
sideBarBtn:showRedPoint()
|
||||
else
|
||||
sideBarBtn:hideRedPoint()
|
||||
end
|
||||
end
|
||||
end
|
||||
local sideBarCount = #self.leftBarList
|
||||
if sideBarCount > minCount then
|
||||
local count = 0
|
||||
for i = 2, #self.leftBarList do
|
||||
for i = minCount + 1, sideBarCount do
|
||||
if self.leftBarList[i]:getIsShowRedPoint() then
|
||||
self.leftBarList[i]:showRedPoint()
|
||||
count = count + 1
|
||||
@ -738,15 +770,21 @@ function MainCityUI:updateSideBarStatus()
|
||||
end
|
||||
end
|
||||
if self.rightBarList then
|
||||
local first = self.rightBarList[1]
|
||||
if first then
|
||||
if first:getIsShowRedPoint() then
|
||||
first:showRedPoint()
|
||||
else
|
||||
first:hideRedPoint()
|
||||
local minCount = GConst.MainCityConst.SIDE_BAR_MIN_COUNT
|
||||
for i = 1, minCount do
|
||||
local sideBarBtn = self.rightBarList[i]
|
||||
if sideBarBtn then
|
||||
if sideBarBtn:getIsShowRedPoint() then
|
||||
sideBarBtn:showRedPoint()
|
||||
else
|
||||
sideBarBtn:hideRedPoint()
|
||||
end
|
||||
end
|
||||
end
|
||||
local sideBarCount = #self.rightBarList
|
||||
if sideBarCount > minCount then
|
||||
local count = 0
|
||||
for i = 2, #self.rightBarList do
|
||||
for i = minCount + 1, sideBarCount do
|
||||
if self.rightBarList[i]:getIsShowRedPoint() then
|
||||
self.rightBarList[i]:showRedPoint()
|
||||
count = count + 1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user