public IWindowBase Open(UGUI_TYPE uiType, UGUI_TYPE parentUIType = UGUI_TYPE._BEGIN) { IWindowBase uiwindow; m_loadedWindow.TryGetValue(uiType, out uiwindow); if (uiwindow == null) { uiwindow = CreateWindow(uiType); if (uiwindow == null) { return(null); } if (!uiwindow.Is3D()) { m_root2D.Add(uiwindow); } } else { m_root2D.SortChildLayer(uiwindow); //还未销毁,就重新排序 } uiwindow.Open(); if (!uiwindow.Is3D()) { UIBase2D uibase2D = uiwindow as UIBase2D; if (uibase2D.Getlayer() == UGUI_LAYER.MENU) { SetMainUIActive(false); } } HideMainCamera(); if (parentUIType != UGUI_TYPE._BEGIN) { ParentUIStruct parentUI = new ParentUIStruct(); parentUI.ParentUI = parentUIType; parentUI.ChildUI = uiType; m_ParentUI.Push(parentUI); } return(uiwindow); }
public void Close(UGUI_TYPE uiType, bool release = false) { IWindowBase uiwindow = GetUI(uiType); if (uiwindow == null) { return; } uiwindow.Close(); if (release) { if (uiwindow.Is3D()) { } else { m_root2D.Release(uiwindow); } m_loadedWindow.Remove(uiType); } if (!uiwindow.Is3D()) { if (!CheckMenuLayerVisiable()) //如果没有全屏 的系统了,就打开mainUI { SetMainUIActive(true); } } if (m_ParentUI.Count > 0) { ParentUIStruct parentUI = m_ParentUI.Peek(); if (parentUI.ChildUI == uiType) { Open(parentUI.ParentUI); //就是一个固定返回界面,一种父子的关系,尽量少用 m_ParentUI.Pop(); } } }