Beispiel #1
0
 private static void SetDPad(InputRecord input, ref GamePadDPad pad, ref GamePadThumbSticks sticks)
 {
     pad = new GamePadDPad(
         input.HasActions(Actions.Up) ? ButtonState.Pressed : ButtonState.Released,
         input.HasActions(Actions.Down) ? ButtonState.Pressed : ButtonState.Released,
         input.HasActions(Actions.Left) ? ButtonState.Pressed : ButtonState.Released,
         input.HasActions(Actions.Right) ? ButtonState.Pressed : ButtonState.Released
         );
     sticks = new GamePadThumbSticks(new Vector2(0, 0), new Vector2(0, 0));
 }
Beispiel #2
0
        // Token: 0x0600003B RID: 59 RVA: 0x000035D8 File Offset: 0x000017D8
        public static bool GetButton(int button)
        {
            InputRecord inputRecord = Manager.controller.Current;

            switch (button)
            {
            case 0:
                return(inputRecord.HasActions(Actions.Jump));

            case 1:
                return(inputRecord.HasActions(Actions.Goo));

            case 2:
                return(inputRecord.HasActions(Actions.Bouncy));

            case 3:
                return(inputRecord.HasActions(Actions.Water));

            case 4:
                return(inputRecord.HasActions(Actions.Start));

            case 5:
                return(inputRecord.HasActions(Actions.Select));

            case 6:
                return(inputRecord.HasActions(Actions.LeftBumper));

            case 7:
                return(inputRecord.HasActions(Actions.RightBumper));

            default:
                return(false);
            }
        }
Beispiel #3
0
        public static bool GetButtonDown(InputGamepadButton button)
        {
            if (controller.CurrentInputFrame != 1)
            {
                return(false);
            }

            InputRecord input = controller.Current;

            switch (button)
            {
            case InputGamepadButton.Action: return(input.HasActions(Actions.Jump));

            case InputGamepadButton.Back: return(input.HasActions(Actions.Goo));

            case InputGamepadButton.AltAction: return(input.HasActions(Actions.Water));

            case InputGamepadButton.Menu: return(input.HasActions(Actions.Bouncy));

            case InputGamepadButton.Start: return(input.HasActions(Actions.Start));

            case InputGamepadButton.Select: return(input.HasActions(Actions.Select));

            case InputGamepadButton.RB: return(input.HasActions(Actions.RightBumper));

            case InputGamepadButton.LB: return(input.HasActions(Actions.LeftBumper));
            }
            return(false);
        }
Beispiel #4
0
        public bool HasInputReleased(Actions action)
        {
            InputRecord current  = Current;
            InputRecord previous = Previous;

            return(!current.HasActions(action) && previous != null && previous.HasActions(action) && CurrentInputFrame == 1);
        }
Beispiel #5
0
        public static void SetInputs(InputRecord input)
        {
            GamePadDPad        pad    = default;
            GamePadThumbSticks sticks = default;
            GamePadState       state  = default;

            if (input.HasActions(Actions.Feather))
            {
                SetFeather(input, ref pad, ref sticks);
            }
            else
            {
                SetDPad(input, ref pad, ref sticks);
            }

            SetState(input, ref state, ref pad, ref sticks);

            bool found = false;

            for (int i = 0; i < 4; i++)
            {
                MInput.GamePads[i].Update();
                if (MInput.GamePads[i].Attached)
                {
                    found = true;
                    MInput.GamePads[i].CurrentState = state;
                }
            }

            if (!found)
            {
                MInput.GamePads[0].CurrentState = state;
                MInput.GamePads[0].Attached     = true;
            }

            if (input.HasActions(Actions.Confirm))
            {
                MInput.Keyboard.CurrentState = new KeyboardState(Keys.Enter);
            }
            else
            {
                MInput.Keyboard.CurrentState = new KeyboardState();
            }

            UpdateVirtualInputs();
        }
Beispiel #6
0
 private static void SetState(InputRecord input, ref GamePadState state, ref GamePadDPad pad, ref GamePadThumbSticks sticks)
 {
     state = new GamePadState(
         sticks,
         new GamePadTriggers(input.HasActions(Actions.Journal) ? 1f : 0f, 0),
         new GamePadButtons(
             (input.HasActions(Actions.Jump) ? Buttons.A : 0)
             | (input.HasActions(Actions.Jump2) ? Buttons.Y : 0)
             | (input.HasActions(Actions.Dash) ? Buttons.B : 0)
             | (input.HasActions(Actions.Dash2) ? Buttons.X : 0)
             | (input.HasActions(Actions.Grab) ? grabButton : 0)
             | (input.HasActions(Actions.Start) ? Buttons.Start : 0)
             | (input.HasActions(Actions.Restart) ? Buttons.LeftShoulder : 0)
             ),
         pad
         );
 }
Beispiel #7
0
        public PadState GetPressed()
        {
            InputRecord previous = Previous;

            if (previous == null)
            {
                return(GetPadState());
            }
            else
            {
                return(new PadState()
                {
                    up = !previous.HasActions(Actions.Up) && Current.HasActions(Actions.Up),
                    down = !previous.HasActions(Actions.Down) && Current.HasActions(Actions.Down),
                    left = !previous.HasActions(Actions.Left) && Current.HasActions(Actions.Left),
                    right = !previous.HasActions(Actions.Right) && Current.HasActions(Actions.Right),
                    jump = !previous.HasActions(Actions.Jump) && Current.HasActions(Actions.Jump),
                    confirm = !previous.HasActions(Actions.Jump) && Current.HasActions(Actions.Jump),
                    cancel = !previous.HasActions(Actions.Cancel) && Current.HasActions(Actions.Cancel),
                    pause = !previous.HasActions(Actions.Pause) && Current.HasActions(Actions.Pause)
                });
            }
        }
Beispiel #8
0
        public static void SetInputs(InputRecord input)
        {
            GamePadDPad        pad;
            GamePadThumbSticks sticks;

            if (input.HasActions(Actions.Feather))
            {
                pad    = new GamePadDPad(ButtonState.Released, ButtonState.Released, ButtonState.Released, ButtonState.Released);
                sticks = new GamePadThumbSticks(new Vector2(input.GetX(), input.GetY()), new Vector2(0, 0));
            }
            else
            {
                pad = new GamePadDPad(
                    input.HasActions(Actions.Up) ? ButtonState.Pressed : ButtonState.Released,
                    input.HasActions(Actions.Down) ? ButtonState.Pressed : ButtonState.Released,
                    input.HasActions(Actions.Left) ? ButtonState.Pressed : ButtonState.Released,
                    input.HasActions(Actions.Right) ? ButtonState.Pressed : ButtonState.Released
                    );
                sticks = new GamePadThumbSticks(new Vector2(0, 0), new Vector2(0, 0));
            }
            GamePadState state = new GamePadState(
                sticks,
                new GamePadTriggers(input.HasActions(Actions.Journal) ? 1f : 0f, 0),
                new GamePadButtons(
                    (input.HasActions(Actions.Jump) ? Buttons.A : (Buttons)0)
                    | (input.HasActions(Actions.Jump2) ? Buttons.Y : (Buttons)0)
                    | (input.HasActions(Actions.Dash) ? Buttons.B : (Buttons)0)
                    | (input.HasActions(Actions.Dash2) ? Buttons.X : (Buttons)0)
                    | (input.HasActions(Actions.Grab) ? Buttons.RightShoulder : (Buttons)0)
                    | (input.HasActions(Actions.Start) ? Buttons.Start : (Buttons)0)
                    | (input.HasActions(Actions.Restart) ? Buttons.LeftShoulder : (Buttons)0)
                    ),
                pad
                );

            bool found = false;

            for (int i = 0; i < 4; i++)
            {
                MInput.GamePads[i].Update();
                if (MInput.GamePads[i].Attached)
                {
                    found = true;
                    MInput.GamePads[i].CurrentState = state;
                }
            }

            if (!found)
            {
                MInput.GamePads[0].CurrentState = state;
                MInput.GamePads[0].Attached     = true;
            }
            MInput.UpdateVirtualInputs();
        }
Beispiel #9
0
        public bool HasInputPressed(Actions action)
        {
            InputRecord input = Current;

            return(input.HasActions(action) && CurrentInputFrame == 1);
        }
Beispiel #10
0
        public bool HasInput(Actions action)
        {
            InputRecord input = Current;

            return(input.HasActions(action));
        }
Beispiel #11
0
        public static bool GetInput(InputType button)
        {
            InputRecord input = controller.Current;

            switch (button)
            {
            case InputType.MoveLeft: return(input.HasActions(Actions.Left));

            case InputType.MoveRight: return(input.HasActions(Actions.Right));

            case InputType.MoveUp: return(input.HasActions(Actions.Up));

            case InputType.MoveDown: return(input.HasActions(Actions.Down));

            case InputType.Jump: return(input.HasActions(Actions.Jump));

            case InputType.Positive: return(input.HasActions(Actions.Positive));

            case InputType.Negative: return(input.HasActions(Actions.Negative));

            case InputType.Blink: return(input.HasActions(Actions.Blink));

            case InputType.SuitPositive: return(input.HasActions(Actions.CloakPositive));

            case InputType.SuitNegative: return(input.HasActions(Actions.CloakNegative));

            case InputType.Menu: return(input.HasActions(Actions.Start));

            case InputType.Map: return(input.HasActions(Actions.Map));

            case InputType.Suit: return(input.HasActions(Actions.ToggleCloak));
            }
            return(false);
        }
Beispiel #12
0
        public static void SetInputs(InputRecord input)
        {
            GamePadDPad        pad;
            GamePadThumbSticks sticks;

            pad = new GamePadDPad(
                input.HasActions(Actions.Up) ? ButtonState.Pressed : ButtonState.Released,
                input.HasActions(Actions.Down) ? ButtonState.Pressed : ButtonState.Released,
                input.HasActions(Actions.Left) ? ButtonState.Pressed : ButtonState.Released,
                input.HasActions(Actions.Right) ? ButtonState.Pressed : ButtonState.Released
                );
            sticks = new GamePadThumbSticks(new Vector2(0, 0), new Vector2(0, 0));
            GamePadState state = new GamePadState(
                sticks,
                new GamePadTriggers(),
                new GamePadButtons(
                    (input.HasActions(Actions.Jump) ? Buttons.A : 0)
                    | (input.HasActions(Actions.Map) ? Buttons.Y : 0)
                    | (input.HasActions(Actions.Feathers) ? Buttons.B : 0)
                    | (input.HasActions(Actions.Attack) ? Buttons.X : 0)
                    | (input.HasActions(Actions.ToggleRight) ? Buttons.RightShoulder : 0)
                    | (input.HasActions(Actions.Menu) ? Buttons.Start : 0)
                    | (input.HasActions(Actions.ToggleLeft) ? Buttons.LeftShoulder : 0)
                    ),
                pad
                );

            Input.TasGamepadState = state;
        }