Пример #1
0
        public InternalEventHandler GetInputLockEvent(KeyBindings keyBindings, Gamepad gamepad)
        {
            return(() =>
            {
                if (gamepad.InputState.ButtonPressCount == 2 && gamepad.InputState.BackPressed && gamepad.InputState.StartPressed)
                {
                    if (gamepad.KeyDown == 0)
                    {
                        gamepad.Vibrate(UInt16.MaxValue);
                        gamepad.DisableInput();

                        gamepad.AddKeyDown();
                    }
                    else if (gamepad.KeyDown < gamepad.KeyDownDelay)
                    {
                        gamepad.AddKeyDown();
                    }
                    else
                    {
                        gamepad.Vibrate(0);
                    }
                }
                else if (gamepad.PreviousInputState.ButtonPressCount == 2 && gamepad.PreviousInputState.BackPressed && gamepad.PreviousInputState.StartPressed)
                {
                    gamepad.Vibrate(0);

                    if (gamepad.KeyDown < gamepad.KeyDownDelay)
                    {
                        if (gamepad.PreviousIsEnabled)
                        {
                            gamepad.EnableInput();
                        }
                        else
                        {
                            gamepad.DisableInput();
                        }
                    }
                    else
                    {
                        if (gamepad.PreviousIsEnabled)
                        {
                            gamepad.DisableInput();
                        }
                        else
                        {
                            gamepad.EnableInput();
                        }
                    }

                    gamepad.ResetKeyDown();
                }
            });
        }