diff --git a/lua/app/ui/battle/battle_base_ui.lua b/lua/app/ui/battle/battle_base_ui.lua index d3e0ffd4..0fd7ba6c 100644 --- a/lua/app/ui/battle/battle_base_ui.lua +++ b/lua/app/ui/battle/battle_base_ui.lua @@ -10,7 +10,7 @@ local BG_PATH = "assets/arts/textures/background/battle/%s.png" local BATTLE_COMMON_PATH = "assets/arts/textures/background/battle_common/%s.png" local GRID_EDGE_CELL = "app/ui/battle/cell/grid_edge_cell" local CHAPTER_BG_COMP = "app/ui/battle/battle_chapter_bg_comp" -local CHAPTER_BG_PATH = "assets/prefabs/ui/chapter/chapter_1_1.prefab" +local CHAPTER_BG_PATH = "assets/prefabs/ui/chapter/%s_1.prefab" local BOARD_SFX_ORDER = GConst.UI_EFFECT_ORDER.LEVEL4 + 1 local SIDE_ATK = GConst.BattleConst.SIDE_ATK @@ -1197,8 +1197,12 @@ function BattleBaseUI:refreshSkill(elementMap, showSfx, side) end function BattleBaseUI:initChapterBg() - CellManager:loadCellAsync(CHAPTER_BG_PATH, CHAPTER_BG_COMP, self.mapNode, function(cell) - -- cell:getBaseObject():setAnchoredPositionY(738) + local chapterId = DataManager.ChapterData:getChapterId() + local icon = DataManager.ChapterData:getChapterCfg()[chapterId].icon + local scene = DataManager.ChapterData:getChapterCfg()[chapterId].scene + self.bg:setSprite(GConst.ATLAS_PATH.UI_CHAPTER, scene) + local bgPath = string.format(CHAPTER_BG_PATH, icon) + CellManager:loadCellAsync(bgPath, CHAPTER_BG_COMP, self.mapNode, function(cell) cell:pause() self.chapterMapBg = cell end) diff --git a/lua/app/ui/battle/battle_ui.lua b/lua/app/ui/battle/battle_ui.lua index d8339f59..a32aed26 100644 --- a/lua/app/ui/battle/battle_ui.lua +++ b/lua/app/ui/battle/battle_ui.lua @@ -14,6 +14,7 @@ local CacheVector2 = CS.UnityEngine.Vector2(0, 0) function BattleUI:initBaseInfo() local uiMap = self.root:genAllChildren() self.uiMap = uiMap + self.bg = uiMap["battle_ui.battle_root.bg"] self.gridNode = uiMap["battle_ui.bg_2.board_node.grid_node"] self.boardNode = uiMap["battle_ui.bg_2.board_node"] self.boardCenterNode = uiMap["battle_ui.bg_2.board_node.board_center_node"] @@ -59,12 +60,6 @@ function BattleUI:initBaseInfo() end end -function BattleUI:initBg() - self.bg = self.uiMap["battle_ui.battle_root.bg"] - -- self.bg:setLocalScale(0, 0, 0) - -- local width = self.bg:fastGetSizeDelta() - -- self.bg:setAnchoredPositionX(width/4) -end function BattleUI:initSkill() local uiMap = self.root:genAllChildren() local atkNode = uiMap["battle_ui.bg_2.skill_node"]