This commit is contained in:
xiekaidong 2023-04-23 12:10:27 +08:00
commit 73ad9f50f3
2 changed files with 13 additions and 5 deletions

View File

@ -1,6 +1,6 @@
local BottomBtnCell = class("BottomBtnCell", BaseCell)
function BottomBtnCell:refresh(desc, selected)
function BottomBtnCell:refresh(desc, selected, showAni)
self.selected = selected
local uiMap = self:getUIMap()
local icon = uiMap["bottom_btn_cell.icon"]
@ -11,7 +11,13 @@ function BottomBtnCell:refresh(desc, selected)
local pos = -64
icon:setLocalPositionY(pos)
if selected then
GFunc.goTargetElasticityY(icon,nil, 12,0.6)
if showAni then
GFunc.goTargetElasticityY(icon,nil, 12,0.6)
else
GFunc.goTargetElasticityY(icon, true)
icon:setLocalPositionY(pos + 12*2)
icon:setLocalScale(iconScale, iconScale, iconScale)
end
else
icon:setLocalScale(iconScale, iconScale, iconScale)
end

View File

@ -219,13 +219,15 @@ function MainCityUI:refreshBottom(selectedIndex, playAnim)
local isLeft = self.selectedIndex < oldIndex
local offset = isLeft and -20 or 20
GFunc.goTargetPosXShake(self.bottomBgSelected, nil, targetX, offset)
self:refreshBottomCell()
self:refreshBottomCell(true)
else
self:refreshBottomCell(false)
end
end
function MainCityUI:refreshBottomCell()
function MainCityUI:refreshBottomCell(showAni)
for i, cell in ipairs(self.bottomBtnCells) do
cell:refresh(I18N:getGlobalText("MAIN_BTN_" .. i), i == self.selectedIndex, i)
cell:refresh(I18N:getGlobalText("MAIN_BTN_" .. i), i == self.selectedIndex, showAni)
end
end