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.");
            }
        }
Esempio n. 2
0
        //********************************************************************************
        // OnInspectorGUI
        //********************************************************************************
        public override void OnInspectorGUI()
        {
            EditorBehaviour.BehaviourSelectIndex = 0;
            Info.HelpButtonIndex = 0;

            if (m_creature_debug != null)
            {
                m_creature_control.Display.ShowDebug = m_creature_debug.enabled;
            }
            else
            {
                m_creature_control.Display.ShowDebug = false;
            }

            GUI.changed = false;

            EditorGUILayout.Separator();

            Info.HelpEnabled        = m_creature_control.Display.ShowHelp;
            Info.DescriptionEnabled = m_creature_control.Display.ShowHelpDescription;

            // COCKPIT
            EditorRegister.Print(m_creature_control.gameObject.name);
            EditorDisplay.Print(m_creature_control.Display);
            EditorInfo.Print(m_creature_control);

            // ESSENTIALS
            EditorEssentials.Print(m_creature_control);

            // STATUS
            EditorStatus.Print(m_creature_control);

            // MISSIONS
            EditorMissions.Print(m_creature_control);

            // INTERACTION
            EditorInteraction.Print(m_creature_control);

            // ENVIRONMENT
            EditorEnvironment.Print(m_creature_control);

            //BEHAVIOURS
            EditorBehaviour.Print(m_creature_control);


            if (m_creature_control.Display.ShowDebug)
            {
                if (m_creature_debug == null)
                {
                    m_creature_debug = m_creature_control.gameObject.AddComponent <ICECreatureControlDebug>();
                }
                else if (m_creature_debug.enabled == false)
                {
                    m_creature_debug.enabled = true;
                }
            }
            else if (m_creature_debug != null)
            {
                m_creature_debug.enabled = false;

                /*
                 * DestroyImmediate( m_creature_control.GetComponent<ICECreatureControlDebug>() );
                 * EditorGUIUtility.ExitGUI();*/
            }

            if (GUI.changed)
            {
                EditorUtility.SetDirty(m_creature_control);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Updates the 5th hint. Returns true if the 5th room objective is complete.
        /// </summary>
        /// <returns></returns>
        private static bool CompletedHint5()
        {
            bool completedObjective = true;

            DemoCharacter.hints[4] = "";
            foreach (var state in EditorFullscreenState.fullscreenState.window)
            {
                if (state.IsFullscreen && state.WindowType != EditorFullscreenState.MainWindowType && EditorDisplay.ClosestToPoint(state.FullscreenAtPosition).Bounds.Contains(EditorMainWindow.position.center))
                {
                    completedObjective = false;
                    var    fullscreenOption = state.FullscreenOptions;
                    string openAtPos, keysDownString;
                    GetInfoForFullscreenOption(fullscreenOption, out openAtPos, out keysDownString);

                    var windowName = state.WindowType.ToString();
                    if (windowName.Contains("."))
                    {
                        windowName = windowName.Split(".".ToCharArray())[1];
                    }
                    windowName = EditorFullscreenSettings.FormatCamelCaseName(windowName);

                    DemoCharacter.hints[4] += "Press " + keysDownString + " to close the " + windowName;
                    if (fullscreenOption.openAtPosition == EditorFullscreenSettings.OpenFullscreenAtPosition.AtMousePosition)
                    {
                        DemoCharacter.hints[4] += "\n(mouse must be hovering over the window)";
                    }
                    DemoCharacter.hints[4] += "\n";
                }
            }
            return(completedObjective);
        }