示例#1
0
    public void OnKeyDown(KeyCode key)
    {
        if (_isInputString && key == KeyCode.Return)
        {
            _isInputString = false;
            _dynamicCode.GetInputResult(_inputString);
            Typer.Cursor.NextLine();
            Invoker.CanAdd();
        }
        if (_hasApp)
        {
            UpdateApp(key);
        }
        if (_canInputCommands)
        {
            switch (key)
            {
            case KeyCode.LeftArrow:
                Typer.MoveCursor(true);
                return;

            case KeyCode.RightArrow:
                Typer.MoveCursor(false);
                return;

            case KeyCode.UpArrow:
                GetBufferLine(true);
                return;

            case KeyCode.DownArrow:
                GetBufferLine(false);
                return;

            case KeyCode.Tab:
                try {
                    AutoComplete();
                }
                catch {
                }
                return;

            case KeyCode.Return:
                OnCommandEnter(_command, true);
                return;
            }
        }
    }