diff options
author | YonKuma <kumarei@gmail.com> | 2017-11-10 16:20:25 -0500 |
---|---|---|
committer | YonKuma <kumarei@gmail.com> | 2017-11-10 16:20:25 -0500 |
commit | 0330d84e990883a5bd5f98a70570bde007713414 (patch) | |
tree | 461ff006ca1de8a5631f673a4310f4a8acbb537a | |
parent | b9ba645ce0cb8fe924e0c8e880ebba3d065558ef (diff) | |
download | SMAPI-0330d84e990883a5bd5f98a70570bde007713414.tar.gz SMAPI-0330d84e990883a5bd5f98a70570bde007713414.tar.bz2 SMAPI-0330d84e990883a5bd5f98a70570bde007713414.zip |
Simplified mouse checks
SuppressButton now uses the passed button rather than the object button
-rw-r--r-- | src/SMAPI/Events/EventArgsInput.cs | 55 |
1 files changed, 26 insertions, 29 deletions
diff --git a/src/SMAPI/Events/EventArgsInput.cs b/src/SMAPI/Events/EventArgsInput.cs index bb06430a..276bfef6 100644 --- a/src/SMAPI/Events/EventArgsInput.cs +++ b/src/SMAPI/Events/EventArgsInput.cs @@ -56,11 +56,11 @@ namespace StardewModdingAPI.Events public void SuppressButton(SButton button) { // keyboard - if (this.Button.TryGetKeyboard(out Keys key)) + if (button.TryGetKeyboard(out Keys key)) Game1.oldKBState = new KeyboardState(Game1.oldKBState.GetPressedKeys().Union(new[] { key }).ToArray()); // controller - else if (this.Button.TryGetController(out Buttons controllerButton)) + else if (button.TryGetController(out Buttons controllerButton)) { var newState = GamePad.GetState(PlayerIndex.One); var thumbsticks = Game1.oldPadState.ThumbSticks; @@ -129,34 +129,31 @@ namespace StardewModdingAPI.Events } // mouse - else if (this.Button.TryGetStardewInput(out InputButton inputButton)) + else if (button == SButton.MouseLeft) { - if (inputButton.mouseLeft) - { - Game1.oldMouseState = new MouseState( - Game1.oldMouseState.X, - Game1.oldMouseState.Y, - Game1.oldMouseState.ScrollWheelValue, - ButtonState.Pressed, - Game1.oldMouseState.MiddleButton, - Game1.oldMouseState.RightButton, - Game1.oldMouseState.XButton1, - Game1.oldMouseState.XButton2 - ); - } - else if (inputButton.mouseRight) - { - Game1.oldMouseState = new MouseState( - Game1.oldMouseState.X, - Game1.oldMouseState.Y, - Game1.oldMouseState.ScrollWheelValue, - Game1.oldMouseState.LeftButton, - Game1.oldMouseState.MiddleButton, - ButtonState.Pressed, - Game1.oldMouseState.XButton1, - Game1.oldMouseState.XButton2 - ); - } + Game1.oldMouseState = new MouseState( + Game1.oldMouseState.X, + Game1.oldMouseState.Y, + Game1.oldMouseState.ScrollWheelValue, + ButtonState.Pressed, + Game1.oldMouseState.MiddleButton, + Game1.oldMouseState.RightButton, + Game1.oldMouseState.XButton1, + Game1.oldMouseState.XButton2 + ); + } + else if (button == SButton.MouseRight) + { + Game1.oldMouseState = new MouseState( + Game1.oldMouseState.X, + Game1.oldMouseState.Y, + Game1.oldMouseState.ScrollWheelValue, + Game1.oldMouseState.LeftButton, + Game1.oldMouseState.MiddleButton, + ButtonState.Pressed, + Game1.oldMouseState.XButton1, + Game1.oldMouseState.XButton2 + ); } } } |