void OnEnable() { window = this; this.minSize = new Vector2(540, 670); headerStyle.fontSize = 18; headerStyle.fontStyle = FontStyle.Bold; headerStyle.normal.textColor = EditorGUIUtility.isProSkin ? proHeadingColor : new Color(0.25f, 0.25f, 0.25f, 1f); headerStyle.margin.top = 10; headerStyle.margin.bottom = 5; subHeaderStyle.fontSize = 14; subHeaderStyle.fontStyle = FontStyle.Bold; subHeaderStyle.normal.textColor = EditorGUIUtility.isProSkin ? proHeadingColor : new Color(0.25f, 0.25f, 0.25f, 1f); subHeaderStyle.margin.top = 10; smallHeadingStyle.fontStyle = FontStyle.Bold; smallHeadingStyle.margin.top = 5; smallHeadingStyle.margin.left = 6; if (EditorGUIUtility.isProSkin) { smallHeadingStyle.normal.textColor = proHeadingColor; } _windowSettings = EditorFullscreenSettings.LoadSettings(); EditorFullscreenState.TriggerFullscreenEvent(this, this.GetType(), Vector2.zero, false); //Notify everyone that the settings window was opened. }
/// <summary> /// Closes all fullscreen editor windows. /// </summary> /// <returns>True if at least one fullscreen window was closed.</returns> public static bool CloseAllEditorFullscreenWindows() { bool closedAtLeastOneFullscreen = false; try { var allWinStates = EditorFullscreenState.fullscreenState.window.ToArray(); foreach (var win in allWinStates) { if (win.EditorWin != null && win.WindowType != EditorFullscreenState.mainWindowType) { if (win.IsFullscreen) { closedAtLeastOneFullscreen = true; } win.EditorWin.SetFullscreen(false); } } } catch { } if (EditorMainWindow.IsFullscreen()) { closedAtLeastOneFullscreen = true; } EditorMainWindow.SetFullscreen(false); EditorFullscreenState.fullscreenState.CleanDeletedWindows(); EditorFullscreenState.TriggerFullscreenEvent(null, null, Vector2.zero, closedAtLeastOneFullscreen); return(closedAtLeastOneFullscreen); }
/// <summary> /// Closes all fullscreen editor windows. /// </summary> /// <returns>True if at least one fullscreen window was closed.</returns> public static bool CloseAllEditorFullscreenWindows() { bool closedAtLeastOneFullscreen = false; int numOfClosedFullscreens = 0; EWFDebugging.LogLine("Closing all fullscreen windows."); try { var allWinStates = EditorFullscreenState.fullscreenState.window.ToArray(); foreach (var win in allWinStates) { if (win.EditorWin != null && win.WindowType != EditorFullscreenState.MainWindowType) { if (win.IsFullscreen) { closedAtLeastOneFullscreen = true; if (EditorDisplay.ClosestToPoint(win.FullscreenAtPosition).Locked) { EditorFullscreenState.RunAfterDisplayNotLocked(win.FullscreenAtPosition, () => CloseAllEditorFullscreenWindows()); return(true); } if (settings.debugModeEnabled) { EWFDebugging.Log("Closing fullscreen for window, title: " + win.WindowTitle + " type: " + win.WindowType + " FullscreenAtPosition: " + win.FullscreenAtPosition + " Fullscreen in Bounds: " + win.ScreenBounds); } win.EditorWin.SetFullscreen(false); win.containerWindow = null; win.EditorWin = null; //Causes the fullscreen state to be removed in CleanDeletedWindows(); numOfClosedFullscreens++; } } } } catch (Exception e) { EWFDebugging.LogError("Error when closing all fullscreen windows: " + e.Message); } if (EditorMainWindow.IsFullscreen()) { closedAtLeastOneFullscreen = true; numOfClosedFullscreens++; EWFDebugging.Log("Closing main window fullscreen."); } EditorMainWindow.SetFullscreen(false); EditorFullscreenState.fullscreenState.CleanDeletedWindows(); EditorFullscreenState.TriggerFullscreenEvent(null, null, Vector2.zero, closedAtLeastOneFullscreen); EWFDebugging.LogLine("numOfClosedFullscreens: " + numOfClosedFullscreens); return(closedAtLeastOneFullscreen); }