diff options
Diffstat (limited to 'src/SMAPI/Events')
32 files changed, 0 insertions, 1704 deletions
diff --git a/src/SMAPI/Events/ContentEvents.cs b/src/SMAPI/Events/ContentEvents.cs deleted file mode 100644 index aca76ef7..00000000 --- a/src/SMAPI/Events/ContentEvents.cs +++ /dev/null @@ -1,45 +0,0 @@ -#if !SMAPI_3_0_STRICT -using System; -using StardewModdingAPI.Framework; -using StardewModdingAPI.Framework.Events; - -namespace StardewModdingAPI.Events -{ - /// <summary>Events raised when the game loads content.</summary> - [Obsolete("Use " + nameof(Mod.Helper) + "." + nameof(IModHelper.Events) + " instead. See https://smapi.io/3.0 for more info.")] - public static class ContentEvents - { - /********* - ** Fields - *********/ - /// <summary>The core event manager.</summary> - private static EventManager EventManager; - - - /********* - ** Events - *********/ - /// <summary>Raised after the content language changes.</summary> - public static event EventHandler<EventArgsValueChanged<string>> AfterLocaleChanged - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - ContentEvents.EventManager.Legacy_LocaleChanged.Add(value); - } - remove => ContentEvents.EventManager.Legacy_LocaleChanged.Remove(value); - } - - - /********* - ** Public methods - *********/ - /// <summary>Initialise the events.</summary> - /// <param name="eventManager">The core event manager.</param> - internal static void Init(EventManager eventManager) - { - ContentEvents.EventManager = eventManager; - } - } -} -#endif diff --git a/src/SMAPI/Events/ControlEvents.cs b/src/SMAPI/Events/ControlEvents.cs deleted file mode 100644 index 45aedc9b..00000000 --- a/src/SMAPI/Events/ControlEvents.cs +++ /dev/null @@ -1,123 +0,0 @@ -#if !SMAPI_3_0_STRICT -using System; -using Microsoft.Xna.Framework.Input; -using StardewModdingAPI.Framework; -using StardewModdingAPI.Framework.Events; - -namespace StardewModdingAPI.Events -{ - /// <summary>Events raised when the player uses a controller, keyboard, or mouse.</summary> - [Obsolete("Use " + nameof(Mod.Helper) + "." + nameof(IModHelper.Events) + " instead. See https://smapi.io/3.0 for more info.")] - public static class ControlEvents - { - /********* - ** Fields - *********/ - /// <summary>The core event manager.</summary> - private static EventManager EventManager; - - - /********* - ** 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 - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - ControlEvents.EventManager.Legacy_KeyboardChanged.Add(value); - } - remove => ControlEvents.EventManager.Legacy_KeyboardChanged.Remove(value); - } - - /// <summary>Raised after the player presses a keyboard key.</summary> - public static event EventHandler<EventArgsKeyPressed> KeyPressed - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - ControlEvents.EventManager.Legacy_KeyPressed.Add(value); - } - remove => ControlEvents.EventManager.Legacy_KeyPressed.Remove(value); - } - - /// <summary>Raised after the player releases a keyboard key.</summary> - public static event EventHandler<EventArgsKeyPressed> KeyReleased - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - ControlEvents.EventManager.Legacy_KeyReleased.Add(value); - } - remove => ControlEvents.EventManager.Legacy_KeyReleased.Remove(value); - } - - /// <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 - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - ControlEvents.EventManager.Legacy_MouseChanged.Add(value); - } - remove => ControlEvents.EventManager.Legacy_MouseChanged.Remove(value); - } - - /// <summary>The player pressed a controller button. This event isn't raised for trigger buttons.</summary> - public static event EventHandler<EventArgsControllerButtonPressed> ControllerButtonPressed - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - ControlEvents.EventManager.Legacy_ControllerButtonPressed.Add(value); - } - remove => ControlEvents.EventManager.Legacy_ControllerButtonPressed.Remove(value); - } - - /// <summary>The player released a controller button. This event isn't raised for trigger buttons.</summary> - public static event EventHandler<EventArgsControllerButtonReleased> ControllerButtonReleased - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - ControlEvents.EventManager.Legacy_ControllerButtonReleased.Add(value); - } - remove => ControlEvents.EventManager.Legacy_ControllerButtonReleased.Remove(value); - } - - /// <summary>The player pressed a controller trigger button.</summary> - public static event EventHandler<EventArgsControllerTriggerPressed> ControllerTriggerPressed - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - ControlEvents.EventManager.Legacy_ControllerTriggerPressed.Add(value); - } - remove => ControlEvents.EventManager.Legacy_ControllerTriggerPressed.Remove(value); - } - - /// <summary>The player released a controller trigger button.</summary> - public static event EventHandler<EventArgsControllerTriggerReleased> ControllerTriggerReleased - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - ControlEvents.EventManager.Legacy_ControllerTriggerReleased.Add(value); - } - remove => ControlEvents.EventManager.Legacy_ControllerTriggerReleased.Remove(value); - } - - - /********* - ** Public methods - *********/ - /// <summary>Initialise the events.</summary> - /// <param name="eventManager">The core event manager.</param> - internal static void Init(EventManager eventManager) - { - ControlEvents.EventManager = eventManager; - } - } -} -#endif diff --git a/src/SMAPI/Events/EventArgsClickableMenuChanged.cs b/src/SMAPI/Events/EventArgsClickableMenuChanged.cs deleted file mode 100644 index a0b903b7..00000000 --- a/src/SMAPI/Events/EventArgsClickableMenuChanged.cs +++ /dev/null @@ -1,33 +0,0 @@ -#if !SMAPI_3_0_STRICT -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; - } - } -} -#endif diff --git a/src/SMAPI/Events/EventArgsClickableMenuClosed.cs b/src/SMAPI/Events/EventArgsClickableMenuClosed.cs deleted file mode 100644 index 77db69ea..00000000 --- a/src/SMAPI/Events/EventArgsClickableMenuClosed.cs +++ /dev/null @@ -1,28 +0,0 @@ -#if !SMAPI_3_0_STRICT -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; - } - } -} -#endif diff --git a/src/SMAPI/Events/EventArgsControllerButtonPressed.cs b/src/SMAPI/Events/EventArgsControllerButtonPressed.cs deleted file mode 100644 index 949446e1..00000000 --- a/src/SMAPI/Events/EventArgsControllerButtonPressed.cs +++ /dev/null @@ -1,34 +0,0 @@ -#if !SMAPI_3_0_STRICT -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; - } - } -} -#endif diff --git a/src/SMAPI/Events/EventArgsControllerButtonReleased.cs b/src/SMAPI/Events/EventArgsControllerButtonReleased.cs deleted file mode 100644 index d6d6d840..00000000 --- a/src/SMAPI/Events/EventArgsControllerButtonReleased.cs +++ /dev/null @@ -1,34 +0,0 @@ -#if !SMAPI_3_0_STRICT -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; - } - } -} -#endif diff --git a/src/SMAPI/Events/EventArgsControllerTriggerPressed.cs b/src/SMAPI/Events/EventArgsControllerTriggerPressed.cs deleted file mode 100644 index 33be2fa3..00000000 --- a/src/SMAPI/Events/EventArgsControllerTriggerPressed.cs +++ /dev/null @@ -1,39 +0,0 @@ -#if !SMAPI_3_0_STRICT -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; - } - } -} -#endif diff --git a/src/SMAPI/Events/EventArgsControllerTriggerReleased.cs b/src/SMAPI/Events/EventArgsControllerTriggerReleased.cs deleted file mode 100644 index e90ff712..00000000 --- a/src/SMAPI/Events/EventArgsControllerTriggerReleased.cs +++ /dev/null @@ -1,39 +0,0 @@ -#if !SMAPI_3_0_STRICT -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; - } - } -} -#endif diff --git a/src/SMAPI/Events/EventArgsInput.cs b/src/SMAPI/Events/EventArgsInput.cs deleted file mode 100644 index 5cff3408..00000000 --- a/src/SMAPI/Events/EventArgsInput.cs +++ /dev/null @@ -1,64 +0,0 @@ -#if !SMAPI_3_0_STRICT -using System; -using System.Collections.Generic; - -namespace StardewModdingAPI.Events -{ - /// <summary>Event arguments when a button is pressed or released.</summary> - public class EventArgsInput : EventArgs - { - /********* - ** Fields - *********/ - /// <summary>The buttons to suppress.</summary> - private readonly HashSet<SButton> SuppressButtons; - - - /********* - ** 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; } - - /// <summary>Whether the input should trigger actions on the affected tile.</summary> - public bool IsActionButton => this.Button.IsActionButton(); - - /// <summary>Whether the input should use tools on the affected tile.</summary> - public bool IsUseToolButton => this.Button.IsUseToolButton(); - - /// <summary>Whether a mod has indicated the key was already handled.</summary> - public bool IsSuppressed => this.SuppressButtons.Contains(this.Button); - - - /********* - ** 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="suppressButtons">The buttons to suppress.</param> - public EventArgsInput(SButton button, ICursorPosition cursor, HashSet<SButton> suppressButtons) - { - this.Button = button; - this.Cursor = cursor; - this.SuppressButtons = suppressButtons; - } - - /// <summary>Prevent the game from handling the current 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) - { - this.SuppressButtons.Add(button); - } - } -} -#endif diff --git a/src/SMAPI/Events/EventArgsIntChanged.cs b/src/SMAPI/Events/EventArgsIntChanged.cs deleted file mode 100644 index 76ec6d08..00000000 --- a/src/SMAPI/Events/EventArgsIntChanged.cs +++ /dev/null @@ -1,32 +0,0 @@ -#if !SMAPI_3_0_STRICT -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; - } - } -} -#endif diff --git a/src/SMAPI/Events/EventArgsInventoryChanged.cs b/src/SMAPI/Events/EventArgsInventoryChanged.cs deleted file mode 100644 index 488dd23f..00000000 --- a/src/SMAPI/Events/EventArgsInventoryChanged.cs +++ /dev/null @@ -1,43 +0,0 @@ -#if !SMAPI_3_0_STRICT -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 IList<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 sizes changed.</summary> - public List<ItemStackChange> QuantityChanged { get; } - - - /********* - ** Public methods - *********/ - /// <summary>Construct an instance.</summary> - /// <param name="inventory">The player's inventory.</param> - /// <param name="changedItems">The inventory changes.</param> - public EventArgsInventoryChanged(IList<Item> inventory, ItemStackChange[] changedItems) - { - this.Inventory = inventory; - this.Added = changedItems.Where(n => n.ChangeType == ChangeType.Added).ToList(); - this.Removed = changedItems.Where(n => n.ChangeType == ChangeType.Removed).ToList(); - this.QuantityChanged = changedItems.Where(n => n.ChangeType == ChangeType.StackChange).ToList(); - } - } -} -#endif diff --git a/src/SMAPI/Events/EventArgsKeyPressed.cs b/src/SMAPI/Events/EventArgsKeyPressed.cs deleted file mode 100644 index 6204d821..00000000 --- a/src/SMAPI/Events/EventArgsKeyPressed.cs +++ /dev/null @@ -1,28 +0,0 @@ -#if !SMAPI_3_0_STRICT -using System; -using Microsoft.Xna.Framework.Input; - -namespace StardewModdingAPI.Events -{ - /// <summary>Event arguments for a <see cref="ControlEvents.KeyboardChanged"/> event.</summary> - public class EventArgsKeyPressed : EventArgs - { - /********* - ** Accessors - *********/ - /// <summary>The keyboard button that was pressed.</summary> - public Keys KeyPressed { get; } - - - /********* - ** Public methods - *********/ - /// <summary>Construct an instance.</summary> - /// <param name="key">The keyboard button that was pressed.</param> - public EventArgsKeyPressed(Keys key) - { - this.KeyPressed = key; - } - } -} -#endif diff --git a/src/SMAPI/Events/EventArgsKeyboardStateChanged.cs b/src/SMAPI/Events/EventArgsKeyboardStateChanged.cs deleted file mode 100644 index 2c3203b1..00000000 --- a/src/SMAPI/Events/EventArgsKeyboardStateChanged.cs +++ /dev/null @@ -1,33 +0,0 @@ -#if !SMAPI_3_0_STRICT -using System; -using Microsoft.Xna.Framework.Input; - -namespace StardewModdingAPI.Events -{ - /// <summary>Event arguments for a <see cref="ControlEvents.KeyboardChanged"/> event.</summary> - public class EventArgsKeyboardStateChanged : EventArgs - { - /********* - ** Accessors - *********/ - /// <summary>The previous keyboard state.</summary> - public KeyboardState NewState { get; } - - /// <summary>The current keyboard state.</summary> - public KeyboardState PriorState { get; } - - - /********* - ** Public methods - *********/ - /// <summary>Construct an instance.</summary> - /// <param name="priorState">The previous keyboard state.</param> - /// <param name="newState">The current keyboard state.</param> - public EventArgsKeyboardStateChanged(KeyboardState priorState, KeyboardState newState) - { - this.PriorState = priorState; - this.NewState = newState; - } - } -} -#endif diff --git a/src/SMAPI/Events/EventArgsLevelUp.cs b/src/SMAPI/Events/EventArgsLevelUp.cs deleted file mode 100644 index 06c70088..00000000 --- a/src/SMAPI/Events/EventArgsLevelUp.cs +++ /dev/null @@ -1,55 +0,0 @@ -#if !SMAPI_3_0_STRICT -using System; -using StardewModdingAPI.Enums; - -namespace StardewModdingAPI.Events -{ - /// <summary>Event arguments for a <see cref="PlayerEvents.LeveledUp"/> event.</summary> - public class EventArgsLevelUp : EventArgs - { - /********* - ** Accessors - *********/ - /// <summary>The player skill that leveled up.</summary> - public LevelType Type { get; } - - /// <summary>The new skill level.</summary> - public int NewLevel { get; } - - /// <summary>The player skill types.</summary> - public enum LevelType - { - /// <summary>The combat skill.</summary> - Combat = SkillType.Combat, - - /// <summary>The farming skill.</summary> - Farming = SkillType.Farming, - - /// <summary>The fishing skill.</summary> - Fishing = SkillType.Fishing, - - /// <summary>The foraging skill.</summary> - Foraging = SkillType.Foraging, - - /// <summary>The mining skill.</summary> - Mining = SkillType.Mining, - - /// <summary>The luck skill.</summary> - Luck = SkillType.Luck - } - - - /********* - ** Public methods - *********/ - /// <summary>Construct an instance.</summary> - /// <param name="type">The player skill that leveled up.</param> - /// <param name="newLevel">The new skill level.</param> - public EventArgsLevelUp(LevelType type, int newLevel) - { - this.Type = type; - this.NewLevel = newLevel; - } - } -} -#endif diff --git a/src/SMAPI/Events/EventArgsLocationBuildingsChanged.cs b/src/SMAPI/Events/EventArgsLocationBuildingsChanged.cs deleted file mode 100644 index 25e84722..00000000 --- a/src/SMAPI/Events/EventArgsLocationBuildingsChanged.cs +++ /dev/null @@ -1,41 +0,0 @@ -#if !SMAPI_3_0_STRICT -using System; -using System.Collections.Generic; -using System.Linq; -using StardewValley; -using StardewValley.Buildings; - -namespace StardewModdingAPI.Events -{ - /// <summary>Event arguments for a <see cref="LocationEvents.BuildingsChanged"/> event.</summary> - public class EventArgsLocationBuildingsChanged : EventArgs - { - /********* - ** Accessors - *********/ - /// <summary>The location which changed.</summary> - |
