Exemple #1
0
        /// <summary>
        /// Exits the fullscreen game views.
        /// </summary>
        /// <param name="onlyThoseCreatedAtGameStart">If true, only exits the game views which were created when the game was started.</param>
        public static void ExitGameFullscreens(bool onlyThoseCreatedAtGameStart)
        {
            EditorFullscreenState.RunOnLoad methodToRun = ExitGameFullscreensAll;
            if (onlyThoseCreatedAtGameStart)
            {
                methodToRun = ExitGameFullscreensOnlyThoseCreatedAtGameStart;
            }
            if (EditorFullscreenState.RunAfterInitialStateLoaded(methodToRun))
            {
                return;
            }

            var fullscreenGameWindows = new List <EditorWindow>();

            foreach (var state in EditorFullscreenState.fullscreenState.window)
            {
                if (state.EditorWin != null && state.WindowType == EditorFullscreenState.GameViewType && state.EditorWin.IsFullscreen())
                {
                    if (!onlyThoseCreatedAtGameStart || state.CreatedAtGameStart)
                    {
                        fullscreenGameWindows.Add(state.EditorWin);
                    }
                }
            }
            foreach (var gameWin in fullscreenGameWindows)
            {
                gameWin.SetFullscreen(false);
            }
        }
        /// <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);
        }
Exemple #3
0
        /// <summary>
        /// Returns true if a window type is fullscreen on the screen specified by the given options.
        /// </summary>
        public static bool WindowTypeIsFullscreenAtOptionsSpecifiedPosition(Type windowType, EditorFullscreenSettings.FullscreenOption fullscreenOptions)
        {
            var  openAtPosition = fullscreenOptions.openAtPosition;
            bool isFullscreen   = false;

            switch (openAtPosition)
            {
            case EditorFullscreenSettings.OpenFullscreenAtPosition.AtMousePosition:
                EditorWindow mouseOverWin = EditorFullscreenState.GetMouseOverWindow();
                if (mouseOverWin != null && mouseOverWin.GetWindowType() == windowType)
                {
                    isFullscreen = mouseOverWin.IsFullscreen();
                }
                break;

            case EditorFullscreenSettings.OpenFullscreenAtPosition.None:
                isFullscreen = false;
                break;

            default:
                Vector2 openAtPos = GetOptionsSpecifiedFullscreenOpenAtPosition(null, windowType, fullscreenOptions);
                isFullscreen = WindowTypeIsFullscreenOnScreenAtPosition(windowType, openAtPos);
                break;
            }
            return(isFullscreen);
        }
Exemple #4
0
        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.
        }
Exemple #5
0
 /// <summary>
 /// Toggles the top toolbar for the currently focused fullscreen window. (Only applies to Scene View, Game View, and Main Window, which have top toolbars).
 /// </summary>
 public static void ToggleTopToolbar()
 {
     if (EditorFullscreenState.RunAfterInitialStateLoaded(ToggleTopToolbar))
     {
         return;
     }
     EditorFullscreenState.ToggleToolbarInFullscreen();
 }
        private static bool ToggleGameViewFullscreen(bool triggeredOnPlayStateChange)
        {
            EditorFullscreenSettings.FullscreenOption fullscreenOps;
            if (triggeredOnPlayStateChange)
            {
                fullscreenOps = EditorFullscreenSettings.settings.openFullscreenOnGameStart;
            }
            else
            {
                fullscreenOps = EditorFullscreenSettings.GetFullscreenOptionsForWindowType(EditorFullscreenState.gameViewType);
            }
            bool setFullscreen = !EditorFullscreenState.WindowTypeIsFullscreenAtOptionsSpecifiedPosition(EditorFullscreenState.gameViewType, fullscreenOps);

            EditorFullscreenState.RunOnLoad methodToRun;
            if (!triggeredOnPlayStateChange)
            {
                methodToRun = ToggleGameViewFullscreen;
            }
            else
            {
                methodToRun = ToggleGameViewFullscreenPlayStateWasChanged;
            }
            if (EditorFullscreenState.RunAfterInitialStateLoaded(methodToRun))
            {
                return(setFullscreen);
            }

            setFullscreen = EditorFullscreenState.ToggleFullscreenAtOptionsSpecifiedPosition(null, EditorFullscreenState.gameViewType, fullscreenOps, triggeredOnPlayStateChange);
            var focusedWindow = EditorWindow.focusedWindow;

            EditorMainWindow.Focus();
            if (focusedWindow != null)
            {
                focusedWindow.Focus();
            }

            if (!triggeredOnPlayStateChange)
            {
                bool isPlaying = EditorApplication.isPlaying || EditorApplication.isPlayingOrWillChangePlaymode;
                if (settings.startGameWhenEnteringFullscreen && !isPlaying && setFullscreen)
                {
                    //Enter play mode
                    EditorApplication.ExecuteMenuItem("Edit/Play");
                }
                else if (settings.stopGameWhenExitingFullscreen != EditorFullscreenSettings.StopGameWhenExitingFullscreen.Never && isPlaying && !setFullscreen)
                {
                    if (settings.stopGameWhenExitingFullscreen == EditorFullscreenSettings.StopGameWhenExitingFullscreen.WhenAnyFullscreenGameViewIsExited || !WindowTypeIsFullscreen(EditorFullscreenState.gameViewType))
                    {
                        //Exit play mode
                        EditorApplication.ExecuteMenuItem("Edit/Play");
                    }
                }
            }
            return(setFullscreen);
        }
Exemple #7
0
 /// <summary>
 /// Toggles fullscreen for the focused window.
 /// </summary>
 /// <returns>True if the window became fullscreen. False if fullscreen was exited.</returns>
 public static bool ToggleFocusedWindowFullscreen()
 {
     if (EditorWindow.focusedWindow != null)
     {
         return(EditorFullscreenState.ToggleFullscreenUsingOptions(EditorWindow.focusedWindow, EditorWindow.focusedWindow.GetType(), EditorFullscreenSettings.settings.currentlyFocusedWindow, false, true));
     }
     else
     {
         return(false);
     }
 }
 /// <summary>
 /// Toggle fullscreen for the window under the cursor.
 /// </summary>
 /// <returns>True if the window became fullscreen. False if fullscreen was exited.</returns>
 public static bool ToggleWindowUnderCursorFullscreen()
 {
     if (EditorWindow.mouseOverWindow != null)
     {
         return(EditorFullscreenState.ToggleFullscreenAtOptionsSpecifiedPosition(EditorWindow.mouseOverWindow, EditorWindow.mouseOverWindow.GetType(), EditorFullscreenSettings.settings.windowUnderCursor));
     }
     else
     {
         return(false);
     }
 }
Exemple #9
0
        /// <summary> Get the EditorDisplay which currently contains the fullscreen editorWindow </summary>
        internal static EditorDisplay GetFullscreenDisplay(this EditorWindow editorWindow)
        {
            var           fullscreenState = EditorFullscreenState.FindWindowState(editorWindow);
            EditorDisplay display         = null;

            if (fullscreenState != null)
            {
                display = EditorDisplay.ClosestToPoint(fullscreenState.FullscreenAtPosition);
            }
            return(display);
        }
 /// <summary>
 /// Toggles fullscreen for the focused window.
 /// </summary>
 /// <returns>True if the window became fullscreen. False if fullscreen was exited.</returns>
 public static bool ToggleFocusedWindowFullscreen()
 {
     if (EditorWindow.focusedWindow != null)
     {
         return(EditorFullscreenState.ToggleFullscreenAtOptionsSpecifiedPosition(EditorWindow.focusedWindow, EditorWindow.focusedWindow.GetType(), EditorFullscreenSettings.settings.currentlyFocusedWindow));
     }
     else
     {
         return(false);
     }
 }
Exemple #11
0
        /// <summary>
        /// Toggle fullscreen for the window under the cursor.
        /// </summary>
        /// <returns>True if the window became fullscreen. False if fullscreen was exited.</returns>
        public static bool ToggleWindowUnderCursorFullscreen()
        {
            var mouseOverWin = EditorFullscreenState.GetMouseOverWindow();

            if (mouseOverWin != null)
            {
                return(EditorFullscreenState.ToggleFullscreenUsingOptions(mouseOverWin, mouseOverWin.GetType(), EditorFullscreenSettings.settings.windowUnderCursor, false, true));
            }
            else
            {
                return(false);
            }
        }
Exemple #12
0
        /// <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);
        }
Exemple #13
0
        /// <summary>
        /// Toggle fullscreen at the current mouse position for the window with the specified type.
        /// </summary>
        public static bool ToggleFullscreenAtMousePosition(Type windowType, bool showTopToolbar, bool triggeredOnPlayStateChange)
        {
            EditorWindow mouseOverWin = GetMouseOverWindow();

            if (mouseOverWin != null && (windowType == null || mouseOverWin.GetType() == windowType || mouseOverWin.GetWindowType() == windowType))
            {
                return(EditorFullscreenState.ToggleFullscreen(mouseOverWin.GetType(), true, EditorInput.MousePosition, showTopToolbar, triggeredOnPlayStateChange));
            }
            else if (windowType != null)
            {
                return(EditorFullscreenState.ToggleFullscreen(windowType, EditorInput.MousePosition, showTopToolbar, triggeredOnPlayStateChange));
            }
            return(false);
        }
Exemple #14
0
        /// <summary> Toggle fullscreen for a window type </summary>
        public static bool ToggleFullscreen(Type windowType, bool createNewWindow, Vector2 atPosition, bool showTopToolbar, bool triggeredOnPlayStateChange)
        {
            var windowState = EditorFullscreenState.FindWindowState(null, windowType, EditorDisplay.ClosestToPoint(atPosition));

            if (showTopToolbar)
            {
                windowState.ShowTopToolbar = true;
            }
            if (triggeredOnPlayStateChange && !windowState.IsFullscreen)
            {
                windowState.CreatedAtGameStart = true;
            }
            return(ToggleFullscreen(windowState, createNewWindow, atPosition));
        }
Exemple #15
0
        /// <summary> Set fullscreen with the option to show or hide the top tabs </summary>
        public static void SetFullscreen(this EditorWindow editorWindow, bool setFullscreen, Vector2 atPosition, bool showTopToolbar)
        {
            var fullscreenState = EditorFullscreenState.FindWindowState(editorWindow);

            if (editorWindow.GetWindowType() == FS.gameViewType)
            {
                if (showTopToolbar && !fullscreenState.ShowTopToolbar)
                {
                    fullscreenState.CursorLockModePreShowTopToolbar = Cursor.lockState;
                    Cursor.lockState = CursorLockMode.None; //Enable cursor when top tab is enabled
                }
                else if (!showTopToolbar && fullscreenState.ShowTopToolbar)
                {
                    Cursor.lockState = fullscreenState.CursorLockModePreShowTopToolbar; //Reset cursor lock mode when top tab is disabled
                }
            }

            fullscreenState.ShowTopToolbar = showTopToolbar;
            SetFullscreen(fullscreenState.EditorWin, setFullscreen, atPosition);
        }
Exemple #16
0
        /// <summary>
        /// Exit all game views except for a single one (Multiple game views showing at the same time can cause FPS drops in-game)
        /// </summary>
        /// <param name="exceptForThisWindow">This is the only exception. Will not be closed.</param>
        public static void ExitAllGameViews(EditorWindow exceptForThisWindow)
        {
            var gameViews   = (EditorWindow[])Resources.FindObjectsOfTypeAll(EditorFullscreenState.GameViewType);
            var exceptState = EditorFullscreenState.FindWindowState(exceptForThisWindow);

            foreach (var win in gameViews)
            {
                var state = EditorFullscreenState.FindWindowState(win);
                if (exceptState != null && exceptState.CreatedAtGameStart && state != null && state.CreatedAtGameStart)
                {
                    //These game windows were created together at game start, so don't close them.
                    continue;
                }
                else
                {
                    if (win != exceptForThisWindow)
                    {
                        state.CloseOnExitFullscreen = true;
                        win.SetFullscreen(false);
                    }
                }
            }
        }
Exemple #17
0
 /// <summary>
 /// Returns true if an editor window type is fullscreen on the screen at the specified position.
 /// </summary>
 public static bool WindowTypeIsFullscreenOnScreenAtPosition(Type windowType, Vector2 atPosition)
 {
     return(EditorFullscreenState.WindowTypeIsFullscreenOnScreenAtPosition(windowType, atPosition));
 }
Exemple #18
0
        private static bool ToggleGameViewFullscreen(bool triggeredOnGameStart, int optionID)
        {
            EditorWindow            focusedWindow = null;
            List <FullscreenOption> allGameWins   = null;

            EditorFullscreenState.WindowFullscreenState state = null;
            bool setFullscreen;

            if (triggeredOnGameStart)
            {
                allGameWins   = settings.AllGameWindows;
                setFullscreen = true;
            }
            else
            {
                setFullscreen = !EditorFullscreenState.WindowTypeIsFullscreenAtOptionsSpecifiedPosition(EditorFullscreenState.GameViewType, settings.GetFullscreenOption(optionID));
            }

            EditorFullscreenState.RunOnLoad methodToRun;
            if (!triggeredOnGameStart)
            {
                methodToRun = () => ToggleGameViewFullscreen(false, optionID);
            }
            else
            {
                methodToRun = () => ToggleGameViewFullscreen(true, optionID);
            }
            if (EditorFullscreenState.RunAfterInitialStateLoaded(methodToRun))
            {
                return(setFullscreen);
            }

            if (triggeredOnGameStart)
            {
                for (int i = 0; i < allGameWins.Count; i++)
                {
                    if (allGameWins[i].openOnGameStart)
                    {
                        if (!EditorFullscreenState.WindowTypeIsFullscreenAtOptionsSpecifiedPosition(EditorFullscreenState.GameViewType, allGameWins[i]))
                        {
                            EditorFullscreenState.ToggleFullscreenUsingOptions(null, EditorFullscreenState.GameViewType, allGameWins[i], triggeredOnGameStart, false);
                        }
                    }
                }
            }
            else
            {
                state         = EditorFullscreenState.ToggleFullscreenUsingOptions(null, EditorFullscreenState.GameViewType, settings.GetFullscreenOption(optionID), triggeredOnGameStart, false, out setFullscreen);
                focusedWindow = EditorWindow.focusedWindow;
            }

            EditorMainWindow.Focus();
            if (focusedWindow != null)
            {
                focusedWindow.Focus();
            }

            if (!triggeredOnGameStart)
            {
                bool isPlaying = EditorApplication.isPlaying || EditorApplication.isPlayingOrWillChangePlaymode;
                if (settings.startGameWhenEnteringFullscreen && !isPlaying && setFullscreen)
                {
                    //Enter play mode
                    EditorApplication.ExecuteMenuItem("Edit/Play");
                }
                else if (settings.stopGameWhenExitingFullscreen != EditorFullscreenSettings.StopGameWhenExitingFullscreen.Never && isPlaying && !setFullscreen)
                {
                    if (settings.stopGameWhenExitingFullscreen == EditorFullscreenSettings.StopGameWhenExitingFullscreen.WhenAnyFullscreenGameViewIsExited || !WindowTypeIsFullscreen(EditorFullscreenState.GameViewType, state))
                    {
                        //Exit play mode
                        EditorApplication.ExecuteMenuItem("Edit/Play");
                    }
                }
            }
            return(setFullscreen);
        }
Exemple #19
0
 /// <summary>
 /// Toggles fullscreen for the scene view.
 /// </summary>
 public static bool ToggleSceneViewFullscreen()
 {
     return(EditorFullscreenState.ToggleFullscreenUsingOptions(typeof(CustomSceneView), settings.sceneWindow));
 }
Exemple #20
0
        /// <summary>
        /// Triggers a Fullscreen Hotkey.
        /// </summary>
        /// <param name="keyCode">The key code of the hotkey to be triggered.</param>
        /// <param name="modifiers">The modifiers of the hotkey to be triggered.</param>
        /// <returns></returns>
        internal static bool TriggerFullscreenHotkey(KeyCode keyCode, EventModifiers modifiers)
        {
            if (EditorInput.performedHotkeyActionThisUpdate)
            {
                return(false);                                             //Already triggered the hotkey
            }
            EWFDebugging.Begin();
            bool setFullscreen             = false;
            bool fullscreenHotkeyTriggered = true;
            var  settings = EditorFullscreenSettings.settings;

            if (settings.debugModeEnabled)
            {
                EWFDebugging.LogLine("Triggered hotkey: " + EditorInput.GetKeysDownString(keyCode, modifiers) + " (key " + keyCode.ToKeyString() + " modifiers " + modifiers.ToString() + ")");
            }
            EditorDisplay.ClearCachedDisplays();

            EWFDebugging.StartTimer("Check hotkey and fullscreen");
            if (CheckHotkeyTriggered(keyCode, modifiers, settings.closeAllFullscreenWindows))
            {
                setFullscreen = CloseAllEditorFullscreenWindows();                                                                               //In this case setFullscreen is set to true if at least one fullscreen was closed.
            }
            else if (CheckHotkeyTriggered(keyCode, modifiers, settings.mainUnityWindow))
            {
                setFullscreen = ToggleMainWindowFullscreen();
            }
            else if (CheckHotkeyTriggered(keyCode, modifiers, settings.sceneWindow))
            {
                setFullscreen = ToggleSceneViewFullscreen();
            }
            else if (CheckHotkeyTriggered(keyCode, modifiers, settings.gameWindow))
            {
                setFullscreen = ToggleGameViewFullscreen(false, settings.gameWindow.OptionID);
            }
            else if (CheckHotkeyTriggered(keyCode, modifiers, settings.currentlyFocusedWindow))
            {
                setFullscreen = ToggleFocusedWindowFullscreen();
            }
            else if (CheckHotkeyTriggered(keyCode, modifiers, settings.windowUnderCursor))
            {
                setFullscreen = ToggleWindowUnderCursorFullscreen();
            }
            else if (CheckHotkeyTriggered(keyCode, modifiers, settings.toggleTopToolbar))
            {
                ToggleTopToolbar();
            }
            else
            {
                fullscreenHotkeyTriggered = false;

                //Check if a custom window hotkey is triggered
                if (settings.customWindows != null)
                {
                    for (int i = 0; i < settings.customWindows.Count; i++)
                    {
                        if (CheckHotkeyTriggered(keyCode, modifiers, settings.customWindows[i]))
                        {
                            if (settings.customWindows[i].isGameView)
                            {
                                setFullscreen = ToggleGameViewFullscreen(false, settings.customWindows[i].OptionID);
                            }
                            else
                            {
                                setFullscreen = EditorFullscreenState.ToggleFullscreenUsingOptions(settings.customWindows[i].WindowType, settings.customWindows[i]);
                            }
                            fullscreenHotkeyTriggered = true;
                            break;
                        }
                    }
                }
            }

            EWFDebugging.LogTime("Check hotkey and fullscreen");

            if (fullscreenHotkeyTriggered)
            {
                triggeredHotkey = null; //Reset the triggered hotkey after fullscreen is toggled.
            }
            if (FullscreenHotkeyEventHandler != null && fullscreenHotkeyTriggered)
            {
                FullscreenHotkeyEventHandler.Invoke(keyCode, modifiers, setFullscreen);
            }
            EWFDebugging.LogLine("fullscreenHotkeyTriggered: " + fullscreenHotkeyTriggered + ", setFullscreen: " + setFullscreen);
            if (fullscreenHotkeyTriggered)
            {
                EWFDebugging.PrintLog();
                EditorInput.performedHotkeyActionThisUpdate = true;
            }
            return(fullscreenHotkeyTriggered);
        }
Exemple #21
0
        /******************************************/
        /************ Hotkeyed Methods ************/
        /******************************************/

        /// <summary>
        /// Toggles fullscreen for the main editor window.
        /// </summary>
        ///
        public static bool ToggleMainWindowFullscreen()
        {
            return(EditorFullscreenState.ToggleFullscreenUsingOptions(EditorFullscreenState.MainWindowType, settings.mainUnityWindow));
        }
 /// <summary>
 /// Toggle fullscreen at a position decided according to the current settings for the specified window type.
 /// </summary>
 public static bool ToggleFullscreenAtOptionsSpecifiedPosition(Type windowType)
 {
     return(EditorFullscreenState.ToggleFullscreenAtOptionsSpecifiedPosition(windowType));
 }
Exemple #23
0
 /// <summary>
 /// Toggle fullscreen for a window type, on the screen at a position.
 /// </summary>
 /// <param name="windowType">The type of the window to create a fullscreen for.</param>
 /// <param name="atPosition">Fullscreen will be toggled on the screen which is at this position.</param>
 /// <param name="showTopToolbar">Show the top toolbar by default if opening a fullscreen.</param>
 /// <returns>True if the window type became fullscreen. False if fullscreen was exited.</returns>
 public static bool ToggleFullscreen(Type windowType, Vector2 atPosition, bool showTopToolbar)
 {
     return(EditorFullscreenState.ToggleFullscreen(windowType, atPosition, showTopToolbar, false));
 }
Exemple #24
0
 /// <summary>
 /// Toggle fullscreen for a window type (Creates a new fullscreen window if none already exists).
 /// Enters fullscreen on the primary screen.
 /// </summary>
 /// <param name="windowType">The type of the window to create a fullscreen for.</param>
 /// <returns>True if the window type became fullscreen. False if fullscreen was exited.</returns>
 public static bool ToggleFullscreen(Type windowType)
 {
     return(EditorFullscreenState.ToggleFullscreen(windowType));
 }
Exemple #25
0
 /// <summary>
 /// Toggle fullscreen for a window type, on the screen at a position. Shows the toolbar if applicable.
 /// </summary>
 /// <param name="windowType">The type of the window to create a fullscreen for.</param>
 /// <param name="atPosition">Fullscreen will be toggled on the screen which is at this position.</param>
 /// <returns>True if the window type became fullscreen. False if fullscreen was exited.</returns>
 public static bool ToggleFullscreen(Type windowType, Vector2 atPosition)
 {
     return(EditorFullscreenState.ToggleFullscreen(windowType, atPosition, true, false));
 }
Exemple #26
0
 /// <summary>
 /// Toggle fullscreen at the current mouse position for the window with the specified type.
 /// </summary>
 public static bool ToggleFullscreenAtMousePosition(Type windowType, bool showTopToolbar)
 {
     return(EditorFullscreenState.ToggleFullscreenAtMousePosition(windowType, showTopToolbar));
 }
Exemple #27
0
 /// <summary>
 /// Toggle fullscreen at the current mouse position for the window with the specified type. Shows the toolbar if applicable.
 /// </summary>
 public static bool ToggleFullscreenAtMousePosition(Type windowType)
 {
     return(EditorFullscreenState.ToggleFullscreenAtMousePosition(windowType, true));
 }
        /******************************************/
        /************ Hotkeyed Methods ************/
        /******************************************/

        /// <summary>
        /// Toggles fullscreen for the main editor window.
        /// </summary>
        ///
        public static bool ToggleMainWindowFullscreen()
        {
            return(EditorFullscreenState.ToggleFullscreenAtOptionsSpecifiedPosition(EditorFullscreenState.mainWindowType));
        }
 /// <summary>
 /// Toggles fullscreen for the scene view.
 /// </summary>
 public static bool ToggleSceneViewFullscreen()
 {
     return(EditorFullscreenState.ToggleFullscreenAtOptionsSpecifiedPosition(typeof(CustomSceneView)));
 }
        private static void PlayModeStateChanged()
        {
            bool startingPlay = !EditorApplication.isPlaying && EditorApplication.isPlayingOrWillChangePlaymode;
            bool stoppedPlay  = !EditorApplication.isPlaying && !EditorApplication.isPlayingOrWillChangePlaymode;

            if (startingPlay)
            {
                if (settings.openFullscreenOnGameStart.openAtPosition != EditorFullscreenSettings.OpenFullscreenAtPosition.None && !EditorFullscreenState.WindowTypeIsFullscreenAtOptionsSpecifiedPosition(EditorFullscreenState.gameViewType, settings.openFullscreenOnGameStart))
                {
                    ToggleGameViewFullscreen(true);
                }
            }
            else if (stoppedPlay)
            {
                if (settings.closeFullscreenOnGameStop == EditorFullscreenSettings.CloseFullscreenOnGameStop.AllFullscreenGameWindows)
                {
                    ExitGameFullscreens(false);
                }
                else if (settings.closeFullscreenOnGameStop == EditorFullscreenSettings.CloseFullscreenOnGameStop.FullscreensCreatedAtGameStart)
                {
                    ExitGameFullscreens(true);
                }
            }
        }