Пример #1
0
        private void Window_KeyUp(object sender, KeyEventArgs args)
        {
            switch (args.Key)
            {
            case Key.A:
                keyLeft = false;
                break;

            case Key.D:
                keyRight = false;
                break;

            case Key.W:
                keyUp = false;
                break;

            case Key.S:
                keyDown = false;
                break;

            case Key.Space:
                keySpace        = false;
                keySpaceHandled = false;
                break;
            }
            TextLog.Text += $"{args.Key} up\n";
            ScrollLog.ScrollToEnd();
        }
Пример #2
0
        private void Window_KeyDown(object sender, KeyEventArgs args)
        {
            switch (args.Key)
            {
            case Key.OemPlus:
                middleSet += armRepeatSpeed;
                break;

            case Key.OemMinus:
                middleSet -= armRepeatSpeed;
                break;

            case Key.U:
            case Key.I:
                lowSet += armRepeatSpeed;
                break;

            case Key.J:
            case Key.K:
                lowSet -= armRepeatSpeed;
                break;
            }
            if (args.IsRepeat)
            {
                return;
            }
            switch (args.Key)
            {
            case Key.A:
                keyLeft = true;
                break;

            case Key.D:
                keyRight = true;
                break;

            case Key.W:
                keyUp = true;
                break;

            case Key.S:
                keyDown = true;
                break;

            case Key.Space:
                keySpace        = true;
                keySpaceHandled = false;
                break;
            }

            if (args.Key >= Key.D0 && args.Key <= Key.D9)
            {
                armState = args.Key - Key.D0;
                SetArmByState();
            }
            if (args.Key >= Key.NumPad0 && args.Key <= Key.NumPad9)
            {
                armState = args.Key - Key.NumPad0;
                SetArmByState();
            }
            TextLog.Text += $"{args.Key} down\n";
            ScrollLog.ScrollToEnd();
        }
Пример #3
0
 void Awake()
 {
     instance = this;
 }