diff --git a/lua/app/global/global_const.lua b/lua/app/global/global_const.lua index 8d3419d1..412c30d2 100644 --- a/lua/app/global/global_const.lua +++ b/lua/app/global/global_const.lua @@ -157,6 +157,7 @@ GConst.TYPEOF_UNITY_CLASS = { BF_UNITY_SLIDER = typeof(CS.BF.BFUnitySlider), BF_ELIMINATION_TOUCH_EVENT = typeof(CS.BF.EliminationTouchEvent), BF_UI_SPINE_HELPER = typeof(CS.BF.UISpineHelper), + BF_CANVAS_SORTING_ORDER_HELPER = typeof(CS.BF.CanvasSortingOrderHelper), } -- lua 组件 diff --git a/lua/app/ui/battle/battle_ui.lua b/lua/app/ui/battle/battle_ui.lua index 9a809c9c..7a4e33b5 100644 --- a/lua/app/ui/battle/battle_ui.lua +++ b/lua/app/ui/battle/battle_ui.lua @@ -29,6 +29,21 @@ function BattleUI:initBaseInfo() self.aniNode = uiMap["battle_ui.bg_2.ani_node"] self.gridEdgeNode = uiMap["battle_ui.bg_2.board_node.board_center_node.grid_edge_node"] self.gridEdgeCacheCell = uiMap["battle_ui.cache_node.grid_edge_cell"] + self.topNode = uiMap["battle_ui.top_node"] + + if self.topNode then + local comp = self.topNode:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_CANVAS_SORTING_ORDER_HELPER) + if not comp then + comp = self.topNode:addComponent(GConst.TYPEOF_UNITY_CLASS.BF_CANVAS_SORTING_ORDER_HELPER) + end + local gr = self.topNode:getComponent(GConst.TYPEOF_UNITY_CLASS.GRAPHIC_RAYCASTER) + if not gr then + self.topNode:addComponent(GConst.TYPEOF_UNITY_CLASS.GRAPHIC_RAYCASTER) + end + if comp then + comp:SetSortingOrder(self:getUIOrder(), 12) + end + end end function BattleUI:initBg()