Esempio n. 1
0
        public static void Initialize()
        {
            if (DemoCharacter.instance == null)
            {
                return;                                 //Only activate if playing the demo and the character has been initialized.
            }
            if (!EditorApplication.isPlayingOrWillChangePlaymode && !EditorApplication.isPlaying)
            {
                return;                                                                                   //Only activate if playing.
            }
            DateTime startInit = DateTime.Now;

            EditorFullscreenState.FullscreenEventHandler            += OnFullscreenEvent;
            EditorFullscreenController.FullscreenHotkeyEventHandler += OnFullscreenHotkeyEvent;
#if UNITY_2017_2_OR_NEWER
            EditorApplication.playModeStateChanged += DisableController;
#else
            EditorApplication.playmodeStateChanged += DisableController;
#endif

            initialized = true;

            var settings = EditorFullscreenSettings.settings;
            var hints    = new List <string>();
            var displays = EditorDisplay.GetAllDisplays();
            hintOptions = new List <EditorFullscreenSettings.FullscreenOption>();

            AddHint(hints, settings.mainUnityWindow, "Press {0} to fullscreen the Main Window \n({1})");
            AddHint(hints, settings.gameWindow, "Press {0} to fullscreen the Game View \n({1})");

            if (displays.Count > 1 && settings.sceneWindow.openAtPosition == EditorFullscreenSettings.OpenFullscreenAtPosition.AtMousePosition)
            {
                AddHint(hints, settings.sceneWindow, hints[1] + "\n\nPress {0} to open a fullscreen Scene View on ANOTHER screen\n(opens {1})");
            }
            else
            {
                AddHint(hints, settings.sceneWindow, "Press {0} to fullscreen the Scene View \n({1})");
            }

            AddHint(hints, settings.toggleTopToolbar, "Press {0} to toggle the top toolbar for the Game View \n(make sure to focus the Game View first)");

            AddHint(hints, settings.closeAllFullscreenWindows, ""); //Close the (window over main unity view, if one exists), by pushing {x}.)

            AddHint(hints, settings.currentlyFocusedWindow, "Click inside the Inspector window/tab in the Editor.\nThen press {0} to fullscreen it {1}.\n(This hotkey fullscreens the currently focused window).");
            AddHint(hints, settings.windowUnderCursor, "Hover the mouse over the Console window/tab in the Editor.\nThen press {0} to fullscreen it {1}.\n(This hotkey fullscreens the window under the cursor).");
            AddHint(hints, settings.closeAllFullscreenWindows, "Press {0} to close all fullscreen windows\n(First, make sure you have at least one fullscreen window open)");

            AddHint(hints, settings.closeAllFullscreenWindows, "Open the fullscreen settings window.\nUnder the Window menu, go to:\n\"Editor Window Fullscreen >> Fullscreen Window Settings...\"");

            AddHint(hints, settings.closeAllFullscreenWindows, "Demo complete!");

            DemoCharacter.hints = hints.ToArray();
            if (EWFDebugging.Enabled && EWFDebugging.enableTimerLogging)
            {
                Debug.Log("Demo controller initialized. Took " + (DateTime.Now - startInit).Milliseconds + "ms.");
            }
        }