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> - public GameLocation Location { get; } - - /// <summary>The buildings added to the location.</summary> - public IEnumerable<Building> Added { get; } - - /// <summary>The buildings removed from the location.</summary> - public IEnumerable<Building> Removed { get; } - - - /********* - ** Public methods - *********/ - /// <summary>Construct an instance.</summary> - /// <param name="location">The location which changed.</param> - /// <param name="added">The buildings added to the location.</param> - /// <param name="removed">The buildings removed from the location.</param> - public EventArgsLocationBuildingsChanged(GameLocation location, IEnumerable<Building> added, IEnumerable<Building> removed) - { - this.Location = location; - this.Added = added.ToArray(); - this.Removed = removed.ToArray(); - } - } -} -#endif diff --git a/src/SMAPI/Events/EventArgsLocationObjectsChanged.cs b/src/SMAPI/Events/EventArgsLocationObjectsChanged.cs deleted file mode 100644 index 9ca2e3e2..00000000 --- a/src/SMAPI/Events/EventArgsLocationObjectsChanged.cs +++ /dev/null @@ -1,42 +0,0 @@ -#if !SMAPI_3_0_STRICT -using System; -using System.Collections.Generic; -using System.Linq; -using Microsoft.Xna.Framework; -using StardewValley; -using SObject = StardewValley.Object; - -namespace StardewModdingAPI.Events -{ - /// <summary>Event arguments for a <see cref="LocationEvents.ObjectsChanged"/> event.</summary> - public class EventArgsLocationObjectsChanged : EventArgs - { - /********* - ** Accessors - *********/ - /// <summary>The location which changed.</summary> - public GameLocation Location { get; } - - /// <summary>The objects added to the location.</summary> - public IEnumerable<KeyValuePair<Vector2, SObject>> Added { get; } - - /// <summary>The objects removed from the location.</summary> - public IEnumerable<KeyValuePair<Vector2, SObject>> Removed { get; } - - - /********* - ** Public methods - *********/ - /// <summary>Construct an instance.</summary> - /// <param name="location">The location which changed.</param> - /// <param name="added">The objects added to the location.</param> - /// <param name="removed">The objects removed from the location.</param> - public EventArgsLocationObjectsChanged(GameLocation location, IEnumerable<KeyValuePair<Vector2, SObject>> added, IEnumerable<KeyValuePair<Vector2, SObject>> removed) - { - this.Location = location; - this.Added = added.ToArray(); - this.Removed = removed.ToArray(); - } - } -} -#endif diff --git a/src/SMAPI/Events/EventArgsLocationsChanged.cs b/src/SMAPI/Events/EventArgsLocationsChanged.cs deleted file mode 100644 index 1a59e612..00000000 --- a/src/SMAPI/Events/EventArgsLocationsChanged.cs +++ /dev/null @@ -1,35 +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="LocationEvents.LocationsChanged"/> event.</summary> - public class EventArgsLocationsChanged : EventArgs - { - /********* - ** Accessors - *********/ - /// <summary>The added locations.</summary> - public IEnumerable<GameLocation> Added { get; } - - /// <summary>The removed locations.</summary> - public IEnumerable<GameLocation> Removed { get; } - - - /********* - ** Public methods - *********/ - /// <summary>Construct an instance.</summary> - /// <param name="added">The added locations.</param> - /// <param name="removed">The removed locations.</param> - public EventArgsLocationsChanged(IEnumerable<GameLocation> added, IEnumerable<GameLocation> removed) - { - this.Added = added.ToArray(); - this.Removed = removed.ToArray(); - } - } -} -#endif diff --git a/src/SMAPI/Events/EventArgsMineLevelChanged.cs b/src/SMAPI/Events/EventArgsMineLevelChanged.cs deleted file mode 100644 index c63b04e9..00000000 --- a/src/SMAPI/Events/EventArgsMineLevelChanged.cs +++ /dev/null @@ -1,32 +0,0 @@ -#if !SMAPI_3_0_STRICT -using System; - -namespace StardewModdingAPI.Events -{ - /// <summary>Event arguments for a <see cref="MineEvents.MineLevelChanged"/> event.</summary> - public class EventArgsMineLevelChanged : EventArgs - { - /********* - ** Accessors - *********/ - /// <summary>The previous mine level.</summary> - public int PreviousMineLevel { get; } - - /// <summary>The current mine level.</summary> - public int CurrentMineLevel { get; } - - - /********* - ** Public methods - *********/ - /// <summary>Construct an instance.</summary> - /// <param name="previousMineLevel">The previous mine level.</param> - /// <param name="currentMineLevel">The current mine level.</param> - public EventArgsMineLevelChanged(int previousMineLevel, int currentMineLevel) - { - this.PreviousMineLevel = previousMineLevel; - this.CurrentMineLevel = currentMineLevel; - } - } -} -#endif diff --git a/src/SMAPI/Events/EventArgsMouseStateChanged.cs b/src/SMAPI/Events/EventArgsMouseStateChanged.cs deleted file mode 100644 index 09f3f759..00000000 --- a/src/SMAPI/Events/EventArgsMouseStateChanged.cs +++ /dev/null @@ -1,44 +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.MouseChanged"/> event.</summary> - public class EventArgsMouseStateChanged : EventArgs - { - /********* - ** Accessors - *********/ - /// <summary>The previous mouse state.</summary> - public MouseState PriorState { get; } - - /// <summary>The current mouse state.</summary> - public MouseState NewState { get; } - - /// <summary>The previous mouse position on the screen adjusted for the zoom level.</summary> - public Point PriorPosition { get; } - - /// <summary>The current mouse position on the screen adjusted for the zoom level.</summary> - public Point NewPosition { get; } - - - /********* - ** Public methods - *********/ - /// <summary>Construct an instance.</summary> - /// <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> - public EventArgsMouseStateChanged(MouseState priorState, MouseState newState, Point priorPosition, Point newPosition) - { - this.PriorState = priorState; - this.NewState = newState; - this.PriorPosition = priorPosition; - this.NewPosition = newPosition; - } - } -} -#endif diff --git a/src/SMAPI/Events/EventArgsPlayerWarped.cs b/src/SMAPI/Events/EventArgsPlayerWarped.cs deleted file mode 100644 index d1aa1588..00000000 --- a/src/SMAPI/Events/EventArgsPlayerWarped.cs +++ /dev/null @@ -1,34 +0,0 @@ -#if !SMAPI_3_0_STRICT -using System; -using StardewValley; - -namespace StardewModdingAPI.Events -{ - /// <summary>Event arguments for a <see cref="PlayerEvents.Warped"/> event.</summary> - public class EventArgsPlayerWarped : EventArgs - { - /********* - ** Accessors - *********/ - /// <summary>The player's previous location.</summary> - public GameLocation PriorLocation { get; } - - /// <summary>The player's current location.</summary> - public GameLocation NewLocation { 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 EventArgsPlayerWarped(GameLocation priorLocation, GameLocation newLocation) - { - this.NewLocation = newLocation; - this.PriorLocation = priorLocation; - } - } -} -#endif diff --git a/src/SMAPI/Events/EventArgsValueChanged.cs b/src/SMAPI/Events/EventArgsValueChanged.cs deleted file mode 100644 index 7bfac7a2..00000000 --- a/src/SMAPI/Events/EventArgsValueChanged.cs +++ /dev/null @@ -1,33 +0,0 @@ -#if !SMAPI_3_0_STRICT -using System; - -namespace StardewModdingAPI.Events -{ - /// <summary>Event arguments for a field that changed value.</summary> - /// <typeparam name="T">The value type.</typeparam> - public class EventArgsValueChanged<T> : EventArgs - { - /********* - ** Accessors - *********/ - /// <summary>The previous value.</summary> - public T PriorValue { get; } - - /// <summary>The current value.</summary> - public T NewValue { get; } - - - /********* - ** Public methods - *********/ - /// <summary>Construct an instance.</summary> - /// <param name="priorValue">The previous value.</param> - /// <param name="newValue">The current value.</param> - public EventArgsValueChanged(T priorValue, T newValue) - { - this.PriorValue = priorValue; - this.NewValue = newValue; - } - } -} -#endif diff --git a/src/SMAPI/Events/GameEvents.cs b/src/SMAPI/Events/GameEvents.cs deleted file mode 100644 index 9d945277..00000000 --- a/src/SMAPI/Events/GameEvents.cs +++ /dev/null @@ -1,122 +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 changes state.</summary> - [Obsolete("Use " + nameof(Mod.Helper) + "." + nameof(IModHelper.Events) + " instead. See https://smapi.io/3.0 for more info.")] - public static class GameEvents - { - /********* - ** Fields - *********/ - /// <summary>The core event manager.</summary> - private static EventManager EventManager; - - - /********* - ** Events - *********/ - /// <summary>Raised when the game updates its state (≈60 times per second).</summary> - public static event EventHandler UpdateTick - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - GameEvents.EventManager.Legacy_UpdateTick.Add(value); - } - remove => GameEvents.EventManager.Legacy_UpdateTick.Remove(value); - } - - /// <summary>Raised every other tick (≈30 times per second).</summary> - public static event EventHandler SecondUpdateTick - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - GameEvents.EventManager.Legacy_SecondUpdateTick.Add(value); - } - remove => GameEvents.EventManager.Legacy_SecondUpdateTick.Remove(value); - } - - /// <summary>Raised every fourth tick (≈15 times per second).</summary> - public static event EventHandler FourthUpdateTick - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - GameEvents.EventManager.Legacy_FourthUpdateTick.Add(value); - } - remove => GameEvents.EventManager.Legacy_FourthUpdateTick.Remove(value); - } - - /// <summary>Raised every eighth tick (≈8 times per second).</summary> - public static event EventHandler EighthUpdateTick - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - GameEvents.EventManager.Legacy_EighthUpdateTick.Add(value); - } - remove => GameEvents.EventManager.Legacy_EighthUpdateTick.Remove(value); - } - - /// <summary>Raised every 15th tick (≈4 times per second).</summary> - public static event EventHandler QuarterSecondTick - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - GameEvents.EventManager.Legacy_QuarterSecondTick.Add(value); - } - remove => GameEvents.EventManager.Legacy_QuarterSecondTick.Remove(value); - } - - /// <summary>Raised every 30th tick (≈twice per second).</summary> - public static event EventHandler HalfSecondTick - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - GameEvents.EventManager.Legacy_HalfSecondTick.Add(value); - } - remove => GameEvents.EventManager.Legacy_HalfSecondTick.Remove(value); - } - - /// <summary>Raised every 60th tick (≈once per second).</summary> - public static event EventHandler OneSecondTick - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - GameEvents.EventManager.Legacy_OneSecondTick.Add(value); - } - remove => GameEvents.EventManager.Legacy_OneSecondTick.Remove(value); - } - - /// <summary>Raised once after the game initialises and all <see cref="IMod.Entry"/> methods have been called.</summary> - public static event EventHandler FirstUpdateTick - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - GameEvents.EventManager.Legacy_FirstUpdateTick.Add(value); - } - remove => GameEvents.EventManager.Legacy_FirstUpdateTick.Remove(value); - } - - - /********* - ** Public methods - *********/ - /// <summary>Initialise the events.</summary> - /// <param name="eventManager">The core event manager.</param> - internal static void Init(EventManager eventManager) - { - GameEvents.EventManager = eventManager; - } - } -} -#endif diff --git a/src/SMAPI/Events/GraphicsEvents.cs b/src/SMAPI/Events/GraphicsEvents.cs deleted file mode 100644 index 24a16a29..00000000 --- a/src/SMAPI/Events/GraphicsEvents.cs +++ /dev/null @@ -1,120 +0,0 @@ -#if !SMAPI_3_0_STRICT -using System; -using StardewModdingAPI.Framework; -using StardewModdingAPI.Framework.Events; - -namespace StardewModdingAPI.Events -{ - /// <summary>Events raised during the game's draw loop, when the game is rendering content to the window.</summary> - [Obsolete("Use " + nameof(Mod.Helper) + "." + nameof(IModHelper.Events) + " instead. See https://smapi.io/3.0 for more info.")] - public static class GraphicsEvents - { - /********* - ** Fields - *********/ - /// <summary>The core event manager.</summary> - private static EventManager EventManager; - - - /********* - ** Events - *********/ - /// <summary>Raised after the game window is resized.</summary> - public static event EventHandler Resize - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - GraphicsEvents.EventManager.Legacy_Resize.Add(value); - } - remove => GraphicsEvents.EventManager.Legacy_Resize.Remove(value); - } - - /**** - ** Main render events - ****/ - /// <summary>Raised before drawing the world to the screen.</summary> - public static event EventHandler OnPreRenderEvent - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - GraphicsEvents.EventManager.Legacy_OnPreRenderEvent.Add(value); - } - remove => GraphicsEvents.EventManager.Legacy_OnPreRenderEvent.Remove(value); - } - - /// <summary>Raised after drawing the world to the screen.</summary> - public static event EventHandler OnPostRenderEvent - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - GraphicsEvents.EventManager.Legacy_OnPostRenderEvent.Add(value); - } - remove => GraphicsEvents.EventManager.Legacy_OnPostRenderEvent.Remove(value); - } - - /**** - ** HUD events - ****/ - /// <summary>Raised before drawing the HUD (item toolbar, clock, etc) to the screen. The HUD is available at this point, but not necessarily visible. (For example, the event is raised even if a menu is open.)</summary> - public static event EventHandler OnPreRenderHudEvent - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - GraphicsEvents.EventManager.Legacy_OnPreRenderHudEvent.Add(value); - } - remove => GraphicsEvents.EventManager.Legacy_OnPreRenderHudEvent.Remove(value); - } - - /// <summary>Raised after drawing the HUD (item toolbar, clock, etc) to the screen. The HUD is available at this point, but not necessarily visible. (For example, the event is raised even if a menu is open.)</summary> - public static event EventHandler OnPostRenderHudEvent - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - GraphicsEvents.EventManager.Legacy_OnPostRenderHudEvent.Add(value); - } - remove => GraphicsEvents.EventManager.Legacy_OnPostRenderHudEvent.Remove(value); - } - - /**** - ** GUI events - ****/ - /// <summary>Raised before drawing a menu to the screen during a draw loop. This includes the game's internal menus like the title screen.</summary> - public static event EventHandler OnPreRenderGuiEvent - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - GraphicsEvents.EventManager.Legacy_OnPreRenderGuiEvent.Add(value); - } - remove => GraphicsEvents.EventManager.Legacy_OnPreRenderGuiEvent.Remove(value); - } - - /// <summary>Raised after drawing a menu to the screen during a draw loop. This includes the game's internal menus like the title screen.</summary> - public static event EventHandler OnPostRenderGuiEvent - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - GraphicsEvents.EventManager.Legacy_OnPostRenderGuiEvent.Add(value); - } - remove => GraphicsEvents.EventManager.Legacy_OnPostRenderGuiEvent.Remove(value); - } - - - /********* - ** Public methods - *********/ - /// <summary>Initialise the events.</summary> - /// <param name="eventManager">The core event manager.</param> - internal static void Init(EventManager eventManager) - { - GraphicsEvents.EventManager = eventManager; - } - } -} -#endif diff --git a/src/SMAPI/Events/InputEvents.cs b/src/SMAPI/Events/InputEvents.cs deleted file mode 100644 index c5ab8c83..00000000 --- a/src/SMAPI/Events/InputEvents.cs +++ /dev/null @@ -1,56 +0,0 @@ -#if !SMAPI_3_0_STRICT -using System; -using StardewModdingAPI.Framework; -using StardewModdingAPI.Framework.Events; - -namespace StardewModdingAPI.Events -{ - /// <summary>Events raised when the player uses a controller, keyboard, or mouse button.</summary> - [Obsolete("Use " + nameof(Mod.Helper) + "." + nameof(IModHelper.Events) + " instead. See https://smapi.io/3.0 for more info.")] - public static class InputEvents - { - /********* - ** Fields - *********/ - /// <summary>The core event manager.</summary> - private static EventManager EventManager; - - - /********* - ** Events - *********/ - /// <summary>Raised when the player presses a button on the keyboard, controller, or mouse.</summary> - public static event EventHandler<EventArgsInput> ButtonPressed - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - InputEvents.EventManager.Legacy_ButtonPressed.Add(value); - } - remove => InputEvents.EventManager.Legacy_ButtonPressed.Remove(value); - } - - /// <summary>Raised when the player releases a keyboard key on the keyboard, controller, or mouse.</summary> - public static event EventHandler<EventArgsInput> ButtonReleased - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - InputEvents.EventManager.Legacy_ButtonReleased.Add(value); - } - remove => InputEvents.EventManager.Legacy_ButtonReleased.Remove(value); - } - - - /********* - ** Public methods - *********/ - /// <summary>Initialise the events.</summary> - /// <param name="eventManager">The core event manager.</param> - internal static void Init(EventManager eventManager) - { - InputEvents.EventManager = eventManager; - } - } -} -#endif diff --git a/src/SMAPI/Events/LocationEvents.cs b/src/SMAPI/Events/LocationEvents.cs deleted file mode 100644 index 0761bdd8..00000000 --- a/src/SMAPI/Events/LocationEvents.cs +++ /dev/null @@ -1,67 +0,0 @@ -#if !SMAPI_3_0_STRICT -using System; -using StardewModdingAPI.Framework; -using StardewModdingAPI.Framework.Events; - -namespace StardewModdingAPI.Events -{ - /// <summary>Events raised when the player transitions between game locations, a location is added or removed, or the objects in the current location change.</summary> - [Obsolete("Use " + nameof(Mod.Helper) + "." + nameof(IModHelper.Events) + " instead. See https://smapi.io/3.0 for more info.")] - public static class LocationEvents - { - /********* - ** Fields - *********/ - /// <summary>The core event manager.</summary> - private static EventManager EventManager; - - - /********* - ** Events - *********/ - /// <summary>Raised after a game location is added or removed.</summary> - public static event EventHandler<EventArgsLocationsChanged> LocationsChanged - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - LocationEvents.EventManager.Legacy_LocationsChanged.Add(value); - } - remove => LocationEvents.EventManager.Legacy_LocationsChanged.Remove(value); - } - - /// <summary>Raised after buildings are added or removed in a location.</summary> - public static event EventHandler<EventArgsLocationBuildingsChanged> BuildingsChanged - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - LocationEvents.EventManager.Legacy_BuildingsChanged.Add(value); - } - remove => LocationEvents.EventManager.Legacy_BuildingsChanged.Remove(value); - } - - /// <summary>Raised after objects are added or removed in a location.</summary> - public static event EventHandler<EventArgsLocationObjectsChanged> ObjectsChanged - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - LocationEvents.EventManager.Legacy_ObjectsChanged.Add(value); - } - remove => LocationEvents.EventManager.Legacy_ObjectsChanged.Remove(value); - } - - - /********* - ** Public methods - *********/ - /// <summary>Initialise the events.</summary> - /// <param name="eventManager">The core event manager.</param> - internal static void Init(EventManager eventManager) - { - LocationEvents.EventManager = eventManager; - } - } -} -#endif diff --git a/src/SMAPI/Events/MenuEvents.cs b/src/SMAPI/Events/MenuEvents.cs deleted file mode 100644 index 8647c268..00000000 --- a/src/SMAPI/Events/MenuEvents.cs +++ /dev/null @@ -1,56 +0,0 @@ -#if !SMAPI_3_0_STRICT -using System; -using StardewModdingAPI.Framework; -using StardewModdingAPI.Framework.Events; - -namespace StardewModdingAPI.Events -{ - /// <summary>Events raised when a game menu is opened or closed (including internal menus like the title screen).</summary> - [Obsolete("Use " + nameof(Mod.Helper) + "." + nameof(IModHelper.Events) + " instead. See https://smapi.io/3.0 for more info.")] - public static class MenuEvents - { - /********* - ** Fields - *********/ - /// <summary>The core event manager.</summary> - private static EventManager EventManager; - - - /********* - ** Events - *********/ - /// <summary>Raised after a game menu is opened or replaced with another menu. This event is not invoked when a menu is closed.</summary> - public static event EventHandler<EventArgsClickableMenuChanged> MenuChanged - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - MenuEvents.EventManager.Legacy_MenuChanged.Add(value); - } - remove => MenuEvents.EventManager.Legacy_MenuChanged.Remove(value); - } - - /// <summary>Raised after a game menu is closed.</summary> - public static event EventHandler<EventArgsClickableMenuClosed> MenuClosed - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - MenuEvents.EventManager.Legacy_MenuClosed.Add(value); - } - remove => MenuEvents.EventManager.Legacy_MenuClosed.Remove(value); - } - - - /********* - ** Public methods - *********/ - /// <summary>Initialise the events.</summary> - /// <param name="eventManager">The core event manager.</param> - internal static void Init(EventManager eventManager) - { - MenuEvents.EventManager = eventManager; - } - } -} -#endif diff --git a/src/SMAPI/Events/MineEvents.cs b/src/SMAPI/Events/MineEvents.cs deleted file mode 100644 index 929da35b..00000000 --- a/src/SMAPI/Events/MineEvents.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 something happens in the mines.</summary> - [Obsolete("Use " + nameof(Mod.Helper) + "." + nameof(IModHelper.Events) + " instead. See https://smapi.io/3.0 for more info.")] - public static class MineEvents - { - /********* - ** Fields - *********/ - /// <summary>The core event manager.</summary> - private static EventManager EventManager; - - - /********* - ** Events - *********/ - /// <summary>Raised after the player warps to a new level of the mine.</summary> - public static event EventHandler<EventArgsMineLevelChanged> MineLevelChanged - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - MineEvents.EventManager.Legacy_MineLevelChanged.Add(value); - } - remove => MineEvents.EventManager.Legacy_MineLevelChanged.Remove(value); - } - - - /********* - ** Public methods - *********/ - /// <summary>Initialise the events.</summary> - /// <param name="eventManager">The core event manager.</param> - internal static void Init(EventManager eventManager) - { - MineEvents.EventManager = eventManager; - } - } -} -#endif diff --git a/src/SMAPI/Events/MultiplayerEvents.cs b/src/SMAPI/Events/MultiplayerEvents.cs deleted file mode 100644 index 0650a8e2..00000000 --- a/src/SMAPI/Events/MultiplayerEvents.cs +++ /dev/null @@ -1,78 +0,0 @@ -#if !SMAPI_3_0_STRICT -using System; -using StardewModdingAPI.Framework; -using StardewModdingAPI.Framework.Events; - -namespace StardewModdingAPI.Events -{ - /// <summary>Events raised during the multiplayer sync process.</summary> - [Obsolete("Use " + nameof(Mod.Helper) + "." + nameof(IModHelper.Events) + " instead. See https://smapi.io/3.0 for more info.")] - public static class MultiplayerEvents - { - /********* - ** Fields - *********/ - /// <summary>The core event manager.</summary> - private static EventManager EventManager; - - - /********* - ** Events - *********/ - /// <summary>Raised before the game syncs changes from other players.</summary> - public static event EventHandler BeforeMainSync - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - MultiplayerEvents.EventManager.Legacy_BeforeMainSync.Add(value); - } - remove => MultiplayerEvents.EventManager.Legacy_BeforeMainSync.Remove(value); - } - - /// <summary>Raised after the game syncs changes from other players.</summary> - public static event EventHandler AfterMainSync - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - MultiplayerEvents.EventManager.Legacy_AfterMainSync.Add(value); - } - remove => MultiplayerEvents.EventManager.Legacy_AfterMainSync.Remove(value); - } - - /// <summary>Raised before the game broadcasts changes to other players.</summary> - public static event EventHandler BeforeMainBroadcast - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - MultiplayerEvents.EventManager.Legacy_BeforeMainBroadcast.Add(value); - } - remove => MultiplayerEvents.EventManager.Legacy_BeforeMainBroadcast.Remove(value); - } - - /// <summary>Raised after the game broadcasts changes to other players.</summary> - public static event EventHandler AfterMainBroadcast - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - MultiplayerEvents.EventManager.Legacy_AfterMainBroadcast.Add(value); - } - remove => MultiplayerEvents.EventManager.Legacy_AfterMainBroadcast.Remove(value); - } - - - /********* - ** Public methods - *********/ - /// <summary>Initialise the events.</summary> - /// <param name="eventManager">The core event manager.</param> - internal static void Init(EventManager eventManager) - { - MultiplayerEvents.EventManager = eventManager; - } - } -} -#endif diff --git a/src/SMAPI/Events/PlayerEvents.cs b/src/SMAPI/Events/PlayerEvents.cs deleted file mode 100644 index 11ba1e54..00000000 --- a/src/SMAPI/Events/PlayerEvents.cs +++ /dev/null @@ -1,68 +0,0 @@ -#if !SMAPI_3_0_STRICT -using System; -using StardewModdingAPI.Framework; -using StardewModdingAPI.Framework.Events; - -namespace StardewModdingAPI.Events -{ - /// <summary>Events raised when the player data changes.</summary> - [Obsolete("Use " + nameof(Mod.Helper) + "." + nameof(IModHelper.Events) + " instead. See https://smapi.io/3.0 for more info.")] - public static class PlayerEvents - { - /********* - ** Fields - *********/ - /// <summary>The core event manager.</summary> - private static EventManager EventManager; - - - /********* - ** Events - *********/ - /// <summary>Raised after the player's inventory changes in any way (added or removed item, sorted, etc).</summary> - public static event EventHandler<EventArgsInventoryChanged> InventoryChanged - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - PlayerEvents.EventManager.Legacy_InventoryChanged.Add(value); - } - remove => PlayerEvents.EventManager.Legacy_InventoryChanged.Remove(value); - } - - /// <summary>Raised after the player levels up a skill. This happens as soon as they level up, not when the game notifies the player after their character goes to bed.</summary> - public static event EventHandler<EventArgsLevelUp> LeveledUp - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - PlayerEvents.EventManager.Legacy_LeveledUp.Add(value); - } - remove => PlayerEvents.EventManager.Legacy_LeveledUp.Remove(value); - } - - /// <summary>Raised after the player warps to a new location.</summary> - public static event EventHandler<EventArgsPlayerWarped> Warped - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - PlayerEvents.EventManager.Legacy_PlayerWarped.Add(value); - } - remove => PlayerEvents.EventManager.Legacy_PlayerWarped.Remove(value); - } - - - - /********* - ** Public methods - *********/ - /// <summary>Initialise the events.</summary> - /// <param name="eventManager">The core event manager.</param> - internal static void Init(EventManager eventManager) - { - PlayerEvents.EventManager = eventManager; - } - } -} -#endif diff --git a/src/SMAPI/Events/SaveEvents.cs b/src/SMAPI/Events/SaveEvents.cs deleted file mode 100644 index da276d22..00000000 --- a/src/SMAPI/Events/SaveEvents.cs +++ /dev/null @@ -1,100 +0,0 @@ -#if !SMAPI_3_0_STRICT -using System; -using StardewModdingAPI.Framework; -using StardewModdingAPI.Framework.Events; - -namespace StardewModdingAPI.Events -{ - /// <summary>Events raised before and after the player saves/loads the game.</summary> - [Obsolete("Use " + nameof(Mod.Helper) + "." + nameof(IModHelper.Events) + " instead. See https://smapi.io/3.0 for more info.")] - public static class SaveEvents - { - /********* - ** Fields - *********/ - /// <summary>The core event manager.</summary> - private static EventManager EventManager; - - - /********* - ** Events - *********/ - /// <summary>Raised before the game creates the save file.</summary> - public static event EventHandler BeforeCreate - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - SaveEvents.EventManager.Legacy_BeforeCreateSave.Add(value); - } - remove => SaveEvents.EventManager.Legacy_BeforeCreateSave.Remove(value); - } - - /// <summary>Raised after the game finishes creating the save file.</summary> - public static event EventHandler AfterCreate - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - SaveEvents.EventManager.Legacy_AfterCreateSave.Add(value); - } - remove => SaveEvents.EventManager.Legacy_AfterCreateSave.Remove(value); - } - - /// <summary>Raised before the game begins writes data to the save file.</summary> - public static event EventHandler BeforeSave - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - SaveEvents.EventManager.Legacy_BeforeSave.Add(value); - } - remove => SaveEvents.EventManager.Legacy_BeforeSave.Remove(value); - } - - /// <summary>Raised after the game finishes writing data to the save file.</summary> - public static event EventHandler AfterSave - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - SaveEvents.EventManager.Legacy_AfterSave.Add(value); - } - remove => SaveEvents.EventManager.Legacy_AfterSave.Remove(value); - } - - /// <summary>Raised after the player loads a save slot.</summary> - public static event EventHandler AfterLoad - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - SaveEvents.EventManager.Legacy_AfterLoad.Add(value); - } - remove => SaveEvents.EventManager.Legacy_AfterLoad.Remove(value); - } - - /// <summary>Raised after the game returns to the title screen.</summary> - public static event EventHandler AfterReturnToTitle - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - SaveEvents.EventManager.Legacy_AfterReturnToTitle.Add(value); - } - remove => SaveEvents.EventManager.Legacy_AfterReturnToTitle.Remove(value); - } - - - /********* - ** Public methods - *********/ - /// <summary>Initialise the events.</summary> - /// <param name="eventManager">The core event manager.</param> - internal static void Init(EventManager eventManager) - { - SaveEvents.EventManager = eventManager; - } - } -} -#endif diff --git a/src/SMAPI/Events/SpecialisedEvents.cs b/src/SMAPI/Events/SpecialisedEvents.cs deleted file mode 100644 index 4f16e4da..00000000 --- a/src/SMAPI/Events/SpecialisedEvents.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 serving specialised edge cases that shouldn't be used by most mods.</summary> - [Obsolete("Use " + nameof(Mod.Helper) + "." + nameof(IModHelper.Events) + " instead. See https://smapi.io/3.0 for more info.")] - public static class SpecialisedEvents - { - /********* - ** Fields - *********/ - /// <summary>The core event manager.</summary> - private static EventManager EventManager; - - - /********* - ** Events - *********/ - /// <summary>Raised when the game updates its state (≈60 times per second), regardless of normal SMAPI validation. This event is not thread-safe and may be invoked while game logic is running asynchronously. Changes to game state in this method may crash the game or corrupt an in-progress save. Do not use this event unless you're fully aware of the context in which your code will be run. Mods using this method will trigger a stability warning in the SMAPI console.</summary> - public static event EventHandler UnvalidatedUpdateTick - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - SpecialisedEvents.EventManager.Legacy_UnvalidatedUpdateTick.Add(value); - } - remove => SpecialisedEvents.EventManager.Legacy_UnvalidatedUpdateTick.Remove(value); - } - - - /********* - ** Public methods - *********/ - /// <summary>Initialise the events.</summary> - /// <param name="eventManager">The core event manager.</param> - internal static void Init(EventManager eventManager) - { - SpecialisedEvents.EventManager = eventManager; - } - } -} -#endif diff --git a/src/SMAPI/Events/TimeEvents.cs b/src/SMAPI/Events/TimeEvents.cs deleted file mode 100644 index 389532d9..00000000 --- a/src/SMAPI/Events/TimeEvents.cs +++ /dev/null @@ -1,56 +0,0 @@ -#if !SMAPI_3_0_STRICT -using System; -using StardewModdingAPI.Framework; -using StardewModdingAPI.Framework.Events; - -namespace StardewModdingAPI.Events -{ - /// <summary>Events raised when the in-game date or time changes.</summary> - [Obsolete("Use " + nameof(Mod.Helper) + "." + nameof(IModHelper.Events) + " instead. See https://smapi.io/3.0 for more info.")] - public static class TimeEvents - { - /********* - ** Fields - *********/ - /// <summary>The core event manager.</summary> - private static EventManager EventManager; - - - /********* - ** Events - *********/ - /// <summary>Raised after the game begins a new day, including when loading a save.</summary> - public static event EventHandler AfterDayStarted - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - TimeEvents.EventManager.Legacy_AfterDayStarted.Add(value); - } - remove => TimeEvents.EventManager.Legacy_AfterDayStarted.Remove(value); - } - - /// <summary>Raised after the in-game clock changes.</summary> - public static event EventHandler<EventArgsIntChanged> TimeOfDayChanged - { - add - { - SCore.DeprecationManager.WarnForOldEvents(); - TimeEvents.EventManager.Legacy_TimeOfDayChanged.Add(value); - } - remove => TimeEvents.EventManager.Legacy_TimeOfDayChanged.Remove(value); - } - - - /********* - ** Public methods - *********/ - /// <summary>Initialise the events.</summary> - /// <param name="eventManager">The core event manager.</param> - internal static void Init(EventManager eventManager) - { - TimeEvents.EventManager = eventManager; - } - } -} -#endif |