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