From c71e0cd4d005f088e69052fec9680e1b8bb99aec Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Tue, 25 Jul 2023 23:13:59 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dungeon_armor/dungeon_armor_main_ui.lua | 42 +++++++++++-------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/lua/app/ui/dungeon_armor/dungeon_armor_main_ui.lua b/lua/app/ui/dungeon_armor/dungeon_armor_main_ui.lua index 0092504f..793867f4 100644 --- a/lua/app/ui/dungeon_armor/dungeon_armor_main_ui.lua +++ b/lua/app/ui/dungeon_armor/dungeon_armor_main_ui.lua @@ -195,27 +195,33 @@ function DungeonArmorMainUI:refreshBG(chapterId, index) end local obj - if isUp then - local y1 = self.bg1:fastGetAnchoredPositionY() - local y2 = self.bg2:fastGetAnchoredPositionY() - if y1 == y2 then - obj = self.bg1 - elseif y1 < y2 then - obj = self.bg1 + local y1 = self.bg1:fastGetAnchoredPositionY() + local y2 = self.bg2:fastGetAnchoredPositionY() + if y1 == -1 then + obj = self.bg1 + elseif y2 == -1 then + obj = self.bg2 + end + if not obj then + if isUp then + if y1 == y2 then + obj = self.bg1 + elseif y1 < y2 then + obj = self.bg1 + else + obj = self.bg2 + end else - obj = self.bg2 - end - else - local y1 = self.bg1:fastGetAnchoredPositionY() - local y2 = self.bg2:fastGetAnchoredPositionY() - if y1 == y2 then - obj = self.bg2 - elseif y1 < y2 then - obj = self.bg2 - else - obj = self.bg1 + if y1 == y2 then + obj = self.bg2 + elseif y1 < y2 then + obj = self.bg2 + else + obj = self.bg1 + end end end + if self.bgNames[obj] ~= bgName then obj:setTexture("assets/arts/textures/background/dungeon_armor/" .. bgName .. ".png") self.bgNames[obj] = bgName