summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI/Events
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-09-23 20:53:12 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-09-23 20:53:12 -0400
commit2d36105c33ffba77eb979ef6ef0d2e7d906b09bc (patch)
treefe74c3eb7dea4e6e7d59c00cab2e2308c43da3d0 /src/StardewModdingAPI/Events
parenta149f82b7a00d1ebf5ab33e529be93ce70873947 (diff)
downloadSMAPI-2d36105c33ffba77eb979ef6ef0d2e7d906b09bc.tar.gz
SMAPI-2d36105c33ffba77eb979ef6ef0d2e7d906b09bc.tar.bz2
SMAPI-2d36105c33ffba77eb979ef6ef0d2e7d906b09bc.zip
drop support for SMAPI 1.x (#360)
Diffstat (limited to 'src/StardewModdingAPI/Events')
-rw-r--r--src/StardewModdingAPI/Events/EventArgsCommand.cs28
-rw-r--r--src/StardewModdingAPI/Events/EventArgsFarmerChanged.cs33
-rw-r--r--src/StardewModdingAPI/Events/EventArgsInput.cs2
-rw-r--r--src/StardewModdingAPI/Events/EventArgsLoadedGameChanged.cs27
-rw-r--r--src/StardewModdingAPI/Events/EventArgsNewDay.cs37
-rw-r--r--src/StardewModdingAPI/Events/EventArgsStringChanged.cs31
-rw-r--r--src/StardewModdingAPI/Events/GameEvents.cs112
-rw-r--r--src/StardewModdingAPI/Events/InputEvents.cs2
-rw-r--r--src/StardewModdingAPI/Events/PlayerEvents.cs74
-rw-r--r--src/StardewModdingAPI/Events/TimeEvents.cs128
10 files changed, 2 insertions, 472 deletions
diff --git a/src/StardewModdingAPI/Events/EventArgsCommand.cs b/src/StardewModdingAPI/Events/EventArgsCommand.cs
deleted file mode 100644
index 35370139..00000000
--- a/src/StardewModdingAPI/Events/EventArgsCommand.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-#if SMAPI_1_x
-using System;
-
-namespace StardewModdingAPI.Events
-{
- /// <summary>Event arguments for a <see cref="StardewModdingAPI.Command.CommandFired"/> event.</summary>
- [Obsolete("Use " + nameof(IModHelper) + "." + nameof(IModHelper.ConsoleCommands))]
- public class EventArgsCommand : EventArgs
- {
- /*********
- ** Accessors
- *********/
- /// <summary>The triggered command.</summary>
- public Command Command { get; }
-
-
- /*********
- ** Public methods
- *********/
- /// <summary>Construct an instance.</summary>
- /// <param name="command">The triggered command.</param>
- public EventArgsCommand(Command command)
- {
- this.Command = command;
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/src/StardewModdingAPI/Events/EventArgsFarmerChanged.cs b/src/StardewModdingAPI/Events/EventArgsFarmerChanged.cs
deleted file mode 100644
index 4c359939..00000000
--- a/src/StardewModdingAPI/Events/EventArgsFarmerChanged.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-#if SMAPI_1_x
-using System;
-using SFarmer = StardewValley.Farmer;
-
-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 SFarmer NewFarmer { get; }
-
- /// <summary>The new player character.</summary>
- public SFarmer 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(SFarmer priorFarmer, SFarmer newFarmer)
- {
- this.PriorFarmer = priorFarmer;
- this.NewFarmer = newFarmer;
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/src/StardewModdingAPI/Events/EventArgsInput.cs b/src/StardewModdingAPI/Events/EventArgsInput.cs
index 31368555..66cb19f2 100644
--- a/src/StardewModdingAPI/Events/EventArgsInput.cs
+++ b/src/StardewModdingAPI/Events/EventArgsInput.cs
@@ -1,4 +1,3 @@
-#if !SMAPI_1_x
using System;
using System.Linq;
using Microsoft.Xna.Framework;
@@ -123,4 +122,3 @@ namespace StardewModdingAPI.Events
}
}
}
-#endif
diff --git a/src/StardewModdingAPI/Events/EventArgsLoadedGameChanged.cs b/src/StardewModdingAPI/Events/EventArgsLoadedGameChanged.cs
deleted file mode 100644
index 688b4b3d..00000000
--- a/src/StardewModdingAPI/Events/EventArgsLoadedGameChanged.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-#if SMAPI_1_x
-using System;
-
-namespace StardewModdingAPI.Events
-{
- /// <summary>Event arguments for a <see cref="PlayerEvents.LoadedGame"/> event.</summary>
- public class EventArgsLoadedGameChanged : EventArgs
- {
- /*********
- ** Accessors
- *********/
- /// <summary>Whether the save has been loaded. This is always true.</summary>
- public bool LoadedGame { get; }
-
-
- /*********
- ** 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)
- {
- this.LoadedGame = loaded;
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/src/StardewModdingAPI/Events/EventArgsNewDay.cs b/src/StardewModdingAPI/Events/EventArgsNewDay.cs
deleted file mode 100644
index b8cbe9e3..00000000
--- a/src/StardewModdingAPI/Events/EventArgsNewDay.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-#if SMAPI_1_x
-using System;
-
-namespace StardewModdingAPI.Events
-{
- /// <summary>Event arguments for a <see cref="TimeEvents.OnNewDay"/> event.</summary>
- public class EventArgsNewDay : EventArgs
- {
- /*********
- ** Accessors
- *********/
- /// <summary>The previous day value.</summary>
- public int PreviousDay { get; }
-
- /// <summary>The current day value.</summary>
- public int CurrentDay { get; }
-
- /// <summary>Whether the game just started the transition (<c>true</c>) or finished it (<c>false</c>).</summary>
- public bool IsNewDay { get; }
-
-
- /*********
- ** 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;
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/src/StardewModdingAPI/Events/EventArgsStringChanged.cs b/src/StardewModdingAPI/Events/EventArgsStringChanged.cs
deleted file mode 100644
index f580a2ce..00000000
--- a/src/StardewModdingAPI/Events/EventArgsStringChanged.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-#if SMAPI_1_x
-using System;
-
-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; }
-
- /// <summary>The current value.</summary>
- public string PriorString { get; }
-
- /*********
- ** 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)
- {
- this.NewString = newString;
- this.PriorString = priorString;
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/src/StardewModdingAPI/Events/GameEvents.cs b/src/StardewModdingAPI/Events/GameEvents.cs
index deb71a86..b477376e 100644
--- a/src/StardewModdingAPI/Events/GameEvents.cs
+++ b/src/StardewModdingAPI/Events/GameEvents.cs
@@ -1,94 +1,17 @@
using System;
-using System.Diagnostics.CodeAnalysis;
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 game changes state.</summary>
public static class GameEvents
{
/*********
- ** Properties
- *********/
-#if SMAPI_1_x
- /// <summary>Manages deprecation warnings.</summary>
- private static DeprecationManager DeprecationManager;
-
- /// <summary>The backing field for <see cref="Initialize"/>.</summary>
- [SuppressMessage("ReSharper", "InconsistentNaming")]
- private static event EventHandler _Initialize;
-
- /// <summary>The backing field for <see cref="LoadContent"/>.</summary>
- [SuppressMessage("ReSharper", "InconsistentNaming")]
- private static event EventHandler _LoadContent;
-
- /// <summary>The backing field for <see cref="GameLoaded"/>.</summary>
- [SuppressMessage("ReSharper", "InconsistentNaming")]
- private static event EventHandler _GameLoaded;
-
- /// <summary>The backing field for <see cref="FirstUpdateTick"/>.</summary>
- [SuppressMessage("ReSharper", "InconsistentNaming")]
- private static event EventHandler _FirstUpdateTick;
-#endif
-
-
- /*********
** Events
*********/
/// <summary>Raised during launch after configuring XNA or MonoGame. The game window hasn't been opened by this point. Called after <see cref="Microsoft.Xna.Framework.Game.Initialize"/>.</summary>
internal static event EventHandler InitializeInternal;
-#if SMAPI_1_x
- /// <summary>Raised during launch after configuring XNA or MonoGame. The game window hasn't been opened by this point. Called after <see cref="Microsoft.Xna.Framework.Game.Initialize"/>.</summary>
- [Obsolete("The " + nameof(Mod) + "." + nameof(Mod.Entry) + " method is now called after the " + nameof(GameEvents.Initialize) + " event, so any contained logic can be done directly in " + nameof(Mod.Entry) + ".")]
- public static event EventHandler Initialize
- {
- add
- {
- GameEvents.DeprecationManager.Warn($"{nameof(GameEvents)}.{nameof(GameEvents.Initialize)}", "1.10", DeprecationLevel.PendingRemoval);
- GameEvents._Initialize += value;
- }
- remove => GameEvents._Initialize -= value;
- }
-
- /// <summary>Raised before XNA loads or reloads graphics resources. Called during <see cref="Microsoft.Xna.Framework.Game.LoadContent"/>.</summary>
- [Obsolete("The " + nameof(Mod) + "." + nameof(Mod.Entry) + " method is now called after the " + nameof(GameEvents.LoadContent) + " event, so any contained logic can be done directly in " + nameof(Mod.Entry) + ".")]
- public static event EventHandler LoadContent
- {
- add
- {
- GameEvents.DeprecationManager.Warn($"{nameof(GameEvents)}.{nameof(GameEvents.LoadContent)}", "1.10", DeprecationLevel.PendingRemoval);
- GameEvents._LoadContent += value;
- }
- remove => GameEvents._LoadContent -= value;
- }
-
- /// <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>
- [Obsolete("The " + nameof(Mod) + "." + nameof(Mod.Entry) + " method is now called after the game loads, so any contained logic can be done directly in " + nameof(Mod.Entry) + ".")]
- public static event EventHandler GameLoaded
- {
- add
- {
- GameEvents.DeprecationManager.Warn($"{nameof(GameEvents)}.{nameof(GameEvents.GameLoaded)}", "1.12", DeprecationLevel.PendingRemoval);
- GameEvents._GameLoaded += value;
- }
- remove => GameEvents._GameLoaded -= value;
- }
-
- /// <summary>Raised during the first game update tick.</summary>
- [Obsolete("The " + nameof(Mod) + "." + nameof(Mod.Entry) + " method is now called after the game loads, so any contained logic can be done directly in " + nameof(Mod.Entry) + ".")]
- public static event EventHandler FirstUpdateTick
- {
- add
- {
- GameEvents.DeprecationManager.Warn($"{nameof(GameEvents)}.{nameof(GameEvents.FirstUpdateTick)}", "1.12", DeprecationLevel.PendingRemoval);
- GameEvents._FirstUpdateTick += value;
- }
- remove => GameEvents._FirstUpdateTick -= value;
- }
-#endif
-
/// <summary>Raised when the game updates its state (≈60 times per second).</summary>
public static event EventHandler UpdateTick;
@@ -114,47 +37,12 @@ namespace StardewModdingAPI.Events
/*********
** 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)
- {
- GameEvents.DeprecationManager = deprecationManager;
- }
-#endif
-
/// <summary>Raise an <see cref="InitializeInternal"/> event.</summary>
/// <param name="monitor">Encapsulates logging and monitoring.</param>
internal static void InvokeInitialize(IMonitor monitor)
{
monitor.SafelyRaisePlainEvent($"{nameof(GameEvents)}.{nameof(GameEvents.InitializeInternal)}", GameEvents.InitializeInternal?.GetInvocationList());
-#if SMAPI_1_x
- monitor.SafelyRaisePlainEvent($"{nameof(GameEvents)}.{nameof(GameEvents.Initialize)}", GameEvents._Initialize?.GetInvocationList());
-#endif
- }
-
-#if SMAPI_1_x
- /// <summary>Raise a <see cref="LoadContent"/> event.</summary>
- /// <param name="monitor">Encapsulates logging and monitoring.</param>
- internal static void InvokeLoadContent(IMonitor monitor)
- {
- monitor.SafelyRaisePlainEvent($"{nameof(GameEvents)}.{nameof(GameEvents.LoadContent)}", GameEvents._LoadContent?.GetInvocationList());
- }
-
- /// <summary>Raise a <see cref="GameLoadedInternal"/> event.</summary>
- /// <param name="monitor">Encapsulates monitoring and logging.</param>
- internal static void InvokeGameLoaded(IMonitor monitor)
- {
- monitor.SafelyRaisePlainEvent($"{nameof(GameEvents)}.{nameof(GameEvents.GameLoaded)}", GameEvents._GameLoaded?.GetInvocationList());
- }
-
- /// <summary>Raise a <see cref="FirstUpdateTick"/> event.</summary>
- /// <param name="monitor">Encapsulates monitoring and logging.</param>
- internal static void InvokeFirstUpdateTick(IMonitor monitor)
- {
- monitor.SafelyRaisePlainEvent($"{nameof(GameEvents)}.{nameof(GameEvents.FirstUpdateTick)}", GameEvents._FirstUpdateTick?.GetInvocationList());
}
-#endif
/// <summary>Raise an <see cref="UpdateTick"/> event.</summary>
/// <param name="monitor">Encapsulates logging and monitoring.</param>
diff --git a/src/StardewModdingAPI/Events/InputEvents.cs b/src/StardewModdingAPI/Events/InputEvents.cs
index b99b49e0..c31eb698 100644
--- a/src/StardewModdingAPI/Events/InputEvents.cs
+++ b/src/StardewModdingAPI/Events/InputEvents.cs
@@ -1,4 +1,3 @@
-#if !SMAPI_1_x
using System;
using StardewModdingAPI.Framework;
using StardewModdingAPI.Utilities;
@@ -42,4 +41,3 @@ namespace StardewModdingAPI.Events
}
}
}
-#endif \ No newline at end of file
diff --git a/src/StardewModdingAPI/Events/PlayerEvents.cs b/src/StardewModdingAPI/Events/PlayerEvents.cs
index 72826330..5a9a9d5f 100644
--- a/src/StardewModdingAPI/Events/PlayerEvents.cs
+++ b/src/StardewModdingAPI/Events/PlayerEvents.cs
@@ -1,63 +1,17 @@
-using System;
+using System;
using System.Collections.Generic;
-using System.Diagnostics.CodeAnalysis;
using System.Linq;
using StardewModdingAPI.Framework;
using StardewValley;
-using SFarmer = StardewValley.Farmer;
-#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 player data changes.</summary>
public static class PlayerEvents
{
/*********
- ** Properties
- *********/
-#if SMAPI_1_x
- /// <summary>Manages deprecation warnings.</summary>
- private static DeprecationManager DeprecationManager;
-
- /// <summary>The backing field for <see cref="LoadedGame"/>.</summary>
- [SuppressMessage("ReSharper", "InconsistentNaming")]
- private static event EventHandler<EventArgsLoadedGameChanged> _LoadedGame;
-
- /// <summary>The backing field for <see cref="FarmerChanged"/>.</summary>
- [SuppressMessage("ReSharper", "InconsistentNaming")]
- private static event EventHandler<EventArgsFarmerChanged> _FarmerChanged;
-#endif
-
-
- /*********
** Events
*********/
-#if SMAPI_1_x
- /// <summary>Raised after the player loads a saved game.</summary>
- [Obsolete("Use " + nameof(SaveEvents) + "." + nameof(SaveEvents.AfterLoad) + " instead")]
- public static event EventHandler<EventArgsLoadedGameChanged> LoadedGame
- {
- add
- {
- PlayerEvents.DeprecationManager.Warn($"{nameof(PlayerEvents)}.{nameof(PlayerEvents.LoadedGame)}", "1.6", DeprecationLevel.PendingRemoval);
- PlayerEvents._LoadedGame += value;
- }
- remove => PlayerEvents._LoadedGame -= value;
- }
-
- /// <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>
- [Obsolete("should no longer be used")]
- public static event EventHandler<EventArgsFarmerChanged> FarmerChanged
- {
- add
- {
- PlayerEvents.DeprecationManager.Warn($"{nameof(PlayerEvents)}.{nameof(PlayerEvents.FarmerChanged)}", "1.6", DeprecationLevel.PendingRemoval);
- PlayerEvents._FarmerChanged += value;
- }
- remove => PlayerEvents._FarmerChanged -= value;
- }
-#endif
-
/// <summary>Raised after the player's inventory changes in any way (added or removed item, sorted, etc).</summary>
public static event EventHandler<EventArgsInventoryChanged> InventoryChanged;
@@ -68,32 +22,6 @@ namespace StardewModdingAPI.Events
/*********
** 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)
- {
- PlayerEvents.DeprecationManager = deprecationManager;
- }
-
- /// <summary>Raise a <see cref="LoadedGame"/> event.</summary>
- /// <param name="monitor">Encapsulates monitoring and logging.</param>
- /// <param name="loaded">Whether the save has been loaded. This is always true.</param>
- internal static void InvokeLoadedGame(IMonitor monitor, EventArgsLoadedGameChanged loaded)
- {
- monitor.SafelyRaiseGenericEvent($"{nameof(PlayerEvents)}.{nameof(PlayerEvents.LoadedGame)}", PlayerEvents._LoadedGame?.GetInvocationList(), null, loaded);
- }
-
- /// <summary>Raise a <see cref="FarmerChanged"/> event.</summary>
- /// <param name="monitor">Encapsulates monitoring and logging.</param>
- /// <param name="priorFarmer">The previous player character.</param>
- /// <param name="newFarmer">The new player character.</param>
- internal static void InvokeFarmerChanged(IMonitor monitor, SFarmer priorFarmer, SFarmer newFarmer)
- {
- monitor.SafelyRaiseGenericEvent($"{nameof(PlayerEvents)}.{nameof(PlayerEvents.FarmerChanged)}", PlayerEvents._FarmerChanged?.GetInvocationList(), null, new EventArgsFarmerChanged(priorFarmer, newFarmer));
- }
-#endif
-
/// <summary>Raise an <see cref="InventoryChanged"/> event.</summary>
/// <param name="monitor">Encapsulates monitoring and logging.</param>
/// <param name="inventory">The player's inventory.</param>
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
}
}