From 53d639cc3fb26c08a9242421f082d9c4722a89aa Mon Sep 17 00:00:00 2001 From: chenxi Date: Sun, 23 Apr 2023 12:09:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BB=E5=9F=8E=E5=BA=95=E9=83=A8=E5=8A=A8?= =?UTF-8?q?=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/ui/main_city/cell/bottom_btn_cell.lua | 10 ++++++++-- lua/app/ui/main_city/main_city_ui.lua | 8 +++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/lua/app/ui/main_city/cell/bottom_btn_cell.lua b/lua/app/ui/main_city/cell/bottom_btn_cell.lua index 8aa1dc97..b47bead0 100644 --- a/lua/app/ui/main_city/cell/bottom_btn_cell.lua +++ b/lua/app/ui/main_city/cell/bottom_btn_cell.lua @@ -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 diff --git a/lua/app/ui/main_city/main_city_ui.lua b/lua/app/ui/main_city/main_city_ui.lua index 35bbed94..1abe0693 100644 --- a/lua/app/ui/main_city/main_city_ui.lua +++ b/lua/app/ui/main_city/main_city_ui.lua @@ -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