reduce duplicated doc blocks

This commit is contained in:
Jesse Plamondon-Willard 2022-03-22 20:46:21 -04:00
parent a42926868a
commit d3fbdf484a
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
15 changed files with 132 additions and 145 deletions

View File

@ -1,6 +1,4 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using StardewModdingAPI.Events; using StardewModdingAPI.Events;
namespace StardewModdingAPI.Framework.Events namespace StardewModdingAPI.Framework.Events
@ -15,166 +13,166 @@ namespace StardewModdingAPI.Framework.Events
/**** /****
** Display ** Display
****/ ****/
/// <summary>Raised after a game menu is opened, closed, or replaced.</summary> /// <inheritdoc cref="IDisplayEvents.MenuChanged" />
public readonly ManagedEvent<MenuChangedEventArgs> MenuChanged; public readonly ManagedEvent<MenuChangedEventArgs> MenuChanged;
/// <summary>Raised before the game draws anything to the screen in a draw tick, as soon as the sprite batch is opened. The sprite batch may be closed and reopened multiple times after this event is called, but it's only raised once per draw tick. This event isn't useful for drawing to the screen, since the game will draw over it.</summary> /// <inheritdoc cref="IDisplayEvents.Rendering" />
public readonly ManagedEvent<RenderingEventArgs> Rendering; public readonly ManagedEvent<RenderingEventArgs> Rendering;
/// <summary>Raised after the game draws to the sprite patch in a draw tick, just before the final sprite batch is rendered to the screen. Since the game may open/close the sprite batch multiple times in a draw tick, the sprite batch may not contain everything being drawn and some things may already be rendered to the screen. Content drawn to the sprite batch at this point will be drawn over all vanilla content (including menus, HUD, and cursor).</summary> /// <inheritdoc cref="IDisplayEvents.Rendered" />
public readonly ManagedEvent<RenderedEventArgs> Rendered; public readonly ManagedEvent<RenderedEventArgs> Rendered;
/// <summary>Raised before the game world is drawn to the screen.</summary> /// <inheritdoc cref="IDisplayEvents.RenderingWorld" />
public readonly ManagedEvent<RenderingWorldEventArgs> RenderingWorld; public readonly ManagedEvent<RenderingWorldEventArgs> RenderingWorld;
/// <summary>Raised after the game world is drawn to the sprite patch, before it's rendered to the screen.</summary> /// <inheritdoc cref="IDisplayEvents.RenderedWorld" />
public readonly ManagedEvent<RenderedWorldEventArgs> RenderedWorld; public readonly ManagedEvent<RenderedWorldEventArgs> RenderedWorld;
/// <summary>When a menu is open (<see cref="StardewValley.Game1.activeClickableMenu"/> isn't null), raised before that menu is drawn to the screen.</summary> /// <inheritdoc cref="IDisplayEvents.RenderingActiveMenu" />
public readonly ManagedEvent<RenderingActiveMenuEventArgs> RenderingActiveMenu; public readonly ManagedEvent<RenderingActiveMenuEventArgs> RenderingActiveMenu;
/// <summary>When a menu is open (<see cref="StardewValley.Game1.activeClickableMenu"/> isn't null), raised after that menu is drawn to the sprite batch but before it's rendered to the screen.</summary> /// <inheritdoc cref="IDisplayEvents.RenderedActiveMenu" />
public readonly ManagedEvent<RenderedActiveMenuEventArgs> RenderedActiveMenu; public readonly ManagedEvent<RenderedActiveMenuEventArgs> RenderedActiveMenu;
/// <summary>Raised before drawing the HUD (item toolbar, clock, etc) to the screen.</summary> /// <inheritdoc cref="IDisplayEvents.RenderingHud" />
public readonly ManagedEvent<RenderingHudEventArgs> RenderingHud; public readonly ManagedEvent<RenderingHudEventArgs> RenderingHud;
/// <summary>Raised after drawing the HUD (item toolbar, clock, etc) to the sprite batch, but before it's rendered to the screen.</summary> /// <inheritdoc cref="IDisplayEvents.RenderedHud" />
public readonly ManagedEvent<RenderedHudEventArgs> RenderedHud; public readonly ManagedEvent<RenderedHudEventArgs> RenderedHud;
/// <summary>Raised after the game window is resized.</summary> /// <inheritdoc cref="IDisplayEvents.WindowResized" />
public readonly ManagedEvent<WindowResizedEventArgs> WindowResized; public readonly ManagedEvent<WindowResizedEventArgs> WindowResized;
/**** /****
** Game loop ** Game loop
****/ ****/
/// <summary>Raised after the game is launched, right before the first update tick.</summary> /// <inheritdoc cref="IGameLoopEvents.GameLaunched" />
public readonly ManagedEvent<GameLaunchedEventArgs> GameLaunched; public readonly ManagedEvent<GameLaunchedEventArgs> GameLaunched;
/// <summary>Raised before the game performs its overall update tick (≈60 times per second).</summary> /// <inheritdoc cref="IGameLoopEvents.UpdateTicking" />
public readonly ManagedEvent<UpdateTickingEventArgs> UpdateTicking; public readonly ManagedEvent<UpdateTickingEventArgs> UpdateTicking;
/// <summary>Raised after the game performs its overall update tick (≈60 times per second).</summary> /// <inheritdoc cref="IGameLoopEvents.UpdateTicked" />
public readonly ManagedEvent<UpdateTickedEventArgs> UpdateTicked; public readonly ManagedEvent<UpdateTickedEventArgs> UpdateTicked;
/// <summary>Raised once per second before the game performs its overall update tick.</summary> /// <inheritdoc cref="IGameLoopEvents.OneSecondUpdateTicking" />
public readonly ManagedEvent<OneSecondUpdateTickingEventArgs> OneSecondUpdateTicking; public readonly ManagedEvent<OneSecondUpdateTickingEventArgs> OneSecondUpdateTicking;
/// <summary>Raised once per second after the game performs its overall update tick.</summary> /// <inheritdoc cref="IGameLoopEvents.OneSecondUpdateTicked" />
public readonly ManagedEvent<OneSecondUpdateTickedEventArgs> OneSecondUpdateTicked; public readonly ManagedEvent<OneSecondUpdateTickedEventArgs> OneSecondUpdateTicked;
/// <summary>Raised before the game creates the save file.</summary> /// <inheritdoc cref="IGameLoopEvents.SaveCreating" />
public readonly ManagedEvent<SaveCreatingEventArgs> SaveCreating; public readonly ManagedEvent<SaveCreatingEventArgs> SaveCreating;
/// <summary>Raised after the game finishes creating the save file.</summary> /// <inheritdoc cref="IGameLoopEvents.SaveCreated" />
public readonly ManagedEvent<SaveCreatedEventArgs> SaveCreated; public readonly ManagedEvent<SaveCreatedEventArgs> SaveCreated;
/// <summary>Raised before the game begins writes data to the save file (except the initial save creation).</summary> /// <inheritdoc cref="IGameLoopEvents.Saving" />
public readonly ManagedEvent<SavingEventArgs> Saving; public readonly ManagedEvent<SavingEventArgs> Saving;
/// <summary>Raised after the game finishes writing data to the save file (except the initial save creation).</summary> /// <inheritdoc cref="IGameLoopEvents.Saved" />
public readonly ManagedEvent<SavedEventArgs> Saved; public readonly ManagedEvent<SavedEventArgs> Saved;
/// <summary>Raised after the player loads a save slot and the world is initialized.</summary> /// <inheritdoc cref="IGameLoopEvents.SaveLoaded" />
public readonly ManagedEvent<SaveLoadedEventArgs> SaveLoaded; public readonly ManagedEvent<SaveLoadedEventArgs> SaveLoaded;
/// <summary>Raised after the game begins a new day, including when loading a save.</summary> /// <inheritdoc cref="IGameLoopEvents.DayStarted" />
public readonly ManagedEvent<DayStartedEventArgs> DayStarted; public readonly ManagedEvent<DayStartedEventArgs> DayStarted;
/// <summary>Raised before the game ends the current day. This happens before it starts setting up the next day and before <see cref="Saving"/>.</summary> /// <inheritdoc cref="IGameLoopEvents.DayEnding" />
public readonly ManagedEvent<DayEndingEventArgs> DayEnding; public readonly ManagedEvent<DayEndingEventArgs> DayEnding;
/// <summary>Raised after the in-game clock time changes.</summary> /// <inheritdoc cref="IGameLoopEvents.TimeChanged" />
public readonly ManagedEvent<TimeChangedEventArgs> TimeChanged; public readonly ManagedEvent<TimeChangedEventArgs> TimeChanged;
/// <summary>Raised after the game returns to the title screen.</summary> /// <inheritdoc cref="IGameLoopEvents.ReturnedToTitle" />
public readonly ManagedEvent<ReturnedToTitleEventArgs> ReturnedToTitle; public readonly ManagedEvent<ReturnedToTitleEventArgs> ReturnedToTitle;
/**** /****
** Input ** Input
****/ ****/
/// <summary>Raised after the player presses or releases any buttons on the keyboard, controller, or mouse.</summary> /// <inheritdoc cref="IInputEvents.ButtonsChanged" />
public readonly ManagedEvent<ButtonsChangedEventArgs> ButtonsChanged; public readonly ManagedEvent<ButtonsChangedEventArgs> ButtonsChanged;
/// <summary>Raised after the player presses a button on the keyboard, controller, or mouse.</summary> /// <inheritdoc cref="IInputEvents.ButtonPressed" />
public readonly ManagedEvent<ButtonPressedEventArgs> ButtonPressed; public readonly ManagedEvent<ButtonPressedEventArgs> ButtonPressed;
/// <summary>Raised after the player released a button on the keyboard, controller, or mouse.</summary> /// <inheritdoc cref="IInputEvents.ButtonReleased" />
public readonly ManagedEvent<ButtonReleasedEventArgs> ButtonReleased; public readonly ManagedEvent<ButtonReleasedEventArgs> ButtonReleased;
/// <summary>Raised after the player moves the in-game cursor.</summary> /// <inheritdoc cref="IInputEvents.CursorMoved" />
public readonly ManagedEvent<CursorMovedEventArgs> CursorMoved; public readonly ManagedEvent<CursorMovedEventArgs> CursorMoved;
/// <summary>Raised after the player scrolls the mouse wheel.</summary> /// <inheritdoc cref="IInputEvents.MouseWheelScrolled" />
public readonly ManagedEvent<MouseWheelScrolledEventArgs> MouseWheelScrolled; public readonly ManagedEvent<MouseWheelScrolledEventArgs> MouseWheelScrolled;
/**** /****
** Multiplayer ** Multiplayer
****/ ****/
/// <summary>Raised after the mod context for a peer is received. This happens before the game approves the connection (<see cref="IMultiplayerEvents.PeerConnected"/>), so the player doesn't yet exist in the game. This is the earliest point where messages can be sent to the peer via SMAPI.</summary> /// <inheritdoc cref="IMultiplayerEvents.PeerContextReceived" />
public readonly ManagedEvent<PeerContextReceivedEventArgs> PeerContextReceived; public readonly ManagedEvent<PeerContextReceivedEventArgs> PeerContextReceived;
/// <summary>Raised after a peer connection is approved by the game.</summary> /// <inheritdoc cref="IMultiplayerEvents.PeerConnected" />
public readonly ManagedEvent<PeerConnectedEventArgs> PeerConnected; public readonly ManagedEvent<PeerConnectedEventArgs> PeerConnected;
/// <summary>Raised after a mod message is received over the network.</summary> /// <inheritdoc cref="IMultiplayerEvents.ModMessageReceived" />
public readonly ManagedEvent<ModMessageReceivedEventArgs> ModMessageReceived; public readonly ManagedEvent<ModMessageReceivedEventArgs> ModMessageReceived;
/// <summary>Raised after the connection with a peer is severed.</summary> /// <inheritdoc cref="IMultiplayerEvents.PeerDisconnected" />
public readonly ManagedEvent<PeerDisconnectedEventArgs> PeerDisconnected; public readonly ManagedEvent<PeerDisconnectedEventArgs> PeerDisconnected;
/**** /****
** Player ** Player
****/ ****/
/// <summary>Raised after items are added or removed to a player's inventory.</summary> /// <inheritdoc cref="IPlayerEvents.InventoryChanged" />
public readonly ManagedEvent<InventoryChangedEventArgs> InventoryChanged; public readonly ManagedEvent<InventoryChangedEventArgs> InventoryChanged;
/// <summary>Raised after a player skill level changes. This happens as soon as they level up, not when the game notifies the player after their character goes to bed.</summary> /// <inheritdoc cref="IPlayerEvents.LevelChanged" />
public readonly ManagedEvent<LevelChangedEventArgs> LevelChanged; public readonly ManagedEvent<LevelChangedEventArgs> LevelChanged;
/// <summary>Raised after a player warps to a new location.</summary> /// <inheritdoc cref="IPlayerEvents.Warped" />
public readonly ManagedEvent<WarpedEventArgs> Warped; public readonly ManagedEvent<WarpedEventArgs> Warped;
/**** /****
** World ** World
****/ ****/
/// <summary>Raised after a game location is added or removed.</summary> /// <inheritdoc cref="IWorldEvents.LocationListChanged" />
public readonly ManagedEvent<LocationListChangedEventArgs> LocationListChanged; public readonly ManagedEvent<LocationListChangedEventArgs> LocationListChanged;
/// <summary>Raised after buildings are added or removed in a location.</summary> /// <inheritdoc cref="IWorldEvents.BuildingListChanged" />
public readonly ManagedEvent<BuildingListChangedEventArgs> BuildingListChanged; public readonly ManagedEvent<BuildingListChangedEventArgs> BuildingListChanged;
/// <summary>Raised after debris are added or removed in a location.</summary> /// <inheritdoc cref="IWorldEvents.DebrisListChanged" />
public readonly ManagedEvent<DebrisListChangedEventArgs> DebrisListChanged; public readonly ManagedEvent<DebrisListChangedEventArgs> DebrisListChanged;
/// <summary>Raised after large terrain features (like bushes) are added or removed in a location.</summary> /// <inheritdoc cref="IWorldEvents.LargeTerrainFeatureListChanged" />
public readonly ManagedEvent<LargeTerrainFeatureListChangedEventArgs> LargeTerrainFeatureListChanged; public readonly ManagedEvent<LargeTerrainFeatureListChangedEventArgs> LargeTerrainFeatureListChanged;
/// <summary>Raised after NPCs are added or removed in a location.</summary> /// <inheritdoc cref="IWorldEvents.NpcListChanged" />
public readonly ManagedEvent<NpcListChangedEventArgs> NpcListChanged; public readonly ManagedEvent<NpcListChangedEventArgs> NpcListChanged;
/// <summary>Raised after objects are added or removed in a location.</summary> /// <inheritdoc cref="IWorldEvents.ObjectListChanged" />
public readonly ManagedEvent<ObjectListChangedEventArgs> ObjectListChanged; public readonly ManagedEvent<ObjectListChangedEventArgs> ObjectListChanged;
/// <summary>Raised after items are added or removed from a chest.</summary> /// <inheritdoc cref="IWorldEvents.ChestInventoryChanged" />
public readonly ManagedEvent<ChestInventoryChangedEventArgs> ChestInventoryChanged; public readonly ManagedEvent<ChestInventoryChangedEventArgs> ChestInventoryChanged;
/// <summary>Raised after terrain features (like floors and trees) are added or removed in a location.</summary> /// <inheritdoc cref="IWorldEvents.TerrainFeatureListChanged" />
public readonly ManagedEvent<TerrainFeatureListChangedEventArgs> TerrainFeatureListChanged; public readonly ManagedEvent<TerrainFeatureListChangedEventArgs> TerrainFeatureListChanged;
/// <summary>Raised after furniture are added or removed in a location.</summary> /// <inheritdoc cref="IWorldEvents.FurnitureListChanged" />
public readonly ManagedEvent<FurnitureListChangedEventArgs> FurnitureListChanged; public readonly ManagedEvent<FurnitureListChangedEventArgs> FurnitureListChanged;
/**** /****
** Specialized ** Specialized
****/ ****/
/// <summary>Raised when the low-level stage in the game's loading process has changed. See notes on <see cref="ISpecializedEvents.LoadStageChanged"/>.</summary> /// <inheritdoc cref="ISpecializedEvents.LoadStageChanged" />
public readonly ManagedEvent<LoadStageChangedEventArgs> LoadStageChanged; public readonly ManagedEvent<LoadStageChangedEventArgs> LoadStageChanged;
/// <summary>Raised before the game performs its overall update tick (≈60 times per second). See notes on <see cref="ISpecializedEvents.UnvalidatedUpdateTicking"/>.</summary> /// <inheritdoc cref="ISpecializedEvents.UnvalidatedUpdateTicking" />
public readonly ManagedEvent<UnvalidatedUpdateTickingEventArgs> UnvalidatedUpdateTicking; public readonly ManagedEvent<UnvalidatedUpdateTickingEventArgs> UnvalidatedUpdateTicking;
/// <summary>Raised after the game performs its overall update tick (≈60 times per second). See notes on <see cref="ISpecializedEvents.UnvalidatedUpdateTicked"/>.</summary> /// <inheritdoc cref="ISpecializedEvents.UnvalidatedUpdateTicked" />
public readonly ManagedEvent<UnvalidatedUpdateTickedEventArgs> UnvalidatedUpdateTicked; public readonly ManagedEvent<UnvalidatedUpdateTickedEventArgs> UnvalidatedUpdateTicked;
@ -247,12 +245,5 @@ namespace StardewModdingAPI.Framework.Events
this.UnvalidatedUpdateTicking = ManageEventOf<UnvalidatedUpdateTickingEventArgs>(nameof(IModEvents.Specialized), nameof(ISpecializedEvents.UnvalidatedUpdateTicking), isPerformanceCritical: true); this.UnvalidatedUpdateTicking = ManageEventOf<UnvalidatedUpdateTickingEventArgs>(nameof(IModEvents.Specialized), nameof(ISpecializedEvents.UnvalidatedUpdateTicking), isPerformanceCritical: true);
this.UnvalidatedUpdateTicked = ManageEventOf<UnvalidatedUpdateTickedEventArgs>(nameof(IModEvents.Specialized), nameof(ISpecializedEvents.UnvalidatedUpdateTicked), isPerformanceCritical: true); this.UnvalidatedUpdateTicked = ManageEventOf<UnvalidatedUpdateTickedEventArgs>(nameof(IModEvents.Specialized), nameof(ISpecializedEvents.UnvalidatedUpdateTicked), isPerformanceCritical: true);
} }
/// <summary>Get all managed events.</summary>
public IEnumerable<IManagedEvent> GetAllEvents()
{
foreach (FieldInfo field in this.GetType().GetFields())
yield return (IManagedEvent)field.GetValue(this);
}
} }
} }

View File

@ -33,10 +33,10 @@ namespace StardewModdingAPI.Framework.Events
/********* /*********
** Accessors ** Accessors
*********/ *********/
/// <summary>A human-readable name for the event.</summary> /// <inheritdoc />
public string EventName { get; } public string EventName { get; }
/// <summary>Whether the event is typically called at least once per second.</summary> /// <inheritdoc />
public bool IsPerformanceCritical { get; } public bool IsPerformanceCritical { get; }

View File

@ -39,9 +39,7 @@ namespace StardewModdingAPI.Framework.Events
this.SourceMod = sourceMod; this.SourceMod = sourceMod;
} }
/// <summary>Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.</summary> /// <inheritdoc />
/// <param name="obj">An object to compare with this instance.</param>
/// <exception cref="T:System.ArgumentException"><paramref name="obj" /> is not the same type as this instance.</exception>
public int CompareTo(object obj) public int CompareTo(object obj)
{ {
if (!(obj is ManagedEventHandler<TEventArgs> other)) if (!(obj is ManagedEventHandler<TEventArgs> other))

View File

@ -1,79 +1,78 @@
using System; using System;
using StardewModdingAPI.Events; using StardewModdingAPI.Events;
using StardewValley;
namespace StardewModdingAPI.Framework.Events namespace StardewModdingAPI.Framework.Events
{ {
/// <summary>Events related to UI and drawing to the screen.</summary> /// <inheritdoc cref="IDisplayEvents" />
internal class ModDisplayEvents : ModEventsBase, IDisplayEvents internal class ModDisplayEvents : ModEventsBase, IDisplayEvents
{ {
/********* /*********
** Accessors ** Accessors
*********/ *********/
/// <summary>Raised after a game menu is opened, closed, or replaced.</summary> /// <inheritdoc />
public event EventHandler<MenuChangedEventArgs> MenuChanged public event EventHandler<MenuChangedEventArgs> MenuChanged
{ {
add => this.EventManager.MenuChanged.Add(value, this.Mod); add => this.EventManager.MenuChanged.Add(value, this.Mod);
remove => this.EventManager.MenuChanged.Remove(value); remove => this.EventManager.MenuChanged.Remove(value);
} }
/// <summary>Raised before the game draws anything to the screen in a draw tick, as soon as the sprite batch is opened. The sprite batch may be closed and reopened multiple times after this event is called, but it's only raised once per draw tick. This event isn't useful for drawing to the screen, since the game will draw over it.</summary> /// <inheritdoc />
public event EventHandler<RenderingEventArgs> Rendering public event EventHandler<RenderingEventArgs> Rendering
{ {
add => this.EventManager.Rendering.Add(value, this.Mod); add => this.EventManager.Rendering.Add(value, this.Mod);
remove => this.EventManager.Rendering.Remove(value); remove => this.EventManager.Rendering.Remove(value);
} }
/// <summary>Raised after the game draws to the sprite patch in a draw tick, just before the final sprite batch is rendered to the screen. Since the game may open/close the sprite batch multiple times in a draw tick, the sprite batch may not contain everything being drawn and some things may already be rendered to the screen. Content drawn to the sprite batch at this point will be drawn over all vanilla content (including menus, HUD, and cursor).</summary> /// <inheritdoc />
public event EventHandler<RenderedEventArgs> Rendered public event EventHandler<RenderedEventArgs> Rendered
{ {
add => this.EventManager.Rendered.Add(value, this.Mod); add => this.EventManager.Rendered.Add(value, this.Mod);
remove => this.EventManager.Rendered.Remove(value); remove => this.EventManager.Rendered.Remove(value);
} }
/// <summary>Raised before the game world is drawn to the screen. This event isn't useful for drawing to the screen, since the game will draw over it.</summary> /// <inheritdoc />
public event EventHandler<RenderingWorldEventArgs> RenderingWorld public event EventHandler<RenderingWorldEventArgs> RenderingWorld
{ {
add => this.EventManager.RenderingWorld.Add(value, this.Mod); add => this.EventManager.RenderingWorld.Add(value, this.Mod);
remove => this.EventManager.RenderingWorld.Remove(value); remove => this.EventManager.RenderingWorld.Remove(value);
} }
/// <summary>Raised after the game world is drawn to the sprite patch, before it's rendered to the screen. Content drawn to the sprite batch at this point will be drawn over the world, but under any active menu, HUD elements, or cursor.</summary> /// <inheritdoc />
public event EventHandler<RenderedWorldEventArgs> RenderedWorld public event EventHandler<RenderedWorldEventArgs> RenderedWorld
{ {
add => this.EventManager.RenderedWorld.Add(value, this.Mod); add => this.EventManager.RenderedWorld.Add(value, this.Mod);
remove => this.EventManager.RenderedWorld.Remove(value); remove => this.EventManager.RenderedWorld.Remove(value);
} }
/// <summary>When a menu is open (<see cref="Game1.activeClickableMenu"/> isn't null), raised before that menu is drawn to the screen. This includes the game's internal menus like the title screen. Content drawn to the sprite batch at this point will appear under the menu.</summary> /// <inheritdoc />
public event EventHandler<RenderingActiveMenuEventArgs> RenderingActiveMenu public event EventHandler<RenderingActiveMenuEventArgs> RenderingActiveMenu
{ {
add => this.EventManager.RenderingActiveMenu.Add(value, this.Mod); add => this.EventManager.RenderingActiveMenu.Add(value, this.Mod);
remove => this.EventManager.RenderingActiveMenu.Remove(value); remove => this.EventManager.RenderingActiveMenu.Remove(value);
} }
/// <summary>When a menu is open (<see cref="Game1.activeClickableMenu"/> isn't null), raised after that menu is drawn to the sprite batch but before it's rendered to the screen. Content drawn to the sprite batch at this point will appear over the menu and menu cursor.</summary> /// <inheritdoc />
public event EventHandler<RenderedActiveMenuEventArgs> RenderedActiveMenu public event EventHandler<RenderedActiveMenuEventArgs> RenderedActiveMenu
{ {
add => this.EventManager.RenderedActiveMenu.Add(value, this.Mod); add => this.EventManager.RenderedActiveMenu.Add(value, this.Mod);
remove => this.EventManager.RenderedActiveMenu.Remove(value); remove => this.EventManager.RenderedActiveMenu.Remove(value);
} }
/// <summary>Raised before drawing the HUD (item toolbar, clock, etc) to the screen. The vanilla HUD may be hidden at this point (e.g. because a menu is open). Content drawn to the sprite batch at this point will appear under the HUD.</summary> /// <inheritdoc />
public event EventHandler<RenderingHudEventArgs> RenderingHud public event EventHandler<RenderingHudEventArgs> RenderingHud
{ {
add => this.EventManager.RenderingHud.Add(value, this.Mod); add => this.EventManager.RenderingHud.Add(value, this.Mod);
remove => this.EventManager.RenderingHud.Remove(value); remove => this.EventManager.RenderingHud.Remove(value);
} }
/// <summary>Raised after drawing the HUD (item toolbar, clock, etc) to the sprite batch, but before it's rendered to the screen. The vanilla HUD may be hidden at this point (e.g. because a menu is open). Content drawn to the sprite batch at this point will appear over the HUD.</summary> /// <inheritdoc />
public event EventHandler<RenderedHudEventArgs> RenderedHud public event EventHandler<RenderedHudEventArgs> RenderedHud
{ {
add => this.EventManager.RenderedHud.Add(value, this.Mod); add => this.EventManager.RenderedHud.Add(value, this.Mod);
remove => this.EventManager.RenderedHud.Remove(value); remove => this.EventManager.RenderedHud.Remove(value);
} }
/// <summary>Raised after the game window is resized.</summary> /// <inheritdoc />
public event EventHandler<WindowResizedEventArgs> WindowResized public event EventHandler<WindowResizedEventArgs> WindowResized
{ {
add => this.EventManager.WindowResized.Add(value, this.Mod); add => this.EventManager.WindowResized.Add(value, this.Mod);

View File

@ -2,31 +2,31 @@ using StardewModdingAPI.Events;
namespace StardewModdingAPI.Framework.Events namespace StardewModdingAPI.Framework.Events
{ {
/// <summary>Manages access to events raised by SMAPI.</summary> /// <inheritdoc />
internal class ModEvents : IModEvents internal class ModEvents : IModEvents
{ {
/********* /*********
** Accessors ** Accessors
*********/ *********/
/// <summary>Events related to UI and drawing to the screen.</summary> /// <inheritdoc />
public IDisplayEvents Display { get; } public IDisplayEvents Display { get; }
/// <summary>Events linked to the game's update loop. The update loop runs roughly ≈60 times/second to run game logic like state changes, action handling, etc. These can be useful, but you should consider more semantic events like <see cref="IModEvents.Input"/> if possible.</summary> /// <inheritdoc />
public IGameLoopEvents GameLoop { get; } public IGameLoopEvents GameLoop { get; }
/// <summary>Events raised when the player provides input using a controller, keyboard, or mouse.</summary> /// <inheritdoc />
public IInputEvents Input { get; } public IInputEvents Input { get; }
/// <summary>Events raised for multiplayer messages and connections.</summary> /// <inheritdoc />
public IMultiplayerEvents Multiplayer { get; } public IMultiplayerEvents Multiplayer { get; }
/// <summary>Events raised when the player data changes.</summary> /// <inheritdoc />
public IPlayerEvents Player { get; } public IPlayerEvents Player { get; }
/// <summary>Events raised when something changes in the world.</summary> /// <inheritdoc />
public IWorldEvents World { get; } public IWorldEvents World { get; }
/// <summary>Events serving specialized edge cases that shouldn't be used by most mods.</summary> /// <inheritdoc />
public ISpecializedEvents Specialized { get; } public ISpecializedEvents Specialized { get; }

View File

@ -3,104 +3,104 @@ using StardewModdingAPI.Events;
namespace StardewModdingAPI.Framework.Events namespace StardewModdingAPI.Framework.Events
{ {
/// <summary>Events linked to the game's update loop. The update loop runs roughly ≈60 times/second to run game logic like state changes, action handling, etc. These can be useful, but you should consider more semantic events like <see cref="IInputEvents"/> if possible.</summary> /// <inheritdoc cref="IGameLoopEvents" />
internal class ModGameLoopEvents : ModEventsBase, IGameLoopEvents internal class ModGameLoopEvents : ModEventsBase, IGameLoopEvents
{ {
/********* /*********
** Accessors ** Accessors
*********/ *********/
/// <summary>Raised after the game is launched, right before the first update tick.</summary> /// <inheritdoc />
public event EventHandler<GameLaunchedEventArgs> GameLaunched public event EventHandler<GameLaunchedEventArgs> GameLaunched
{ {
add => this.EventManager.GameLaunched.Add(value, this.Mod); add => this.EventManager.GameLaunched.Add(value, this.Mod);
remove => this.EventManager.GameLaunched.Remove(value); remove => this.EventManager.GameLaunched.Remove(value);
} }
/// <summary>Raised before the game performs its overall update tick (≈60 times per second).</summary> /// <inheritdoc />
public event EventHandler<UpdateTickingEventArgs> UpdateTicking public event EventHandler<UpdateTickingEventArgs> UpdateTicking
{ {
add => this.EventManager.UpdateTicking.Add(value, this.Mod); add => this.EventManager.UpdateTicking.Add(value, this.Mod);
remove => this.EventManager.UpdateTicking.Remove(value); remove => this.EventManager.UpdateTicking.Remove(value);
} }
/// <summary>Raised after the game performs its overall update tick (≈60 times per second).</summary> /// <inheritdoc />
public event EventHandler<UpdateTickedEventArgs> UpdateTicked public event EventHandler<UpdateTickedEventArgs> UpdateTicked
{ {
add => this.EventManager.UpdateTicked.Add(value, this.Mod); add => this.EventManager.UpdateTicked.Add(value, this.Mod);
remove => this.EventManager.UpdateTicked.Remove(value); remove => this.EventManager.UpdateTicked.Remove(value);
} }
/// <summary>Raised once per second before the game state is updated.</summary> /// <inheritdoc />
public event EventHandler<OneSecondUpdateTickingEventArgs> OneSecondUpdateTicking public event EventHandler<OneSecondUpdateTickingEventArgs> OneSecondUpdateTicking
{ {
add => this.EventManager.OneSecondUpdateTicking.Add(value, this.Mod); add => this.EventManager.OneSecondUpdateTicking.Add(value, this.Mod);
remove => this.EventManager.OneSecondUpdateTicking.Remove(value); remove => this.EventManager.OneSecondUpdateTicking.Remove(value);
} }
/// <summary>Raised once per second after the game state is updated.</summary> /// <inheritdoc />
public event EventHandler<OneSecondUpdateTickedEventArgs> OneSecondUpdateTicked public event EventHandler<OneSecondUpdateTickedEventArgs> OneSecondUpdateTicked
{ {
add => this.EventManager.OneSecondUpdateTicked.Add(value, this.Mod); add => this.EventManager.OneSecondUpdateTicked.Add(value, this.Mod);
remove => this.EventManager.OneSecondUpdateTicked.Remove(value); remove => this.EventManager.OneSecondUpdateTicked.Remove(value);
} }
/// <summary>Raised before the game creates a new save file.</summary> /// <inheritdoc />
public event EventHandler<SaveCreatingEventArgs> SaveCreating public event EventHandler<SaveCreatingEventArgs> SaveCreating
{ {
add => this.EventManager.SaveCreating.Add(value, this.Mod); add => this.EventManager.SaveCreating.Add(value, this.Mod);
remove => this.EventManager.SaveCreating.Remove(value); remove => this.EventManager.SaveCreating.Remove(value);
} }
/// <summary>Raised after the game finishes creating the save file.</summary> /// <inheritdoc />
public event EventHandler<SaveCreatedEventArgs> SaveCreated public event EventHandler<SaveCreatedEventArgs> SaveCreated
{ {
add => this.EventManager.SaveCreated.Add(value, this.Mod); add => this.EventManager.SaveCreated.Add(value, this.Mod);
remove => this.EventManager.SaveCreated.Remove(value); remove => this.EventManager.SaveCreated.Remove(value);
} }
/// <summary>Raised before the game begins writes data to the save file.</summary> /// <inheritdoc />
public event EventHandler<SavingEventArgs> Saving public event EventHandler<SavingEventArgs> Saving
{ {
add => this.EventManager.Saving.Add(value, this.Mod); add => this.EventManager.Saving.Add(value, this.Mod);
remove => this.EventManager.Saving.Remove(value); remove => this.EventManager.Saving.Remove(value);
} }
/// <summary>Raised after the game finishes writing data to the save file.</summary> /// <inheritdoc />
public event EventHandler<SavedEventArgs> Saved public event EventHandler<SavedEventArgs> Saved
{ {
add => this.EventManager.Saved.Add(value, this.Mod); add => this.EventManager.Saved.Add(value, this.Mod);
remove => this.EventManager.Saved.Remove(value); remove => this.EventManager.Saved.Remove(value);
} }
/// <summary>Raised after the player loads a save slot and the world is initialized.</summary> /// <inheritdoc />
public event EventHandler<SaveLoadedEventArgs> SaveLoaded public event EventHandler<SaveLoadedEventArgs> SaveLoaded
{ {
add => this.EventManager.SaveLoaded.Add(value, this.Mod); add => this.EventManager.SaveLoaded.Add(value, this.Mod);
remove => this.EventManager.SaveLoaded.Remove(value); remove => this.EventManager.SaveLoaded.Remove(value);
} }
/// <summary>Raised after the game begins a new day (including when the player loads a save).</summary> /// <inheritdoc />
public event EventHandler<DayStartedEventArgs> DayStarted public event EventHandler<DayStartedEventArgs> DayStarted
{ {
add => this.EventManager.DayStarted.Add(value, this.Mod); add => this.EventManager.DayStarted.Add(value, this.Mod);
remove => this.EventManager.DayStarted.Remove(value); remove => this.EventManager.DayStarted.Remove(value);
} }
/// <summary>Raised before the game ends the current day. This happens before it starts setting up the next day and before <see cref="IGameLoopEvents.Saving"/>.</summary> /// <inheritdoc />
public event EventHandler<DayEndingEventArgs> DayEnding public event EventHandler<DayEndingEventArgs> DayEnding
{ {
add => this.EventManager.DayEnding.Add(value, this.Mod); add => this.EventManager.DayEnding.Add(value, this.Mod);
remove => this.EventManager.DayEnding.Remove(value); remove => this.EventManager.DayEnding.Remove(value);
} }
/// <summary>Raised after the in-game clock time changes.</summary> /// <inheritdoc />
public event EventHandler<TimeChangedEventArgs> TimeChanged public event EventHandler<TimeChangedEventArgs> TimeChanged
{ {
add => this.EventManager.TimeChanged.Add(value, this.Mod); add => this.EventManager.TimeChanged.Add(value, this.Mod);
remove => this.EventManager.TimeChanged.Remove(value); remove => this.EventManager.TimeChanged.Remove(value);
} }
/// <summary>Raised after the game returns to the title screen.</summary> /// <inheritdoc />
public event EventHandler<ReturnedToTitleEventArgs> ReturnedToTitle public event EventHandler<ReturnedToTitleEventArgs> ReturnedToTitle
{ {
add => this.EventManager.ReturnedToTitle.Add(value, this.Mod); add => this.EventManager.ReturnedToTitle.Add(value, this.Mod);

View File

@ -3,41 +3,41 @@ using StardewModdingAPI.Events;
namespace StardewModdingAPI.Framework.Events namespace StardewModdingAPI.Framework.Events
{ {
/// <summary>Events raised when the player provides input using a controller, keyboard, or mouse.</summary> /// <inheritdoc cref="IInputEvents" />
internal class ModInputEvents : ModEventsBase, IInputEvents internal class ModInputEvents : ModEventsBase, IInputEvents
{ {
/********* /*********
** Accessors ** Accessors
*********/ *********/
/// <summary>Raised after the player presses or releases any buttons on the keyboard, controller, or mouse.</summary> /// <inheritdoc />
public event EventHandler<ButtonsChangedEventArgs> ButtonsChanged public event EventHandler<ButtonsChangedEventArgs> ButtonsChanged
{ {
add => this.EventManager.ButtonsChanged.Add(value, this.Mod); add => this.EventManager.ButtonsChanged.Add(value, this.Mod);
remove => this.EventManager.ButtonsChanged.Remove(value); remove => this.EventManager.ButtonsChanged.Remove(value);
} }
/// <summary>Raised after the player presses a button on the keyboard, controller, or mouse.</summary> /// <inheritdoc />
public event EventHandler<ButtonPressedEventArgs> ButtonPressed public event EventHandler<ButtonPressedEventArgs> ButtonPressed
{ {
add => this.EventManager.ButtonPressed.Add(value, this.Mod); add => this.EventManager.ButtonPressed.Add(value, this.Mod);
remove => this.EventManager.ButtonPressed.Remove(value); remove => this.EventManager.ButtonPressed.Remove(value);
} }
/// <summary>Raised after the player releases a button on the keyboard, controller, or mouse.</summary> /// <inheritdoc />
public event EventHandler<ButtonReleasedEventArgs> ButtonReleased public event EventHandler<ButtonReleasedEventArgs> ButtonReleased
{ {
add => this.EventManager.ButtonReleased.Add(value, this.Mod); add => this.EventManager.ButtonReleased.Add(value, this.Mod);
remove => this.EventManager.ButtonReleased.Remove(value); remove => this.EventManager.ButtonReleased.Remove(value);
} }
/// <summary>Raised after the player moves the in-game cursor.</summary> /// <inheritdoc />
public event EventHandler<CursorMovedEventArgs> CursorMoved public event EventHandler<CursorMovedEventArgs> CursorMoved
{ {
add => this.EventManager.CursorMoved.Add(value, this.Mod); add => this.EventManager.CursorMoved.Add(value, this.Mod);
remove => this.EventManager.CursorMoved.Remove(value); remove => this.EventManager.CursorMoved.Remove(value);
} }
/// <summary>Raised after the player scrolls the mouse wheel.</summary> /// <inheritdoc />
public event EventHandler<MouseWheelScrolledEventArgs> MouseWheelScrolled public event EventHandler<MouseWheelScrolledEventArgs> MouseWheelScrolled
{ {
add => this.EventManager.MouseWheelScrolled.Add(value, this.Mod); add => this.EventManager.MouseWheelScrolled.Add(value, this.Mod);

View File

@ -3,34 +3,34 @@ using StardewModdingAPI.Events;
namespace StardewModdingAPI.Framework.Events namespace StardewModdingAPI.Framework.Events
{ {
/// <summary>Events raised for multiplayer messages and connections.</summary> /// <inheritdoc cref="IMultiplayerEvents" />
internal class ModMultiplayerEvents : ModEventsBase, IMultiplayerEvents internal class ModMultiplayerEvents : ModEventsBase, IMultiplayerEvents
{ {
/********* /*********
** Accessors ** Accessors
*********/ *********/
/// <summary>Raised after the mod context for a peer is received. This happens before the game approves the connection (<see cref="IMultiplayerEvents.PeerConnected"/>), so the player doesn't yet exist in the game. This is the earliest point where messages can be sent to the peer via SMAPI.</summary> /// <inheritdoc />
public event EventHandler<PeerContextReceivedEventArgs> PeerContextReceived public event EventHandler<PeerContextReceivedEventArgs> PeerContextReceived
{ {
add => this.EventManager.PeerContextReceived.Add(value, this.Mod); add => this.EventManager.PeerContextReceived.Add(value, this.Mod);
remove => this.EventManager.PeerContextReceived.Remove(value); remove => this.EventManager.PeerContextReceived.Remove(value);
} }
/// <summary>Raised after a peer connection is approved by the game.</summary> /// <inheritdoc />
public event EventHandler<PeerConnectedEventArgs> PeerConnected public event EventHandler<PeerConnectedEventArgs> PeerConnected
{ {
add => this.EventManager.PeerConnected.Add(value, this.Mod); add => this.EventManager.PeerConnected.Add(value, this.Mod);
remove => this.EventManager.PeerConnected.Remove(value); remove => this.EventManager.PeerConnected.Remove(value);
} }
/// <summary>Raised after a mod message is received over the network.</summary> /// <inheritdoc />
public event EventHandler<ModMessageReceivedEventArgs> ModMessageReceived public event EventHandler<ModMessageReceivedEventArgs> ModMessageReceived
{ {
add => this.EventManager.ModMessageReceived.Add(value, this.Mod); add => this.EventManager.ModMessageReceived.Add(value, this.Mod);
remove => this.EventManager.ModMessageReceived.Remove(value); remove => this.EventManager.ModMessageReceived.Remove(value);
} }
/// <summary>Raised after the connection with a peer is severed.</summary> /// <inheritdoc />
public event EventHandler<PeerDisconnectedEventArgs> PeerDisconnected public event EventHandler<PeerDisconnectedEventArgs> PeerDisconnected
{ {
add => this.EventManager.PeerDisconnected.Add(value, this.Mod); add => this.EventManager.PeerDisconnected.Add(value, this.Mod);

View File

@ -3,27 +3,27 @@ using StardewModdingAPI.Events;
namespace StardewModdingAPI.Framework.Events namespace StardewModdingAPI.Framework.Events
{ {
/// <summary>Events raised when the player data changes.</summary> /// <inheritdoc cref="IPlayerEvents" />
internal class ModPlayerEvents : ModEventsBase, IPlayerEvents internal class ModPlayerEvents : ModEventsBase, IPlayerEvents
{ {
/********* /*********
** Accessors ** Accessors
*********/ *********/
/// <summary>Raised after items are added or removed to a player's inventory. NOTE: this event is currently only raised for the local player.</summary> /// <inheritdoc />
public event EventHandler<InventoryChangedEventArgs> InventoryChanged public event EventHandler<InventoryChangedEventArgs> InventoryChanged
{ {
add => this.EventManager.InventoryChanged.Add(value, this.Mod); add => this.EventManager.InventoryChanged.Add(value, this.Mod);
remove => this.EventManager.InventoryChanged.Remove(value); remove => this.EventManager.InventoryChanged.Remove(value);
} }
/// <summary>Raised after a player skill level changes. This happens as soon as they level up, not when the game notifies the player after their character goes to bed. NOTE: this event is currently only raised for the local player.</summary> /// <inheritdoc />
public event EventHandler<LevelChangedEventArgs> LevelChanged public event EventHandler<LevelChangedEventArgs> LevelChanged
{ {
add => this.EventManager.LevelChanged.Add(value, this.Mod); add => this.EventManager.LevelChanged.Add(value, this.Mod);
remove => this.EventManager.LevelChanged.Remove(value); remove => this.EventManager.LevelChanged.Remove(value);
} }
/// <summary>Raised after a player warps to a new location. NOTE: this event is currently only raised for the local player.</summary> /// <inheritdoc />
public event EventHandler<WarpedEventArgs> Warped public event EventHandler<WarpedEventArgs> Warped
{ {
add => this.EventManager.Warped.Add(value, this.Mod); add => this.EventManager.Warped.Add(value, this.Mod);

View File

@ -3,27 +3,27 @@ using StardewModdingAPI.Events;
namespace StardewModdingAPI.Framework.Events namespace StardewModdingAPI.Framework.Events
{ {
/// <summary>Events serving specialized edge cases that shouldn't be used by most mods.</summary> /// <inheritdoc cref="ISpecializedEvents" />
internal class ModSpecializedEvents : ModEventsBase, ISpecializedEvents internal class ModSpecializedEvents : ModEventsBase, ISpecializedEvents
{ {
/********* /*********
** Accessors ** Accessors
*********/ *********/
/// <summary>Raised when the low-level stage in the game's loading process has changed. This is an advanced event for mods which need to run code at specific points in the loading process. The available stages or when they happen might change without warning in future versions (e.g. due to changes in the game's load process), so mods using this event are more likely to break or have bugs. Most mods should use <see cref="IGameLoopEvents"/> instead.</summary> /// <inheritdoc />
public event EventHandler<LoadStageChangedEventArgs> LoadStageChanged public event EventHandler<LoadStageChangedEventArgs> LoadStageChanged
{ {
add => this.EventManager.LoadStageChanged.Add(value, this.Mod); add => this.EventManager.LoadStageChanged.Add(value, this.Mod);
remove => this.EventManager.LoadStageChanged.Remove(value); remove => this.EventManager.LoadStageChanged.Remove(value);
} }
/// <summary>Raised before the game state is updated (≈60 times per second), regardless of normal SMAPI validation. This event is not thread-safe and may be invoked while game logic is running asynchronously. Changes to game state in this method may crash the game or corrupt an in-progress save. Do not use this event unless you're fully aware of the context in which your code will be run. Mods using this event will trigger a stability warning in the SMAPI console.</summary> /// <inheritdoc />
public event EventHandler<UnvalidatedUpdateTickingEventArgs> UnvalidatedUpdateTicking public event EventHandler<UnvalidatedUpdateTickingEventArgs> UnvalidatedUpdateTicking
{ {
add => this.EventManager.UnvalidatedUpdateTicking.Add(value, this.Mod); add => this.EventManager.UnvalidatedUpdateTicking.Add(value, this.Mod);
remove => this.EventManager.UnvalidatedUpdateTicking.Remove(value); remove => this.EventManager.UnvalidatedUpdateTicking.Remove(value);
} }
/// <summary>Raised after the game state is updated (≈60 times per second), regardless of normal SMAPI validation. This event is not thread-safe and may be invoked while game logic is running asynchronously. Changes to game state in this method may crash the game or corrupt an in-progress save. Do not use this event unless you're fully aware of the context in which your code will be run. Mods using this event will trigger a stability warning in the SMAPI console.</summary> /// <inheritdoc />
public event EventHandler<UnvalidatedUpdateTickedEventArgs> UnvalidatedUpdateTicked public event EventHandler<UnvalidatedUpdateTickedEventArgs> UnvalidatedUpdateTicked
{ {
add => this.EventManager.UnvalidatedUpdateTicked.Add(value, this.Mod); add => this.EventManager.UnvalidatedUpdateTicked.Add(value, this.Mod);

View File

@ -3,69 +3,69 @@ using StardewModdingAPI.Events;
namespace StardewModdingAPI.Framework.Events namespace StardewModdingAPI.Framework.Events
{ {
/// <summary>Events raised when something changes in the world.</summary> /// <inheritdoc cref="IWorldEvents" />
internal class ModWorldEvents : ModEventsBase, IWorldEvents internal class ModWorldEvents : ModEventsBase, IWorldEvents
{ {
/********* /*********
** Accessors ** Accessors
*********/ *********/
/// <summary>Raised after a game location is added or removed.</summary> /// <inheritdoc />
public event EventHandler<LocationListChangedEventArgs> LocationListChanged public event EventHandler<LocationListChangedEventArgs> LocationListChanged
{ {
add => this.EventManager.LocationListChanged.Add(value, this.Mod); add => this.EventManager.LocationListChanged.Add(value, this.Mod);
remove => this.EventManager.LocationListChanged.Remove(value); remove => this.EventManager.LocationListChanged.Remove(value);
} }
/// <summary>Raised after buildings are added or removed in a location.</summary> /// <inheritdoc />
public event EventHandler<BuildingListChangedEventArgs> BuildingListChanged public event EventHandler<BuildingListChangedEventArgs> BuildingListChanged
{ {
add => this.EventManager.BuildingListChanged.Add(value, this.Mod); add => this.EventManager.BuildingListChanged.Add(value, this.Mod);
remove => this.EventManager.BuildingListChanged.Remove(value); remove => this.EventManager.BuildingListChanged.Remove(value);
} }
/// <summary>Raised after debris are added or removed in a location.</summary> /// <inheritdoc />
public event EventHandler<DebrisListChangedEventArgs> DebrisListChanged public event EventHandler<DebrisListChangedEventArgs> DebrisListChanged
{ {
add => this.EventManager.DebrisListChanged.Add(value, this.Mod); add => this.EventManager.DebrisListChanged.Add(value, this.Mod);
remove => this.EventManager.DebrisListChanged.Remove(value); remove => this.EventManager.DebrisListChanged.Remove(value);
} }
/// <summary>Raised after large terrain features (like bushes) are added or removed in a location.</summary> /// <inheritdoc />
public event EventHandler<LargeTerrainFeatureListChangedEventArgs> LargeTerrainFeatureListChanged public event EventHandler<LargeTerrainFeatureListChangedEventArgs> LargeTerrainFeatureListChanged
{ {
add => this.EventManager.LargeTerrainFeatureListChanged.Add(value, this.Mod); add => this.EventManager.LargeTerrainFeatureListChanged.Add(value, this.Mod);
remove => this.EventManager.LargeTerrainFeatureListChanged.Remove(value); remove => this.EventManager.LargeTerrainFeatureListChanged.Remove(value);
} }
/// <summary>Raised after NPCs are added or removed in a location.</summary> /// <inheritdoc />
public event EventHandler<NpcListChangedEventArgs> NpcListChanged public event EventHandler<NpcListChangedEventArgs> NpcListChanged
{ {
add => this.EventManager.NpcListChanged.Add(value, this.Mod); add => this.EventManager.NpcListChanged.Add(value, this.Mod);
remove => this.EventManager.NpcListChanged.Remove(value); remove => this.EventManager.NpcListChanged.Remove(value);
} }
/// <summary>Raised after objects are added or removed in a location.</summary> /// <inheritdoc />
public event EventHandler<ObjectListChangedEventArgs> ObjectListChanged public event EventHandler<ObjectListChangedEventArgs> ObjectListChanged
{ {
add => this.EventManager.ObjectListChanged.Add(value, this.Mod); add => this.EventManager.ObjectListChanged.Add(value, this.Mod);
remove => this.EventManager.ObjectListChanged.Remove(value); remove => this.EventManager.ObjectListChanged.Remove(value);
} }
/// <summary>Raised after items are added or removed from a chest.</summary> /// <inheritdoc />
public event EventHandler<ChestInventoryChangedEventArgs> ChestInventoryChanged public event EventHandler<ChestInventoryChangedEventArgs> ChestInventoryChanged
{ {
add => this.EventManager.ChestInventoryChanged.Add(value, this.Mod); add => this.EventManager.ChestInventoryChanged.Add(value, this.Mod);
remove => this.EventManager.ChestInventoryChanged.Remove(value); remove => this.EventManager.ChestInventoryChanged.Remove(value);
} }
/// <summary>Raised after terrain features (like floors and trees) are added or removed in a location.</summary> /// <inheritdoc />
public event EventHandler<TerrainFeatureListChangedEventArgs> TerrainFeatureListChanged public event EventHandler<TerrainFeatureListChangedEventArgs> TerrainFeatureListChanged
{ {
add => this.EventManager.TerrainFeatureListChanged.Add(value, this.Mod); add => this.EventManager.TerrainFeatureListChanged.Add(value, this.Mod);
remove => this.EventManager.TerrainFeatureListChanged.Remove(value); remove => this.EventManager.TerrainFeatureListChanged.Remove(value);
} }
/// <summary>Raised after furniture are added or removed in a location.</summary> /// <inheritdoc />
public event EventHandler<FurnitureListChangedEventArgs> FurnitureListChanged public event EventHandler<FurnitureListChangedEventArgs> FurnitureListChanged
{ {
add => this.EventManager.FurnitureListChanged.Add(value, this.Mod); add => this.EventManager.FurnitureListChanged.Add(value, this.Mod);

View File

@ -85,8 +85,7 @@ namespace StardewModdingAPI.Framework.Input
this.RightStickPos = sticks.Right; this.RightStickPos = sticks.Right;
} }
/// <summary>Override the states for a set of buttons.</summary> /// <inheritdoc />
/// <param name="overrides">The button state overrides.</param>
public GamePadStateBuilder OverrideButtons(IDictionary<SButton, SButtonState> overrides) public GamePadStateBuilder OverrideButtons(IDictionary<SButton, SButtonState> overrides)
{ {
if (!this.IsConnected) if (!this.IsConnected)
@ -151,7 +150,7 @@ namespace StardewModdingAPI.Framework.Input
return this; return this;
} }
/// <summary>Get the currently pressed buttons.</summary> /// <inheritdoc />
public IEnumerable<SButton> GetPressedButtons() public IEnumerable<SButton> GetPressedButtons()
{ {
if (!this.IsConnected) if (!this.IsConnected)
@ -191,7 +190,7 @@ namespace StardewModdingAPI.Framework.Input
} }
} }
/// <summary>Get the equivalent state.</summary> /// <inheritdoc />
public GamePadState GetState() public GamePadState GetState()
{ {
this.State ??= new GamePadState( this.State ??= new GamePadState(

View File

@ -31,8 +31,7 @@ namespace StardewModdingAPI.Framework.Input
this.PressedButtons.Add(button); this.PressedButtons.Add(button);
} }
/// <summary>Override the states for a set of buttons.</summary> /// <inheritdoc />
/// <param name="overrides">The button state overrides.</param>
public KeyboardStateBuilder OverrideButtons(IDictionary<SButton, SButtonState> overrides) public KeyboardStateBuilder OverrideButtons(IDictionary<SButton, SButtonState> overrides)
{ {
foreach (var pair in overrides) foreach (var pair in overrides)
@ -51,14 +50,14 @@ namespace StardewModdingAPI.Framework.Input
return this; return this;
} }
/// <summary>Get the currently pressed buttons.</summary> /// <inheritdoc />
public IEnumerable<SButton> GetPressedButtons() public IEnumerable<SButton> GetPressedButtons()
{ {
foreach (Keys key in this.PressedButtons) foreach (Keys key in this.PressedButtons)
yield return key.ToSButton(); yield return key.ToSButton();
} }
/// <summary>Get the equivalent state.</summary> /// <inheritdoc />
public KeyboardState GetState() public KeyboardState GetState()
{ {
return return

View File

@ -51,8 +51,7 @@ namespace StardewModdingAPI.Framework.Input
this.ScrollWheelValue = state.ScrollWheelValue; this.ScrollWheelValue = state.ScrollWheelValue;
} }
/// <summary>Override the states for a set of buttons.</summary> /// <inheritdoc />
/// <param name="overrides">The button state overrides.</param>
public MouseStateBuilder OverrideButtons(IDictionary<SButton, SButtonState> overrides) public MouseStateBuilder OverrideButtons(IDictionary<SButton, SButtonState> overrides)
{ {
foreach (var pair in overrides) foreach (var pair in overrides)
@ -67,7 +66,7 @@ namespace StardewModdingAPI.Framework.Input
return this; return this;
} }
/// <summary>Get the currently pressed buttons.</summary> /// <inheritdoc />
public IEnumerable<SButton> GetPressedButtons() public IEnumerable<SButton> GetPressedButtons()
{ {
foreach (var pair in this.ButtonStates) foreach (var pair in this.ButtonStates)
@ -77,7 +76,7 @@ namespace StardewModdingAPI.Framework.Input
} }
} }
/// <summary>Get the equivalent state.</summary> /// <inheritdoc />
public MouseState GetState() public MouseState GetState()
{ {
this.State ??= new MouseState( this.State ??= new MouseState(

View File

@ -8,25 +8,27 @@ namespace StardewModdingAPI
/********* /*********
** Accessors ** Accessors
*********/ *********/
/// <summary>Provides simplified APIs for writing mods.</summary> /// <inheritdoc />
public IModHelper Helper { get; internal set; } public IModHelper Helper { get; internal set; }
/// <summary>Writes messages to the console and log file.</summary> /// <inheritdoc />
public IMonitor Monitor { get; internal set; } public IMonitor Monitor { get; internal set; }
/// <summary>The mod's manifest.</summary> /// <inheritdoc />
public IManifest ModManifest { get; internal set; } public IManifest ModManifest { get; internal set; }
/********* /*********
** Public methods ** Public methods
*********/ *********/
/// <summary>The mod entry point, called after the mod is first loaded.</summary> /// <inheritdoc />
/// <param name="helper">Provides simplified APIs for writing mods.</param>
public abstract void Entry(IModHelper helper); public abstract void Entry(IModHelper helper);
/// <summary>Get an API that other mods can access. This is always called after <see cref="Entry"/>.</summary> /// <inheritdoc />
public virtual object GetApi() => null; public virtual object GetApi()
{
return null;
}
/// <summary>Release or reset unmanaged resources.</summary> /// <summary>Release or reset unmanaged resources.</summary>
public void Dispose() public void Dispose()