diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2016-11-04 15:29:55 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2016-11-04 15:29:55 -0400 |
commit | 5a3951e77c3ff384b9bdd11aba6b70b82958d88f (patch) | |
tree | de1f93ac16bb1472918514ebd02b7533700cf7ad /src | |
parent | 810479fc8ba9044796c231bf4637519de3ea89e4 (diff) | |
download | SMAPI-5a3951e77c3ff384b9bdd11aba6b70b82958d88f.tar.gz SMAPI-5a3951e77c3ff384b9bdd11aba6b70b82958d88f.tar.bz2 SMAPI-5a3951e77c3ff384b9bdd11aba6b70b82958d88f.zip |
simplify menu event logic (should have same effect)
Diffstat (limited to 'src')
-rw-r--r-- | src/StardewModdingAPI/Inheritance/SGame.cs | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/StardewModdingAPI/Inheritance/SGame.cs b/src/StardewModdingAPI/Inheritance/SGame.cs index 8f751bc7..92109f8b 100644 --- a/src/StardewModdingAPI/Inheritance/SGame.cs +++ b/src/StardewModdingAPI/Inheritance/SGame.cs @@ -104,9 +104,6 @@ namespace StardewModdingAPI.Inheritance /// <summary>The active game menu at last check.</summary> public IClickableMenu PreviousActiveMenu { get; private set; } - /// <summary>Whether the <see cref="MenuEvents.MenuClosed"/> event was raised in the last tick.</summary> - internal bool WasMenuClosedInvoked; - /// <summary>The mine level at last check.</summary> public int PreviousMineLevel { get; private set; } @@ -936,18 +933,13 @@ namespace StardewModdingAPI.Inheritance } // raise menu changed - if (Game1.activeClickableMenu != null && Game1.activeClickableMenu != this.PreviousActiveMenu) + if (Game1.activeClickableMenu != this.PreviousActiveMenu) { - MenuEvents.InvokeMenuChanged(this.PreviousActiveMenu, Game1.activeClickableMenu); + if (Game1.activeClickableMenu != null) + MenuEvents.InvokeMenuChanged(this.PreviousActiveMenu, Game1.activeClickableMenu); + else + MenuEvents.InvokeMenuClosed(this.PreviousActiveMenu); this.PreviousActiveMenu = Game1.activeClickableMenu; - this.WasMenuClosedInvoked = false; - } - - // raise menu closed - if (!this.WasMenuClosedInvoked && this.PreviousActiveMenu != null && Game1.activeClickableMenu == null) - { - MenuEvents.InvokeMenuClosed(this.PreviousActiveMenu); - this.WasMenuClosedInvoked = true; } // raise location list changed |