/// <summary> /// 销毁所有窗体 /// </summary> private void DestroyAllWindow() { var bw = _showWindowList.First; FairyGUIBaseWindow view = null; while (bw != null) { view = bw.Value; view.OnClose(); view.Hide(); bw = bw.Next; } _showWindowList.Clear(); _fairyGUIPackageManager.RemoveAllPackage(); }
/// <summary> /// 暂时隐藏窗体 /// </summary> /// <param name="FairyGUIWindowName">窗体类型枚举</param> public void HideWindow(Type FairyGUIWindowType, bool isHide = true, bool unLoadAssets = false) { FairyGUIBaseWindow bw = GetFairyGUIBaseWindow(FairyGUIWindowType); if (bw == null) { Debug.LogError("要关闭的不是窗体,请检查HideWindow函数的参数是否为FairyGUIBaseWindow的子类并且已在注册表注册!"); return; } bw = null; foreach (var view in _showWindowList) { if (view.Name == FairyGUIWindowType.Name) { bw = view; break; } } if (bw != null) { if (isHide) { bw.OnClose(); bw.Hide(); bw.HasOpen = false; _showWindowList.Remove(bw); } else { bw.OnPause(); unLoadAssets = false; } if (unLoadAssets) { _fairyGUIPackageManager.UnloadAssets(bw.FairyGuiWindowInfo.packageName); bw.AssetLoaded = false; } } }