From 45ee74219ee931b5fef3b67c08adf79d55aa091d Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 18 Dec 2016 17:42:51 -0500 Subject: fix issue where changing the active menu inside a menu change handler didn't trigger a new event (#194) --- src/StardewModdingAPI/Inheritance/SGame.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/StardewModdingAPI/Inheritance') diff --git a/src/StardewModdingAPI/Inheritance/SGame.cs b/src/StardewModdingAPI/Inheritance/SGame.cs index f70d0696..16803a73 100644 --- a/src/StardewModdingAPI/Inheritance/SGame.cs +++ b/src/StardewModdingAPI/Inheritance/SGame.cs @@ -913,11 +913,17 @@ namespace StardewModdingAPI.Inheritance // raise menu changed if (Game1.activeClickableMenu != this.PreviousActiveMenu) { + // raise events + IClickableMenu previousMenu = this.PreviousActiveMenu; + IClickableMenu newMenu = Game1.activeClickableMenu; if (Game1.activeClickableMenu != null) - MenuEvents.InvokeMenuChanged(this.Monitor, this.PreviousActiveMenu, Game1.activeClickableMenu); + MenuEvents.InvokeMenuChanged(this.Monitor, previousMenu, newMenu); else - MenuEvents.InvokeMenuClosed(this.Monitor, this.PreviousActiveMenu); - this.PreviousActiveMenu = Game1.activeClickableMenu; + MenuEvents.InvokeMenuClosed(this.Monitor, previousMenu); + + // update previous menu + // (if the menu was changed in one of the handlers, deliberately defer detection until the next update so mods can be notified of the new menu change) + this.PreviousActiveMenu = newMenu; } // raise location list changed -- cgit From 8416c9009e37def03ff894dc660dec34a05c0558 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 23 Dec 2016 12:36:03 -0500 Subject: increase deprecation levels for less-used deprecated code --- release-notes.md | 1 + src/StardewModdingAPI/Inheritance/SObject.cs | 2 +- src/StardewModdingAPI/LogWriter.cs | 2 +- src/StardewModdingAPI/Program.cs | 4 ++-- 4 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src/StardewModdingAPI/Inheritance') diff --git a/release-notes.md b/release-notes.md index 11f393bd..9eeae111 100644 --- a/release-notes.md +++ b/release-notes.md @@ -11,6 +11,7 @@ For players: For developers: * Deprecated `Version` in favour of `SemanticVersion`. _This new implementation is [semver 2.0](http://semver.org/)-compliant, introduces `NewerThan(version)` and `OlderThan(version)` convenience methods, adds support for parsing a version string into a `SemanticVersion`, and fixes various bugs with the former implementation._ + * Increased deprecation levels for `SObject`, `Extensions`, `LogWriter` (not `Log`), `SPlayer`, and `Mod.Entry(ModHelper)` (not `Mod.Entry(IModHelper)`). ## 1.4 See [log](https://github.com/Pathoschild/SMAPI/compare/1.3...1.4). diff --git a/src/StardewModdingAPI/Inheritance/SObject.cs b/src/StardewModdingAPI/Inheritance/SObject.cs index 4a218f33..eae5424d 100644 --- a/src/StardewModdingAPI/Inheritance/SObject.cs +++ b/src/StardewModdingAPI/Inheritance/SObject.cs @@ -49,7 +49,7 @@ namespace StardewModdingAPI.Inheritance *********/ public SObject() { - Program.DeprecationManager.Warn(nameof(SObject), "0.39.3", DeprecationLevel.Notice); + Program.DeprecationManager.Warn(nameof(SObject), "0.39.3", DeprecationLevel.Info); this.name = "Modded Item Name"; this.Description = "Modded Item Description"; diff --git a/src/StardewModdingAPI/LogWriter.cs b/src/StardewModdingAPI/LogWriter.cs index 11bcf5f3..058fa649 100644 --- a/src/StardewModdingAPI/LogWriter.cs +++ b/src/StardewModdingAPI/LogWriter.cs @@ -55,7 +55,7 @@ namespace StardewModdingAPI /// Raise a deprecation warning. private void WarnDeprecated() { - Program.DeprecationManager.Warn($"the {nameof(LogWriter)} class", "1.0", DeprecationLevel.Notice); + Program.DeprecationManager.Warn($"the {nameof(LogWriter)} class", "1.0", DeprecationLevel.Info); } } } \ No newline at end of file diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs index a48fa716..090098ca 100644 --- a/src/StardewModdingAPI/Program.cs +++ b/src/StardewModdingAPI/Program.cs @@ -542,9 +542,9 @@ namespace StardewModdingAPI // raise deprecation warning for old Entry() methods if (Program.DeprecationManager.IsVirtualMethodImplemented(mod.GetType(), typeof(Mod), nameof(Mod.Entry), new[] { typeof(object[]) })) - Program.DeprecationManager.Warn(manifest.Name, $"an old version of {nameof(Mod)}.{nameof(Mod.Entry)}", "1.0", DeprecationLevel.Notice); + Program.DeprecationManager.Warn(manifest.Name, $"{nameof(Mod)}.{nameof(Mod.Entry)}(object[]) instead of {nameof(Mod)}.{nameof(Mod.Entry)}({nameof(IModHelper)})", "1.0", DeprecationLevel.Notice); if (Program.DeprecationManager.IsVirtualMethodImplemented(mod.GetType(), typeof(Mod), nameof(Mod.Entry), new[] { typeof(ModHelper) })) - Program.DeprecationManager.Warn(manifest.Name, $"an old version of {nameof(Mod)}.{nameof(Mod.Entry)}", "1.1", DeprecationLevel.Notice); + Program.DeprecationManager.Warn(manifest.Name, $"{nameof(Mod)}.{nameof(Mod.Entry)}({nameof(ModHelper)}) instead of {nameof(Mod)}.{nameof(Mod.Entry)}({nameof(IModHelper)})", "1.1", DeprecationLevel.Info); } catch (Exception ex) { -- cgit