diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-05-12 00:01:39 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-05-12 00:01:39 -0400 |
commit | e84028f22bf3fc81682ff6fb3a59293f23c030f4 (patch) | |
tree | 01ab1264025a88c7a80bd0d00db73924a00752bf /src/StardewModdingAPI | |
parent | bb165f2079e33d02c0e673db73ac5b336272a3fa (diff) | |
download | SMAPI-e84028f22bf3fc81682ff6fb3a59293f23c030f4.tar.gz SMAPI-e84028f22bf3fc81682ff6fb3a59293f23c030f4.tar.bz2 SMAPI-e84028f22bf3fc81682ff6fb3a59293f23c030f4.zip |
fix SMAPI raising a deprecation warning for its own use of an event
Diffstat (limited to 'src/StardewModdingAPI')
-rw-r--r-- | src/StardewModdingAPI/Events/GameEvents.cs | 7 | ||||
-rw-r--r-- | src/StardewModdingAPI/Program.cs | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/StardewModdingAPI/Events/GameEvents.cs b/src/StardewModdingAPI/Events/GameEvents.cs index be06a03b..4f9ce7a7 100644 --- a/src/StardewModdingAPI/Events/GameEvents.cs +++ b/src/StardewModdingAPI/Events/GameEvents.cs @@ -19,6 +19,9 @@ namespace StardewModdingAPI.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; + /// <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> + internal static event EventHandler GameLoadedInternal; + /// <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; @@ -101,6 +104,10 @@ namespace StardewModdingAPI.Events /// <param name="monitor">Encapsulates monitoring and logging.</param> internal static void InvokeGameLoaded(IMonitor monitor) { + // notify SMAPI + monitor.SafelyRaisePlainEvent($"{nameof(GameEvents)}.{nameof(GameEvents.GameLoadedInternal)}", GameEvents.GameLoadedInternal?.GetInvocationList()); + + // notify mods if (GameEvents.GameLoaded == null) return; diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs index b8d70ad7..75bdba0f 100644 --- a/src/StardewModdingAPI/Program.cs +++ b/src/StardewModdingAPI/Program.cs @@ -176,7 +176,7 @@ namespace StardewModdingAPI this.GameInstance.Exiting += (sender, e) => this.Dispose(); this.GameInstance.Window.ClientSizeChanged += (sender, e) => GraphicsEvents.InvokeResize(this.Monitor, sender, e); GameEvents.InitializeInternal += (sender, e) => this.InitialiseAfterGameStart(); - GameEvents.GameLoaded += (sender, e) => this.CheckForUpdateAsync(); + GameEvents.GameLoadedInternal += (sender, e) => this.CheckForUpdateAsync(); // set window titles this.GameInstance.Window.Title = $"Stardew Valley {Constants.GetGameDisplayVersion(Constants.GameVersion)} - running SMAPI {Constants.ApiVersion}"; |