/// <summary> /// 隐藏GrayScreen, /// </summary> /// <param name="wnd"></param> public static void HideGrayScreen(UI3Wnd wnd) { if (wnd == null || wnd.gameObject == null || wnd.WndType != UI3WndType.PopUp || wnd.GetClassName() == "UIGrayScreen") { return; } UIGrayScreen grayWnd = findWindow <UIGrayScreen>(); if (grayWnd == null) { return; } string panelLayer = GetPanelLayer(wnd.GetClassName()); UIStack <string> stack = GetStackByPanelLayer(panelLayer); if (stack == null) { return; } UI3Wnd lastWnd = GetLastGrayScreen(stack); if (lastWnd == null) { grayWnd.setActive(false); } else { ShowGrayScreen(lastWnd); } }
/// <summary> /// 显示GrayScreen, /// </summary> /// <param name="wnd"></param> /// <param name="OnClickGrayScreen"></param> public static void ShowGrayScreen(UI3Wnd wnd, System.Action OnClickGrayScreen = null) { if (wnd == null || wnd.gameObject == null || wnd.WndType != UI3WndType.PopUp || wnd.GetClassName() == "UIGrayScreen") { return; } UIGrayScreen grayWnd = createWindow <UIGrayScreen>(); if (grayWnd == null) { return; } grayWnd.OnClickEventCallback = OnClickGrayScreen != null ? OnClickGrayScreen : wnd.OnClickGrayScreen; grayWnd.Wnd = wnd.gameObject; int depth = wnd.getMinDepth(); grayWnd.setDepth(depth - 1); grayWnd.setActive(true); }