Ejemplo n.º 1
0
        static FullscreenPreferences()
        {
            var rectSourceTooltip = string.Empty;

            rectSourceTooltip += "Controls where Fullscreen views opens.\n\n";
            rectSourceTooltip += "Main Screen: Fullscreen opens on the primary screen;\n\n";
            rectSourceTooltip += "Window Display: Open on the display that the target window is located (Windows only);\n\n";
            rectSourceTooltip += "At Mouse Position: Fullscreen opens on the screen where the mouse pointer is;\n\n";
            rectSourceTooltip += "Span: Fullscreen spans across all screens (Windows only);\n\n";
            rectSourceTooltip += "Custom Rect: Fullscreen opens on the given custom Rect.";

            ToolbarVisible          = new PrefItem <bool>("Toolbar", false, "Toolbar Visible", "Show and hide the toolbar on the top of some windows, like the Game View and Scene View.");
            FullscreenOnPlayEnabled = new PrefItem <bool>("FullscreenOnPlay", false, "Fullscreen On Play", "Override the \"Maximize on Play\" option of the game view to \"Fullscreen on Play\"");
            RectSource           = new PrefItem <RectSourceMode>("RectSource", RectSourceMode.AtMousePosition, "Rect Source", rectSourceTooltip);
            CustomRect           = new PrefItem <Rect>("CustomRect", FullscreenRects.GetMainDisplayRect(), "Custom Rect", string.Empty);
            DisableNotifications = new PrefItem <bool>("DisableNotifications", false, "Disable Notifications", "Disable the notifications that shows up when opening a new fullscreen view.");

            if (FullscreenUtility.MenuItemHasShortcut(Shortcut.TOOLBAR_PATH))
            {
                ToolbarVisible.Content.text += string.Format(" ({0})", FullscreenUtility.TextifyMenuItemShortcut(Shortcut.TOOLBAR_PATH));
            }
            if (FullscreenUtility.MenuItemHasShortcut(Shortcut.FULLSCREEN_ON_PLAY_PATH))
            {
                FullscreenOnPlayEnabled.Content.text += string.Format(" ({0})", FullscreenUtility.TextifyMenuItemShortcut(Shortcut.FULLSCREEN_ON_PLAY_PATH));
            }
        }
Ejemplo n.º 2
0
        static FullscreenPreferences()
        {
            var rectSourceTooltip = string.Empty;

            rectSourceTooltip += "Controls where Fullscreen views opens.\n\n";
            rectSourceTooltip += "Main Screen: Fullscreen opens on the primary screen;\n\n";
            rectSourceTooltip += "Window Display: Open on the display that the target window is located (Windows only);\n\n";
            rectSourceTooltip += "At Mouse Position: Fullscreen opens on the screen where the mouse pointer is;\n\n";
            rectSourceTooltip += "Span: Fullscreen spans across all screens (Windows only);\n\n";
            rectSourceTooltip += "Custom Rect: Fullscreen opens on the given custom Rect.";

            ToolbarVisible          = new PrefItem <bool>("Toolbar", false, "Toolbar Visible", "Show and hide the toolbar on the top of some windows, like the Game View and Scene View.");
            FullscreenOnPlayEnabled = new PrefItem <bool>("FullscreenOnPlay", false, "Fullscreen On Play", "Override the \"Maximize on Play\" option of the game view to \"Fullscreen on Play\"");
            RectSource                = new PrefItem <RectSourceMode>("RectSource", RectSourceMode.AtMousePosition, "Rect Source", rectSourceTooltip);
            CustomRect                = new PrefItem <Rect>("CustomRect", FullscreenRects.GetMainDisplayRect(), "Custom Rect", string.Empty);
            DisableNotifications      = new PrefItem <bool>("DisableNotifications", false, "Disable Notifications", "Disable the notifications that shows up when opening a new fullscreen view.");
            KeepFullscreenBelow       = new PrefItem <bool>("KeepFullscreenBelow", true, "Keep Utility Views Above", "Keep utility views on top of fullscreen views.\nThis is useful to integrate with assets that need to keep windows open, such as Peek by Ludiq.");
            DisableSceneViewRendering = new PrefItem <bool>("DisableSceneViewRendering", true, "Disable Scene View Rendering", "Increase Fullscreen Editor performance by not rendering SceneViews while there are open fullscreen views.");
            MosaicMapping             = new PrefItem <int[]>("MosaicMapping", new [] { 0, 1, 2, 3, 4, 5, 6, 7 }, "Mosaic Screen Mapping", "Defines which display renders on each screen when using Mosaic.");

            onLoadDefaults += () => // Array won't revert automaticaly because it is changed as reference
                              MosaicMapping.Value = new [] { 0, 1, 2, 3, 4, 5, 6, 7 };

            if (FullscreenUtility.MenuItemHasShortcut(Shortcut.TOOLBAR_PATH))
            {
                ToolbarVisible.Content.text += string.Format(" ({0})", FullscreenUtility.TextifyMenuItemShortcut(Shortcut.TOOLBAR_PATH));
            }
            if (FullscreenUtility.MenuItemHasShortcut(Shortcut.FULLSCREEN_ON_PLAY_PATH))
            {
                FullscreenOnPlayEnabled.Content.text += string.Format(" ({0})", FullscreenUtility.TextifyMenuItemShortcut(Shortcut.FULLSCREEN_ON_PLAY_PATH));
            }
        }
Ejemplo n.º 3
0
        /// <summary>Create a <see cref="FullscreenWindow"/> for a given window.</summary>
        /// <param name="type">The type of the window to instantiate if the given window is null.</param>
        /// <param name="window">The window that will go fullscreen. If null a new one will be instantiated based on the given type.</param>
        /// <param name="disposableWindow">Set this to true when the target window was created solely for fullscreen,
        /// this will cause it to be destroyed once the fullscreen closes, it has no effects if the target window is null.</param>
        /// <returns>Returns the newly created <see cref="FullscreenWindow"/>.</returns>
        public static FullscreenWindow MakeFullscreen(Type type, EditorWindow window = null, bool disposableWindow = false)
        {
            var rect       = FullscreenRects.GetFullscreenRect(FullscreenPreferences.RectSource, window);
            var fullscreen = ScriptableObject.CreateInstance <FullscreenWindow>();

            fullscreen.OpenWindow(rect, type, window, disposableWindow);
            return(fullscreen);
        }
Ejemplo n.º 4
0
        /// <summary>Create a <see cref="FullscreenView"/> for a given view.</summary>
        /// <param name="view">The view that will go fullscreen, cannot be null.</param>
        /// <returns>Returns the newly created <see cref="FullscreenView"/>.</returns>
        public static FullscreenView MakeFullscreen(ScriptableObject view)
        {
            if (!view)
            {
                throw new ArgumentNullException("view");
            }

            view.EnsureOfType(Types.View);

            var rect       = FullscreenRects.GetFullscreenRect(FullscreenPreferences.RectSource, view);
            var fullscreen = ScriptableObject.CreateInstance <FullscreenView>();

            fullscreen.OpenView(rect, view);

            return(fullscreen);
        }
Ejemplo n.º 5
0
        /// <summary>Open a new fullscreen if there's none open, otherwise, close the one already open.</summary>
        /// <param name="view">The view that will go fullscreen, cannot be null.</param>
        public static void ToggleFullscreen(ScriptableObject view)
        {
            var rect       = FullscreenRects.GetFullscreenRect(FullscreenPreferences.RectSource, view);
            var fullscreen = GetFullscreenOnRect(rect);

            if (!fullscreen)
            {
                fullscreen = GetFullscreenFromView(view);
            }

            if (fullscreen)
            {
                fullscreen.Close();
            }
            else
            {
                MakeFullscreen(view);
            }
        }
Ejemplo n.º 6
0
        /// <summary>Open a new fullscreen if there's none open, otherwise, close the one already open.</summary>
        /// <param name="window">The window that will go fullscreen. If null a new one will be instantiated based on the given type.</param>
        /// <param name="type">The type of the window to instantiate if the given window is null.</param>
        public static void ToggleFullscreen(Type type, EditorWindow window = null)
        {
            var rect       = FullscreenRects.GetFullscreenRect(FullscreenPreferences.RectSource, window);
            var fullscreen = GetFullscreenOnRect(rect);

            if (!fullscreen)
            {
                fullscreen = GetFullscreenFromView(window);
            }

            if (fullscreen)
            {
                fullscreen.Close();
            }
            else
            {
                MakeFullscreen(type, window);
            }
        }
Ejemplo n.º 7
0
        /// <summary>Open a new fullscreen if there's none open, otherwise, close the one already open.</summary>
        /// <param name="view">The view that will go fullscreen, cannot be null.</param>
        public static void ToggleFullscreen(ScriptableObject view)
        {
            var rect          = FullscreenRects.GetFullscreenRect(FullscreenPreferences.RectSource, view);
            var oldFullscreen = GetFullscreenFromView(view);

            if (oldFullscreen)
            {
                oldFullscreen.Close();
                return;
            }

            oldFullscreen = GetFullscreenOnRect(rect);

            var newFullscreen = MakeFullscreen(view);

            newFullscreen.didPresent += () => {
                if (oldFullscreen)
                {
                    oldFullscreen.Close();
                }
            };
        }
Ejemplo n.º 8
0
        /// <summary>Open a new fullscreen if there's none open, otherwise, close the one already open.</summary>
        /// <param name="window">The window that will go fullscreen. If null a new one will be instantiated based on the given type.</param>
        /// <param name="type">The type of the window to instantiate if the given window is null.</param>
        public static void ToggleFullscreen(Type type, EditorWindow window = null)
        {
            var rect          = FullscreenRects.GetFullscreenRect(FullscreenPreferences.RectSource, window);
            var oldFullscreen = GetFullscreenFromView(window);

            if (oldFullscreen)
            {
                oldFullscreen.Close();
                return;
            }

            oldFullscreen = GetFullscreenOnRect(rect);

            var newFullscreen = MakeFullscreen(type, window);

            newFullscreen.didPresent += () => {
                if (oldFullscreen)
                {
                    oldFullscreen.Close();
                }
            };
        }