summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI/Events
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2016-10-31 14:48:23 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2016-10-31 14:48:23 -0400
commit7fe85119219c17d459fd5a373916dafff7b4e2a2 (patch)
tree85e17035489dbeeb1ea5d44d18b7e868cfb93754 /src/StardewModdingAPI/Events
parentd9adaf73869ce768686301ef30687a5fc18048a0 (diff)
downloadSMAPI-7fe85119219c17d459fd5a373916dafff7b4e2a2.tar.gz
SMAPI-7fe85119219c17d459fd5a373916dafff7b4e2a2.tar.bz2
SMAPI-7fe85119219c17d459fd5a373916dafff7b4e2a2.zip
document & format event code
Diffstat (limited to 'src/StardewModdingAPI/Events')
-rw-r--r--src/StardewModdingAPI/Events/ControlEvents.cs73
-rw-r--r--src/StardewModdingAPI/Events/EventArgsClickableMenuChanged.cs26
-rw-r--r--src/StardewModdingAPI/Events/EventArgsClickableMenuClosed.cs19
-rw-r--r--src/StardewModdingAPI/Events/EventArgsCommand.cs19
-rw-r--r--src/StardewModdingAPI/Events/EventArgsControllerButtonPressed.cs28
-rw-r--r--src/StardewModdingAPI/Events/EventArgsControllerButtonReleased.cs28
-rw-r--r--src/StardewModdingAPI/Events/EventArgsControllerTriggerPressed.cs33
-rw-r--r--src/StardewModdingAPI/Events/EventArgsControllerTriggerReleased.cs33
-rw-r--r--src/StardewModdingAPI/Events/EventArgsCurrentLocationChanged.cs26
-rw-r--r--src/StardewModdingAPI/Events/EventArgsFarmerChanged.cs26
-rw-r--r--src/StardewModdingAPI/Events/EventArgsGameLocationsChanged.cs19
-rw-r--r--src/StardewModdingAPI/Events/EventArgsIntChanged.cs26
-rw-r--r--src/StardewModdingAPI/Events/EventArgsInventoryChanged.cs36
-rw-r--r--src/StardewModdingAPI/Events/EventArgsKeyPressed.cs21
-rw-r--r--src/StardewModdingAPI/Events/EventArgsKeyboardStateChanged.cs26
-rw-r--r--src/StardewModdingAPI/Events/EventArgsLevelUp.cs38
-rw-r--r--src/StardewModdingAPI/Events/EventArgsLoadedGameChanged.cs21
-rw-r--r--src/StardewModdingAPI/Events/EventArgsLocationObjectsChanged.cs19
-rw-r--r--src/StardewModdingAPI/Events/EventArgsMineLevelChanged.cs26
-rw-r--r--src/StardewModdingAPI/Events/EventArgsMouseStateChanged.cs26
-rw-r--r--src/StardewModdingAPI/Events/EventArgsNewDay.cs33
-rw-r--r--src/StardewModdingAPI/Events/EventArgsStringChanged.cs25
-rw-r--r--src/StardewModdingAPI/Events/GameEvents.cs80
-rw-r--r--src/StardewModdingAPI/Events/GraphicsEvents.cs234
-rw-r--r--src/StardewModdingAPI/Events/LocationEvents.cs34
-rw-r--r--src/StardewModdingAPI/Events/MenuEvents.cs22
-rw-r--r--src/StardewModdingAPI/Events/MineEvents.cs18
-rw-r--r--src/StardewModdingAPI/Events/PlayerEvents.cs46
-rw-r--r--src/StardewModdingAPI/Events/TimeEvents.cs57
29 files changed, 809 insertions, 309 deletions
diff --git a/src/StardewModdingAPI/Events/ControlEvents.cs b/src/StardewModdingAPI/Events/ControlEvents.cs
index cb597cf1..8fb9061d 100644
--- a/src/StardewModdingAPI/Events/ControlEvents.cs
+++ b/src/StardewModdingAPI/Events/ControlEvents.cs
@@ -4,55 +4,102 @@ using Microsoft.Xna.Framework.Input;
namespace StardewModdingAPI.Events
{
+ /// <summary>Events raised when the player uses a controller, keyboard, or mouse.</summary>
public static class ControlEvents
{
+ /*********
+ ** Events
+ *********/
+ /// <summary>Raised when the <see cref="KeyboardState"/> changes. That happens when the player presses or releases a key.</summary>
public static event EventHandler<EventArgsKeyboardStateChanged> KeyboardChanged = delegate { };
+
+ /// <summary>Raised when the player presses a keyboard key.</summary>
public static event EventHandler<EventArgsKeyPressed> KeyPressed = delegate { };
+
+ /// <summary>Raised when the player releases a keyboard key.</summary>
public static event EventHandler<EventArgsKeyPressed> KeyReleased = delegate { };
+
+ /// <summary>Raised when the <see cref="MouseState"/> changes. That happens when the player moves the mouse, scrolls the mouse wheel, or presses/releases a button.</summary>
public static event EventHandler<EventArgsMouseStateChanged> MouseChanged = delegate { };
+
+ /// <summary>The player pressed a controller button. This event isn't raised for trigger buttons.</summary>
public static event EventHandler<EventArgsControllerButtonPressed> ControllerButtonPressed = delegate { };
+
+ /// <summary>The player released a controller button. This event isn't raised for trigger buttons.</summary>
public static event EventHandler<EventArgsControllerButtonReleased> ControllerButtonReleased = delegate { };
+
+ /// <summary>The player pressed a controller trigger button.</summary>
public static event EventHandler<EventArgsControllerTriggerPressed> ControllerTriggerPressed = delegate { };
+
+ /// <summary>The player released a controller trigger button.</summary>
public static event EventHandler<EventArgsControllerTriggerReleased> ControllerTriggerReleased = delegate { };
+
+ /*********
+ ** Internal methods
+ *********/
+ /// <summary>Raise a <see cref="KeyboardChanged"/> event.</summary>
+ /// <param name="priorState">The previous keyboard state.</param>
+ /// <param name="newState">The current keyboard state.</param>
internal static void InvokeKeyboardChanged(KeyboardState priorState, KeyboardState newState)
{
- KeyboardChanged.Invoke(null, new EventArgsKeyboardStateChanged(priorState, newState));
+ ControlEvents.KeyboardChanged.Invoke(null, new EventArgsKeyboardStateChanged(priorState, newState));
}
+ /// <summary>Raise a <see cref="MouseChanged"/> event.</summary>
+ /// <param name="priorState">The previous mouse state.</param>
+ /// <param name="newState">The current mouse state.</param>
internal static void InvokeMouseChanged(MouseState priorState, MouseState newState)
{
- MouseChanged.Invoke(null, new EventArgsMouseStateChanged(priorState, newState));
+ ControlEvents.MouseChanged.Invoke(null, new EventArgsMouseStateChanged(priorState, newState));
}
+ /// <summary>Raise a <see cref="KeyPressed"/> event.</summary>
+ /// <param name="key">The keyboard button that was pressed.</param>
internal static void InvokeKeyPressed(Keys key)
{
- KeyPressed.Invoke(null, new EventArgsKeyPressed(key));
+ ControlEvents.KeyPressed.Invoke(null, new EventArgsKeyPressed(key));
}
+ /// <summary>Raise a <see cref="KeyReleased"/> event.</summary>
+ /// <param name="key">The keyboard button that was released.</param>
internal static void InvokeKeyReleased(Keys key)
{
- KeyReleased.Invoke(null, new EventArgsKeyPressed(key));
+ ControlEvents.KeyReleased.Invoke(null, new EventArgsKeyPressed(key));
}
- internal static void InvokeButtonPressed(PlayerIndex playerIndex, Buttons buttons)
+ /// <summary>Raise a <see cref="ControllerButtonPressed"/> event.</summary>
+ /// <param name="playerIndex">The player who pressed the button.</param>
+ /// <param name="button">The controller button that was pressed.</param>
+ internal static void InvokeButtonPressed(PlayerIndex playerIndex, Buttons button)
{
- ControllerButtonPressed.Invoke(null, new EventArgsControllerButtonPressed(playerIndex, buttons));
+ ControlEvents.ControllerButtonPressed.Invoke(null, new EventArgsControllerButtonPressed(playerIndex, button));
}
- internal static void InvokeButtonReleased(PlayerIndex playerIndex, Buttons buttons)
+ /// <summary>Raise a <see cref="ControllerButtonReleased"/> event.</summary>
+ /// <param name="playerIndex">The player who released the button.</param>
+ /// <param name="button">The controller button that was released.</param>
+ internal static void InvokeButtonReleased(PlayerIndex playerIndex, Buttons button)
{
- ControllerButtonReleased.Invoke(null, new EventArgsControllerButtonReleased(playerIndex, buttons));
+ ControlEvents.ControllerButtonReleased.Invoke(null, new EventArgsControllerButtonReleased(playerIndex, button));
}
- internal static void InvokeTriggerPressed(PlayerIndex playerIndex, Buttons buttons, float value)
+ /// <summary>Raise a <see cref="ControllerTriggerPressed"/> event.</summary>
+ /// <param name="playerIndex">The player who pressed the trigger button.</param>
+ /// <param name="button">The trigger button that was pressed.</param>
+ /// <param name="value">The current trigger value.</param>
+ internal static void InvokeTriggerPressed(PlayerIndex playerIndex, Buttons button, float value)
{
- ControllerTriggerPressed.Invoke(null, new EventArgsControllerTriggerPressed(playerIndex, buttons, value));
+ ControlEvents.ControllerTriggerPressed.Invoke(null, new EventArgsControllerTriggerPressed(playerIndex, button, value));
}
- internal static void InvokeTriggerReleased(PlayerIndex playerIndex, Buttons buttons, float value)
+ /// <summary>Raise a <see cref="ControllerTriggerReleased"/> event.</summary>
+ /// <param name="playerIndex">The player who pressed the trigger button.</param>
+ /// <param name="button">The trigger button that was pressed.</param>
+ /// <param name="value">The current trigger value.</param>
+ internal static void InvokeTriggerReleased(PlayerIndex playerIndex, Buttons button, float value)
{
- ControllerTriggerReleased.Invoke(null, new EventArgsControllerTriggerReleased(playerIndex, buttons, value));
+ ControlEvents.ControllerTriggerReleased.Invoke(null, new EventArgsControllerTriggerReleased(playerIndex, button, value));
}
}
-} \ No newline at end of file
+}
diff --git a/src/StardewModdingAPI/Events/EventArgsClickableMenuChanged.cs b/src/StardewModdingAPI/Events/EventArgsClickableMenuChanged.cs
index 6765c8da..708c02e0 100644
--- a/src/StardewModdingAPI/Events/EventArgsClickableMenuChanged.cs
+++ b/src/StardewModdingAPI/Events/EventArgsClickableMenuChanged.cs
@@ -3,15 +3,29 @@ using StardewValley.Menus;
namespace StardewModdingAPI.Events
{
+ /// <summary>Event arguments for a <see cref="MenuEvents.MenuChanged"/> event.</summary>
public class EventArgsClickableMenuChanged : EventArgs
{
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The previous menu.</summary>
+ public IClickableMenu NewMenu { get; private set; }
+
+ /// <summary>The current menu.</summary>
+ public IClickableMenu PriorMenu { get; private set; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="priorMenu">The previous menu.</param>
+ /// <param name="newMenu">The current menu.</param>
public EventArgsClickableMenuChanged(IClickableMenu priorMenu, IClickableMenu newMenu)
{
- NewMenu = newMenu;
- PriorMenu = priorMenu;
+ this.NewMenu = newMenu;
+ this.PriorMenu = priorMenu;
}
-
- public IClickableMenu NewMenu { get; private set; }
- public IClickableMenu PriorMenu { get; private set; }
}
-} \ No newline at end of file
+}
diff --git a/src/StardewModdingAPI/Events/EventArgsClickableMenuClosed.cs b/src/StardewModdingAPI/Events/EventArgsClickableMenuClosed.cs
index bdf44285..1a62432f 100644
--- a/src/StardewModdingAPI/Events/EventArgsClickableMenuClosed.cs
+++ b/src/StardewModdingAPI/Events/EventArgsClickableMenuClosed.cs
@@ -3,13 +3,24 @@ using StardewValley.Menus;
namespace StardewModdingAPI.Events
{
+ /// <summary>Event arguments for a <see cref="MenuEvents.MenuClosed"/> event.</summary>
public class EventArgsClickableMenuClosed : EventArgs
{
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The menu that was closed.</summary>
+ public IClickableMenu PriorMenu { get; private set; }
+
+
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="priorMenu">The menu that was closed.</param>
public EventArgsClickableMenuClosed(IClickableMenu priorMenu)
{
- PriorMenu = priorMenu;
+ this.PriorMenu = priorMenu;
}
-
- public IClickableMenu PriorMenu { get; private set; }
}
-} \ No newline at end of file
+}
diff --git a/src/StardewModdingAPI/Events/EventArgsCommand.cs b/src/StardewModdingAPI/Events/EventArgsCommand.cs
index fd2d4a51..ddf644fb 100644
--- a/src/StardewModdingAPI/Events/EventArgsCommand.cs
+++ b/src/StardewModdingAPI/Events/EventArgsCommand.cs
@@ -2,13 +2,24 @@
namespace StardewModdingAPI.Events
{
+ /// <summary>Event arguments for a <see cref="StardewModdingAPI.Command.CommandFired"/> event.</summary>
public class EventArgsCommand : EventArgs
{
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The triggered command.</summary>
+ public Command Command { get; private set; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="command">The triggered command.</param>
public EventArgsCommand(Command command)
{
- Command = command;
+ this.Command = command;
}
-
- public Command Command { get; private set; }
}
-} \ No newline at end of file
+}
diff --git a/src/StardewModdingAPI/Events/EventArgsControllerButtonPressed.cs b/src/StardewModdingAPI/Events/EventArgsControllerButtonPressed.cs
index b51a8a5b..87c96678 100644
--- a/src/StardewModdingAPI/Events/EventArgsControllerButtonPressed.cs
+++ b/src/StardewModdingAPI/Events/EventArgsControllerButtonPressed.cs
@@ -4,15 +4,29 @@ using Microsoft.Xna.Framework.Input;
namespace StardewModdingAPI.Events
{
+ /// <summary>Event arguments for a <see cref="ControlEvents.ControllerButtonPressed"/> event.</summary>
public class EventArgsControllerButtonPressed : EventArgs
{
- public EventArgsControllerButtonPressed(PlayerIndex playerIndex, Buttons buttonPressed)
- {
- PlayerIndex = playerIndex;
- ButtonPressed = buttonPressed;
- }
-
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The player who pressed the button.</summary>
public PlayerIndex PlayerIndex { get; private set; }
+
+ /// <summary>The controller button that was pressed.</summary>
public Buttons ButtonPressed { get; private set; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="playerIndex">The player who pressed the button.</param>
+ /// <param name="button">The controller button that was pressed.</param>
+ public EventArgsControllerButtonPressed(PlayerIndex playerIndex, Buttons button)
+ {
+ this.PlayerIndex = playerIndex;
+ this.ButtonPressed = button;
+ }
}
-} \ No newline at end of file
+}
diff --git a/src/StardewModdingAPI/Events/EventArgsControllerButtonReleased.cs b/src/StardewModdingAPI/Events/EventArgsControllerButtonReleased.cs
index 0164b8d6..cb53b545 100644
--- a/src/StardewModdingAPI/Events/EventArgsControllerButtonReleased.cs
+++ b/src/StardewModdingAPI/Events/EventArgsControllerButtonReleased.cs
@@ -4,15 +4,29 @@ using Microsoft.Xna.Framework.Input;
namespace StardewModdingAPI.Events
{
+ /// <summary>Event arguments for a <see cref="ControlEvents.ControllerButtonReleased"/> event.</summary>
public class EventArgsControllerButtonReleased : EventArgs
{
- public EventArgsControllerButtonReleased(PlayerIndex playerIndex, Buttons buttonReleased)
- {
- PlayerIndex = playerIndex;
- ButtonReleased = buttonReleased;
- }
-
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The player who pressed the button.</summary>
public PlayerIndex PlayerIndex { get; private set; }
+
+ /// <summary>The controller button that was pressed.</summary>
public Buttons ButtonReleased { get; private set; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="playerIndex">The player who pressed the button.</param>
+ /// <param name="button">The controller button that was released.</param>
+ public EventArgsControllerButtonReleased(PlayerIndex playerIndex, Buttons button)
+ {
+ this.PlayerIndex = playerIndex;
+ this.ButtonReleased = button;
+ }
}
-} \ No newline at end of file
+}
diff --git a/src/StardewModdingAPI/Events/EventArgsControllerTriggerPressed.cs b/src/StardewModdingAPI/Events/EventArgsControllerTriggerPressed.cs
index 1bf4fa46..72b73040 100644
--- a/src/StardewModdingAPI/Events/EventArgsControllerTriggerPressed.cs
+++ b/src/StardewModdingAPI/Events/EventArgsControllerTriggerPressed.cs
@@ -4,17 +4,34 @@ using Microsoft.Xna.Framework.Input;
namespace StardewModdingAPI.Events
{
+ /// <summary>Event arguments for a <see cref="ControlEvents.ControllerTriggerPressed"/> event.</summary>
public class EventArgsControllerTriggerPressed : EventArgs
{
- public EventArgsControllerTriggerPressed(PlayerIndex playerIndex, Buttons buttonPressed, float value)
- {
- PlayerIndex = playerIndex;
- ButtonPressed = buttonPressed;
- Value = value;
- }
-
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The player who pressed the button.</summary>
public PlayerIndex PlayerIndex { get; private set; }
+
+ /// <summary>The controller button that was pressed.</summary>
public Buttons ButtonPressed { get; private set; }
+
+ /// <summary>The current trigger value.</summary>
public float Value { get; private set; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="playerIndex">The player who pressed the trigger button.</param>
+ /// <param name="button">The trigger button that was pressed.</param>
+ /// <param name="value">The current trigger value.</param>
+ public EventArgsControllerTriggerPressed(PlayerIndex playerIndex, Buttons button, float value)
+ {
+ this.PlayerIndex = playerIndex;
+ this.ButtonPressed = button;
+ this.Value = value;
+ }
}
-} \ No newline at end of file
+}
diff --git a/src/StardewModdingAPI/Events/EventArgsControllerTriggerReleased.cs b/src/StardewModdingAPI/Events/EventArgsControllerTriggerReleased.cs
index 07a4bcb1..de28a159 100644
--- a/src/StardewModdingAPI/Events/EventArgsControllerTriggerReleased.cs
+++ b/src/StardewModdingAPI/Events/EventArgsControllerTriggerReleased.cs
@@ -4,17 +4,34 @@ using Microsoft.Xna.Framework.Input;
namespace StardewModdingAPI.Events
{
+ /// <summary>Event arguments for a <see cref="ControlEvents.ControllerTriggerReleased"/> event.</summary>
public class EventArgsControllerTriggerReleased : EventArgs
{
- public EventArgsControllerTriggerReleased(PlayerIndex playerIndex, Buttons buttonReleased, float value)
- {
- PlayerIndex = playerIndex;
- ButtonReleased = buttonReleased;
- Value = value;
- }
-
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The player who pressed the button.</summary>
public PlayerIndex PlayerIndex { get; private set; }
+
+ /// <summary>The controller button that was released.</summary>
public Buttons ButtonReleased { get; private set; }
+
+ /// <summary>The current trigger value.</summary>
public float Value { get; private set; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="playerIndex">The player who pressed the trigger button.</param>
+ /// <param name="button">The trigger button that was released.</param>
+ /// <param name="value">The current trigger value.</param>
+ public EventArgsControllerTriggerReleased(PlayerIndex playerIndex, Buttons button, float value)
+ {
+ this.PlayerIndex = playerIndex;
+ this.ButtonReleased = button;
+ this.Value = value;
+ }
}
-} \ No newline at end of file
+}
diff --git a/src/StardewModdingAPI/Events/EventArgsCurrentLocationChanged.cs b/src/StardewModdingAPI/Events/EventArgsCurrentLocationChanged.cs
index 53ed1551..443429aa 100644
--- a/src/StardewModdingAPI/Events/EventArgsCurrentLocationChanged.cs
+++ b/src/StardewModdingAPI/Events/EventArgsCurrentLocationChanged.cs
@@ -3,15 +3,29 @@ using StardewValley;
namespace StardewModdingAPI.Events
{
+ /// <summary>Event arguments for a <see cref="LocationEvents.CurrentLocationChanged"/> event.</summary>
public class EventArgsCurrentLocationChanged : EventArgs
{
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The player's previous location.</summary>
+ public GameLocation NewLocation { get; private set; }
+
+ /// <summary>The player's current location.</summary>
+ public GameLocation PriorLocation { get; private set; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="priorLocation">The player's previous location.</param>
+ /// <param name="newLocation">The player's current location.</param>
public EventArgsCurrentLocationChanged(GameLocation priorLocation, GameLocation newLocation)
{
- NewLocation = newLocation;
- PriorLocation = priorLocation;
+ this.NewLocation = newLocation;
+ this.PriorLocation = priorLocation;
}
-
- public GameLocation NewLocation { get; private set; }
- public GameLocation PriorLocation { get; private set; }
}
-} \ No newline at end of file
+}
diff --git a/src/StardewModdingAPI/Events/EventArgsFarmerChanged.cs b/src/StardewModdingAPI/Events/EventArgsFarmerChanged.cs
index 468d18ee..ba8794b7 100644
--- a/src/StardewModdingAPI/Events/EventArgsFarmerChanged.cs
+++ b/src/StardewModdingAPI/Events/EventArgsFarmerChanged.cs
@@ -3,15 +3,29 @@ using StardewValley;
namespace StardewModdingAPI.Events
{
+ /// <summary>Event arguments for a <see cref="PlayerEvents.FarmerChanged"/> event.</summary>
public class EventArgsFarmerChanged : EventArgs
{
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The previous player character.</summary>
+ public Farmer NewFarmer { get; }
+
+ /// <summary>The new player character.</summary>
+ public Farmer PriorFarmer { get; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="priorFarmer">The previous player character.</param>
+ /// <param name="newFarmer">The new player character.</param>
public EventArgsFarmerChanged(Farmer priorFarmer, Farmer newFarmer)
{
- NewFarmer = NewFarmer;
- PriorFarmer = PriorFarmer;
+ this.NewFarmer = NewFarmer;
+ this.PriorFarmer = PriorFarmer;
}
-
- public Farmer NewFarmer { get; }
- public Farmer PriorFarmer { get; }
}
-} \ No newline at end of file
+}
diff --git a/src/StardewModdingAPI/Events/EventArgsGameLocationsChanged.cs b/src/StardewModdingAPI/Events/EventArgsGameLocationsChanged.cs
index 6a55c87a..c68951ce 100644
--- a/src/StardewModdingAPI/Events/EventArgsGameLocationsChanged.cs
+++ b/src/StardewModdingAPI/Events/EventArgsGameLocationsChanged.cs
@@ -4,13 +4,24 @@ using StardewValley;
namespace StardewModdingAPI.Events
{
+ /// <summary>Event arguments for a <see cref="LocationEvents.LocationsChanged"/> event.</summary>
public class EventArgsGameLocationsChanged : EventArgs
{
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The current list of game locations.</summary>
+ public List<GameLocation> NewLocations { get; private set; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="newLocations">The current list of game locations.</param>
public EventArgsGameLocationsChanged(List<GameLocation> newLocations)
{
- NewLocations = newLocations;
+ this.NewLocations = newLocations;
}
-
- public List<GameLocation> NewLocations { get; private set; }
}
-} \ No newline at end of file
+}
diff --git a/src/StardewModdingAPI/Events/EventArgsIntChanged.cs b/src/StardewModdingAPI/Events/EventArgsIntChanged.cs
index c8a6e86d..0ccb9b87 100644
--- a/src/StardewModdingAPI/Events/EventArgsIntChanged.cs
+++ b/src/StardewModdingAPI/Events/EventArgsIntChanged.cs
@@ -2,15 +2,29 @@
namespace StardewModdingAPI.Events
{
+ /// <summary>Event arguments for an integer field that changed value.</summary>
public class EventArgsIntChanged : EventArgs
{
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The previous value.</summary>
+ public int NewInt { get; }
+
+ /// <summary>The current value.</summary>
+ public int PriorInt { get; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="priorInt">The previous value.</param>
+ /// <param name="newInt">The current value.</param>
public EventArgsIntChanged(int priorInt, int newInt)
{
- NewInt = NewInt;
- PriorInt = PriorInt;
+ this.NewInt = NewInt;
+ this.PriorInt = PriorInt;
}
-
- public int NewInt { get; }
- public int PriorInt { get; }
}
-} \ No newline at end of file
+}
diff --git a/src/StardewModdingAPI/Events/EventArgsInventoryChanged.cs b/src/StardewModdingAPI/Events/EventArgsInventoryChanged.cs
index fa929ab5..40c77419 100644
--- a/src/StardewModdingAPI/Events/EventArgsInventoryChanged.cs
+++ b/src/StardewModdingAPI/Events/EventArgsInventoryChanged.cs
@@ -6,19 +6,37 @@ using StardewValley;
namespace StardewModdingAPI.Events
{
+ /// <summary>Event arguments for a <see cref="PlayerEvents.InventoryChanged"/> event.</summary>
public class EventArgsInventoryChanged : EventArgs
{
- public EventArgsInventoryChanged(List<Item> inventory, List<ItemStackChange> changedItems)
- {
- Inventory = inventory;
- Added = changedItems.Where(n => n.ChangeType == ChangeType.Added).ToList();
- Removed = changedItems.Where(n => n.ChangeType == ChangeType.Removed).ToList();
- QuantityChanged = changedItems.Where(n => n.ChangeType == ChangeType.StackChange).ToList();
- }
-
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The player's inventory.</summary>
public List<Item> Inventory { get; private set; }
+
+ /// <summary>The added items.</summary>
public List<ItemStackChange> Added { get; private set; }
+
+ /// <summary>The removed items.</summary>
public List<ItemStackChange> Removed { get; private set; }
+
+ /// <summary>The items whose stack sizes changed.</summary>
public List<ItemStackChange> QuantityChanged { get; private set; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="inventory">The player's inventory.</param>
+ /// <param name="changedItems">The inventory changes.</param>
+ public EventArgsInventoryChanged(List<Item> inventory, List<ItemStackChange> changedItems)
+ {
+ this.Inventory = inventory;
+ this.Added = changedItems.Where(n => n.ChangeType == ChangeType.Added).ToList();
+ this.Removed = changedItems.Where(n => n.ChangeType == ChangeType.Removed).ToList();
+ this.QuantityChanged = changedItems.Where(n => n.ChangeType == ChangeType.StackChange).ToList();
+ }
}
-} \ No newline at end of file
+}
diff --git a/src/StardewModdingAPI/Events/EventArgsKeyPressed.cs b/src/StardewModdingAPI/Events/EventArgsKeyPressed.cs
index df45e111..82a593be 100644
--- a/src/StardewModdingAPI/Events/EventArgsKeyPressed.cs
+++ b/src/StardewModdingAPI/Events/EventArgsKeyPressed.cs
@@ -3,13 +3,24 @@ using Microsoft.Xna.Framework.Input;
namespace StardewModdingAPI.Events
{
+ /// <summary>Event arguments for a <see cref="ControlEvents.KeyboardChanged"/> event.</summary>
public class EventArgsKeyPressed : EventArgs
{
- public EventArgsKeyPressed(Keys keyPressed)
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The keyboard button that was pressed.</summary>
+ public Keys KeyPressed { get; private set; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="key">The keyboard button that was pressed.</param>
+ public EventArgsKeyPressed(Keys key)
{
- KeyPressed = keyPressed;
+ this.KeyPressed = key;
}
-
- public Keys KeyPressed { get; private set; }
}
-} \ No newline at end of file
+}
diff --git a/src/StardewModdingAPI/Events/EventArgsKeyboardStateChanged.cs b/src/StardewModdingAPI/Events/EventArgsKeyboardStateChanged.cs
index 784cd197..42daa4db 100644
--- a/src/StardewModdingAPI/Events/EventArgsKeyboardStateChanged.cs
+++ b/src/StardewModdingAPI/Events/EventArgsKeyboardStateChanged.cs
@@ -3,15 +3,29 @@ using Microsoft.Xna.Framework.Input;
namespace StardewModdingAPI.Events
{
+ /// <summary>Event arguments for a <see cref="ControlEvents.KeyboardChanged"/> event.</summary>
public class EventArgsKeyboardStateChanged : EventArgs
{
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The previous keyboard state.</summary>
+ public KeyboardState NewState { get; private set; }
+
+ /// <summary>The current keyboard state.</summary>
+ public KeyboardState PriorState { get; private set; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="priorState">The previous keyboard state.</param>
+ /// <param name="newState">The current keyboard state.</param>
public EventArgsKeyboardStateChanged(KeyboardState priorState, KeyboardState newState)
{
- NewState = newState;
- NewState = newState;
+ this.NewState = newState;
+ this.NewState = newState;
}
-
- public KeyboardState NewState { get; private set; }
- public KeyboardState PriorState { get; private set; }
}
-} \ No newline at end of file
+}
diff --git a/src/StardewModdingAPI/Events/EventArgsLevelUp.cs b/src/StardewModdingAPI/Events/EventArgsLevelUp.cs
index 762422c2..826914da 100644
--- a/src/StardewModdingAPI/Events/EventArgsLevelUp.cs
+++ b/src/StardewModdingAPI/Events/EventArgsLevelUp.cs
@@ -2,25 +2,51 @@ using System;
namespace StardewModdingAPI.Events
{
+ /// <summary>Event arguments for a <see cref="PlayerEvents.LeveledUp"/> event.</summary>
public class EventArgsLevelUp : EventArgs
{
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The player skill that leveled up.</summary>
+ public LevelType Type { get; private set; }
+
+ /// <summary>The new skill level.</summary>
+ public int NewLevel { get; private set; }
+
+ /// <summary>The player skill types.</summary>
public enum LevelType
{
+ /// <summary>The combat skill.</summary>
Combat,
+
+ /// <summary>The farming skill.</summary>
Farming,
+
+ /// <summary>The fishing skill.</summary>
Fishing,
+
+ /// <summary>The foraging skill.</summary>
Foraging,
+
+ /// <summary>The mining skill.</summary>
Mining,
+
+ /// <summary>The luck skill.</summary>
Luck
}
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="type">The player skill that leveled up.</param>
+ /// <param name="newLevel">The new skill level.</param>
public EventArgsLevelUp(LevelType type, int newLevel)
{
- Type = type;
- NewLevel = newLevel;
+ this.Type = type;
+ this.NewLevel = newLevel;
}
-
- public LevelType Type { get; private set; }
- public int NewLevel { get; private set; }
}
-} \ No newline at end of file
+}
diff --git a/src/StardewModdingAPI/Events/EventArgsLoadedGameChanged.cs b/src/StardewModdingAPI/Events/EventArgsLoadedGameChanged.cs
index 1b6e21e2..cd7a366f 100644
--- a/src/StardewModdingAPI/Events/EventArgsLoadedGameChanged.cs
+++ b/src/StardewModdingAPI/Events/EventArgsLoadedGameChanged.cs
@@ -2,13 +2,24 @@
namespace StardewModdingAPI.Events
{
+ /// <summary>Event arguments for a <see cref="PlayerEvents.LoadedGame"/> event.</summary>
public class EventArgsLoadedGameChanged : EventArgs
{
- public EventArgsLoadedGameChanged(bool loadedGame)
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>Whether the save has been loaded. This is always true.</summary>
+ public bool LoadedGame { get; private set; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="loaded">Whether the save has been loaded. This is always true.</param>
+ public EventArgsLoadedGameChanged(bool loaded)
{
- LoadedGame = loadedGame;
+ this.LoadedGame = loaded;
}
-
- public bool LoadedGame { get; private set; }
}
-} \ No newline at end of file
+}
diff --git a/src/StardewModdingAPI/Events/EventArgsLocationObjectsChanged.cs b/src/StardewModdingAPI/Events/EventArgsLocationObjectsChanged.cs
index 70309192..f708ab6b 100644
--- a/src/StardewModdingAPI/Events/EventArgsLocationObjectsChanged.cs
+++ b/src/StardewModdingAPI/Events/EventArgsLocationObjectsChanged.cs
@@ -5,13 +5,24 @@ using Object = StardewValley.Object;
namespace StardewModdingAPI.Events
{
+ /// <summary>Event arguments for a <see cref="LocationEvents.LocationObjectsChanged"/> event.</summary>
public class EventArgsLocationObjectsChanged : EventArgs
{
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The current list of objects in the current location.</summary>
+ public SerializableDictionary<Vector2, Object> NewObjects { get; private set; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="newObjects">The current list of objects in the current location.</param>
public EventArgsLocationObjectsChanged(SerializableDictionary<Vector2, Object> newObjects)
{
- NewObjects = newObjects;
+ this.NewObjects = newObjects;
}
-
- public SerializableDictionary<Vector2, Object> NewObjects { get; private set; }
}
-} \ No newline at end of file
+}
diff --git a/src/StardewModdingAPI/Events/EventArgsMineLevelChanged.cs b/src/StardewModdingAPI/Events/EventArgsMineLevelChanged.cs
index f95e0ac2..a02921d2 100644
--- a/src/StardewModdingAPI/Events/EventArgsMineLevelChanged.cs
+++ b/src/StardewModdingAPI/Events/EventArgsMineLevelChanged.cs
@@ -2,15 +2,29 @@
namespace StardewModdingAPI.Events
{
+ /// <summary>Event arguments for a <see cref="MineEvents.MineLevelChanged"/> event.</summary>
public class EventArgsMineLevelChanged : EventArgs
{
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The previous mine level.</summary>
+ public int PreviousMineLevel { get; private set; }
+
+ /// <summary>The current mine level.</summary>
+ public int CurrentMineLevel { get; private set; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="previousMineLevel">The previous mine level.</param>
+ /// <param name="currentMineLevel">The current mine level.</param>
public EventArgsMineLevelChanged(int previousMineLevel, int currentMineLevel)
{
- PreviousMineLevel = previousMineLevel;
- CurrentMineLevel = currentMineLevel;
+ this.PreviousMineLevel = previousMineLevel;
+ this.CurrentMineLevel = currentMineLevel;
}
-
- public int PreviousMineLevel { get; private set; }
- public int CurrentMineLevel { get; private set; }
}
-} \ No newline at end of file
+}
diff --git a/src/StardewModdingAPI/Events/EventArgsMouseStateChanged.cs b/src/StardewModdingAPI/Events/EventArgsMouseStateChanged.cs
index 145a4445..9117a0c2 100644
--- a/src/StardewModdingAPI/Events/EventArgsMouseStateChanged.cs
+++ b/src/StardewModdingAPI/Events/EventArgsMouseStateChanged.cs
@@ -3,15 +3,29 @@ using Microsoft.Xna.Framework.Input;
namespace StardewModdingAPI.Events
{
+ /// <summary>Event arguments for a <see cref="ControlEvents.MouseChanged"/> event.</summary>
public class EventArgsMouseStateChanged : EventArgs
{
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The previous mouse state.</summary>
+ public MouseState NewState { get; private set; }
+
+ /// <summary>The current mouse state.</summary>
+ public MouseState PriorState { get; private set; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="priorState">The previous mouse state.</param>
+ /// <param name="newState">The current mouse state.</param>
public EventArgsMouseStateChanged(MouseState priorState, MouseState newState)
{
- PriorState = priorState;
- NewState = newState;
+ this.PriorState = priorState;
+ this.NewState = newState;
}
-
- public MouseState NewState { get; private set; }
- public MouseState PriorState { get; private set; }
}
-} \ No newline at end of file
+}
diff --git a/src/StardewModdingAPI/Events/EventArgsNewDay.cs b/src/StardewModdingAPI/Events/EventArgsNewDay.cs
index 04d0e389..5088cb5c 100644
--- a/src/StardewModdingAPI/Events/EventArgsNewDay.cs
+++ b/src/StardewModdingAPI/Events/EventArgsNewDay.cs
@@ -2,17 +2,34 @@
namespace StardewModdingAPI.Events
{
+ /// <summary>Event arguments for a <see cref="TimeEvents.OnNewDay"/> event.</summary>
public class EventArgsNewDay : EventArgs
{
- public EventArgsNewDay(int prevDay, int curDay, bool newDay)
- {
- PreviousDay = prevDay;
- CurrentDay = curDay;
- IsNewDay = newDay;
- }
-
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The previous day value.</summary>
public int PreviousDay { get; private set; }
+
+ /// <summary>The current day value.</summary>
public int CurrentDay { get; private set; }
+
+ /// <summary>Whether the game just started the transition (<c>true</c>) or finished it (<c>false</c>).</summary>
public bool IsNewDay { get; private set; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="priorDay">The previous day value.</param>
+ /// <param name="newDay">The current day value.</param>
+ /// <param name="isTransitioning">Whether the game just started the transition (<c>true</c>) or finished it (<c>false</c>).</param>
+ public EventArgsNewDay(int priorDay, int newDay, bool isTransitioning)
+ {
+ this.PreviousDay = priorDay;
+ this.CurrentDay = newDay;
+ this.IsNewDay = isTransitioning;
+ }
}
-} \ No newline at end of file
+}
diff --git a/src/StardewModdingAPI/Events/EventArgsStringChanged.cs b/src/StardewModdingAPI/Events/EventArgsStringChanged.cs
index 626d77b7..f91951ae 100644
--- a/src/StardewModdingAPI/Events/EventArgsStringChanged.cs
+++ b/src/StardewModdingAPI/Events/EventArgsStringChanged.cs
@@ -2,15 +2,28 @@
namespace StardewModdingAPI.Events
{
+ /// <summary>Event arguments for a string field that changed value.</summary>
public class EventArgsStringChanged : EventArgs
{
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The previous value.</summary>
+ public string NewString { get; private set; }
+
+ /// <summary>The current value.</summary>
+ public string PriorString { get; private set; }
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="priorString">The previous value.</param>
+ /// <param name="newString">The current value.</param>
public EventArgsStringChanged(string priorString, string newString)
{
- NewString = newString;
- PriorString = priorString;
+ this.NewString = newString;
+ this.PriorString = priorString;
}
-
- public string NewString { get; private set; }
- public string PriorString { get; private set; }
}
-} \ No newline at end of file
+}
diff --git a/src/StardewModdingAPI/Events/GameEvents.cs b/src/StardewModdingAPI/Events/GameEvents.cs
index 1a366011..e4a0e08d 100644
--- a/src/StardewModdingAPI/Events/GameEvents.cs
+++ b/src/StardewModdingAPI/Events/GameEvents.cs
@@ -2,58 +2,61 @@
namespace StardewModdingAPI.Events
{
+ /// <summary>Events raised when the game changes state.</summary>
public static class GameEvents
{
- public static event EventHandler GameLoaded = delegate { };
+ /*********
+ ** Events
+ *********/
+ /// <summary>Raised during launch after configuring XNA or MonoGame. The game window hasn't been opened by this point. Called during <see cref="Microsoft.Xna.Framework.Game.Initialize"/>.</summary>
public static event EventHandler Initialize = delegate { };
+
+ /// <summary>Raised during launch after configuring Stardew Valley, loading it into memory, and opening the game window. The window is still blank by this point.</summary>
+ public static event EventHandler GameLoaded = delegate { };
+
+ /// <summary>Raised before XNA loads or reloads graphics resources. Called during <see cref="Microsoft.Xna.Framework.Game.LoadContent"/>.</summary>
public static event EventHandler LoadContent = delegate { };
+
+ /// <summary>Raised during the first game update tick.</summary>
public static event EventHandler FirstUpdateTick = delegate { };
- /// <summary>
- /// Fires every update (1/60 of a second)
- /// </summary>
+ /// <summary>Raised when the game updates its state (≈60 times per second).</summary>
public static event EventHandler UpdateTick = delegate { };
- /// <summary>
- /// Fires every other update (1/30 of a second)
- /// </summary>
+ /// <summary>Raised every other tick (≈30 times per second).</summary>
public static event EventHandler SecondUpdateTick = delegate { };
- /// <summary>
- /// Fires every fourth update (1/15 of a second)
- /// </summary>
+ /// <summary>Raised every fourth tick (≈15 times per second).</summary>
public static event EventHandler FourthUpdateTick = delegate { };
- /// <summary>
- /// Fires every eighth update (roughly 1/8 of a second)
- /// </summary>
+ /// <summary>Raised every eighth tick (≈8 times per second).</summary>
public static event EventHandler EighthUpdateTick = delegate { };
- /// <summary>
- /// Fires every fifthteenth update (1/4 of a second)
- /// </summary>
+ /// <summary>Raised every 15th tick (≈4 times per second).</summary>
public static event EventHandler QuarterSecondTick = delegate { };
- /// <summary>
- /// Fires every thirtieth update (1/2 of a second)
- /// </summary>
+ /// <summary>Raised every 30th tick (≈twice per second).</summary>
public static event EventHandler HalfSecondTick = delegate { };
- /// <summary>
- /// Fires every sixtieth update (a second)
- /// </summary>
+ /// <summary>Raised every 60th tick (≈once per second).</summary>
public static event EventHandler OneSecondTick = delegate { };
+
+ /*********
+ ** Internal methods
+ *********/
+ /// <summary>Raise a <see cref="GameLoaded"/> event.</summary>
internal static void InvokeGameLoaded()
{
- GameLoaded.Invoke(null, EventArgs.Empty);
+ GameEvents.GameLoaded.Invoke(null, EventArgs.Empty);
}
+ /// <summary>Raise an <see cref="Initialize"/> event.</summary>
internal static void InvokeInitialize()
{
try
{
- Initialize.Invoke(null, EventArgs.Empty);
+ GameEvents.Initialize.Invoke(null, EventArgs.Empty);
}
catch (Exception ex)
{
@@ -61,11 +64,12 @@ namespace StardewModdingAPI.Events
}
}
+ /// <summary>Raise a <see cref="LoadContent"/> event.</summary>
internal static void InvokeLoadContent()
{
try
{
- LoadContent.Invoke(null, EventArgs.Empty);
+ GameEvents.LoadContent.Invoke(null, EventArgs.Empty);
}
catch (Exception ex)
{
@@ -73,11 +77,12 @@ namespace StardewModdingAPI.Events
}
}
+ /// <summary>Raise an <see cref="UpdateTick"/> event.</summary>
internal static void InvokeUpdateTick()
{
try
{
- UpdateTick.Invoke(null, EventArgs.Empty);
+ GameEvents.UpdateTick.Invoke(null, EventArgs.Empty);
}
catch (Exception ex)
{
@@ -85,39 +90,46 @@ namespace StardewModdingAPI.Events
}
}
+ /// <summary>Raise a <see cref="SecondUpdateTick"/> event.</summary>
internal static void InvokeSecondUpdateTick()
{
- SecondUpdateTick.Invoke(null, EventArgs.Empty);
+ GameEvents.SecondUpdateTick.Invoke(null, EventArgs.Empty);
}
+ /// <summary>Raise a <see cref="FourthUpdateTick"/> event.</summary>
internal static void InvokeFourthUpdateTick()
{
- FourthUpdateTick.Invoke(null, EventArgs.Empty);
+ GameEvents.FourthUpdateTick.Invoke(null, EventArgs.Empty);
}
+ /// <summary>Raise a <see cref="EighthUpdateTick"/> event.</summary>
internal static void InvokeEighthUpdateTick()
{
- EighthUpdateTick.Invoke(null, EventArgs.Empty);
+ GameEvents.EighthUpdateTick.Invoke(null, EventArgs.Empty);
}
+ /// <summary>Raise a <see cref="QuarterSecondTick"/> event.</summary>
internal static void InvokeQuarterSecondTick()
{
- QuarterSecondTick.Invoke(null, EventArgs.Empty);
+ GameEvents.QuarterSecondTick.Invoke(null, EventArgs.Empty);
}
+ /// <summary>Raise a <see cref="HalfSecondTick"/> event.</summary>
internal static void InvokeHalfSecondTick()
{
- HalfSecondTick.Invoke(null, EventArgs.Empty);
+ GameEvents.HalfSecondTick.Invoke(null, EventArgs.Empty);
}
+ /// <summary>Raise a <see cref="OneSecondTick"/> event.</summary>
internal static void InvokeOneSecondTick()
{
- OneSecondTick.Invoke(null, EventArgs.Empty);
+ GameEvents.OneSecondTick.Invoke(null, EventArgs.Empty);
}
+ /// <summary>Raise a <see cref="FirstUpdateTick"/> event.</summary>
internal static void InvokeFirstUpdateTick()
{
- FirstUpdateTick.Invoke(null, EventArgs.Empty);
+ GameEvents.FirstUpdateTick.Invoke(null, EventArgs.Empty);
}
}
-} \ No newline at end of file
+}
diff --git a/src/StardewModdingAPI/Events/GraphicsEvents.cs b/src/StardewModdingAPI/Events/GraphicsEvents.cs
index 1435bc37..fe38c1bb 100644
--- a/src/StardewModdingAPI/Events/GraphicsEvents.cs
+++ b/src/StardewModdingAPI/Events/GraphicsEvents.cs
@@ -2,161 +2,199 @@
namespace StardewModdingAPI.Events
{
- /// <summary>
- ///
- /// </summary>
+ /// <summary>Events raised during the game's draw loop, when the game is rendering content to the window.</summary>
public static class GraphicsEvents
{
- /// <summary>
- /// Occurs when the form (game) is resized.
- /// </summary>
+ /*********
+ ** Events
+ *********/
+ /****
+ ** Generic events
+ ****/
+ /// <summary>Raised after the game window is resized.</summary>
public static event EventHandler Resize = delegate { };
- /// <summary>
- /// Occurs before anything is drawn.
- /// </summary>
- public static event EventHandler OnPreRenderEvent = delegate { };
+ /// <summary>Raised when drawing debug information to the screen (when <see cref="StardewModdingAPI.Inheritance.SGame.Debug"/> is true). This is called after the sprite batch is begun. If you just want to add debug info, use <see cref="StardewModdingAPI.Inheritance.SGame.DebugMessageQueue" /> in your update loop.</summary>
+ public static event EventHandler DrawDebug = delegate { };
- /// <summary>
- /// Occurs before the GUI is drawn.
- /// </summary>
- public static event EventHandler OnPreRenderGuiEvent = delegate { };
+ /// <summary>Obsolete.</summary>
+ [Obsolete("Use the other Pre/Post render events instead.")]
+ public static event EventHandler DrawTick = delegate { };
- /// <summary>
- /// Occurs after the GUI is drawn.
- /// </summary>
- public static event EventHandler OnPostRenderGuiEvent = delegate { };
+ /// <summary>Obsolete.</summary>
+ [Obsolete("Use the other Pre/Post render events instead. All of them will automatically be drawn into the render target if needed.")]
+ public static event EventHandler DrawInRenderTargetTick = delegate { };
+
+ /****
+ ** Main render events
+ ****/
+ /// <summary>Raised before drawing everything to the screen during a draw loop.</summary>
+ public static event EventHandler OnPreRenderEvent = delegate { };
- /// <summary>
- /// Occurs before the HUD is drawn.
- /// </summary>
+ /// <summary>Raised after drawing everything to the screen during a draw loop.</summary>
+ public static event EventHandler OnPostRenderEvent = delegate { };
+
+ /****
+ ** HUD events
+ ****/
+ /// <summary>Raised before drawing the HUD (item toolbar, clock, etc) to the screen. The HUD is available at this point, but not necessarily visible. (For example, the event is raised even if a menu is open.)</summary>
public static event EventHandler OnPreRenderHudEvent = delegate { };
- /// <summary>
- /// Occurs after the HUD is drawn.
- /// </summary>
+ /// <summary>Equivalent to <see cref="OnPreRenderHudEvent"/>, but invoked even if the HUD isn't available.</summary>
+ public static event EventHandler OnPreRenderHudEventNoCheck = delegate { };
+
+ /// <summary>Raised after drawing the HUD (item toolbar, clock, etc) to the screen. The HUD is available at this point, but not necessarily visible. (For example, the event is raised even if a menu is open.)</summary>
public static event EventHandler OnPostRenderHudEvent = delegate { };
- /// <summary>
- /// Occurs after everything is drawn.
- /// </summary>
- public static event EventHandler OnPostRenderEvent = delegate { };
+ /// <summary>Equivalent to <see cref="OnPostRenderHudEvent"/>, but invoked even if the HUD isn't available.</summary>
+ public static event EventHandler OnPostRenderHudEventNoCheck = delegate { };
- /// <summary>
- /// Occurs before the GUI is drawn. Does not check for conditional statements.
- /// </summary>
- public static event EventHandler OnPreRenderGuiEventNoCheck = delegate { };
+ /****
+ ** GUI events
+ ****/
+ /// <summary>Raised before drawing a menu to the screen during a draw loop. This includes the game's internal menus like the title screen.</summary>
+ public static event EventHandler OnPreRenderGuiEvent = delegate { };
- /// <summary>
- /// Occurs after the GUI is drawn. Does not check for conditional statements.
- /// </summary>
- public static event EventHandler OnPostRenderGuiEventNoCheck = delegate { };
+ /// <summary>Equivalent to <see cref="OnPreRenderGuiEvent"/>, but invoked even if there's no menu being drawn.</summary>
+ public static event EventHandler OnPreRenderGuiEventNoCheck = delegate { };
- /// <summary>
- /// Occurs before the HUD is drawn. Does not check for conditional statements.
- /// </summary>
- public static event EventHandler OnPreRenderHudEventNoCheck = delegate { };
+ /// <summary>Raised after drawing a menu to the screen during a draw loop. This includes the game's internal menus like the title screen.</summary>
+ public static event EventHandler OnPostRenderGuiEvent = delegate { };
- /// <summary>
- /// Occurs after the HUD is drawn. Does not check for conditional statements.
- /// </summary>
- public static event EventHandler OnPostRenderHudEventNoCheck = delegate { };
+ /// <summary>Equivalent to <see cref="OnPreRenderGuiEvent"/>, but invoked even if there's no menu being drawn.</summary>
+ public static event EventHandler OnPostRenderGuiEventNoCheck = delegate { };
- /// <summary>
- /// Draws when SGame.Debug is true. F3 toggles this.
- /// Game1.spriteBatch.Begin() is pre-called.
- /// Do not make end or begin calls to the spritebatch.
- /// If you are only trying to add debug information, use SGame.DebugMessageQueue in your Update loop.
- /// </summary>
- public static event EventHandler DrawDebug = delegate { };
- internal static void InvokeDrawDebug(object sender, EventArgs e)
+ /*********
+ ** Internal methods
+ *********/
+ /****
+ ** Generic events
+ ****/
+ /// <summary>Raise a <see cref="Resize"/> event.</summary>
+ /// <param name="sender">The object which raised the event.</param>
+ /// <param name="e">The event arguments.</param>
+ internal static void InvokeResize(object sender, EventArgs e)
{
- DrawDebug.Invoke(sender, e);
+ GraphicsEvents.Resize.Invoke(sender, e);
}
- internal static void InvokeOnPreRenderEvent(object sender, EventArgs e)
+ /// <summary>Raise a <see cref="DrawDebug"/> event.</summary>
+ /// <param name="sender">The object which raised the event.</param>
+ /// <param name="e">The event arguments.</param>
+ internal static void InvokeDrawDebug(object sender, EventArgs e)
{
- OnPreRenderEvent.Invoke(sender, e);
+ GraphicsEvents.DrawDebug.Invoke(sender, e);
}
- internal static void InvokeOnPreRenderGuiEvent(object sender, EventArgs e)
+ /// <summary>Raise a <see cref="DrawTick"/> event.</summary>
+ [Obsolete("Should not be used.")]
+ public static void InvokeDrawTick()
{
- OnPreRenderGuiEvent.Invoke(sender, e);
+ try
+ {
+ GraphicsEvents.DrawTick.Invoke(null, EventArgs.Empty);
+ }
+ catch (Exception ex)
+ {
+ Log.AsyncR("An exception occured in a Mod's DrawTick: " + ex);
+ }
}
- internal static void InvokeOnPostRenderGuiEvent(object sender, EventArgs e)
+ /// <summary>Raise a <see cref="DrawInRenderTargetTick"/> event.</summary>
+ [Obsolete("Should not be used.")]
+ public static void InvokeDrawInRenderTargetTick()
{
- OnPostRenderGuiEvent.Invoke(sender, e);
+ GraphicsEvents.DrawInRenderTargetTick.Invoke(null, EventArgs.Empty);
}
- internal static void InvokeOnPreRenderHudEvent(object sender, EventArgs e)
+ /****
+ ** Main render events
+ ****/
+ /// <summary>Raise an <see cref="OnPreRenderEvent"/> event.</summary>
+ /// <param name="sender">The object which raised the event.</param>
+ /// <param name="e">The event arguments.</param>
+ internal static void InvokeOnPreRenderEvent(object sender, EventArgs e)
{
- OnPreRenderHudEvent.Invoke(sender, e);
+ GraphicsEvents.OnPreRenderEvent.Invoke(sender, e);
}
- internal static void InvokeOnPostRenderHudEvent(object sender, EventArgs e)
+ /// <summary>Raise an <see cref="OnPostRenderEvent"/> event.</summary>
+ /// <param name="sender">The object which raised the event.</param>
+ /// <param name="e">The event arguments.</param>
+ internal static void InvokeOnPostRenderEvent(object sender, EventArgs e)
{
- OnPostRenderHudEvent.Invoke(sender, e);
+ GraphicsEvents.OnPostRenderEvent.Invoke(sender, e);
}
- internal static void InvokeOnPostRenderEvent(object sender, EventArgs e)
+ /****
+ ** HUD events
+ ****/
+ /// <summary>Raise an <see cref="OnPreRenderGuiEvent"/> event.</summary>
+ /// <param name="sender">The object which raised the event.</param>
+ /// <param name="e">The event arguments.</param>
+ internal static void InvokeOnPreRenderGuiEvent(object sender, EventArgs e)
{
- OnPostRenderEvent.Invoke(sender, e);
+ GraphicsEvents.OnPreRenderGuiEvent.Invoke(sender, e);
}
+ /// <summary>Raise an <see cref="OnPreRenderGuiEventNoCheck"/> event.</summary>
+ /// <param name="sender">The object which raised the event.</param>
+ /// <param name="e">The event arguments.</param>
internal static void InvokeOnPreRenderGuiEventNoCheck(object sender, EventArgs e)
{
- OnPreRenderGuiEventNoCheck.Invoke(sender, e);
+ GraphicsEvents.OnPreRenderGuiEventNoCheck.Invoke(sender, e);
}
- internal static void InvokeOnPostRenderGuiEventNoCheck(object sender, EventArgs e)
+ /// <summary>Raise an <see cref="OnPostRenderGuiEvent"/> event.</summary>
+ /// <param name="sender">The object which raised the event.</param>
+ /// <param name="e">The event arguments.</param>
+ internal static void InvokeOnPostRenderGuiEvent(object sender, EventArgs e)
{
- OnPostRenderGuiEventNoCheck.Invoke(sender, e);
+ GraphicsEvents.OnPostRenderGuiEvent.Invoke(sender, e);
}
- internal static void InvokeOnPreRenderHudEventNoCheck(object sender, EventArgs e)
+ /// <summary>Raise an <see cref="OnPostRenderGuiEventNoCheck"/> event.</summary>
+ /// <param name="sender">The object which raised the event.</param>
+ /// <param name="e">The event arguments.</param>
+ internal static void InvokeOnPostRenderGuiEventNoCheck(object sender, EventArgs e)
{
- OnPreRenderHudEventNoCheck.Invoke(sender, e);
+ GraphicsEvents.OnPostRenderGuiEventNoCheck.Invoke(sender, e);
}
- internal static void InvokeOnPostRenderHudEventNoCheck(object sender, EventArgs e)
+ /****
+ ** GUI events
+ ****/
+ /// <summary>Raise an <see cref="OnPreRenderHudEvent"/> event.</summary>
+ /// <param name="sender">The object which raised the event.</param>
+ /// <param name="e">The event arguments.</param>
+ internal static void InvokeOnPreRenderHudEvent(object sender, EventArgs e)
{
- OnPostRenderHudEventNoCheck.Invoke(sender, e);
+ GraphicsEvents.OnPreRenderHudEvent.Invoke(sender, e);
}
- internal static void InvokeResize(object sender, EventArgs e)
+ /// <summary>Raise an <see cref="OnPreRenderHudEventNoCheck"/> event.</summary>
+ /// <param name="sender">The object which raised the event.</param>
+ /// <param name="e">The event arguments.</param>
+ internal static void InvokeOnPreRenderHudEventNoCheck(object sender, EventArgs e)
{
- Resize.Invoke(sender, e);
+ GraphicsEvents.OnPreRenderHudEventNoCheck.Invoke(sender, e);
}
- #region To Remove
-
- [Obsolete("Use the other Pre/Post render events instead.")]
- public static event EventHandler DrawTick = delegate { };
-
- [Obsolete("Use the other Pre/Post render events instead. All of them will automatically be drawn into the render target if needed.")]
- public static event EventHandler DrawInRenderTargetTick = delegate { };
-
- [Obsolete("Should not be used.")]
- public static void InvokeDrawTick()
+ /// <summary>Raise an <see cref="OnPostRenderHudEvent"/> event.</summary>
+ /// <param name="sender">The object which raised the event.</param>
+ /// <param name="e">The event arguments.</param>
+ internal static void InvokeOnPostRenderHudEvent(object sender, EventArgs e)
{
- try
- {
- DrawTick.Invoke(null, EventArgs.Empty);
- }
- catch (Exception ex)
- {
- Log.AsyncR("An exception occured in a Mod's DrawTick: " + ex);
- }
+ GraphicsEvents.OnPostRenderHudEvent.Invoke(sender, e);
}
- [Obsolete("Should not be used.")]
- public static void InvokeDrawInRenderTargetTick()
+ /// <summary>Raise an <see cref="OnPostRenderHudEventNoCheck"/> event.</summary>
+ /// <param name="sender">The object which raised the event.</param>
+ /// <param name="e">The event arguments.</param>
+ internal static void InvokeOnPostRenderHudEventNoCheck(object sender, EventArgs e)
{
- DrawInRenderTargetTick.Invoke(null, EventArgs.Empty);
+ GraphicsEvents.OnPostRenderHudEventNoCheck.Invoke(sender, e);
}
-
- #endregion
}
-} \ No newline at end of file
+}
diff --git a/src/StardewModdingAPI/Events/LocationEvents.cs b/src/StardewModdingAPI/Events/LocationEvents.cs
index b4b4ac33..af2eb400 100644
--- a/src/StardewModdingAPI/Events/LocationEvents.cs
+++ b/src/StardewModdingAPI/Events/LocationEvents.cs
@@ -6,25 +6,45 @@ using Object = StardewValley.Object;
namespace StardewModdingAPI.Events
{
+ /// <summary>Events raised when the player transitions between game locations, a location is added or removed, or the objects in the current location change.</summary>
public static class LocationEvents
{
+ /*********
+ ** Events
+ *********/
+ /// <summary>Raised after the player warps to a new location.</summary>
+ public static event EventHandler<EventArgsCurrentLocationChanged> CurrentLocationChanged = delegate { };
+
+ /// <summary>Raised after a game location is added or removed.</summary>
public static event EventHandler<EventArgsGameLocationsChanged> LocationsChanged = delegate { };
+
+ /// <summary>Raised after the list of objects in the current location changes (e.g. an object is added or removed).</summary>
public static event EventHandler<EventArgsLocationObjectsChanged> LocationObjectsChanged = delegate { };
- public static event EventHandler<EventArgsCurrentLocationChanged> CurrentLocationChanged = delegate { };
- internal static void InvokeLocationsChanged(List<GameLocation> newLocations)
+
+ /*********
+ ** Internal methods
+ *********/
+ /// <summary>Raise a <see cref="CurrentLocationChanged"/> event.</summary>
+ /// <param name="priorLocation">The player's previous location.</param>
+ /// <param name="newLocation">The player's current location.</param>
+ internal static void InvokeCurrentLocationChanged(GameLocation priorLocation, GameLocation newLocation)
{
- LocationsChanged.Invoke(null, new EventArgsGameLocationsChanged(newLocations));
+ LocationEvents.CurrentLocationChanged.Invoke(null, new EventArgsCurrentLocationChanged(priorLocation, newLocation));
}
- internal static void InvokeCurrentLocationChanged(GameLocation priorLocation, GameLocation newLocation)
+ /// <summary>Raise a <see cref="LocationsChanged"/> event.</summary>
+ /// <param name="newLocations">The current list of game locations.</param>
+ internal static void InvokeLocationsChanged(List<GameLocation> newLocations)
{
- CurrentLocationChanged.Invoke(null, new EventArgsCurrentLocationChanged(priorLocation, newLocation));
+ LocationEvents.LocationsChanged.Invoke(null, new EventArgsGameLocationsChanged(newLocations));
}
+ /// <summary>Raise a <see cref="LocationObjectsChanged"/> event.</summary>
+ /// <param name="newObjects">The current list of objects in the current location.</param>
internal static void InvokeOnNewLocationObject(SerializableDictionary<Vector2, Object> newObjects)
{
- LocationObjectsChanged.Invoke(null, new EventArgsLocationObjectsChanged(newObjects));
+ LocationEvents.LocationObjectsChanged.Invoke(null, new EventArgsLocationObjectsChanged(newObjects));
}
}
-} \ No newline at end of file
+}
diff --git a/src/StardewModdingAPI/Events/MenuEvents.cs b/src/StardewModdingAPI/Events/MenuEvents.cs
index fdd96f00..59f03449 100644
--- a/src/StardewModdingAPI/Events/MenuEvents.cs
+++ b/src/StardewModdingAPI/Events/MenuEvents.cs
@@ -3,19 +3,35 @@ using StardewValley.Menus;
namespace StardewModdingAPI.Events
{
+ /// <summary>Events raised when a game menu is opened or closed (including internal menus like the title screen).</summary>
public static class MenuEvents
{
+ /*********
+ ** Events
+ *********/
+ /// <summary>Raised after a game menu is opened or replaced with another menu. This event is not invoked when a menu is closed.</summary>
public static event EventHandler<EventArgsClickableMenuChanged> MenuChanged = delegate { };
+
+ /// <summary>Raised after a game menu is closed.</summary>
public static event EventHandler<EventArgsClickableMenuClosed> MenuClosed = delegate { };
+
+ /*********
+ ** Internal methods
+ *********/
+ /// <summary>Raise a <see cref="MenuChanged"/> event.</summary>
+ /// <param name="priorMenu">The previous menu.</param>
+ /// <param name="newMenu">The current menu.</param>
internal static void InvokeMenuChanged(IClickableMenu priorMenu, IClickableMenu newMenu)
{
- MenuChanged.Invoke(null, new EventArgsClickableMenuChanged(priorMenu, newMenu));
+ MenuEvents.MenuChanged.Invoke(null, new EventArgsClickableMenuChanged(priorMenu, newMenu));
}
+ /// <summary>Raise a <see cref="MenuClosed"/> event.</summary>
+ /// <param name="priorMenu">The menu that was closed.</param>
internal static void InvokeMenuClosed(IClickableMenu priorMenu)
{
- MenuClosed.Invoke(null, new EventArgsClickableMenuClosed(priorMenu));
+ MenuEvents.MenuClosed.Invoke(null, new EventArgsClickableMenuClosed(priorMenu));
}
}
-} \ No newline at end of file
+}
diff --git a/src/StardewModdingAPI/Events/MineEvents.cs b/src/StardewModdingAPI/Events/MineEvents.cs
index b9c3070c..6121abf4 100644
--- a/src/StardewModdingAPI/Events/MineEvents.cs
+++ b/src/StardewModdingAPI/Events/MineEvents.cs
@@ -2,13 +2,25 @@
namespace StardewModdingAPI.Events
{
+ /// <summary>Events raised when something happens in the mines.</summary>
public static class MineEvents
{
+ /*********
+ ** Events
+ *********/
+ /// <summary>Raised after the player warps to a new level of the mine.</summary>
public static event EventHandler<EventArgsMineLevelChanged> MineLevelChanged = delegate { };
- internal static void InvokeMineLevelChanged(int previousMinelevel, int currentMineLevel)
+
+ /*********
+ ** Internal methods
+ *********/
+ /// <summary>Raise a <see cref="MineLevelChanged"/> event.</summary>
+ /// <param name="previousMineLevel">The previous mine level.</param>
+ /// <param name="currentMineLevel">The current mine level.</param>
+ internal static void InvokeMineLevelChanged(int previousMineLevel, int currentMineLevel)
{
- MineLevelChanged.Invoke(null, new EventArgsMineLevelChanged(previousMinelevel, currentMineLevel));
+ MineEvents.MineLevelChanged.Invoke(null, new EventArgsMineLevelChanged(previousMineLevel, currentMineLevel));
}
}
-} \ No newline at end of file
+}
diff --git a/src/StardewModdingAPI/Events/PlayerEvents.cs b/src/StardewModdingAPI/Events/PlayerEvents.cs
index 910f3c96..71b43e71 100644
--- a/src/StardewModdingAPI/Events/PlayerEvents.cs
+++ b/src/StardewModdingAPI/Events/PlayerEvents.cs
@@ -5,31 +5,57 @@ using StardewValley;
namespace StardewModdingAPI.Events
{
+ /// <summary>Events raised when the player data changes.</summary>
public static class PlayerEvents
{
+ /*********
+ ** Events
+ *********/
+ /// <summary>Raised after the player loads a saved game.</summary>
+ public static event EventHandler<EventArgsLoadedGameChanged> LoadedGame = delegate { };
+
+ /// <summary>Raised after the game assigns a new player character. This happens just before <see cref="LoadedGame"/>; it's unclear how this would happen any other time.</summary>
public static event EventHandler<EventArgsFarmerChanged> FarmerChanged = delegate { };
+
+ /// <summary>Raised after the player's inventory changes in any way (added or removed item, sorted, etc).</summary>
public static event EventHandler<EventArgsInventoryChanged> InventoryChanged = delegate { };
+
+ /// <summary> Raised after the player levels up a skill. This happens as soon as they level up, not when the game notifies the player after their character goes to bed.</summary>
public static event EventHandler<EventArgsLevelUp> LeveledUp = delegate { };
- public static event EventHandler<EventArgsLoadedGameChanged> LoadedGame = delegate { };
- internal static void InvokeFarmerChanged(Farmer priorFarmer, Farmer newFarmer)
+
+ /*********
+ ** Internal methods
+ *********/
+ /// <summary>Raise a <see cref="LoadedGame"/> event.</summary>
+ /// <param name="loaded">Whether the save has been loaded. This is always true.</param>
+ internal static void InvokeLoadedGame(EventArgsLoadedGameChanged loaded)
{
- FarmerChanged.Invoke(null, new EventArgsFarmerChanged(priorFarmer, newFarmer));
+ PlayerEvents.LoadedGame.Invoke(null, loaded);
}
- internal static void InvokeInventoryChanged(List<Item> inventory, List<ItemStackChange> changedItems)
+ /// <summary>Raise a <see cref="FarmerChanged"/> event.</summary>
+ /// <param name="priorFarmer">The previous player character.</param>
+ /// <param name="newFarmer">The new player character.</param>
+ internal static void InvokeFarmerChanged(Farmer priorFarmer, Farmer newFarmer)
{
- InventoryChanged.Invoke(null, new EventArgsInventoryChanged(inventory, changedItems));
+ PlayerEvents.FarmerChanged.Invoke(null, new EventArgsFarmerChanged(priorFarmer, newFarmer));
}
- internal static void InvokeLeveledUp(EventArgsLevelUp.LevelType type, int newLevel)
+ /// <summary>Raise an <see cref="InventoryChanged"/> event.</summary>
+ /// <param name="inventory">The player's inventory.</param>
+ /// <param name="changedItems">The inventory changes.</param>
+ internal static void InvokeInventoryChanged(List<Item> inventory, List<ItemStackChange> changedItems)
{
- LeveledUp.Invoke(null, new EventArgsLevelUp(type, newLevel));
+ PlayerEvents.InventoryChanged.Invoke(null, new EventArgsInventoryChanged(inventory, changedItems));
}
- internal static void InvokeLoadedGame(EventArgsLoadedGameChanged loaded)
+ /// <summary>Rase a <see cref="LeveledUp"/> event.</summary>
+ /// <param name="type">The player skill that leveled up.</param>
+ /// <param name="newLevel">The new skill level.</param>
+ internal static void InvokeLeveledUp(EventArgsLevelUp.LevelType type, int newLevel)
{
- LoadedGame.Invoke(null, loaded);
+ PlayerEvents.LeveledUp.Invoke(null, new EventArgsLevelUp(type, newLevel));
}
}
-} \ No newline at end of file
+}
diff --git a/src/StardewModdingAPI/Events/TimeEvents.cs b/src/StardewModdingAPI/Events/TimeEvents.cs
index 42fa6ce2..ee83a267 100644
--- a/src/StardewModdingAPI/Events/TimeEvents.cs
+++ b/src/StardewModdingAPI/Events/TimeEvents.cs
@@ -2,41 +2,70 @@
namespace StardewModdingAPI.Events
{
+ /// <summary>Events raised when the in-game date or time changes.</summary>
public static class TimeEvents
{
+ /*********
+ ** Events
+ *********/
+ /// <summary>Raised after the in-game clock changes.</summary>
public static event EventHandler<EventArgsIntChanged> TimeOfDayChanged = delegate { };
+
+ /// <summary>Raised after the day-of-month value changes, including when loading a save (unlike <see cref="OnNewDay"/>).</summary>
public static event EventHandler<EventArgsIntChanged> DayOfMonthChanged = delegate { };
+
+ /// <summary>Raised after the year value changes.</summary>
public static event EventHandler<EventArgsIntChanged> YearOfGameChanged = delegate { };
+
+ /// <summary>Raised after the season value changes.</summary>
public static event EventHandler<EventArgsStringChanged> SeasonOfYearChanged = delegate { };
- /// <summary>
- /// Occurs when Game1.newDay changes. True directly before saving, and False directly after.
- /// </summary>
+ /// <summary>Raised when the player is transitioning to a new day and the game is performing its day update logic. This event is triggered twice: once after the game starts transitioning, and again after it finishes.</summary>
public static event EventHandler<EventArgsNewDay> OnNewDay = delegate { };
- internal static void InvokeTimeOfDayChanged(int priorInt, int newInt)
+
+ /*********
+ ** Internal methods
+ *********/
+ /// <summary>Raise a <see cref="InvokeDayOfMonthChanged"/> event.</summary>
+ /// <param name="priorTime">The previous time in military time format (e.g. 6:00pm is 1800).</param>
+ /// <param name="newTime">The current time in military time format (e.g. 6:10pm is 1810).</param>
+ internal static void InvokeTimeOfDayChanged(int priorTime, int newTime)
{
- TimeOfDayChanged.Invoke(null, new EventArgsIntChanged(priorInt, newInt));
+ TimeEvents.TimeOfDayChanged.Invoke(null, new EventArgsIntChanged(priorTime, newTime));
}
- internal static void InvokeDayOfMonthChanged(int priorInt, int newInt)
+ /// <summary>Raise a <see cref="DayOfMonthChanged"/> event.</summary>
+ /// <param name="priorDay">The previous day value.</param>
+ /// <param name="newDay">The current day value.</param>
+ internal static void InvokeDayOfMonthChanged(int priorDay, int newDay)
{
- DayOfMonthChanged.Invoke(null, new EventArgsIntChanged(priorInt, newInt));
+ TimeEvents.DayOfMonthChanged.Invoke(null, new EventArgsIntChanged(priorDay, newDay));
}
- internal static void InvokeYearOfGameChanged(int priorInt, int newInt)
+ /// <summary>Raise a <see cref="YearOfGameChanged"/> event.</summary>
+ /// <param name="priorYear">The previous year value.</param>
+ /// <param name="newYear">The current year value.</param>
+ internal static void InvokeYearOfGameChanged(int priorYear, int newYear)
{
- YearOfGameChanged.Invoke(null, new EventArgsIntChanged(priorInt, newInt));
+ TimeEvents.YearOfGameChanged.Invoke(null, new EventArgsIntChanged(priorYear, newYear));
}
- internal static void InvokeSeasonOfYearChanged(string priorString, string newString)
+ /// <summary>Raise a <see cref="SeasonOfYearChanged"/> event.</summary>
+ /// <param name="priorSeason">The previous season name.</param>
+ /// <param name="newSeason">The current season name.</param>
+ internal static void InvokeSeasonOfYearChanged(string priorSeason, string newSeason)
{
- SeasonOfYearChanged.Invoke(null, new EventArgsStringChanged(priorString, newString));
+ TimeEvents.SeasonOfYearChanged.Invoke(null, new EventArgsStringChanged(priorSeason, newSeason));
}
- internal static void InvokeOnNewDay(int priorInt, int newInt, bool newDay)
+ /// <summary>Raise a <see cref="OnNewDay"/> event.</summary>
+ /// <param name="priorDay">The previous day value.</param>
+ /// <param name="newDay">The current day value.</param>
+ /// <param name="isTransitioning">Whether the game just started the transition (<c>true</c>) or finished it (<c>false</c>).</param>
+ internal static void InvokeOnNewDay(int priorDay, int newDay, bool isTransitioning)
{
- OnNewDay.Invoke(null, new EventArgsNewDay(priorInt, newInt, newDay));
+ TimeEvents.OnNewDay.Invoke(null, new EventArgsNewDay(priorDay, newDay, isTransitioning));
}
}
-} \ No newline at end of file
+}