#if !SMAPI_3_0_STRICT
using System;
using StardewModdingAPI.Framework;
using StardewModdingAPI.Framework.Events;
namespace StardewModdingAPI.Events
{
/// Events raised when the player uses a controller, keyboard, or mouse button.
[Obsolete("Use " + nameof(Mod.Helper) + "." + nameof(IModHelper.Events) + " instead. See https://smapi.io/3.0 for more info.")]
public static class InputEvents
{
/*********
** Properties
*********/
/// The core event manager.
private static EventManager EventManager;
/// Manages deprecation warnings.
private static DeprecationManager DeprecationManager;
/*********
** Events
*********/
/// Raised when the player presses a button on the keyboard, controller, or mouse.
public static event EventHandler ButtonPressed
{
add
{
InputEvents.DeprecationManager.WarnForOldEvents();
InputEvents.EventManager.Legacy_ButtonPressed.Add(value);
}
remove => InputEvents.EventManager.Legacy_ButtonPressed.Remove(value);
}
/// Raised when the player releases a keyboard key on the keyboard, controller, or mouse.
public static event EventHandler ButtonReleased
{
add
{
InputEvents.DeprecationManager.WarnForOldEvents();
InputEvents.EventManager.Legacy_ButtonReleased.Add(value);
}
remove => InputEvents.EventManager.Legacy_ButtonReleased.Remove(value);
}
/*********
** Public methods
*********/
/// Initialise the events.
/// The core event manager.
/// Manages deprecation warnings.
internal static void Init(EventManager eventManager, DeprecationManager deprecationManager)
{
InputEvents.EventManager = eventManager;
InputEvents.DeprecationManager = deprecationManager;
}
}
}
#endif