diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-01-15 19:21:26 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-01-15 19:21:26 -0500 |
commit | 64a72c45e3c4b504c7a1b61a539f1cbc9b9d23cc (patch) | |
tree | 8648e73314fdf8a2b957d2bd3e3b651799d46888 /src/StardewModdingAPI/Events/TimeEvents.cs | |
parent | 0c73b02d58712f7f340f4326143d5439d6cd7f93 (diff) | |
download | SMAPI-64a72c45e3c4b504c7a1b61a539f1cbc9b9d23cc.tar.gz SMAPI-64a72c45e3c4b504c7a1b61a539f1cbc9b9d23cc.tar.bz2 SMAPI-64a72c45e3c4b504c7a1b61a539f1cbc9b9d23cc.zip |
deprecate events replaced by save events (#215)
Diffstat (limited to 'src/StardewModdingAPI/Events/TimeEvents.cs')
-rw-r--r-- | src/StardewModdingAPI/Events/TimeEvents.cs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/StardewModdingAPI/Events/TimeEvents.cs b/src/StardewModdingAPI/Events/TimeEvents.cs index 1b367230..dedd7e77 100644 --- a/src/StardewModdingAPI/Events/TimeEvents.cs +++ b/src/StardewModdingAPI/Events/TimeEvents.cs @@ -22,6 +22,7 @@ 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")] public static event EventHandler<EventArgsNewDay> OnNewDay; @@ -71,7 +72,14 @@ namespace StardewModdingAPI.Events /// <param name="isTransitioning">Whether the game just started the transition (<c>true</c>) or finished it (<c>false</c>).</param> internal static void InvokeOnNewDay(IMonitor monitor, int priorDay, int newDay, bool isTransitioning) { - monitor.SafelyRaiseGenericEvent($"{nameof(TimeEvents)}.{nameof(TimeEvents.OnNewDay)}", TimeEvents.OnNewDay?.GetInvocationList(), null, new EventArgsNewDay(priorDay, newDay, isTransitioning)); + if (TimeEvents.OnNewDay == null) + return; + + string name = $"{nameof(TimeEvents)}.{nameof(TimeEvents.OnNewDay)}"; + Delegate[] handlers = TimeEvents.OnNewDay.GetInvocationList(); + + Program.DeprecationManager.WarnForEvent(handlers, name, "1.6", DeprecationLevel.Notice); + monitor.SafelyRaiseGenericEvent(name, handlers, null, new EventArgsNewDay(priorDay, newDay, isTransitioning)); } } } |