From 5a3951e77c3ff384b9bdd11aba6b70b82958d88f Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 4 Nov 2016 15:29:55 -0400 Subject: simplify menu event logic (should have same effect) --- src/StardewModdingAPI/Inheritance/SGame.cs | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'src/StardewModdingAPI') 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 /// The active game menu at last check. public IClickableMenu PreviousActiveMenu { get; private set; } - /// Whether the event was raised in the last tick. - internal bool WasMenuClosedInvoked; - /// The mine level at last check. 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 -- cgit