Exemple #1
0
    void OnGUI()
    {
        if (Event.current.type == EventType.KeyUp)
        {
            if (Event.current.keyCode == KeyCode.RightAlt)
            {
                if (GUI.GetNameOfFocusedControl() == nameOfControle)
                {
                    GUI.FocusControl(string.Empty);
                }
                else
                {
                    GUI.FocusControl(nameOfControle);
                }
            }

            if (GUI.GetNameOfFocusedControl() == nameOfControle) //logic for command suggestions
            {
                if (!InputLine.IsEmpty())
                {
                    if (Event.current.keyCode == KeyCode.RightControl)
                    {
                        InputLine.Switch();
                    }
                }
            }

            if (Event.current.keyCode == KeyCode.UpArrow)
            {
                InputLine.Up();
            }
            else if (Event.current.keyCode == KeyCode.DownArrow)
            {
                InputLine.Down();
            }
            else if (Event.current.keyCode == KeyCode.F3)
            {
                Visible = !Visible;
            }
        }
        else if (Event.current.type == EventType.KeyDown)
        {
        }

        if (GUI.GetNameOfFocusedControl() != nameOfControle && InputLine.IsSuggestionModeEnabled)
        {
            InputLine.Switch();
        }

        if (Visible)
        {
            EMCliGUI();
        }
    }
Exemple #2
0
    private void KeyUpGUI()
    {
        if (Event.current.keyCode == keyCodeFocus)
        {
            if (focusedOnInputLine)
            {
                GUI.FocusControl(string.Empty);
            }
            else
            {
                GUI.FocusControl(nameOfControle);
            }
        }

        if (focusedOnInputLine) //logic for command suggestions
        {
            if (!InputLine.IsEmpty())
            {
                if (Event.current.keyCode == keyCodeSwitch)
                {
                    InputLine.Switch();
                }
            }
        }

        if (Event.current.keyCode == keyCodeUp)
        {
            InputLine.Up();
        }
        else if (Event.current.keyCode == keyCodeDown)
        {
            InputLine.Down();
        }
        else if (Event.current.keyCode == keyCodeShowHide)
        {
            if (!(focusOnEnable = Visible = !Visible))
            {
                InputLine.OnSwitchFix();
            }
        }
        else if (Event.current.keyCode == keyCodeShowHide2)
        {
            if (Visible)
            {
                Visible = !Visible;
            }
        }
    }