summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI/Events
diff options
context:
space:
mode:
Diffstat (limited to 'src/StardewModdingAPI/Events')
-rw-r--r--src/StardewModdingAPI/Events/ChangeType.cs15
-rw-r--r--src/StardewModdingAPI/Events/ContentEvents.cs29
-rw-r--r--src/StardewModdingAPI/Events/ControlEvents.cs112
-rw-r--r--src/StardewModdingAPI/Events/EventArgsClickableMenuChanged.cs31
-rw-r--r--src/StardewModdingAPI/Events/EventArgsClickableMenuClosed.cs26
-rw-r--r--src/StardewModdingAPI/Events/EventArgsControllerButtonPressed.cs32
-rw-r--r--src/StardewModdingAPI/Events/EventArgsControllerButtonReleased.cs32
-rw-r--r--src/StardewModdingAPI/Events/EventArgsControllerTriggerPressed.cs37
-rw-r--r--src/StardewModdingAPI/Events/EventArgsControllerTriggerReleased.cs37
-rw-r--r--src/StardewModdingAPI/Events/EventArgsCurrentLocationChanged.cs31
-rw-r--r--src/StardewModdingAPI/Events/EventArgsGameLocationsChanged.cs27
-rw-r--r--src/StardewModdingAPI/Events/EventArgsInput.cs124
-rw-r--r--src/StardewModdingAPI/Events/EventArgsIntChanged.cs29
-rw-r--r--src/StardewModdingAPI/Events/EventArgsInventoryChanged.cs41
-rw-r--r--src/StardewModdingAPI/Events/EventArgsKeyPressed.cs26
-rw-r--r--src/StardewModdingAPI/Events/EventArgsKeyboardStateChanged.cs31
-rw-r--r--src/StardewModdingAPI/Events/EventArgsLevelUp.cs52
-rw-r--r--src/StardewModdingAPI/Events/EventArgsLocationObjectsChanged.cs28
-rw-r--r--src/StardewModdingAPI/Events/EventArgsMineLevelChanged.cs30
-rw-r--r--src/StardewModdingAPI/Events/EventArgsMouseStateChanged.cs42
-rw-r--r--src/StardewModdingAPI/Events/EventArgsValueChanged.cs31
-rw-r--r--src/StardewModdingAPI/Events/GameEvents.cs96
-rw-r--r--src/StardewModdingAPI/Events/GraphicsEvents.cs116
-rw-r--r--src/StardewModdingAPI/Events/InputEvents.cs43
-rw-r--r--src/StardewModdingAPI/Events/ItemStackChange.cs20
-rw-r--r--src/StardewModdingAPI/Events/LocationEvents.cs54
-rw-r--r--src/StardewModdingAPI/Events/MenuEvents.cs40
-rw-r--r--src/StardewModdingAPI/Events/MineEvents.cs28
-rw-r--r--src/StardewModdingAPI/Events/PlayerEvents.cs43
-rw-r--r--src/StardewModdingAPI/Events/SaveEvents.cs56
-rw-r--r--src/StardewModdingAPI/Events/TimeEvents.cs37
31 files changed, 0 insertions, 1376 deletions
diff --git a/src/StardewModdingAPI/Events/ChangeType.cs b/src/StardewModdingAPI/Events/ChangeType.cs
deleted file mode 100644
index 4b207f08..00000000
--- a/src/StardewModdingAPI/Events/ChangeType.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-namespace StardewModdingAPI.Events
-{
- /// <summary>Indicates how an inventory item changed.</summary>
- public enum ChangeType
- {
- /// <summary>The entire stack was removed.</summary>
- Removed,
-
- /// <summary>The entire stack was added.</summary>
- Added,
-
- /// <summary>The stack size changed.</summary>
- StackChange
- }
-} \ No newline at end of file
diff --git a/src/StardewModdingAPI/Events/ContentEvents.cs b/src/StardewModdingAPI/Events/ContentEvents.cs
deleted file mode 100644
index 4b4e2ad0..00000000
--- a/src/StardewModdingAPI/Events/ContentEvents.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-using System;
-using StardewModdingAPI.Framework;
-
-namespace StardewModdingAPI.Events
-{
- /// <summary>Events raised when the game loads content.</summary>
- public static class ContentEvents
- {
-
- /*********
- ** Events
- *********/
- /// <summary>Raised after the content language changes.</summary>
- public static event EventHandler<EventArgsValueChanged<string>> AfterLocaleChanged;
-
-
- /*********
- ** Internal methods
- *********/
- /// <summary>Raise an <see cref="AfterLocaleChanged"/> event.</summary>
- /// <param name="monitor">Encapsulates monitoring and logging.</param>
- /// <param name="oldLocale">The previous locale.</param>
- /// <param name="newLocale">The current locale.</param>
- internal static void InvokeAfterLocaleChanged(IMonitor monitor, string oldLocale, string newLocale)
- {
- monitor.SafelyRaiseGenericEvent($"{nameof(ContentEvents)}.{nameof(ContentEvents.AfterLocaleChanged)}", ContentEvents.AfterLocaleChanged?.GetInvocationList(), null, new EventArgsValueChanged<string>(oldLocale, newLocale));
- }
- }
-}
diff --git a/src/StardewModdingAPI/Events/ControlEvents.cs b/src/StardewModdingAPI/Events/ControlEvents.cs
deleted file mode 100644
index 80d0f547..00000000
--- a/src/StardewModdingAPI/Events/ControlEvents.cs
+++ /dev/null
@@ -1,112 +0,0 @@
-using System;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Input;
-using StardewModdingAPI.Framework;
-
-namespace StardewModdingAPI.Events
-{
- /// <summary>Events raised when the player uses a controller, keyboard, or mouse.</summary>
- public static class ControlEvents
- {
- /*********
- ** Events
- *********/
- /// <summary>Raised when the <see cref="KeyboardState"/> changes. That happens when the player presses or releases a key.</summary>
- public static event EventHandler<EventArgsKeyboardStateChanged> KeyboardChanged;
-
- /// <summary>Raised when the player presses a keyboard key.</summary>
- public static event EventHandler<EventArgsKeyPressed> KeyPressed;
-
- /// <summary>Raised when the player releases a keyboard key.</summary>
- public static event EventHandler<EventArgsKeyPressed> KeyReleased;
-
- /// <summary>Raised when the <see cref="MouseState"/> changes. That happens when the player moves the mouse, scrolls the mouse wheel, or presses/releases a button.</summary>
- public static event EventHandler<EventArgsMouseStateChanged> MouseChanged;
-
- /// <summary>The player pressed a controller button. This event isn't raised for trigger buttons.</summary>
- public static event EventHandler<EventArgsControllerButtonPressed> ControllerButtonPressed;
-
- /// <summary>The player released a controller button. This event isn't raised for trigger buttons.</summary>
- public static event EventHandler<EventArgsControllerButtonReleased> ControllerButtonReleased;
-
- /// <summary>The player pressed a controller trigger button.</summary>
- public static event EventHandler<EventArgsControllerTriggerPressed> ControllerTriggerPressed;
-
- /// <summary>The player released a controller trigger button.</summary>
- public static event EventHandler<EventArgsControllerTriggerReleased> ControllerTriggerReleased;
-
-
- /*********
- ** Internal methods
- *********/
- /// <summary>Raise a <see cref="KeyboardChanged"/> event.</summary>
- /// <param name="monitor">Encapsulates monitoring and logging.</param>
- /// <param name="priorState">The previous keyboard state.</param>
- /// <param name="newState">The current keyboard state.</param>
- internal static void InvokeKeyboardChanged(IMonitor monitor, KeyboardState priorState, KeyboardState newState)
- {
- monitor.SafelyRaiseGenericEvent($"{nameof(ControlEvents)}.{nameof(ControlEvents.KeyboardChanged)}", ControlEvents.KeyboardChanged?.GetInvocationList(), null, new EventArgsKeyboardStateChanged(priorState, newState));
- }
-
- /// <summary>Raise a <see cref="MouseChanged"/> event.</summary>
- /// <param name="monitor">Encapsulates monitoring and logging.</param>
- /// <param name="priorState">The previous mouse state.</param>
- /// <param name="newState">The current mouse state.</param>
- /// <param name="priorPosition">The previous mouse position on the screen adjusted for the zoom level.</param>
- /// <param name="newPosition">The current mouse position on the screen adjusted for the zoom level.</param>
- internal static void InvokeMouseChanged(IMonitor monitor, MouseState priorState, MouseState newState, Point priorPosition, Point newPosition)
- {
- monitor.SafelyRaiseGenericEvent($"{nameof(ControlEvents)}.{nameof(ControlEvents.MouseChanged)}", ControlEvents.MouseChanged?.GetInvocationList(), null, new EventArgsMouseStateChanged(priorState, newState, priorPosition, newPosition));
- }
-
- /// <summary>Raise a <see cref="KeyPressed"/> event.</summary>
- /// <param name="monitor">Encapsulates monitoring and logging.</param>
- /// <param name="key">The keyboard button that was pressed.</param>
- internal static void InvokeKeyPressed(IMonitor monitor, Keys key)
- {
- monitor.SafelyRaiseGenericEvent($"{nameof(ControlEvents)}.{nameof(ControlEvents.KeyPressed)}", ControlEvents.KeyPressed?.GetInvocationList(), null, new EventArgsKeyPressed(key));
- }
-
- /// <summary>Raise a <see cref="KeyReleased"/> event.</summary>
- /// <param name="monitor">Encapsulates monitoring and logging.</param>
- /// <param name="key">The keyboard button that was released.</param>
- internal static void InvokeKeyReleased(IMonitor monitor, Keys key)
- {
- monitor.SafelyRaiseGenericEvent($"{nameof(ControlEvents)}.{nameof(ControlEvents.KeyReleased)}", ControlEvents.KeyReleased?.GetInvocationList(), null, new EventArgsKeyPressed(key));
- }
-
- /// <summary>Raise a <see cref="ControllerButtonPressed"/> event.</summary>
- /// <param name="monitor">Encapsulates monitoring and logging.</param>
- /// <param name="button">The controller button that was pressed.</param>
- internal static void InvokeButtonPressed(IMonitor monitor, Buttons button)
- {
- monitor.SafelyRaiseGenericEvent($"{nameof(ControlEvents)}.{nameof(ControlEvents.ControllerButtonPressed)}", ControlEvents.ControllerButtonPressed?.GetInvocationList(), null, new EventArgsControllerButtonPressed(PlayerIndex.One, button));
- }
-
- /// <summary>Raise a <see cref="ControllerButtonReleased"/> event.</summary>
- /// <param name="monitor">Encapsulates monitoring and logging.</param>
- /// <param name="button">The controller button that was released.</param>
- internal static void InvokeButtonReleased(IMonitor monitor, Buttons button)
- {
- monitor.SafelyRaiseGenericEvent($"{nameof(ControlEvents)}.{nameof(ControlEvents.ControllerButtonReleased)}", ControlEvents.ControllerButtonReleased?.GetInvocationList(), null, new EventArgsControllerButtonReleased(PlayerIndex.One, button));
- }
-
- /// <summary>Raise a <see cref="ControllerTriggerPressed"/> event.</summary>
- /// <param name="monitor">Encapsulates monitoring and logging.</param>
- /// <param name="button">The trigger button that was pressed.</param>
- /// <param name="value">The current trigger value.</param>
- internal static void InvokeTriggerPressed(IMonitor monitor, Buttons button, float value)
- {
- monitor.SafelyRaiseGenericEvent($"{nameof(ControlEvents)}.{nameof(ControlEvents.ControllerTriggerPressed)}", ControlEvents.ControllerTriggerPressed?.GetInvocationList(), null, new EventArgsControllerTriggerPressed(PlayerIndex.One, button, value));
- }
-
- /// <summary>Raise a <see cref="ControllerTriggerReleased"/> event.</summary>
- /// <param name="monitor">Encapsulates monitoring and logging.</param>
- /// <param name="button">The trigger button that was pressed.</param>
- /// <param name="value">The current trigger value.</param>
- internal static void InvokeTriggerReleased(IMonitor monitor, Buttons button, float value)
- {
- monitor.SafelyRaiseGenericEvent($"{nameof(ControlEvents)}.{nameof(ControlEvents.ControllerTriggerReleased)}", ControlEvents.ControllerTriggerReleased?.GetInvocationList(), null, new EventArgsControllerTriggerReleased(PlayerIndex.One, button, value));
- }
- }
-}
diff --git a/src/StardewModdingAPI/Events/EventArgsClickableMenuChanged.cs b/src/StardewModdingAPI/Events/EventArgsClickableMenuChanged.cs
deleted file mode 100644
index 2a2aa163..00000000
--- a/src/StardewModdingAPI/Events/EventArgsClickableMenuChanged.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using System;
-using StardewValley.Menus;
-
-namespace StardewModdingAPI.Events
-{
- /// <summary>Event arguments for a <see cref="MenuEvents.MenuChanged"/> event.</summary>
- public class EventArgsClickableMenuChanged : EventArgs
- {
- /*********
- ** Accessors
- *********/
- /// <summary>The previous menu.</summary>
- public IClickableMenu NewMenu { get; }
-
- /// <summary>The current menu.</summary>
- public IClickableMenu PriorMenu { get; }
-
-
- /*********
- ** Public methods
- *********/
- /// <summary>Construct an instance.</summary>
- /// <param name="priorMenu">The previous menu.</param>
- /// <param name="newMenu">The current menu.</param>
- public EventArgsClickableMenuChanged(IClickableMenu priorMenu, IClickableMenu newMenu)
- {
- this.NewMenu = newMenu;
- this.PriorMenu = priorMenu;
- }
- }
-}
diff --git a/src/StardewModdingAPI/Events/EventArgsClickableMenuClosed.cs b/src/StardewModdingAPI/Events/EventArgsClickableMenuClosed.cs
deleted file mode 100644
index 5e6585f0..00000000
--- a/src/StardewModdingAPI/Events/EventArgsClickableMenuClosed.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using System;
-using StardewValley.Menus;
-
-namespace StardewModdingAPI.Events
-{
- /// <summary>Event arguments for a <see cref="MenuEvents.MenuClosed"/> event.</summary>
- public class EventArgsClickableMenuClosed : EventArgs
- {
- /*********
- ** Accessors
- *********/
- /// <summary>The menu that was closed.</summary>
- public IClickableMenu PriorMenu { get; }
-
-
- /*********
- ** Accessors
- *********/
- /// <summary>Construct an instance.</summary>
- /// <param name="priorMenu">The menu that was closed.</param>
- public EventArgsClickableMenuClosed(IClickableMenu priorMenu)
- {
- this.PriorMenu = priorMenu;
- }
- }
-}
diff --git a/src/StardewModdingAPI/Events/EventArgsControllerButtonPressed.cs b/src/StardewModdingAPI/Events/EventArgsControllerButtonPressed.cs
deleted file mode 100644
index 3243b80b..00000000
--- a/src/StardewModdingAPI/Events/EventArgsControllerButtonPressed.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using System;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Input;
-
-namespace StardewModdingAPI.Events
-{
- /// <summary>Event arguments for a <see cref="ControlEvents.ControllerButtonPressed"/> event.</summary>
- public class EventArgsControllerButtonPressed : EventArgs
- {
- /*********
- ** Accessors
- *********/
- /// <summary>The player who pressed the button.</summary>
- public PlayerIndex PlayerIndex { get; }
-
- /// <summary>The controller button that was pressed.</summary>
- public Buttons ButtonPressed { get; }
-
-
- /*********
- ** Public methods
- *********/
- /// <summary>Construct an instance.</summary>
- /// <param name="playerIndex">The player who pressed the button.</param>
- /// <param name="button">The controller button that was pressed.</param>
- public EventArgsControllerButtonPressed(PlayerIndex playerIndex, Buttons button)
- {
- this.PlayerIndex = playerIndex;
- this.ButtonPressed = button;
- }
- }
-}
diff --git a/src/StardewModdingAPI/Events/EventArgsControllerButtonReleased.cs b/src/StardewModdingAPI/Events/EventArgsControllerButtonReleased.cs
deleted file mode 100644
index e05a080b..00000000
--- a/src/StardewModdingAPI/Events/EventArgsControllerButtonReleased.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using System;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Input;
-
-namespace StardewModdingAPI.Events
-{
- /// <summary>Event arguments for a <see cref="ControlEvents.ControllerButtonReleased"/> event.</summary>
- public class EventArgsControllerButtonReleased : EventArgs
- {
- /*********
- ** Accessors
- *********/
- /// <summary>The player who pressed the button.</summary>
- public PlayerIndex PlayerIndex { get; }
-
- /// <summary>The controller button that was pressed.</summary>
- public Buttons ButtonReleased { get; }
-
-
- /*********
- ** Public methods
- *********/
- /// <summary>Construct an instance.</summary>
- /// <param name="playerIndex">The player who pressed the button.</param>
- /// <param name="button">The controller button that was released.</param>
- public EventArgsControllerButtonReleased(PlayerIndex playerIndex, Buttons button)
- {
- this.PlayerIndex = playerIndex;
- this.ButtonReleased = button;
- }
- }
-}
diff --git a/src/StardewModdingAPI/Events/EventArgsControllerTriggerPressed.cs b/src/StardewModdingAPI/Events/EventArgsControllerTriggerPressed.cs
deleted file mode 100644
index a2087733..00000000
--- a/src/StardewModdingAPI/Events/EventArgsControllerTriggerPressed.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using System;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Input;
-
-namespace StardewModdingAPI.Events
-{
- /// <summary>Event arguments for a <see cref="ControlEvents.ControllerTriggerPressed"/> event.</summary>
- public class EventArgsControllerTriggerPressed : EventArgs
- {
- /*********
- ** Accessors
- *********/
- /// <summary>The player who pressed the button.</summary>
- public PlayerIndex PlayerIndex { get; }
-
- /// <summary>The controller button that was pressed.</summary>
- public Buttons ButtonPressed { get; }
-
- /// <summary>The current trigger value.</summary>
- public float Value { get; }
-
-
- /*********
- ** Public methods
- *********/
- /// <summary>Construct an instance.</summary>
- /// <param name="playerIndex">The player who pressed the trigger button.</param>
- /// <param name="button">The trigger button that was pressed.</param>
- /// <param name="value">The current trigger value.</param>
- public EventArgsControllerTriggerPressed(PlayerIndex playerIndex, Buttons button, float value)
- {
- this.PlayerIndex = playerIndex;
- this.ButtonPressed = button;
- this.Value = value;
- }
- }
-}
diff --git a/src/StardewModdingAPI/Events/EventArgsControllerTriggerReleased.cs b/src/StardewModdingAPI/Events/EventArgsControllerTriggerReleased.cs
deleted file mode 100644
index d2eecbec..00000000
--- a/src/StardewModdingAPI/Events/EventArgsControllerTriggerReleased.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using System;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Input;
-
-namespace StardewModdingAPI.Events
-{
- /// <summary>Event arguments for a <see cref="ControlEvents.ControllerTriggerReleased"/> event.</summary>
- public class EventArgsControllerTriggerReleased : EventArgs
- {
- /*********
- ** Accessors
- *********/
- /// <summary>The player who pressed the button.</summary>
- public PlayerIndex PlayerIndex { get; }
-
- /// <summary>The controller button that was released.</summary>
- public Buttons ButtonReleased { get; }
-
- /// <summary>The current trigger value.</summary>
- public float Value { get; }
-
-
- /*********
- ** Public methods
- *********/
- /// <summary>Construct an instance.</summary>
- /// <param name="playerIndex">The player who pressed the trigger button.</param>
- /// <param name="button">The trigger button that was released.</param>
- /// <param name="value">The current trigger value.</param>
- public EventArgsControllerTriggerReleased(PlayerIndex playerIndex, Buttons button, float value)
- {
- this.PlayerIndex = playerIndex;
- this.ButtonReleased = button;
- this.Value = value;
- }
- }
-}
diff --git a/src/StardewModdingAPI/Events/EventArgsCurrentLocationChanged.cs b/src/StardewModdingAPI/Events/EventArgsCurrentLocationChanged.cs
deleted file mode 100644
index 25d3ebf3..00000000
--- a/src/StardewModdingAPI/Events/EventArgsCurrentLocationChanged.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using System;
-using StardewValley;
-
-namespace StardewModdingAPI.Events
-{
- /// <summary>Event arguments for a <see cref="LocationEvents.CurrentLocationChanged"/> event.</summary>
- public class EventArgsCurrentLocationChanged : EventArgs
- {
- /*********
- ** Accessors
- *********/
- /// <summary>The player's current location.</summary>
- public GameLocation NewLocation { get; }
-
- /// <summary>The player's previous location.</summary>
- public GameLocation PriorLocation { get; }
-
-
- /*********
- ** Public methods
- *********/
- /// <summary>Construct an instance.</summary>
- /// <param name="priorLocation">The player's previous location.</param>
- /// <param name="newLocation">The player's current location.</param>
- public EventArgsCurrentLocationChanged(GameLocation priorLocation, GameLocation newLocation)
- {
- this.NewLocation = newLocation;
- this.PriorLocation = priorLocation;
- }
- }
-}
diff --git a/src/StardewModdingAPI/Events/EventArgsGameLocationsChanged.cs b/src/StardewModdingAPI/Events/EventArgsGameLocationsChanged.cs
deleted file mode 100644
index fb8c821e..00000000
--- a/src/StardewModdingAPI/Events/EventArgsGameLocationsChanged.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using System;
-using System.Collections.Generic;
-using StardewValley;
-
-namespace StardewModdingAPI.Events
-{
- /// <summary>Event arguments for a <see cref="LocationEvents.LocationsChanged"/> event.</summary>
- public class EventArgsGameLocationsChanged : EventArgs
- {
- /*********
- ** Accessors
- *********/
- /// <summary>The current list of game locations.</summary>
- public List<GameLocation> NewLocations { get; }
-
-
- /*********
- ** Public methods
- *********/
- /// <summary>Construct an instance.</summary>
- /// <param name="newLocations">The current list of game locations.</param>
- public EventArgsGameLocationsChanged(List<GameLocation> newLocations)
- {
- this.NewLocations = newLocations;
- }
- }
-}
diff --git a/src/StardewModdingAPI/Events/EventArgsInput.cs b/src/StardewModdingAPI/Events/EventArgsInput.cs
deleted file mode 100644
index 66cb19f2..00000000
--- a/src/StardewModdingAPI/Events/EventArgsInput.cs
+++ /dev/null
@@ -1,124 +0,0 @@
-using System;
-using System.Linq;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Input;
-using StardewModdingAPI.Utilities;
-using StardewValley;
-
-namespace StardewModdingAPI.Events
-{
- /// <summary>Event arguments when a button is pressed or released.</summary>
- public class EventArgsInput : EventArgs
- {
- /*********
- ** Accessors
- *********/
- /// <summary>The button on the controller, keyboard, or mouse.</summary>
- public SButton Button { get; }
-
- /// <summary>The current cursor position.</summary>
- public ICursorPosition Cursor { get; set; }
-
- /// <summary>Whether the input is considered a 'click' by the game for enabling action.</summary>
- public bool IsClick { get; }
-
-
- /*********
- ** Public methods
- *********/
- /// <summary>Construct an instance.</summary>
- /// <param name="button">The button on the controller, keyboard, or mouse.</param>
- /// <param name="cursor">The cursor position.</param>
- /// <param name="isClick">Whether the input is considered a 'click' by the game for enabling action.</param>
- public EventArgsInput(SButton button, ICursorPosition cursor, bool isClick)
- {
- this.Button = button;
- this.Cursor = cursor;
- this.IsClick = isClick;
- }
-
- /// <summary>Prevent the game from handling the vurrent button press. This doesn't prevent other mods from receiving the event.</summary>
- public void SuppressButton()
- {
- this.SuppressButton(this.Button);
- }
-
- /// <summary>Prevent the game from handling a button press. This doesn't prevent other mods from receiving the event.</summary>
- /// <param name="button">The button to suppress.</param>
- public void SuppressButton(SButton button)
- {
- // keyboard
- if (this.Button.TryGetKeyboard(out Keys key))
- Game1.oldKBState = new KeyboardState(Game1.oldKBState.GetPressedKeys().Except(new[] { key }).ToArray());
-
- // controller
- else if (this.Button.TryGetController(out Buttons controllerButton))
- {
- var newState = GamePad.GetState(PlayerIndex.One);
- var thumbsticks = Game1.oldPadState.ThumbSticks;
- var triggers = Game1.oldPadState.Triggers;
- var buttons = Game1.oldPadState.Buttons;
- var dpad = Game1.oldPadState.DPad;
-
- switch (controllerButton)
- {
- // d-pad
- case Buttons.DPadDown:
- dpad = new GamePadDPad(dpad.Up, newState.DPad.Down, dpad.Left, dpad.Right);
- break;
- case Buttons.DPadLeft:
- dpad = new GamePadDPad(dpad.Up, dpad.Down, newState.DPad.Left, dpad.Right);
- break;
- case Buttons.DPadRight:
- dpad = new GamePadDPad(dpad.Up, dpad.Down, dpad.Left, newState.DPad.Right);
- break;
- case Buttons.DPadUp:
- dpad = new GamePadDPad(newState.DPad.Up, dpad.Down, dpad.Left, dpad.Right);
- break;
-
- // trigger
- case Buttons.LeftTrigger:
- triggers = new GamePadTriggers(newState.Triggers.Left, triggers.Right);
- break;
- case Buttons.RightTrigger:
- triggers = new GamePadTriggers(triggers.Left, newState.Triggers.Right);
- break;
-
- // thumbstick
- case Buttons.LeftThumbstickDown:
- case Buttons.LeftThumbstickLeft:
- case Buttons.LeftThumbstickRight:
- case Buttons.LeftThumbstickUp:
- thumbsticks = new GamePadThumbSticks(newState.ThumbSticks.Left, thumbsticks.Right);
- break;
- case Buttons.RightThumbstickDown:
- case Buttons.RightThumbstickLeft:
- case Buttons.RightThumbstickRight:
- case Buttons.RightThumbstickUp:
- thumbsticks = new GamePadThumbSticks(newState.ThumbSticks.Right, thumbsticks.Left);
- break;
-
- // buttons
- default:
- var mask =
- (buttons.A == ButtonState.Pressed ? Buttons.A : 0)
- | (buttons.B == ButtonState.Pressed ? Buttons.B : 0)
- | (buttons.Back == ButtonState.Pressed ? Buttons.Back : 0)
- | (buttons.BigButton == ButtonState.Pressed ? Buttons.BigButton : 0)
- | (buttons.LeftShoulder == ButtonState.Pressed ? Buttons.LeftShoulder : 0)
- | (buttons.LeftStick == ButtonState.Pressed ? Buttons.LeftStick : 0)
- | (buttons.RightShoulder == ButtonState.Pressed ? Buttons.RightShoulder : 0)
- | (buttons.RightStick == ButtonState.Pressed ? Buttons.RightStick : 0)
- | (buttons.Start == ButtonState.Pressed ? Buttons.Start : 0)
- | (buttons.X == ButtonState.Pressed ? Buttons.X : 0)
- | (buttons.Y == ButtonState.Pressed ? Buttons.Y : 0);
- mask = mask ^ controllerButton;
- buttons = new GamePadButtons(mask);
- break;
- }
-
- Game1.oldPadState = new GamePadState(thumbsticks, triggers, buttons, dpad);
- }
- }
- }
-}
diff --git a/src/StardewModdingAPI/Events/EventArgsIntChanged.cs b/src/StardewModdingAPI/Events/EventArgsIntChanged.cs
deleted file mode 100644
index 0c742d12..00000000
--- a/src/StardewModdingAPI/Events/EventArgsIntChanged.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-using System;
-
-namespace StardewModdingAPI.Events
-{
- /// <summary>Event arguments for an integer field that changed value.</summary>
- public class EventArgsIntChanged : EventArgs
- {
- /*********
- ** Accessors
- *********/
- /// <summary>The previous value.</summary>
- public int PriorInt { get; }
-
- /// <summary>The current value.</summary>
- public int NewInt { get; }
-
- /*********
- ** Public methods
- *********/
- /// <summary>Construct an instance.</summary>
- /// <param name="priorInt">The previous value.</param>
- /// <param name="newInt">The current value.</param>
- public EventArgsIntChanged(int priorInt, int newInt)
- {
- this.PriorInt = priorInt;
- this.NewInt = newInt;
- }
- }
-}
diff --git a/src/StardewModdingAPI/Events/EventArgsInventoryChanged.cs b/src/StardewModdingAPI/Events/EventArgsInventoryChanged.cs
deleted file mode 100644
index 1ee02842..00000000
--- a/src/StardewModdingAPI/Events/EventArgsInventoryChanged.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using StardewValley;
-
-namespace StardewModdingAPI.Events
-{
- /// <summary>Event arguments for a <see cref="PlayerEvents.InventoryChanged"/> event.</summary>
- public class EventArgsInventoryChanged : EventArgs
- {
- /*********
- ** Accessors
- *********/
- /// <summary>The player's inventory.</summary>
- public List<Item> Inventory { get; }
-
- /// <summary>The added items.</summary>
- public List<ItemStackChange> Added { get; }
-
- /// <summary>The removed items.</summary>
- public List<ItemStackChange> Removed { get; }
-
- /// <summary>The items whose stack