diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-02-24 17:54:31 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-02-24 17:54:31 -0500 |
commit | 414cf5c197b5b59776d3dda914eb15710efb0868 (patch) | |
tree | 0393a95194ad78cf4440c68657b0488b7db6d68b /src/SMAPI/Events/MenuEvents.cs | |
parent | 5da8b707385b9851ff3f6442de58519125f5c96f (diff) | |
parent | f2e8450706d1971d774f870081deffdb0c6b92eb (diff) | |
download | SMAPI-414cf5c197b5b59776d3dda914eb15710efb0868.tar.gz SMAPI-414cf5c197b5b59776d3dda914eb15710efb0868.tar.bz2 SMAPI-414cf5c197b5b59776d3dda914eb15710efb0868.zip |
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI/Events/MenuEvents.cs')
-rw-r--r-- | src/SMAPI/Events/MenuEvents.cs | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/src/SMAPI/Events/MenuEvents.cs b/src/SMAPI/Events/MenuEvents.cs index bd8d897e..7fcc3844 100644 --- a/src/SMAPI/Events/MenuEvents.cs +++ b/src/SMAPI/Events/MenuEvents.cs @@ -1,6 +1,5 @@ -using System; -using StardewModdingAPI.Framework; -using StardewValley.Menus; +using System; +using StardewModdingAPI.Framework.Events; namespace StardewModdingAPI.Events { @@ -8,33 +7,38 @@ namespace StardewModdingAPI.Events public static class MenuEvents { /********* + ** Properties + *********/ + /// <summary>The core event manager.</summary> + private static EventManager EventManager; + + + /********* ** Events *********/ /// <summary>Raised after a game menu is opened or replaced with another menu. This event is not invoked when a menu is closed.</summary> - public static event EventHandler<EventArgsClickableMenuChanged> MenuChanged; + public static event EventHandler<EventArgsClickableMenuChanged> MenuChanged + { + add => MenuEvents.EventManager.Menu_Changed.Add(value); + remove => MenuEvents.EventManager.Menu_Changed.Remove(value); + } /// <summary>Raised after a game menu is closed.</summary> - public static event EventHandler<EventArgsClickableMenuClosed> MenuClosed; + public static event EventHandler<EventArgsClickableMenuClosed> MenuClosed + { + add => MenuEvents.EventManager.Menu_Closed.Add(value); + remove => MenuEvents.EventManager.Menu_Closed.Remove(value); + } /********* - ** Internal methods + ** Public methods *********/ - /// <summary>Raise a <see cref="MenuChanged"/> event.</summary> - /// <param name="monitor">Encapsulates monitoring and logging.</param> - /// <param name="priorMenu">The previous menu.</param> - /// <param name="newMenu">The current menu.</param> - internal static void InvokeMenuChanged(IMonitor monitor, IClickableMenu priorMenu, IClickableMenu newMenu) - { - monitor.SafelyRaiseGenericEvent($"{nameof(MenuEvents)}.{nameof(MenuEvents.MenuChanged)}", MenuEvents.MenuChanged?.GetInvocationList(), null, new EventArgsClickableMenuChanged(priorMenu, newMenu)); - } - - /// <summary>Raise a <see cref="MenuClosed"/> event.</summary> - /// <param name="monitor">Encapsulates monitoring and logging.</param> - /// <param name="priorMenu">The menu that was closed.</param> - internal static void InvokeMenuClosed(IMonitor monitor, IClickableMenu priorMenu) + /// <summary>Initialise the events.</summary> + /// <param name="eventManager">The core event manager.</param> + internal static void Init(EventManager eventManager) { - monitor.SafelyRaiseGenericEvent($"{nameof(MenuEvents)}.{nameof(MenuEvents.MenuClosed)}", MenuEvents.MenuClosed?.GetInvocationList(), null, new EventArgsClickableMenuClosed(priorMenu)); + MenuEvents.EventManager = eventManager; } } } |