using System;
using StardewModdingAPI.Framework.Input;
namespace StardewModdingAPI.Events
{
/// Event arguments when a button is released.
public class ButtonReleasedEventArgs : EventArgs
{
/*********
** Fields
*********/
/// The game's current input state.
private readonly SInputState InputState;
/*********
** Accessors
*********/
/// The button on the controller, keyboard, or mouse.
public SButton Button { get; }
/// The current cursor position.
public ICursorPosition Cursor { get; }
/*********
** Public methods
*********/
/// Construct an instance.
/// The button on the controller, keyboard, or mouse.
/// The cursor position.
/// The game's current input state.
internal ButtonReleasedEventArgs(SButton button, ICursorPosition cursor, SInputState inputState)
{
this.Button = button;
this.Cursor = cursor;
this.InputState = inputState;
}
/// Get whether a mod has indicated the key was already handled, so the game shouldn't handle it.
public bool IsSuppressed()
{
return this.IsSuppressed(this.Button);
}
/// Get whether a mod has indicated the key was already handled, so the game shouldn't handle it.
/// The button to check.
public bool IsSuppressed(SButton button)
{
return this.InputState.IsSuppressed(button);
}
/// Get whether a given button was pressed or held.
/// The button to check.
public bool IsDown(SButton button)
{
return this.InputState.IsDown(button);
}
}
}