Esempio n. 1
0
        /// <summary>
        /// 删除所有的ui窗口
        /// </summary>
        public void ClearUI()
        {
            List <UIBaseWindow> NeedRemoveList = new List <UIBaseWindow>();
            Dictionary <string, UIBaseWindow> DontRemoveList = new Dictionary <string, UIBaseWindow>();

            foreach (var kv in mWindows)
            {
                if (kv.Value.WindowType != UIType.Loading)
                {
                    if (kv.Value.mUIObject != null)
                    {
                        NeedRemoveList.Add(kv.Value);
                    }
                }
                else
                {
                    if (DontRemoveList.ContainsKey(kv.Key) == false)
                    {
                        DontRemoveList.Add(kv.Key, kv.Value);
                    }
                }
            }
            for (int i = 0; i < NeedRemoveList.Count; i++)
            {
                NeedRemoveList[i].Destroy();
                DestroyWindowGameObject((GameObject)NeedRemoveList[i].mUIObject);
            }
            NeedRemoveList.Clear();
            NeedRemoveList = null;
            mWindows.Clear();

            loadingWindows.Clear();
            if (MainCtrl != null)
            {
                MainCtrl.ClearAllChildWindow();
            }

            foreach (var kv in DontRemoveList)
            {
                mWindows.Add(kv.Key, kv.Value);
            }
            mCurUIName = "";

            UINavgationCtrl.Instance.Clear();
            mOpenedSysWindow.Clear();
            mOpeningSysWin.Clear();

            UpdateSysUIMaskBg();
        }