static UIWindow OpenWindow(Type type, params object[] pars) { string winName = type.ToString(); #if UNITY_EDITOR System.Diagnostics.Stopwatch w = new System.Diagnostics.Stopwatch(); w.Start(); #endif if (Instance._curOpenWindow == winName) { return(null); } UIWindow win = GetCacheWindow(winName); if (win == null) { win = Activator.CreateInstance(type) as UIWindow; if (win != null) { AddCacheWindow(win); } else { Debugger.LogError("Open : " + winName + " window fail, create class " + winName + " fail!"); return(null); } } else if (win.IsOpening) { Debugger.LogError("Then Window : " + winName + " is Already Opened"); return(null); } if (!win.Settings.IsHover) { bool find = UpdateOpenList(winName); CloseCurOpenWindow(find); Instance._curOpenWindow = winName; } else { Instance._openingHoverWindow.Add(win); } if (win.Root == null) { GameObject root = LoadUIWindow(win); if (root) { win.Init(); } else { Debugger.LogError("Open : " + winName + " window fail, load prefab " + win.Settings.PrefabName + " fail!"); return(null); } } bool rsl = win.Open(pars); if (!rsl) { return(null); } #if UNITY_EDITOR w.Stop(); Debugger.Log("Open " + winName + " finish. Use time : " + w.ElapsedMilliseconds + " ms"); #endif return(win); }