using System; using StardewModdingAPI.Framework.Input; namespace StardewModdingAPI.Events { /// Event arguments when a button is released. public class InputButtonReleasedArgsInput : EventArgs { /********* ** Properties *********/ /// 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 InputButtonReleasedArgsInput(SButton button, ICursorPosition cursor, SInputState inputState) { this.Button = button; this.Cursor = cursor; this.InputState = inputState; } /// Whether a mod has indicated the key was already handled, so the game should handle it. public bool IsSuppressed() { return this.IsSuppressed(this.Button); } /// Whether a mod has indicated the key was already handled, so the game should handle it. /// The button to check. public bool IsSuppressed(SButton button) { return this.InputState.SuppressButtons.Contains(button); } /// Get whether a given button was pressed or held. /// The button to check. public bool IsDown(SButton button) { return this.InputState.IsDown(button); } } }