Exemple #1
0
        private static void DisplayTextInputField(CommandConsoleWindow window)
        {
            GUI.skin.settings.cursorFlashSpeed = 1;

            const string controlName = "searchCommand";

            GUI.SetNextControlName(controlName);
            bool wasEmpty = window.SearchTerms.IsNullOrEmpty();

            window.SearchTerms = EditorGUIExt.TextField((window.SearchTerms ?? "").Replace("`", ""),
                                                        controlName,
                                                        (window.SearchTerms.IsNullOrEmpty())
                    ? MonkeyStyle.Instance.SearchLabelStyleEmpty
                    : MonkeyStyle.Instance.SearchLabelStyle);

            if (wasEmpty && !window.SearchTerms.IsNullOrEmpty())
            {
                window.CommandResult = new List <CommandInfo>();
            }

            if (window.PreventSearchMovement)
            {
                CommandConsoleWindow.ForceEditSearchAtEnd(window.SearchTerms);
            }

            if (window.Focused)
            {
                if (!window.SearchTerms.IsNullOrEmpty() && !window.CommandResult.Any())
                {
                    window.MonkeyFocusLogoStyle = MonkeyStyle.Instance.MonkeyLogoStyle;
                }
                else
                {
                    window.MonkeyFocusLogoStyle = window.SearchTerms.IsNullOrEmpty()
                        ? MonkeyStyle.Instance.MonkeyLogoStyleSmiling
                        : MonkeyStyle.Instance.MonkeyLogoStyleHappy;
                }

                window.Repaint();
            }

            if (!window.IsDocked || window.JustOpenedActiveMode || window.Focused)
            {
                GUI.FocusControl(controlName);
            }
        }
Exemple #2
0
        private static void DisplayAutoCompleteSection(CommandConsoleWindow window,
                                                       string controlName)
        {
            ParametricCommandExecution exec = window.CurrentExecution;

            GUILayout.BeginVertical(MonkeyStyle.Instance.SearchLabelGroupStyle);


            if (exec.IsArray && exec.CurrentTextEntered.IsNullOrEmpty() &&
                exec.CurrentAutoCompleteID == -1)
            {
                if (exec.HasNextVariable)
                {
                    GUILayout.Label("Press TAB or ENTER to go to the next variable",
                                    MonkeyStyle.Instance.VariableTypeTextStyle, GUILayout.ExpandWidth(true));
                }
                else
                {
                    GUILayout.Label("Press TAB or ENTER to go to execute the command",
                                    MonkeyStyle.Instance.VariableTypeTextStyle, GUILayout.ExpandWidth(true));
                }
            }

            GUILayout.BeginHorizontal(MonkeyStyle.Instance.SearchLabelStyle);
            GUILayout.BeginHorizontal(MonkeyStyle.Instance.AutoCompleteSearchLabelGroupStyle);

            DisplayInstructionOrDefault(window, exec);

            GUI.SetNextControlName(controlName);
            window.SearchTerms = EditorGUIExt.TextField(window.SearchTerms, controlName,
                                                        MonkeyStyle.Instance.SearchLabelStyle);

            if (!window.IsDocked || window.JustOpenedActiveMode ||
                window.PreventSearchMovement || window.Focused)
            {
                if (window.PreventSearchMovement)
                {
                    CommandConsoleWindow.ForceEditSearchAtEnd(window.SearchTerms);
                }
                window.Focus();

                GUI.FocusControl(controlName);
            }

            //    GUILayout.FlexibleSpace();

            GUILayout.EndHorizontal();

            GUILayout.EndHorizontal();

            ComputeDragAndDrop(window);

            GUILayout.BeginVertical(GUILayout.ExpandWidth(true));

            DisplayAutoCompleteOptions(window);

            GUILayout.EndVertical();

            GUILayout.FlexibleSpace();

            GUILayout.EndVertical();
        }