diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2018-12-07 13:40:44 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2018-12-07 13:40:44 -0500 |
commit | a78b1935928919694dfe8de823a1accd6d222732 (patch) | |
tree | 3f17b6087cf2749e52c1e237de17e2e9addb6c06 /src/SMAPI/Events/InputEvents.cs | |
parent | 4cd9eda1591c3908bf80b60c2902491a7595ee27 (diff) | |
parent | 8901218418693d610a17b22fe789ba6279f63446 (diff) | |
download | SMAPI-a78b1935928919694dfe8de823a1accd6d222732.tar.gz SMAPI-a78b1935928919694dfe8de823a1accd6d222732.tar.bz2 SMAPI-a78b1935928919694dfe8de823a1accd6d222732.zip |
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI/Events/InputEvents.cs')
-rw-r--r-- | src/SMAPI/Events/InputEvents.cs | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/SMAPI/Events/InputEvents.cs b/src/SMAPI/Events/InputEvents.cs index 4c1781a5..255b9c8a 100644 --- a/src/SMAPI/Events/InputEvents.cs +++ b/src/SMAPI/Events/InputEvents.cs @@ -1,9 +1,12 @@ +#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 { /********* @@ -12,6 +15,9 @@ namespace StardewModdingAPI.Events /// <summary>The core event manager.</summary> private static EventManager EventManager; + /// <summary>Manages deprecation warnings.</summary> + private static DeprecationManager DeprecationManager; + /********* ** Events @@ -19,14 +25,22 @@ namespace StardewModdingAPI.Events /// <summary>Raised when the player presses a button on the keyboard, controller, or mouse.</summary> public static event EventHandler<EventArgsInput> ButtonPressed { - add => InputEvents.EventManager.Legacy_ButtonPressed.Add(value); + add + { + InputEvents.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 => InputEvents.EventManager.Legacy_ButtonReleased.Add(value); + add + { + InputEvents.DeprecationManager.WarnForOldEvents(); + InputEvents.EventManager.Legacy_ButtonReleased.Add(value); + } remove => InputEvents.EventManager.Legacy_ButtonReleased.Remove(value); } @@ -36,9 +50,12 @@ namespace StardewModdingAPI.Events *********/ /// <summary>Initialise the events.</summary> /// <param name="eventManager">The core event manager.</param> - internal static void Init(EventManager eventManager) + /// <param name="deprecationManager">Manages deprecation warnings.</param> + internal static void Init(EventManager eventManager, DeprecationManager deprecationManager) { InputEvents.EventManager = eventManager; + InputEvents.DeprecationManager = deprecationManager; } } } +#endif |