From 9ab3798c3779419093fa3ff8fe2b86a509aa6b7a Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期五, 01 二月 2019 19:23:02 +0800
Subject: [PATCH] 3335 重构窗口管理

---
 System/WindowBase/WindowCenter.cs | 1633 +++++++++++++++++++++++++++++-----------------------------
 1 files changed, 816 insertions(+), 817 deletions(-)

diff --git a/System/WindowBase/WindowCenter.cs b/System/WindowBase/WindowCenter.cs
index 916b305..27eb24c 100644
--- a/System/WindowBase/WindowCenter.cs
+++ b/System/WindowBase/WindowCenter.cs
@@ -1,817 +1,816 @@
-锘縰sing System.Collections.Generic;
-using UnityEngine;
-using System;
-
-namespace Snxxz.UI
-{
-    [XLua.LuaCallCSharp]
-    public class WindowCenter : Singleton<WindowCenter>
-
-    {
-        public event Action<Window> windowBeforeOpenEvent;
-        public event Action<Window> windowAfterOpenEvent;
-        public event Action<Window> windowBeforeCloseEvent;
-        public event Action<Window> windowAfterCloseEvent;
-        public event Action<Window> jumpWindowCloseEvent;
-        List<string> closeAllIgnoreWindows = new List<string>() {
-            "MessageWin", "NewBieWin", "NewItemGetWin", "AttributePromoteShowWin" ,"DungeonBeginCoolDownWin","DungeonFightWin","StatusTipWin"
-            ,"ScrollTipWin","MarqueeWin","ExperienceOpenWin","TrumpetWin","BattlePrepareCoolDownWin","DungeonGradeWin","BattleHintWin",
-            "TreasureDungeonMissionHintWin","FairyGrabBossHintWin","DungeonFairyFeastHintWin","PetAndMountPushWin","UpgradeWin","DungeonFairyLandWin"
-            ,"GatherSoulDungeonHintWin"
-        };
-
-        UIRoot m_UIRoot;
-        public UIRoot uiRoot {
-            get {
-                if (m_UIRoot == null)
-                {
-                    var prefab = BuiltInLoader.LoadPrefab("UIRoot");
-                    var instance = GameObject.Instantiate(prefab, Vector3.zero, Quaternion.identity);
-                    instance.name = "UIRoot";
-                    m_UIRoot = instance.GetComponent<UIRoot>();
-                    if (Application.isPlaying)
-                    {
-                        GameObject.DontDestroyOnLoad(instance);
-                    }
-                }
-                return m_UIRoot;
-            }
-        }
-
-        WindowAsyncLoad m_AnyncLoad;
-        public WindowAsyncLoad asyncLoad {
-            get {
-                if (m_AnyncLoad == null)
-                {
-                    var gameObject = new GameObject("WindowAnyncLoad");
-                    m_AnyncLoad = gameObject.AddMissingComponent<WindowAsyncLoad>();
-                    GameObject.DontDestroyOnLoad(gameObject);
-                }
-
-                return m_AnyncLoad;
-            }
-        }
-
-        int m_PreCreateWindowNum = 0;
-        public bool isPreCreating {
-            get {
-                return m_PreCreateWindowNum > 0;
-            }
-        }
-
-        Dictionary<string, Window> windows = new Dictionary<string, Window>();
-
-        public void OpenFromLocal<T>() where T : Window
-        {
-            var windowName = typeof(T).Name;
-            OpenFromLocal(windowName);
-        }
-
-        public void OpenFromLocal(string _name)
-        {
-            Window win = null;
-            if (TryGetWindow(_name, out win))
-            {
-                if (win.windowState == Window.WindowState.Closed)
-                {
-                    win.functionOrder = 0;
-                    win.playAnimation = true;
-                    win.Open();
-                }
-                else
-                {
-                    DebugEx.LogFormat("{0} 绐楀彛宸茬粡鎵撳紑锛�", _name);
-                }
-            }
-            else
-            {
-                win = GetWindowInstance(_name, true);
-                if (win != null)
-                {
-                    win.functionOrder = 0;
-                    win.playAnimation = true;
-                    win.Open();
-                }
-            }
-        }
-
-        public T Open<T>(bool _forceSync = false, int _functionalOrder = 0) where T : Window
-        {
-            var name = typeof(T).Name;
-            var window = Open(name, _forceSync, _functionalOrder);
-            if (window != null)
-            {
-                return window as T;
-            }
-            else
-            {
-                return null;
-            }
-        }
-
-        public Window Open(string _name, bool _forceSync = false, int _functionalOrder = 0)
-        {
-            if (VersionConfig.Get().isBanShu)
-            {
-                if (_name == "VipRechargeWin")
-                {
-                    SysNotifyMgr.Instance.ShowTip("FuncNoOpen_VIP");
-                    return null;
-                }
-            }
-
-            var childWindow = string.Empty;
-            if (_forceSync || AssetSource.uiFromEditor)
-            {
-                return OpenSingleWindow(_name, _forceSync, _functionalOrder);
-            }
-            else
-            {
-                if (WindowConfig.Get().FindChildWindow(_name, _functionalOrder, out childWindow))
-                {
-                    WindowTrim(childWindow);
-                    if (!windows.ContainsKey(childWindow))
-                    {
-                        GetWindowInstanceAsync(childWindow, (bool _ok, UnityEngine.Object _object) =>
-                        {
-                            if (_ok)
-                            {
-                                OpenSingleWindow(_name, _forceSync, _functionalOrder);
-                            }
-                        });
-
-                        return null;
-                    }
-                    else
-                    {
-                        return OpenSingleWindow(_name, _forceSync, _functionalOrder);
-                    }
-                }
-                else
-                {
-                    return OpenSingleWindow(_name, _forceSync, _functionalOrder);
-                }
-            }
-        }
-
-        public T OpenWithoutAnimation<T>() where T : Window
-        {
-            var name = typeof(T).Name;
-            var window = OpenWithoutAnimation(name);
-            if (window != null)
-            {
-                return window as T;
-            }
-            else
-            {
-                return null;
-            }
-        }
-
-        public Window OpenWithoutAnimation(string _name)
-        {
-            Window win = null;
-            if (TryGetWindow(_name, out win))
-            {
-                if (win.windowState == Window.WindowState.Closed)
-                {
-                    win.functionOrder = 0;
-                    win.playAnimation = false;
-                    win.Open();
-                }
-                else
-                {
-                    DebugEx.LogFormat("{0} 绐楀彛宸茬粡鎵撳紑锛�", _name);
-                }
-
-                return win;
-            }
-
-            win = GetWindowInstance(_name, false);
-            if (win != null)
-            {
-                win.functionOrder = 0;
-                win.playAnimation = false;
-                win.Open();
-            }
-
-            return win;
-        }
-
-        public T Get<T>() where T : Window
-        {
-            T win = null;
-            if (TryGetWindow(out win))
-            {
-                return win;
-            }
-            else
-            {
-                DebugEx.LogFormat("娌℃湁鎵惧埌绐楀彛:{0}", typeof(T).Name);
-                return null;
-            }
-
-        }
-
-        public Window Get(string _window)
-        {
-            if (windows.ContainsKey(_window))
-            {
-                return windows[_window];
-            }
-            else
-            {
-                return null;
-            }
-        }
-
-        public T Close<T>() where T : Window
-        {
-            T win = null;
-            if (TryGetWindow<T>(out win))
-            {
-                if (win.windowState != Window.WindowState.Closed)
-                {
-                    win.CloseImmediately();
-                }
-                else
-                {
-                    DebugEx.LogFormat("{0} 绐楀彛宸茬粡鍏抽棴锛�", typeof(T));
-                }
-            }
-            else
-            {
-                asyncLoad.StopTask(typeof(T).Name);
-                DebugEx.LogFormat("{0} 绐楀彛鏃犳硶鑾峰緱锛�", typeof(T));
-            }
-
-            return win;
-        }
-
-        public Window Close(string _name)
-        {
-            if (windows.ContainsKey(_name))
-            {
-                var window = windows[_name];
-                if (window.windowState != Window.WindowState.Closed)
-                {
-                    window.CloseImmediately();
-                }
-                else
-                {
-                    DebugEx.LogFormat("{0} 绐楀彛宸茬粡鍏抽棴锛�", _name);
-                }
-
-                return window;
-            }
-            else
-            {
-                asyncLoad.StopTask(_name);
-                DebugEx.LogFormat("{0} 绐楀彛鏃犳硶鑾峰緱锛�", _name);
-                return null;
-            }
-
-        }
-
-        public T CloseImmediately<T>() where T : Window
-        {
-            T win = null;
-            if (TryGetWindow<T>(out win))
-            {
-                if (win.windowState != Window.WindowState.Closed)
-                {
-                    win.CloseImmediately();
-                }
-                else
-                {
-                    DebugEx.LogFormat("{0} 绐楀彛宸茬粡鍏抽棴锛�", typeof(T));
-                }
-            }
-            else
-            {
-                asyncLoad.StopTask(typeof(T).Name);
-                DebugEx.LogFormat("{0} 绐楀彛鏃犳硶鑾峰緱锛�", typeof(T));
-            }
-
-            return win;
-        }
-
-        public List<string> GetAll()
-        {
-            return new List<string>(windows.Keys);
-        }
-
-        public void CloseAll(CloseAllIgnoreType _ignoreType = CloseAllIgnoreType.System)
-        {
-            foreach (var window in windows.Values)
-            {
-                if (window == null)
-                {
-                    continue;
-                }
-
-                var isIgnore = false;
-                switch (_ignoreType)
-                {
-                    case CloseAllIgnoreType.Base:
-                        isIgnore = window.windowInfo.windowType <= WindowType.Base;
-                        break;
-                    case CloseAllIgnoreType.BaseAndCustom:
-                        isIgnore = window.windowInfo.windowType <= WindowType.Base || closeAllIgnoreWindows.Contains(window.name);
-                        break;
-                    case CloseAllIgnoreType.System:
-                        isIgnore = window.windowInfo.windowType >= WindowType.System;
-                        break;
-                    case CloseAllIgnoreType.Custom:
-                        isIgnore = closeAllIgnoreWindows.Contains(window.name);
-                        break;
-                    case CloseAllIgnoreType.SystemAndCustom:
-                        isIgnore = window.windowInfo.windowType >= WindowType.System || closeAllIgnoreWindows.Contains(window.name);
-                        break;
-                }
-
-                if (!isIgnore)
-                {
-                    if (window.windowState == Window.WindowState.Opened || window.windowState == Window.WindowState.Opening)
-                    {
-                        window.CloseImmediately();
-                    }
-                }
-            }
-
-            asyncLoad.StopAllTasks();
-        }
-
-        public void CloseOthers<T>() where T : Window
-        {
-            foreach (var window in windows.Values)
-            {
-                if (window is T)
-                {
-                    continue;
-                }
-
-                if (window != null)
-                {
-                    if (window.windowState == Window.WindowState.Opened || window.windowState == Window.WindowState.Opening)
-                    {
-                        window.CloseImmediately();
-                    }
-                }
-            }
-
-            asyncLoad.StopAllTasks();
-        }
-
-        public void CloseOthers(List<string> _windowNames, CloseAllIgnoreType _ignoreType)
-        {
-            foreach (var window in windows.Values)
-            {
-                if (window == null)
-                {
-                    continue;
-                }
-
-                var isIgnore = false;
-                switch (_ignoreType)
-                {
-                    case CloseAllIgnoreType.Base:
-                        isIgnore = _windowNames.Contains(window.name) || window.windowInfo.windowType <= WindowType.Base;
-                        break;
-                    case CloseAllIgnoreType.BaseAndCustom:
-                        isIgnore = _windowNames.Contains(window.name) || window.windowInfo.windowType <= WindowType.Base || closeAllIgnoreWindows.Contains(window.name);
-                        break;
-                    case CloseAllIgnoreType.System:
-                        isIgnore = _windowNames.Contains(window.name) || window.windowInfo.windowType >= WindowType.System;
-                        break;
-                    case CloseAllIgnoreType.Custom:
-                        isIgnore = _windowNames.Contains(window.name) || closeAllIgnoreWindows.Contains(window.name);
-                        break;
-                    case CloseAllIgnoreType.SystemAndCustom:
-                        isIgnore = _windowNames.Contains(window.name) || window.windowInfo.windowType >= WindowType.System || closeAllIgnoreWindows.Contains(window.name);
-                        break;
-                }
-
-                if (!isIgnore)
-                {
-                    if (window.windowState == Window.WindowState.Opened || window.windowState == Window.WindowState.Opening)
-                    {
-                        window.CloseImmediately();
-                    }
-                }
-            }
-
-            asyncLoad.StopAllTasks();
-        }
-
-        public void DestoryWinsByStage(WindowStage _windowStage)
-        {
-            switch (_windowStage)
-            {
-                case WindowStage.Launch:
-                    DestroyWin<DownLoadWin>();
-                    DestroyWin<VersionUpdateWin>();
-                    DestroyWin<LaunchWin>();
-                    break;
-                case WindowStage.Login:
-                    DestroyWin<LoginWin>();
-                    DestroyWin<ServerListWin>();
-                    break;
-                case WindowStage.SelectRole:
-                    DestroyWin<CreateRoleWin>();
-                    DestroyWin<SelectRoleWin>();
-                    DestroyWin<LaunchBackGroundWin>();
-                    break;
-                default:
-                    break;
-            }
-
-            UnLoadAssetBundle(_windowStage);
-        }
-
-        public void DestroyWin<T>() where T : Window
-        {
-            DestroyWin(typeof(T).Name);
-        }
-
-        public void DestroyWin(string _name)
-        {
-            if (windows.ContainsKey(_name))
-            {
-                var win = windows[_name];
-                win.CloseImmediately();
-                GameObject.Destroy(win.gameObject);
-                MonoBehaviour.Destroy(win);
-                windows[_name] = null;
-                windows.Remove(_name);
-            }
-            else
-            {
-                DebugEx.LogFormat("{0} 绐楀彛鏃犳硶鑾峰緱锛�", _name);
-            }
-        }
-
-        public void UnLoadAssetBundle(WindowStage _windowStage)
-        {
-            if (!AssetSource.uiFromEditor)
-            {
-                switch (_windowStage)
-                {
-                    case WindowStage.Launch:
-                        break;
-                    case WindowStage.Login:
-                        AssetBundleUtility.Instance.UnloadAsset("ui/prioritywindow", "LoginWin");
-                        AssetBundleUtility.Instance.UnloadAsset("ui/prioritywindow", "ServerListWin");
-                        break;
-                    case WindowStage.SelectRole:
-                        AssetBundleUtility.Instance.UnloadAsset("ui/prioritywindow", "CreateRoleWin");
-                        AssetBundleUtility.Instance.UnloadAsset("ui/prioritywindow", "SelectRoleWin");
-                        break;
-                    default:
-                        break;
-                }
-            }
-        }
-
-        public bool IsOpen<T>() where T : Window
-        {
-            T win = null;
-            if (TryGetWindow(out win))
-            {
-                var open = win.windowState == Window.WindowState.Opened
-                               || win.windowState == Window.WindowState.Opening;
-
-                return open;
-            }
-            else
-            {
-                return false;
-            }
-        }
-
-        public bool IsOpen(string _name)
-        {
-            if (windows.ContainsKey(_name) && windows[_name] != null)
-            {
-                var window = windows[_name];
-                return window.windowState == Window.WindowState.Opened || window.windowState == Window.WindowState.Opening;
-            }
-            else
-            {
-                return false;
-            }
-        }
-
-        public bool ExitAnyFullScreenOrMaskWin()
-        {
-            bool exit = false;
-            foreach (var window in windows.Values)
-            {
-                if (window.windowInfo.needMask || window.windowInfo.fullScreen)
-                {
-                    if (window.windowState == Window.WindowState.Opened || window.windowState == Window.WindowState.Opening)
-                    {
-                        exit = true;
-                        break;
-                    }
-                }
-            }
-
-            return exit;
-        }
-
-        /// <summary>
-        /// 鏄惁瀛樺湪澶т簬鎴栫瓑浜庤繖涓眰绾х殑鍏ㄥ睆鎴栨湁妯$硦鑳屾櫙鐨勭晫闈�
-        /// </summary>
-        /// <param name="_windowType"></param>
-        /// <returns></returns>
-        public bool ExitAnyFullScreenOrMaskWinLEqual(WindowType _windowType)
-        {
-            bool exit = false;
-            foreach (var window in windows.Values)
-            {
-                if ((window.windowInfo.needMask || window.windowInfo.fullScreen) && window.windowInfo.windowType >= _windowType)
-                {
-                    if (window.windowState == Window.WindowState.Opened || window.windowState == Window.WindowState.Opening)
-                    {
-                        exit = true;
-                        break;
-                    }
-                }
-            }
-
-            return exit;
-        }
-
-        internal void NotifyBeforeOpen<T>(T _window) where T : Window
-        {
-            if (windowBeforeOpenEvent != null)
-            {
-                windowBeforeOpenEvent(_window);
-            }
-        }
-
-        internal void NotifyAfterOpen<T>(T _window) where T : Window
-        {
-            if (windowAfterOpenEvent != null)
-            {
-                windowAfterOpenEvent(_window);
-            }
-        }
-
-        internal void NotifyBeforeClose<T>(T _window) where T : Window
-        {
-            if (windowBeforeCloseEvent != null)
-            {
-                windowBeforeCloseEvent(_window);
-            }
-        }
-
-        internal void NotifyAfterClose<T>(T _window) where T : Window
-        {
-            if (windowAfterCloseEvent != null)
-            {
-                windowAfterCloseEvent(_window);
-            }
-        }
-
-        internal void JumpNotifyAfterClose<T>(T _window) where T : Window
-        {
-            if (jumpWindowCloseEvent != null)
-            {
-                jumpWindowCloseEvent(_window);
-            }
-        }
-
-        private T OpenSingleWindow<T>(bool _forceSync, int _functionalOrder) where T : Window
-        {
-            var name = typeof(T).Name;
-            var window = OpenSingleWindow(name, _forceSync, _functionalOrder);
-            if (window != null)
-            {
-                return window as T;
-            }
-            else
-            {
-                return null;
-            }
-        }
-
-        private Window OpenSingleWindow(string _name, bool _forceSync, int _functionalOrder)
-        {
-            Window win = null;
-            if (TryGetWindow(_name, out win))
-            {
-                if (win.windowState == Window.WindowState.Closed)
-                {
-                    win.functionOrder = _functionalOrder;
-                    win.playAnimation = true;
-                    win.Open();
-                }
-                else
-                {
-                    DebugEx.LogFormat("{0} 绐楀彛宸茬粡鎵撳紑锛�", _name);
-                }
-
-                return win;
-            }
-
-            if (_forceSync || AssetSource.uiFromEditor)
-            {
-                win = GetWindowInstance(_name, false);
-                if (win != null)
-                {
-                    win.functionOrder = _functionalOrder;
-                    win.playAnimation = true;
-                    win.Open();
-                }
-
-                return win;
-            }
-            else
-            {
-                GetWindowInstanceAsync(_name,
-                    (bool ok, UnityEngine.Object _object) =>
-                    {
-                        if (TryGetWindow(_name, out win))
-                        {
-                            if (win.windowState == Window.WindowState.Closed)
-                            {
-                                win.functionOrder = _functionalOrder;
-                                win.playAnimation = true;
-                                win.Open();
-                            }
-                            else
-                            {
-                                DebugEx.Log(string.Format("{0} 绐楀彛宸茬粡鎵撳紑锛�", _name));
-                            }
-                        }
-                    }
-                    );
-
-                return null;
-            }
-        }
-
-        private bool TryGetWindow<T>(out T _win) where T : Window
-        {
-            var name = typeof(T).Name;
-            Window window = null;
-            if (TryGetWindow(name, out window))
-            {
-                _win = windows[name] as T;
-                return _win != null;
-            }
-            else
-            {
-                _win = null;
-                return false;
-            }
-        }
-
-        private bool TryGetWindow(string _name, out Window _win)
-        {
-            WindowTrim(_name);
-            if (windows.ContainsKey(_name))
-            {
-                _win = windows[_name];
-                return _win != null;
-            }
-            else
-            {
-                _win = null;
-                return false;
-            }
-        }
-
-        private void WindowTrim(string _windowName)
-        {
-            if (windows.ContainsKey(_windowName))
-            {
-                if (windows[_windowName] == null || windows[_windowName].gameObject == null)
-                {
-                    windows.Remove(_windowName);
-                }
-            }
-        }
-
-        private T GetWindowInstance<T>(bool _fromLocal) where T : Window
-        {
-            var prefabName = typeof(T).Name;
-            var window = GetWindowInstance(prefabName, _fromLocal);
-            if (window != null)
-            {
-                return window as T;
-            }
-            else
-            {
-                return null;
-            }
-        }
-
-        private Window GetWindowInstance(string _name, bool _fromLocal)
-        {
-            if (windows.ContainsKey(_name))
-            {
-                return windows[_name];
-            }
-            else
-            {
-                var prefab = _fromLocal ? BuiltInLoader.LoadPrefab(_name) : UILoader.LoadWindow(_name);
-                prefab.SetActive(false);
-                var instance = GameObject.Instantiate(prefab);
-                instance.name = _name;
-                if (AssetSource.uiFromEditor)
-                {
-                    prefab.SetActive(true);
-                }
-
-                if (_fromLocal)
-                {
-                    BuiltInLoader.UnLoadPrefab(_name);
-                }
-                else
-                {
-                    UILoader.UnLoadWindowAsset(_name);
-                }
-
-                var window = instance.GetComponent<Window>();
-                if (window != null)
-                {
-                    windows[_name] = window;
-                }
-                else
-                {
-                    DebugEx.LogFormat("鏃犳硶鑾峰緱  {0}  鐨勮祫婧愶紒", _name);
-                }
-
-                return window;
-            }
-        }
-
-        private void GetWindowInstanceAsync<T>(Action<bool, UnityEngine.Object> _callBack) where T : Window
-        {
-            GetWindowInstanceAsync(typeof(T).Name, _callBack);
-        }
-
-        private void GetWindowInstanceAsync(string _name, Action<bool, UnityEngine.Object> _callBack)
-        {
-            Action<bool, UnityEngine.Object> addAction = (bool _ok, UnityEngine.Object _object) =>
-            {
-                var prefabName = _name;
-                Window window = null;
-                if (!windows.ContainsKey(_name))
-                {
-                    var prefab = _object as GameObject;
-                    prefab.SetActive(false);
-                    var instance = GameObject.Instantiate(prefab);
-
-                    if (AssetSource.uiFromEditor)
-                    {
-                        prefab.SetActive(true);
-                    }
-
-                    UILoader.UnLoadWindowAsset(prefabName);
-                    window = instance.GetComponent<Window>();
-                    var typeName = window.GetType().Name;
-                    instance.name = typeName;
-                    if (window != null)
-                    {
-                        windows[typeName] = window;
-                    }
-                    else
-                    {
-                        Debug.LogFormat("鏃犳硶鑾峰緱  {0}  鐨勮祫婧愶紒", _name);
-                    }
-                }
-
-                if (_callBack != null)
-                {
-                    _callBack(_ok && window != null, _object);
-                }
-            };
-
-            asyncLoad.PushTask(new WindowAsyncLoad.Task(_name, addAction));
-        }
-
-        public enum WindowStage
-        {
-            Launch,
-            Login,
-            SelectRole,
-            Other,
-        }
-
-        public enum CloseAllIgnoreType
-        {
-            Base = 1,
-            System = 2,
-            Custom = 3,
-            BaseAndCustom = 4,
-            SystemAndCustom = 5,
-        }
-
-    }
-
-
-}
+锘�// using System.Collections.Generic;
+// using UnityEngine;
+// using System;
+// 
+// namespace Snxxz.UI
+// {
+//     [XLua.LuaCallCSharp]
+//     public class WindowCenter : Singleton<WindowCenter>
+//     {
+//         public event Action<Window> windowBeforeOpenEvent;
+//         public event Action<Window> windowAfterOpenEvent;
+//         public event Action<Window> windowBeforeCloseEvent;
+//         public event Action<Window> windowAfterCloseEvent;
+//         public event Action<Window> jumpWindowCloseEvent;
+//         List<string> closeAllIgnoreWindows = new List<string>() {
+//             "MessageWin", "NewBieWin", "NewItemGetWin", "AttributePromoteShowWin" ,"DungeonBeginCoolDownWin","DungeonFightWin","StatusTipWin"
+//             ,"ScrollTipWin","MarqueeWin","ExperienceOpenWin","TrumpetWin","BattlePrepareCoolDownWin","DungeonGradeWin","BattleHintWin",
+//             "TreasureDungeonMissionHintWin","FairyGrabBossHintWin","DungeonFairyFeastHintWin","PetAndMountPushWin","UpgradeWin","DungeonFairyLandWin"
+//             ,"GatherSoulDungeonHintWin"
+//         };
+// 
+//         UIRoot m_UIRoot;
+//         public UIRoot uiRoot {
+//             get {
+//                 if (m_UIRoot == null)
+//                 {
+//                     var prefab = BuiltInLoader.LoadPrefab("UIRoot");
+//                     var instance = GameObject.Instantiate(prefab, Vector3.zero, Quaternion.identity);
+//                     instance.name = "UIRoot";
+//                     m_UIRoot = instance.GetComponent<UIRoot>();
+//                     if (Application.isPlaying)
+//                     {
+//                         GameObject.DontDestroyOnLoad(instance);
+//                     }
+//                 }
+//                 return m_UIRoot;
+//             }
+//         }
+// 
+//         WindowAsyncLoad m_AnyncLoad;
+//         public WindowAsyncLoad asyncLoad {
+//             get {
+//                 if (m_AnyncLoad == null)
+//                 {
+//                     var gameObject = new GameObject("WindowAnyncLoad");
+//                     m_AnyncLoad = gameObject.AddMissingComponent<WindowAsyncLoad>();
+//                     GameObject.DontDestroyOnLoad(gameObject);
+//                 }
+// 
+//                 return m_AnyncLoad;
+//             }
+//         }
+// 
+//         int m_PreCreateWindowNum = 0;
+//         public bool isPreCreating {
+//             get {
+//                 return m_PreCreateWindowNum > 0;
+//             }
+//         }
+// 
+//         Dictionary<string, Window> windows = new Dictionary<string, Window>();
+// 
+//         public void OpenFromLocal<T>() where T : Window
+//         {
+//             var windowName = typeof(T).Name;
+//             OpenFromLocal(windowName);
+//         }
+// 
+//         public void OpenFromLocal(string _name)
+//         {
+//             Window win = null;
+//             if (TryGetWindow(_name, out win))
+//             {
+//                 if (win.windowState == Window.WindowState.Closed)
+//                 {
+//                     win.functionOrder = 0;
+//                     win.playAnimation = true;
+//                     win.Open();
+//                 }
+//                 else
+//                 {
+//                     DebugEx.LogFormat("{0} 绐楀彛宸茬粡鎵撳紑锛�", _name);
+//                 }
+//             }
+//             else
+//             {
+//                 win = GetWindowInstance(_name, true);
+//                 if (win != null)
+//                 {
+//                     win.functionOrder = 0;
+//                     win.playAnimation = true;
+//                     win.Open();
+//                 }
+//             }
+//         }
+// 
+//         public T Open<T>(bool _forceSync = false, int _functionalOrder = 0) where T : Window
+//         {
+//             var name = typeof(T).Name;
+//             var window = Open(name, _forceSync, _functionalOrder);
+//             if (window != null)
+//             {
+//                 return window as T;
+//             }
+//             else
+//             {
+//                 return null;
+//             }
+//         }
+// 
+//         public Window Open(string _name, bool _forceSync = false, int _functionalOrder = 0)
+//         {
+//             if (VersionConfig.Get().isBanShu)
+//             {
+//                 if (_name == "VipRechargeWin")
+//                 {
+//                     SysNotifyMgr.Instance.ShowTip("FuncNoOpen_VIP");
+//                     return null;
+//                 }
+//             }
+// 
+//             var childWindow = string.Empty;
+//             if (_forceSync || AssetSource.uiFromEditor)
+//             {
+//                 return OpenSingleWindow(_name, _forceSync, _functionalOrder);
+//             }
+//             else
+//             {
+//                 if (WindowConfig.Get().FindChildWindow(_name, _functionalOrder, out childWindow))
+//                 {
+//                     WindowTrim(childWindow);
+//                     if (!windows.ContainsKey(childWindow))
+//                     {
+//                         GetWindowInstanceAsync(childWindow, (bool _ok, UnityEngine.Object _object) =>
+//                         {
+//                             if (_ok)
+//                             {
+//                                 OpenSingleWindow(_name, _forceSync, _functionalOrder);
+//                             }
+//                         });
+// 
+//                         return null;
+//                     }
+//                     else
+//                     {
+//                         return OpenSingleWindow(_name, _forceSync, _functionalOrder);
+//                     }
+//                 }
+//                 else
+//                 {
+//                     return OpenSingleWindow(_name, _forceSync, _functionalOrder);
+//                 }
+//             }
+//         }
+// 
+//         public T OpenWithoutAnimation<T>() where T : Window
+//         {
+//             var name = typeof(T).Name;
+//             var window = OpenWithoutAnimation(name);
+//             if (window != null)
+//             {
+//                 return window as T;
+//             }
+//             else
+//             {
+//                 return null;
+//             }
+//         }
+// 
+//         public Window OpenWithoutAnimation(string _name)
+//         {
+//             Window win = null;
+//             if (TryGetWindow(_name, out win))
+//             {
+//                 if (win.windowState == Window.WindowState.Closed)
+//                 {
+//                     win.functionOrder = 0;
+//                     win.playAnimation = false;
+//                     win.Open();
+//                 }
+//                 else
+//                 {
+//                     DebugEx.LogFormat("{0} 绐楀彛宸茬粡鎵撳紑锛�", _name);
+//                 }
+// 
+//                 return win;
+//             }
+// 
+//             win = GetWindowInstance(_name, false);
+//             if (win != null)
+//             {
+//                 win.functionOrder = 0;
+//                 win.playAnimation = false;
+//                 win.Open();
+//             }
+// 
+//             return win;
+//         }
+// 
+//         public T Get<T>() where T : Window
+//         {
+//             T win = null;
+//             if (TryGetWindow(out win))
+//             {
+//                 return win;
+//             }
+//             else
+//             {
+//                 DebugEx.LogFormat("娌℃湁鎵惧埌绐楀彛:{0}", typeof(T).Name);
+//                 return null;
+//             }
+// 
+//         }
+// 
+//         public Window Get(string _window)
+//         {
+//             if (windows.ContainsKey(_window))
+//             {
+//                 return windows[_window];
+//             }
+//             else
+//             {
+//                 return null;
+//             }
+//         }
+// 
+//         public T Close<T>() where T : Window
+//         {
+//             T win = null;
+//             if (TryGetWindow<T>(out win))
+//             {
+//                 if (win.windowState != Window.WindowState.Closed)
+//                 {
+//                     win.CloseImmediately();
+//                 }
+//                 else
+//                 {
+//                     DebugEx.LogFormat("{0} 绐楀彛宸茬粡鍏抽棴锛�", typeof(T));
+//                 }
+//             }
+//             else
+//             {
+//                 asyncLoad.StopTask(typeof(T).Name);
+//                 DebugEx.LogFormat("{0} 绐楀彛鏃犳硶鑾峰緱锛�", typeof(T));
+//             }
+// 
+//             return win;
+//         }
+// 
+//         public Window Close(string _name)
+//         {
+//             if (windows.ContainsKey(_name))
+//             {
+//                 var window = windows[_name];
+//                 if (window.windowState != Window.WindowState.Closed)
+//                 {
+//                     window.CloseImmediately();
+//                 }
+//                 else
+//                 {
+//                     DebugEx.LogFormat("{0} 绐楀彛宸茬粡鍏抽棴锛�", _name);
+//                 }
+// 
+//                 return window;
+//             }
+//             else
+//             {
+//                 asyncLoad.StopTask(_name);
+//                 DebugEx.LogFormat("{0} 绐楀彛鏃犳硶鑾峰緱锛�", _name);
+//                 return null;
+//             }
+// 
+//         }
+// 
+//         public T CloseImmediately<T>() where T : Window
+//         {
+//             T win = null;
+//             if (TryGetWindow<T>(out win))
+//             {
+//                 if (win.windowState != Window.WindowState.Closed)
+//                 {
+//                     win.CloseImmediately();
+//                 }
+//                 else
+//                 {
+//                     DebugEx.LogFormat("{0} 绐楀彛宸茬粡鍏抽棴锛�", typeof(T));
+//                 }
+//             }
+//             else
+//             {
+//                 asyncLoad.StopTask(typeof(T).Name);
+//                 DebugEx.LogFormat("{0} 绐楀彛鏃犳硶鑾峰緱锛�", typeof(T));
+//             }
+// 
+//             return win;
+//         }
+// 
+//         public List<string> GetAll()
+//         {
+//             return new List<string>(windows.Keys);
+//         }
+// 
+//         public void CloseAll(CloseAllIgnoreType _ignoreType = CloseAllIgnoreType.System)
+//         {
+//             foreach (var window in windows.Values)
+//             {
+//                 if (window == null)
+//                 {
+//                     continue;
+//                 }
+// 
+//                 var isIgnore = false;
+//                 switch (_ignoreType)
+//                 {
+//                     case CloseAllIgnoreType.Base:
+//                         isIgnore = window.windowInfo.windowType <= WindowType.Base;
+//                         break;
+//                     case CloseAllIgnoreType.BaseAndCustom:
+//                         isIgnore = window.windowInfo.windowType <= WindowType.Base || closeAllIgnoreWindows.Contains(window.name);
+//                         break;
+//                     case CloseAllIgnoreType.System:
+//                         isIgnore = window.windowInfo.windowType >= WindowType.System;
+//                         break;
+//                     case CloseAllIgnoreType.Custom:
+//                         isIgnore = closeAllIgnoreWindows.Contains(window.name);
+//                         break;
+//                     case CloseAllIgnoreType.SystemAndCustom:
+//                         isIgnore = window.windowInfo.windowType >= WindowType.System || closeAllIgnoreWindows.Contains(window.name);
+//                         break;
+//                 }
+// 
+//                 if (!isIgnore)
+//                 {
+//                     if (window.windowState == Window.WindowState.Opened || window.windowState == Window.WindowState.Opening)
+//                     {
+//                         window.CloseImmediately();
+//                     }
+//                 }
+//             }
+// 
+//             asyncLoad.StopAllTasks();
+//         }
+// 
+//         public void CloseOthers<T>() where T : Window
+//         {
+//             foreach (var window in windows.Values)
+//             {
+//                 if (window is T)
+//                 {
+//                     continue;
+//                 }
+// 
+//                 if (window != null)
+//                 {
+//                     if (window.windowState == Window.WindowState.Opened || window.windowState == Window.WindowState.Opening)
+//                     {
+//                         window.CloseImmediately();
+//                     }
+//                 }
+//             }
+// 
+//             asyncLoad.StopAllTasks();
+//         }
+// 
+//         public void CloseOthers(List<string> _windowNames, CloseAllIgnoreType _ignoreType)
+//         {
+//             foreach (var window in windows.Values)
+//             {
+//                 if (window == null)
+//                 {
+//                     continue;
+//                 }
+// 
+//                 var isIgnore = false;
+//                 switch (_ignoreType)
+//                 {
+//                     case CloseAllIgnoreType.Base:
+//                         isIgnore = _windowNames.Contains(window.name) || window.windowInfo.windowType <= WindowType.Base;
+//                         break;
+//                     case CloseAllIgnoreType.BaseAndCustom:
+//                         isIgnore = _windowNames.Contains(window.name) || window.windowInfo.windowType <= WindowType.Base || closeAllIgnoreWindows.Contains(window.name);
+//                         break;
+//                     case CloseAllIgnoreType.System:
+//                         isIgnore = _windowNames.Contains(window.name) || window.windowInfo.windowType >= WindowType.System;
+//                         break;
+//                     case CloseAllIgnoreType.Custom:
+//                         isIgnore = _windowNames.Contains(window.name) || closeAllIgnoreWindows.Contains(window.name);
+//                         break;
+//                     case CloseAllIgnoreType.SystemAndCustom:
+//                         isIgnore = _windowNames.Contains(window.name) || window.windowInfo.windowType >= WindowType.System || closeAllIgnoreWindows.Contains(window.name);
+//                         break;
+//                 }
+// 
+//                 if (!isIgnore)
+//                 {
+//                     if (window.windowState == Window.WindowState.Opened || window.windowState == Window.WindowState.Opening)
+//                     {
+//                         window.CloseImmediately();
+//                     }
+//                 }
+//             }
+// 
+//             asyncLoad.StopAllTasks();
+//         }
+// 
+//         public void DestoryWinsByStage(WindowStage _windowStage)
+//         {
+//             switch (_windowStage)
+//             {
+//                 case WindowStage.Launch:
+//                     DestroyWin<DownLoadWin>();
+//                     DestroyWin<VersionUpdateWin>();
+//                     DestroyWin<LaunchWin>();
+//                     break;
+//                 case WindowStage.Login:
+//                     DestroyWin<LoginWin>();
+//                     DestroyWin<ServerListWin>();
+//                     break;
+//                 case WindowStage.SelectRole:
+//                     DestroyWin<CreateRoleWin>();
+//                     DestroyWin<SelectRoleWin>();
+//                     DestroyWin<LaunchBackGroundWin>();
+//                     break;
+//                 default:
+//                     break;
+//             }
+// 
+//             UnLoadAssetBundle(_windowStage);
+//         }
+// 
+//         public void DestroyWin<T>() where T : Window
+//         {
+//             DestroyWin(typeof(T).Name);
+//         }
+// 
+//         public void DestroyWin(string _name)
+//         {
+//             if (windows.ContainsKey(_name))
+//             {
+//                 var win = windows[_name];
+//                 win.CloseImmediately();
+//                 GameObject.Destroy(win.gameObject);
+//                 MonoBehaviour.Destroy(win);
+//                 windows[_name] = null;
+//                 windows.Remove(_name);
+//             }
+//             else
+//             {
+//                 DebugEx.LogFormat("{0} 绐楀彛鏃犳硶鑾峰緱锛�", _name);
+//             }
+//         }
+// 
+//         public void UnLoadAssetBundle(WindowStage _windowStage)
+//         {
+//             if (!AssetSource.uiFromEditor)
+//             {
+//                 switch (_windowStage)
+//                 {
+//                     case WindowStage.Launch:
+//                         break;
+//                     case WindowStage.Login:
+//                         AssetBundleUtility.Instance.UnloadAsset("ui/prioritywindow", "LoginWin");
+//                         AssetBundleUtility.Instance.UnloadAsset("ui/prioritywindow", "ServerListWin");
+//                         break;
+//                     case WindowStage.SelectRole:
+//                         AssetBundleUtility.Instance.UnloadAsset("ui/prioritywindow", "CreateRoleWin");
+//                         AssetBundleUtility.Instance.UnloadAsset("ui/prioritywindow", "SelectRoleWin");
+//                         break;
+//                     default:
+//                         break;
+//                 }
+//             }
+//         }
+// 
+//         public bool IsOpen<T>() where T : Window
+//         {
+//             T win = null;
+//             if (TryGetWindow(out win))
+//             {
+//                 var open = win.windowState == Window.WindowState.Opened
+//                                || win.windowState == Window.WindowState.Opening;
+// 
+//                 return open;
+//             }
+//             else
+//             {
+//                 return false;
+//             }
+//         }
+// 
+//         public bool IsOpen(string _name)
+//         {
+//             if (windows.ContainsKey(_name) && windows[_name] != null)
+//             {
+//                 var window = windows[_name];
+//                 return window.windowState == Window.WindowState.Opened || window.windowState == Window.WindowState.Opening;
+//             }
+//             else
+//             {
+//                 return false;
+//             }
+//         }
+// 
+//         public bool ExitAnyFullScreenOrMaskWin()
+//         {
+//             bool exit = false;
+//             foreach (var window in windows.Values)
+//             {
+//                 if (window.windowInfo.needMask || window.windowInfo.fullScreen)
+//                 {
+//                     if (window.windowState == Window.WindowState.Opened || window.windowState == Window.WindowState.Opening)
+//                     {
+//                         exit = true;
+//                         break;
+//                     }
+//                 }
+//             }
+// 
+//             return exit;
+//         }
+// 
+//         /// <summary>
+//         /// 鏄惁瀛樺湪澶т簬鎴栫瓑浜庤繖涓眰绾х殑鍏ㄥ睆鎴栨湁妯$硦鑳屾櫙鐨勭晫闈�
+//         /// </summary>
+//         /// <param name="_windowType"></param>
+//         /// <returns></returns>
+//         public bool ExitAnyFullScreenOrMaskWinLEqual(WindowType _windowType)
+//         {
+//             bool exit = false;
+//             foreach (var window in windows.Values)
+//             {
+//                 if ((window.windowInfo.needMask || window.windowInfo.fullScreen) && window.windowInfo.windowType >= _windowType)
+//                 {
+//                     if (window.windowState == Window.WindowState.Opened || window.windowState == Window.WindowState.Opening)
+//                     {
+//                         exit = true;
+//                         break;
+//                     }
+//                 }
+//             }
+// 
+//             return exit;
+//         }
+// 
+//         internal void NotifyBeforeOpen<T>(T _window) where T : Window
+//         {
+//             if (windowBeforeOpenEvent != null)
+//             {
+//                 windowBeforeOpenEvent(_window);
+//             }
+//         }
+// 
+//         internal void NotifyAfterOpen<T>(T _window) where T : Window
+//         {
+//             if (windowAfterOpenEvent != null)
+//             {
+//                 windowAfterOpenEvent(_window);
+//             }
+//         }
+// 
+//         internal void NotifyBeforeClose<T>(T _window) where T : Window
+//         {
+//             if (windowBeforeCloseEvent != null)
+//             {
+//                 windowBeforeCloseEvent(_window);
+//             }
+//         }
+// 
+//         internal void NotifyAfterClose<T>(T _window) where T : Window
+//         {
+//             if (windowAfterCloseEvent != null)
+//             {
+//                 windowAfterCloseEvent(_window);
+//             }
+//         }
+// 
+//         internal void JumpNotifyAfterClose<T>(T _window) where T : Window
+//         {
+//             if (jumpWindowCloseEvent != null)
+//             {
+//                 jumpWindowCloseEvent(_window);
+//             }
+//         }
+// 
+//         private T OpenSingleWindow<T>(bool _forceSync, int _functionalOrder) where T : Window
+//         {
+//             var name = typeof(T).Name;
+//             var window = OpenSingleWindow(name, _forceSync, _functionalOrder);
+//             if (window != null)
+//             {
+//                 return window as T;
+//             }
+//             else
+//             {
+//                 return null;
+//             }
+//         }
+// 
+//         private Window OpenSingleWindow(string _name, bool _forceSync, int _functionalOrder)
+//         {
+//             Window win = null;
+//             if (TryGetWindow(_name, out win))
+//             {
+//                 if (win.windowState == Window.WindowState.Closed)
+//                 {
+//                     win.functionOrder = _functionalOrder;
+//                     win.playAnimation = true;
+//                     win.Open();
+//                 }
+//                 else
+//                 {
+//                     DebugEx.LogFormat("{0} 绐楀彛宸茬粡鎵撳紑锛�", _name);
+//                 }
+// 
+//                 return win;
+//             }
+// 
+//             if (_forceSync || AssetSource.uiFromEditor)
+//             {
+//                 win = GetWindowInstance(_name, false);
+//                 if (win != null)
+//                 {
+//                     win.functionOrder = _functionalOrder;
+//                     win.playAnimation = true;
+//                     win.Open();
+//                 }
+// 
+//                 return win;
+//             }
+//             else
+//             {
+//                 GetWindowInstanceAsync(_name,
+//                     (bool ok, UnityEngine.Object _object) =>
+//                     {
+//                         if (TryGetWindow(_name, out win))
+//                         {
+//                             if (win.windowState == Window.WindowState.Closed)
+//                             {
+//                                 win.functionOrder = _functionalOrder;
+//                                 win.playAnimation = true;
+//                                 win.Open();
+//                             }
+//                             else
+//                             {
+//                                 DebugEx.Log(string.Format("{0} 绐楀彛宸茬粡鎵撳紑锛�", _name));
+//                             }
+//                         }
+//                     }
+//                     );
+// 
+//                 return null;
+//             }
+//         }
+// 
+//         private bool TryGetWindow<T>(out T _win) where T : Window
+//         {
+//             var name = typeof(T).Name;
+//             Window window = null;
+//             if (TryGetWindow(name, out window))
+//             {
+//                 _win = windows[name] as T;
+//                 return _win != null;
+//             }
+//             else
+//             {
+//                 _win = null;
+//                 return false;
+//             }
+//         }
+// 
+//         private bool TryGetWindow(string _name, out Window _win)
+//         {
+//             WindowTrim(_name);
+//             if (windows.ContainsKey(_name))
+//             {
+//                 _win = windows[_name];
+//                 return _win != null;
+//             }
+//             else
+//             {
+//                 _win = null;
+//                 return false;
+//             }
+//         }
+// 
+//         private void WindowTrim(string _windowName)
+//         {
+//             if (windows.ContainsKey(_windowName))
+//             {
+//                 if (windows[_windowName] == null || windows[_windowName].gameObject == null)
+//                 {
+//                     windows.Remove(_windowName);
+//                 }
+//             }
+//         }
+// 
+//         private T GetWindowInstance<T>(bool _fromLocal) where T : Window
+//         {
+//             var prefabName = typeof(T).Name;
+//             var window = GetWindowInstance(prefabName, _fromLocal);
+//             if (window != null)
+//             {
+//                 return window as T;
+//             }
+//             else
+//             {
+//                 return null;
+//             }
+//         }
+// 
+//         private Window GetWindowInstance(string _name, bool _fromLocal)
+//         {
+//             if (windows.ContainsKey(_name))
+//             {
+//                 return windows[_name];
+//             }
+//             else
+//             {
+//                 var prefab = _fromLocal ? BuiltInLoader.LoadPrefab(_name) : UILoader.LoadWindow(_name);
+//                 prefab.SetActive(false);
+//                 var instance = GameObject.Instantiate(prefab);
+//                 instance.name = _name;
+//                 if (AssetSource.uiFromEditor)
+//                 {
+//                     prefab.SetActive(true);
+//                 }
+// 
+//                 if (_fromLocal)
+//                 {
+//                     BuiltInLoader.UnLoadPrefab(_name);
+//                 }
+//                 else
+//                 {
+//                     UILoader.UnLoadWindowAsset(_name);
+//                 }
+// 
+//                 var window = instance.GetComponent<Window>();
+//                 if (window != null)
+//                 {
+//                     windows[_name] = window;
+//                 }
+//                 else
+//                 {
+//                     DebugEx.LogFormat("鏃犳硶鑾峰緱  {0}  鐨勮祫婧愶紒", _name);
+//                 }
+// 
+//                 return window;
+//             }
+//         }
+// 
+//         private void GetWindowInstanceAsync<T>(Action<bool, UnityEngine.Object> _callBack) where T : Window
+//         {
+//             GetWindowInstanceAsync(typeof(T).Name, _callBack);
+//         }
+// 
+//         private void GetWindowInstanceAsync(string _name, Action<bool, UnityEngine.Object> _callBack)
+//         {
+//             Action<bool, UnityEngine.Object> addAction = (bool _ok, UnityEngine.Object _object) =>
+//             {
+//                 var prefabName = _name;
+//                 Window window = null;
+//                 if (!windows.ContainsKey(_name))
+//                 {
+//                     var prefab = _object as GameObject;
+//                     prefab.SetActive(false);
+//                     var instance = GameObject.Instantiate(prefab);
+// 
+//                     if (AssetSource.uiFromEditor)
+//                     {
+//                         prefab.SetActive(true);
+//                     }
+// 
+//                     UILoader.UnLoadWindowAsset(prefabName);
+//                     window = instance.GetComponent<Window>();
+//                     var typeName = window.GetType().Name;
+//                     instance.name = typeName;
+//                     if (window != null)
+//                     {
+//                         windows[typeName] = window;
+//                     }
+//                     else
+//                     {
+//                         Debug.LogFormat("鏃犳硶鑾峰緱  {0}  鐨勮祫婧愶紒", _name);
+//                     }
+//                 }
+// 
+//                 if (_callBack != null)
+//                 {
+//                     _callBack(_ok && window != null, _object);
+//                 }
+//             };
+// 
+//             asyncLoad.PushTask(new WindowAsyncLoad.Task(_name, addAction));
+//         }
+// 
+//         public enum WindowStage
+//         {
+//             Launch,
+//             Login,
+//             SelectRole,
+//             Other,
+//         }
+// 
+//         public enum CloseAllIgnoreType
+//         {
+//             Base = 1,
+//             System = 2,
+//             Custom = 3,
+//             BaseAndCustom = 4,
+//             SystemAndCustom = 5,
+//         }
+// 
+//     }
+// 
+// 
+// }

--
Gitblit v1.8.0