/// <summary> /// 出栈需要返回界面(栈顶),显示界面, /// </summary> /// <param name="wnd"></param> public static void BackPopup(string name) { UI3WndType type = GetWndType(name); if (UI3WndType.ReturnFullScreen != type) { return; } UIStack <string> stack = GetStackByWndName(name); string lastName = Peek(stack); lastName = GetValid(lastName, false); stack.DisplayList(); if (string.IsNullOrEmpty(lastName) == true) { return; } UI3Wnd wnd = createWindow(lastName); if (wnd == null) { return; } int index = stack.FindLastByName(GetValid(lastName, true)); stack.PopAt(index); wnd.show(); stack.DisplayList(); }
/// <summary> /// 出栈指定元素,不会返回之前的元素, /// </summary> public static bool CanPopBack(string name, int index, UIStack <string> stack) { if (index < 0 || stack == null) { return(false); } string nextName = stack.Peek(index + 1); if (string.IsNullOrEmpty(nextName) == true) { return(true); } UI3WndType wndType = GetWndType(nextName); return(wndType != UI3WndType.ReturnFullScreen); }
/// <summary> /// 入栈完成之后操作, /// 需要注意,这些步骤不能修改,修改的话,会有问题, /// 步骤1,打开ReturnFullScreen界面时候,需要先复制栈顶界面在入栈本界面, /// 步骤2,打开全屏界面时候需要隐藏之前接口,同时隐藏PopUp layer之前所有界面, /// 步骤3,打开DonotReturnFullScreen界面时候,清空栈, /// 步骤4,入栈该界面,这个时候只有一个界面, /// </summary> /// <param name="wnd"></param> public static void OnPushBack(UIResInfoAsset resInfoAsset, UIStack <string> stack = null) { stack = stack == null?GetStackByPanelLayer(resInfoAsset.layerType.ToString()) : stack; if (stack == null) { return; } stack.DisplayList(); UI3WndType wndType = (UI3WndType)resInfoAsset.wndType; //步骤1,打开ReturnFullScreen界面时候,需要先复制栈顶界面在入栈本界面, if (wndType == UI3WndType.ReturnFullScreen) { string lastT = stack.Peek(); lastT = GetValid(lastT, true); if (stack.Have(lastT) == false) { stack.PushBack(lastT); } } //步骤2,打开全屏界面时候需要隐藏之前接口,同时隐藏PopUp layer之前所有界面, if (wndType == UI3WndType.ReturnFullScreen || wndType == UI3WndType.DonotReturnFullScreen) { HideStackWindows(resInfoAsset.layerType, resInfoAsset.name); } //步骤3,打开DonotReturnFullScreen界面时候,清空栈, if (wndType == UI3WndType.DonotReturnFullScreen) { //当前layer栈clear, stack.Clear(); } //步骤4,入栈该界面,这个时候只有一个界面, if (GetIsPushStack(resInfoAsset.name) == true) { stack.PushBack(resInfoAsset.name); } }