From 9edff95dd595608d97650e647efbc35e36527eb1 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 29 Aug 2020 23:10:29 -0400 Subject: [PATCH] minor tweaks to reduce changes from origin --- src/SMAPI/Constants.cs | 4 ---- src/SMAPI/Framework/SCore.cs | 17 ++++++++--------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/SMAPI/Constants.cs b/src/SMAPI/Constants.cs index d6d216d7..22d3d7ad 100644 --- a/src/SMAPI/Constants.cs +++ b/src/SMAPI/Constants.cs @@ -47,11 +47,7 @@ namespace StardewModdingAPI #endif /// The target game platform. -#if SMAPI_FOR_MOBILE internal static GamePlatform Platform { get; } = (GamePlatform)Enum.Parse(typeof(GamePlatform), LowLevelEnvironmentUtility.DetectPlatform()); -#else - internal static GamePlatform Platform { get; } = (GamePlatform)Enum.Parse(typeof(GamePlatform), LowLevelEnvironmentUtility.DetectPlatform()); -#endif /// The game's assembly name. internal static string GameAssemblyName => EarlyConstants.Platform == GamePlatform.Windows ? "Stardew Valley" : "StardewValley"; diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs index da169b20..f152a3e3 100644 --- a/src/SMAPI/Framework/SCore.cs +++ b/src/SMAPI/Framework/SCore.cs @@ -505,6 +505,10 @@ namespace StardewModdingAPI.Framework try { + /********* + ** Safe queued work + *********/ + // print warnings/alerts SCore.DeprecationManager.PrintQueued(); SCore.PerformanceMonitor.PrintQueuedAlerts(); @@ -895,19 +899,16 @@ namespace StardewModdingAPI.Framework *********/ if (state.ActiveMenu.IsChanged) { - if (this.Monitor.IsVerbose) - this.Monitor.Log($"Context: menu changed from {state.ActiveMenu.Old?.GetType().FullName ?? "none"} to {state.ActiveMenu.New?.GetType().FullName ?? "none"}."); + var was = state.ActiveMenu.Old; + var now = state.ActiveMenu.New; - // raise menu events -#if SMAPI_FOR_MOBILE - IClickableMenu was = state.ActiveMenu.Old; - IClickableMenu now = state.ActiveMenu.New; if (this.Monitor.IsVerbose) - this.Monitor.Log($"Context: menu changed from {state.ActiveMenu.Old?.GetType().FullName ?? "none"} to {state.ActiveMenu.New?.GetType().FullName ?? "none"}.", LogLevel.Trace); + this.Monitor.Log($"Context: menu changed from {was?.GetType().FullName ?? "none"} to {now?.GetType().FullName ?? "none"}."); // raise menu events events.MenuChanged.Raise(new MenuChangedEventArgs(was, now)); +#if SMAPI_FOR_MOBILE if (now is GameMenu gameMenu) { foreach (IClickableMenu menu in gameMenu.pages) @@ -934,8 +935,6 @@ namespace StardewModdingAPI.Framework } } events.MenuChanged.Raise(new MenuChangedEventArgs(was, now)); -#else - events.MenuChanged.Raise(new MenuChangedEventArgs(state.ActiveMenu.Old, state.ActiveMenu.New)); #endif }