/// <summary> /// 处理窗口导航、互斥关系 /// </summary> /// <param name="win"></param> /// <param name="open"></param> void DealWindowStack(UIViewBase win, bool open) { if (win.ShowMode != EWindowShowMode.HideOther) { return; } if (open) { if (m_MutexStacks.Count > 0) { UIViewBase w = m_MutexStacks[m_MutexStacks.Count - 1]; for (int i = 0; i < m_OpenWindows.Count; i++) { UIViewBase view = m_OpenWindows[i]; if (view.ShowMode == EWindowShowMode.SaveTarget && w.ID == view.TargetID) { view.SetActive(false); } if (view.Type == EWindowType.Window && view.ShowMode == EWindowShowMode.DoNothing) { view.Close(); } } w.SetActive(false); } m_MutexStacks.Add(win); } else { m_MutexStacks.Remove(win); for (int i = m_OpenWindows.Count - 1; i >= 0; i--) { UIViewBase view = m_OpenWindows[i]; if (view.ShowMode == EWindowShowMode.SaveTarget && view.TargetID == win.ID) { CloseWindow(view.ID); } } if (m_MutexStacks.Count > 0) { UIViewBase last = m_MutexStacks[m_MutexStacks.Count - 1]; last.SetActive(true); for (int i = 0; i < m_OpenWindows.Count; i++) { UIViewBase view = m_OpenWindows[i]; if (view.ShowMode == EWindowShowMode.SaveTarget && view.TargetID == last.ID) { view.SetActive(true); } } } } }
public void OpenView(EViewType viewType) { while (openedView.Count > 0) { UIViewBase view = openedView.Dequeue(); view.Close(); } UIViewBase target = viewDict[(int)viewType]; target.Open(); openedView.Enqueue(target); }
public void CleseView(UIViewId viewId) { if (mOpendViewDic.ContainsKey(viewId)) { UIViewBase viewBase = mOpendViewDic [viewId]; viewBase.Close(); ViewConfigInfo configInfo = mViewConfig [viewId]; GameMain.Instance.ResMgr.UnloadResource(configInfo.prefabName, typeof(GameObject)); } else if (mOpendViewDic.ContainsKey(viewId)) { if (!mWaitCloseingSet.Contains(viewId)) { mWaitCloseingSet.Add(viewId); } } else { Logger.LogWarning("UIManager close not opend or opening view: " + viewId.ToString()); } }