summaryrefslogtreecommitdiff
path: root/src/SMAPI/Events/InputEvents.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2018-02-24 17:54:31 -0500
committerJesse Plamondon-Willard <github@jplamondonw.com>2018-02-24 17:54:31 -0500
commit414cf5c197b5b59776d3dda914eb15710efb0868 (patch)
tree0393a95194ad78cf4440c68657b0488b7db6d68b /src/SMAPI/Events/InputEvents.cs
parent5da8b707385b9851ff3f6442de58519125f5c96f (diff)
parentf2e8450706d1971d774f870081deffdb0c6b92eb (diff)
downloadSMAPI-414cf5c197b5b59776d3dda914eb15710efb0868.tar.gz
SMAPI-414cf5c197b5b59776d3dda914eb15710efb0868.tar.bz2
SMAPI-414cf5c197b5b59776d3dda914eb15710efb0868.zip
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI/Events/InputEvents.cs')
-rw-r--r--src/SMAPI/Events/InputEvents.cs46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/SMAPI/Events/InputEvents.cs b/src/SMAPI/Events/InputEvents.cs
index 985aed99..84d7ce5d 100644
--- a/src/SMAPI/Events/InputEvents.cs
+++ b/src/SMAPI/Events/InputEvents.cs
@@ -1,5 +1,5 @@
using System;
-using StardewModdingAPI.Framework;
+using StardewModdingAPI.Framework.Events;
namespace StardewModdingAPI.Events
{
@@ -7,38 +7,38 @@ namespace StardewModdingAPI.Events
public static class InputEvents
{
/*********
+ ** Properties
+ *********/
+ /// <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;
+ public static event EventHandler<EventArgsInput> ButtonPressed
+ {
+ add => InputEvents.EventManager.Input_ButtonPressed.Add(value);
+ remove => InputEvents.EventManager.Input_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;
+ public static event EventHandler<EventArgsInput> ButtonReleased
+ {
+ add => InputEvents.EventManager.Input_ButtonReleased.Add(value);
+ remove => InputEvents.EventManager.Input_ButtonReleased.Remove(value);
+ }
/*********
- ** Internal methods
+ ** Public methods
*********/
- /// <summary>Raise a <see cref="ButtonPressed"/> event.</summary>
- /// <param name="monitor">Encapsulates monitoring and logging.</param>
- /// <param name="button">The button on the controller, keyboard, or mouse.</param>
- /// <param name="cursor">The cursor position.</param>
- /// <param name="isActionButton">Whether the input should trigger actions on the affected tile.</param>
- /// <param name="isUseToolButton">Whether the input should use tools on the affected tile.</param>
- internal static void InvokeButtonPressed(IMonitor monitor, SButton button, ICursorPosition cursor, bool isActionButton, bool isUseToolButton)
- {
- monitor.SafelyRaiseGenericEvent($"{nameof(InputEvents)}.{nameof(InputEvents.ButtonPressed)}", InputEvents.ButtonPressed?.GetInvocationList(), null, new EventArgsInput(button, cursor, isActionButton, isUseToolButton));
- }
-
- /// <summary>Raise a <see cref="ButtonReleased"/> event.</summary>
- /// <param name="monitor">Encapsulates monitoring and logging.</param>
- /// <param name="button">The button on the controller, keyboard, or mouse.</param>
- /// <param name="cursor">The cursor position.</param>
- /// <param name="isActionButton">Whether the input should trigger actions on the affected tile.</param>
- /// <param name="isUseToolButton">Whether the input should use tools on the affected tile.</param>
- internal static void InvokeButtonReleased(IMonitor monitor, SButton button, ICursorPosition cursor, bool isActionButton, bool isUseToolButton)
+ /// <summary>Initialise the events.</summary>
+ /// <param name="eventManager">The core event manager.</param>
+ internal static void Init(EventManager eventManager)
{
- monitor.SafelyRaiseGenericEvent($"{nameof(InputEvents)}.{nameof(InputEvents.ButtonReleased)}", InputEvents.ButtonReleased?.GetInvocationList(), null, new EventArgsInput(button, cursor, isActionButton, isUseToolButton));
+ InputEvents.EventManager = eventManager;
}
}
}