This commit is contained in:
puxuan 2025-08-19 17:12:25 +08:00
parent 36cdeeee11
commit 1f552c4a41
2 changed files with 8 additions and 9 deletions

View File

@ -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 BATTLE_COMMON_PATH = "assets/arts/textures/background/battle_common/%s.png"
local GRID_EDGE_CELL = "app/ui/battle/cell/grid_edge_cell" 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_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 BOARD_SFX_ORDER = GConst.UI_EFFECT_ORDER.LEVEL4 + 1
local SIDE_ATK = GConst.BattleConst.SIDE_ATK local SIDE_ATK = GConst.BattleConst.SIDE_ATK
@ -1197,8 +1197,12 @@ function BattleBaseUI:refreshSkill(elementMap, showSfx, side)
end end
function BattleBaseUI:initChapterBg() function BattleBaseUI:initChapterBg()
CellManager:loadCellAsync(CHAPTER_BG_PATH, CHAPTER_BG_COMP, self.mapNode, function(cell) local chapterId = DataManager.ChapterData:getChapterId()
-- cell:getBaseObject():setAnchoredPositionY(738) 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() cell:pause()
self.chapterMapBg = cell self.chapterMapBg = cell
end) end)

View File

@ -14,6 +14,7 @@ local CacheVector2 = CS.UnityEngine.Vector2(0, 0)
function BattleUI:initBaseInfo() function BattleUI:initBaseInfo()
local uiMap = self.root:genAllChildren() local uiMap = self.root:genAllChildren()
self.uiMap = uiMap self.uiMap = uiMap
self.bg = uiMap["battle_ui.battle_root.bg"]
self.gridNode = uiMap["battle_ui.bg_2.board_node.grid_node"] self.gridNode = uiMap["battle_ui.bg_2.board_node.grid_node"]
self.boardNode = uiMap["battle_ui.bg_2.board_node"] self.boardNode = uiMap["battle_ui.bg_2.board_node"]
self.boardCenterNode = uiMap["battle_ui.bg_2.board_node.board_center_node"] self.boardCenterNode = uiMap["battle_ui.bg_2.board_node.board_center_node"]
@ -59,12 +60,6 @@ function BattleUI:initBaseInfo()
end end
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() function BattleUI:initSkill()
local uiMap = self.root:genAllChildren() local uiMap = self.root:genAllChildren()
local atkNode = uiMap["battle_ui.bg_2.skill_node"] local atkNode = uiMap["battle_ui.bg_2.skill_node"]