diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-09-23 20:53:12 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-09-23 20:53:12 -0400 |
commit | 2d36105c33ffba77eb979ef6ef0d2e7d906b09bc (patch) | |
tree | fe74c3eb7dea4e6e7d59c00cab2e2308c43da3d0 /src/StardewModdingAPI/Events/TimeEvents.cs | |
parent | a149f82b7a00d1ebf5ab33e529be93ce70873947 (diff) | |
download | SMAPI-2d36105c33ffba77eb979ef6ef0d2e7d906b09bc.tar.gz SMAPI-2d36105c33ffba77eb979ef6ef0d2e7d906b09bc.tar.bz2 SMAPI-2d36105c33ffba77eb979ef6ef0d2e7d906b09bc.zip |
drop support for SMAPI 1.x (#360)
Diffstat (limited to 'src/StardewModdingAPI/Events/TimeEvents.cs')
-rw-r--r-- | src/StardewModdingAPI/Events/TimeEvents.cs | 128 |
1 files changed, 1 insertions, 127 deletions
diff --git a/src/StardewModdingAPI/Events/TimeEvents.cs b/src/StardewModdingAPI/Events/TimeEvents.cs index d5ab9fb7..9aea5e04 100644 --- a/src/StardewModdingAPI/Events/TimeEvents.cs +++ b/src/StardewModdingAPI/Events/TimeEvents.cs @@ -1,39 +1,12 @@ -using System; -using System.Diagnostics.CodeAnalysis; +using System; using StardewModdingAPI.Framework; -#pragma warning disable 618 // Suppress obsolete-symbol errors in this file. Since several events are marked obsolete, this produces unnecessary warnings. namespace StardewModdingAPI.Events { /// <summary>Events raised when the in-game date or time changes.</summary> public static class TimeEvents { /********* - ** Properties - *********/ -#if SMAPI_1_x - /// <summary>Manages deprecation warnings.</summary> - private static DeprecationManager DeprecationManager; - - /// <summary>The backing field for <see cref="OnNewDay"/>.</summary> - [SuppressMessage("ReSharper", "InconsistentNaming")] - private static event EventHandler<EventArgsNewDay> _OnNewDay; - - /// <summary>The backing field for <see cref="DayOfMonthChanged"/>.</summary> - [SuppressMessage("ReSharper", "InconsistentNaming")] - private static event EventHandler<EventArgsIntChanged> _DayOfMonthChanged; - - /// <summary>The backing field for <see cref="SeasonOfYearChanged"/>.</summary> - [SuppressMessage("ReSharper", "InconsistentNaming")] - private static event EventHandler<EventArgsStringChanged> _SeasonOfYearChanged; - - /// <summary>The backing field for <see cref="YearOfGameChanged"/>.</summary> - [SuppressMessage("ReSharper", "InconsistentNaming")] - private static event EventHandler<EventArgsIntChanged> _YearOfGameChanged; -#endif - - - /********* ** Events *********/ /// <summary>Raised after the game begins a new day, including when loading a save.</summary> @@ -42,69 +15,9 @@ namespace StardewModdingAPI.Events /// <summary>Raised after the in-game clock changes.</summary> public static event EventHandler<EventArgsIntChanged> TimeOfDayChanged; -#if SMAPI_1_x - /// <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> - [Obsolete("Use " + nameof(TimeEvents) + "." + nameof(TimeEvents.AfterDayStarted) + " or " + nameof(SaveEvents) + " instead")] - public static event EventHandler<EventArgsIntChanged> DayOfMonthChanged - { - add - { - TimeEvents.DeprecationManager.Warn($"{nameof(TimeEvents)}.{nameof(TimeEvents.DayOfMonthChanged)}", "1.14", DeprecationLevel.PendingRemoval); - TimeEvents._DayOfMonthChanged += value; - } - remove => TimeEvents._DayOfMonthChanged -= value; - } - - /// <summary>Raised after the year value changes.</summary> - [Obsolete("Use " + nameof(TimeEvents) + "." + nameof(TimeEvents.AfterDayStarted) + " or " + nameof(SaveEvents) + " instead")] - public static event EventHandler<EventArgsIntChanged> YearOfGameChanged - { - add - { - TimeEvents.DeprecationManager.Warn($"{nameof(TimeEvents)}.{nameof(TimeEvents.YearOfGameChanged)}", "1.14", DeprecationLevel.PendingRemoval); - TimeEvents._YearOfGameChanged += value; - } - remove => TimeEvents._YearOfGameChanged -= value; - } - - /// <summary>Raised after the season value changes.</summary> - [Obsolete("Use " + nameof(TimeEvents) + "." + nameof(TimeEvents.AfterDayStarted) + " or " + nameof(SaveEvents) + " instead")] - public static event EventHandler<EventArgsStringChanged> SeasonOfYearChanged - { - add - { - TimeEvents.DeprecationManager.Warn($"{nameof(TimeEvents)}.{nameof(TimeEvents.SeasonOfYearChanged)}", "1.14", DeprecationLevel.PendingRemoval); - TimeEvents._SeasonOfYearChanged += value; - } - remove => TimeEvents._SeasonOfYearChanged -= value; - } - - /// <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(TimeEvents.AfterDayStarted) + " or " + nameof(SaveEvents) + " instead")] - public static event EventHandler<EventArgsNewDay> OnNewDay - { - add - { - TimeEvents.DeprecationManager.Warn($"{nameof(TimeEvents)}.{nameof(TimeEvents.OnNewDay)}", "1.6", DeprecationLevel.PendingRemoval); - TimeEvents._OnNewDay += value; - } - remove => TimeEvents._OnNewDay -= value; - } -#endif - - /********* ** Internal methods *********/ -#if SMAPI_1_x - /// <summary>Injects types required for backwards compatibility.</summary> - /// <param name="deprecationManager">Manages deprecation warnings.</param> - internal static void Shim(DeprecationManager deprecationManager) - { - TimeEvents.DeprecationManager = deprecationManager; - } -#endif - /// <summary>Raise an <see cref="AfterDayStarted"/> event.</summary> /// <param name="monitor">Encapsulates monitoring and logging.</param> internal static void InvokeAfterDayStarted(IMonitor monitor) @@ -120,44 +33,5 @@ namespace StardewModdingAPI.Events { monitor.SafelyRaiseGenericEvent($"{nameof(TimeEvents)}.{nameof(TimeEvents.TimeOfDayChanged)}", TimeEvents.TimeOfDayChanged?.GetInvocationList(), null, new EventArgsIntChanged(priorTime, newTime)); } - -#if SMAPI_1_x - /// <summary>Raise a <see cref="DayOfMonthChanged"/> event.</summary> - /// <param name="monitor">Encapsulates monitoring and logging.</param> - /// <param name="priorDay">The previous day value.</param> - /// <param name="newDay">The current day value.</param> - internal static void InvokeDayOfMonthChanged(IMonitor monitor, int priorDay, int newDay) - { - monitor.SafelyRaiseGenericEvent($"{nameof(TimeEvents)}.{nameof(TimeEvents.DayOfMonthChanged)}", TimeEvents._DayOfMonthChanged?.GetInvocationList(), null, new EventArgsIntChanged(priorDay, newDay)); - } - - /// <summary>Raise a <see cref="YearOfGameChanged"/> event.</summary> - /// <param name="monitor">Encapsulates monitoring and logging.</param> - /// <param name="priorYear">The previous year value.</param> - /// <param name="newYear">The current year value.</param> - internal static void InvokeYearOfGameChanged(IMonitor monitor, int priorYear, int newYear) - { - monitor.SafelyRaiseGenericEvent($"{nameof(TimeEvents)}.{nameof(TimeEvents.YearOfGameChanged)}", TimeEvents._YearOfGameChanged?.GetInvocationList(), null, new EventArgsIntChanged(priorYear, newYear)); - } - - /// <summary>Raise a <see cref="SeasonOfYearChanged"/> event.</summary> - /// <param name="monitor">Encapsulates monitoring and logging.</param> - /// <param name="priorSeason">The previous season name.</param> - /// <param name="newSeason">The current season name.</param> - internal static void InvokeSeasonOfYearChanged(IMonitor monitor, string priorSeason, string newSeason) - { - monitor.SafelyRaiseGenericEvent($"{nameof(TimeEvents)}.{nameof(TimeEvents.SeasonOfYearChanged)}", TimeEvents._SeasonOfYearChanged?.GetInvocationList(), null, new EventArgsStringChanged(priorSeason, newSeason)); - } - - /// <summary>Raise a <see cref="OnNewDay"/> event.</summary> - /// <param name="monitor">Encapsulates monitoring and logging.</param> - /// <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(IMonitor monitor, int priorDay, int newDay, bool isTransitioning) - { - monitor.SafelyRaiseGenericEvent($"{nameof(TimeEvents)}.{nameof(TimeEvents.OnNewDay)}", TimeEvents._OnNewDay?.GetInvocationList(), null, new EventArgsNewDay(priorDay, newDay, isTransitioning)); - } -#endif } } |