void HandleLayerAddBlackMaskBehind() { object targetPanel = null; int targetPanelSortingOrder = 0; for (int i = EnumUtil.GetCount <EUILayerName>() - 1; i >= 0; i--) { EUILayerName uiLayerName = (EUILayerName)i; var uiLayer = Client.instance.uiManager.uiLayerManager.GetUILayer(uiLayerName); if (uiLayer.graphicComponent.IsShow() && uiLayer.uiLayerConfig.uiLayerRule.IsAddBlackMaskBehind()) { for (int j = uiLayer.panelList.Count - 1; j >= 0; j--) { var panel = uiLayer.panelList[j]; if (panel is UIPanel uiPanel) { if (!uiPanel.isHideBlackMaskBehind) { targetPanel = uiPanel; targetPanelSortingOrder = uiPanel.sortingOrder; break; } } else { LuaTable panelLuaTable = (LuaTable)panel; if (!panelLuaTable.InvokeFunc <bool>("IsHideBlackMaskBehind")) { targetPanel = panel; targetPanelSortingOrder = panelLuaTable.InvokeFunc <int>("GetSortingOrder"); break; } } } } } if (targetPanel == null) { this.Broadcast(null, UIEventNameConst.HideUIBlackMask); } else { this.Broadcast(null, UIEventNameConst.ShowUIBlackMask, targetPanelSortingOrder, targetPanel); } }