summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI/Events/TimeEvents.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-02-11 12:38:32 -0500
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-02-11 12:38:32 -0500
commite393a2aad958c636ffaf5431e0e9dfdf6faf4461 (patch)
tree4b3abd19a9d30cae1550ada90091406783bb46a3 /src/StardewModdingAPI/Events/TimeEvents.cs
parent1f332c5f4d522908ee89e07ea081359b17ad324c (diff)
downloadSMAPI-e393a2aad958c636ffaf5431e0e9dfdf6faf4461.tar.gz
SMAPI-e393a2aad958c636ffaf5431e0e9dfdf6faf4461.tar.bz2
SMAPI-e393a2aad958c636ffaf5431e0e9dfdf6faf4461.zip
add TimeEvents.AfterDayStarted event (#236)
Diffstat (limited to 'src/StardewModdingAPI/Events/TimeEvents.cs')
-rw-r--r--src/StardewModdingAPI/Events/TimeEvents.cs14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/StardewModdingAPI/Events/TimeEvents.cs b/src/StardewModdingAPI/Events/TimeEvents.cs
index dedd7e77..a140a223 100644
--- a/src/StardewModdingAPI/Events/TimeEvents.cs
+++ b/src/StardewModdingAPI/Events/TimeEvents.cs
@@ -9,10 +9,13 @@ namespace StardewModdingAPI.Events
/*********
** Events
*********/
+ /// <summary>Raised after the game begins a new day, including when loading a save.</summary>
+ public static event EventHandler AfterDayStarted;
+
/// <summary>Raised after the in-game clock changes.</summary>
public static event EventHandler<EventArgsIntChanged> TimeOfDayChanged;
- /// <summary>Raised after the day-of-month value changes, including when loading a save (unlike <see cref="OnNewDay"/>).</summary>
+ /// <summary>Raised after the day-of-month value changes, including when loading a save. This may happen before save; in most cases you should use <see cref="AfterDayStarted"/> instead.</summary>
public static event EventHandler<EventArgsIntChanged> DayOfMonthChanged;
/// <summary>Raised after the year value changes.</summary>
@@ -22,13 +25,20 @@ namespace StardewModdingAPI.Events
public static event EventHandler<EventArgsStringChanged> SeasonOfYearChanged;
/// <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>
- [Obsolete("Use " + nameof(TimeEvents) + "." + nameof(DayOfMonthChanged) + " or " + nameof(SaveEvents) + " instead")]
+ [Obsolete("Use " + nameof(TimeEvents) + "." + nameof(TimeEvents.AfterDayStarted) + " or " + nameof(SaveEvents) + " instead")]
public static event EventHandler<EventArgsNewDay> OnNewDay;
/*********
** Internal methods
*********/
+ /// <summary>Raise an <see cref="AfterDayStarted"/> event.</summary>
+ /// <param name="monitor">Encapsulates monitoring and logging.</param>
+ internal static void InvokeAfterDayStarted(IMonitor monitor)
+ {
+ monitor.SafelyRaisePlainEvent($"{nameof(TimeEvents)}.{nameof(TimeEvents.AfterDayStarted)}", TimeEvents.AfterDayStarted?.GetInvocationList(), null, EventArgs.Empty);
+ }
+
/// <summary>Raise a <see cref="InvokeDayOfMonthChanged"/> event.</summary>
/// <param name="monitor">Encapsulates monitoring and logging.</param>
/// <param name="priorTime">The previous time in military time format (e.g. 6:00pm is 1800).</param>