#if !SMAPI_3_0_STRICT using System; using StardewModdingAPI.Framework; using StardewModdingAPI.Framework.Events; namespace StardewModdingAPI.Events { /// Events raised when a game menu is opened or closed (including internal menus like the title screen). [Obsolete("Use " + nameof(Mod.Helper) + "." + nameof(IModHelper.Events) + " instead. See https://smapi.io/3.0 for more info.")] public static class MenuEvents { /********* ** Properties *********/ /// The core event manager. private static EventManager EventManager; /// Manages deprecation warnings. private static DeprecationManager DeprecationManager; /********* ** Events *********/ /// Raised after a game menu is opened or replaced with another menu. This event is not invoked when a menu is closed. public static event EventHandler MenuChanged { add { MenuEvents.DeprecationManager.WarnForOldEvents(); MenuEvents.EventManager.Legacy_MenuChanged.Add(value); } remove => MenuEvents.EventManager.Legacy_MenuChanged.Remove(value); } /// Raised after a game menu is closed. public static event EventHandler MenuClosed { add { MenuEvents.DeprecationManager.WarnForOldEvents(); MenuEvents.EventManager.Legacy_MenuClosed.Add(value); } remove => MenuEvents.EventManager.Legacy_MenuClosed.Remove(value); } /********* ** Public methods *********/ /// Initialise the events. /// The core event manager. /// Manages deprecation warnings. internal static void Init(EventManager eventManager, DeprecationManager deprecationManager) { MenuEvents.EventManager = eventManager; MenuEvents.DeprecationManager = deprecationManager; } } } #endif