using System; using StardewValley.Menus; namespace StardewModdingAPI.Events { /// Events raised when a game menu is opened or closed (including internal menus like the title screen). public static class MenuEvents { /********* ** 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; /// Raised after a game menu is closed. public static event EventHandler MenuClosed; /********* ** Internal methods *********/ /// Raise a event. /// The previous menu. /// The current menu. internal static void InvokeMenuChanged(IClickableMenu priorMenu, IClickableMenu newMenu) { MenuEvents.MenuChanged?.Invoke(null, new EventArgsClickableMenuChanged(priorMenu, newMenu)); } /// Raise a event. /// The menu that was closed. internal static void InvokeMenuClosed(IClickableMenu priorMenu) { MenuEvents.MenuClosed?.Invoke(null, new EventArgsClickableMenuClosed(priorMenu)); } } }