using StardewModdingAPI.Events; namespace StardewModdingAPI.Framework.Events { /// Manages SMAPI events. internal class EventManager { /********* ** Events *********/ /**** ** Content ****/ /// public readonly ManagedEvent AssetRequested; /// public readonly ManagedEvent AssetsInvalidated; /// public readonly ManagedEvent AssetReady; /// public readonly ManagedEvent LocaleChanged; /**** ** Display ****/ /// public readonly ManagedEvent MenuChanged; /// public readonly ManagedEvent Rendering; /// public readonly ManagedEvent Rendered; /// public readonly ManagedEvent RenderingWorld; /// public readonly ManagedEvent RenderedWorld; /// public readonly ManagedEvent RenderingActiveMenu; /// public readonly ManagedEvent RenderedActiveMenu; /// public readonly ManagedEvent RenderingHud; /// public readonly ManagedEvent RenderedHud; /// public readonly ManagedEvent WindowResized; /**** ** Game loop ****/ /// public readonly ManagedEvent GameLaunched; /// public readonly ManagedEvent UpdateTicking; /// public readonly ManagedEvent UpdateTicked; /// public readonly ManagedEvent OneSecondUpdateTicking; /// public readonly ManagedEvent OneSecondUpdateTicked; /// public readonly ManagedEvent SaveCreating; /// public readonly ManagedEvent SaveCreated; /// public readonly ManagedEvent Saving; /// public readonly ManagedEvent Saved; /// public readonly ManagedEvent SaveLoaded; /// public readonly ManagedEvent DayStarted; /// public readonly ManagedEvent DayEnding; /// public readonly ManagedEvent TimeChanged; /// public readonly ManagedEvent ReturnedToTitle; /**** ** Input ****/ /// public readonly ManagedEvent ButtonsChanged; /// public readonly ManagedEvent ButtonPressed; /// public readonly ManagedEvent ButtonReleased; /// public readonly ManagedEvent CursorMoved; /// public readonly ManagedEvent MouseWheelScrolled; /**** ** Multiplayer ****/ /// public readonly ManagedEvent PeerContextReceived; /// public readonly ManagedEvent PeerConnected; /// public readonly ManagedEvent ModMessageReceived; /// public readonly ManagedEvent PeerDisconnected; /**** ** Player ****/ /// public readonly ManagedEvent InventoryChanged; /// public readonly ManagedEvent LevelChanged; /// public readonly ManagedEvent Warped; /**** ** World ****/ /// public readonly ManagedEvent LocationListChanged; /// public readonly ManagedEvent BuildingListChanged; /// public readonly ManagedEvent DebrisListChanged; /// public readonly ManagedEvent LargeTerrainFeatureListChanged; /// public readonly ManagedEvent NpcListChanged; /// public readonly ManagedEvent ObjectListChanged; /// public readonly ManagedEvent ChestInventoryChanged; /// public readonly ManagedEvent TerrainFeatureListChanged; /// public readonly ManagedEvent FurnitureListChanged; /**** ** Specialized ****/ /// public readonly ManagedEvent LoadStageChanged; /// public readonly ManagedEvent UnvalidatedUpdateTicking; /// public readonly ManagedEvent UnvalidatedUpdateTicked; /********* ** Public methods *********/ /// Construct an instance. /// The mod registry with which to identify mods. public EventManager(ModRegistry modRegistry) { // create shortcut initializers ManagedEvent ManageEventOf(string typeName, string eventName) { return new ManagedEvent($"{typeName}.{eventName}", modRegistry); } // init events this.AssetRequested = ManageEventOf(nameof(IModEvents.Content), nameof(IContentEvents.AssetRequested)); this.AssetsInvalidated = ManageEventOf(nameof(IModEvents.Content), nameof(IContentEvents.AssetsInvalidated)); this.AssetReady = ManageEventOf(nameof(IModEvents.Content), nameof(IContentEvents.AssetReady)); this.LocaleChanged = ManageEventOf(nameof(IModEvents.Content), nameof(IContentEvents.LocaleChanged)); this.MenuChanged = ManageEventOf(nameof(IModEvents.Display), nameof(IDisplayEvents.MenuChanged)); this.Rendering = ManageEventOf(nameof(IModEvents.Display), nameof(IDisplayEvents.Rendering)); this.Rendered = ManageEventOf(nameof(IModEvents.Display), nameof(IDisplayEvents.Rendered)); this.RenderingWorld = ManageEventOf(nameof(IModEvents.Display), nameof(IDisplayEvents.RenderingWorld)); this.RenderedWorld = ManageEventOf(nameof(IModEvents.Display), nameof(IDisplayEvents.RenderedWorld)); this.RenderingActiveMenu = ManageEventOf(nameof(IModEvents.Display), nameof(IDisplayEvents.RenderingActiveMenu)); this.RenderedActiveMenu = ManageEventOf(nameof(IModEvents.Display), nameof(IDisplayEvents.RenderedActiveMenu)); this.RenderingHud = ManageEventOf(nameof(IModEvents.Display), nameof(IDisplayEvents.RenderingHud)); this.RenderedHud = ManageEventOf(nameof(IModEvents.Display), nameof(IDisplayEvents.RenderedHud)); this.WindowResized = ManageEventOf(nameof(IModEvents.Display), nameof(IDisplayEvents.WindowResized)); this.GameLaunched = ManageEventOf(nameof(IModEvents.GameLoop), nameof(IGameLoopEvents.GameLaunched)); this.UpdateTicking = ManageEventOf(nameof(IModEvents.GameLoop), nameof(IGameLoopEvents.UpdateTicking)); this.UpdateTicked = ManageEventOf(nameof(IModEvents.GameLoop), nameof(IGameLoopEvents.UpdateTicked)); this.OneSecondUpdateTicking = ManageEventOf(nameof(IModEvents.GameLoop), nameof(IGameLoopEvents.OneSecondUpdateTicking)); this.OneSecondUpdateTicked = ManageEventOf(nameof(IModEvents.GameLoop), nameof(IGameLoopEvents.OneSecondUpdateTicked)); this.SaveCreating = ManageEventOf(nameof(IModEvents.GameLoop), nameof(IGameLoopEvents.SaveCreating)); this.SaveCreated = ManageEventOf(nameof(IModEvents.GameLoop), nameof(IGameLoopEvents.SaveCreated)); this.Saving = ManageEventOf(nameof(IModEvents.GameLoop), nameof(IGameLoopEvents.Saving)); this.Saved = ManageEventOf(nameof(IModEvents.GameLoop), nameof(IGameLoopEvents.Saved)); this.SaveLoaded = ManageEventOf(nameof(IModEvents.GameLoop), nameof(IGameLoopEvents.SaveLoaded)); this.DayStarted = ManageEventOf(nameof(IModEvents.GameLoop), nameof(IGameLoopEvents.DayStarted)); this.DayEnding = ManageEventOf(nameof(IModEvents.GameLoop), nameof(IGameLoopEvents.DayEnding)); this.TimeChanged = ManageEventOf(nameof(IModEvents.GameLoop), nameof(IGameLoopEvents.TimeChanged)); this.ReturnedToTitle = ManageEventOf(nameof(IModEvents.GameLoop), nameof(IGameLoopEvents.ReturnedToTitle)); this.ButtonsChanged = ManageEventOf(nameof(IModEvents.Input), nameof(IInputEvents.ButtonsChanged)); this.ButtonPressed = ManageEventOf(nameof(IModEvents.Input), nameof(IInputEvents.ButtonPressed)); this.ButtonReleased = ManageEventOf(nameof(IModEvents.Input), nameof(IInputEvents.ButtonReleased)); this.CursorMoved = ManageEventOf(nameof(IModEvents.Input), nameof(IInputEvents.CursorMoved)); this.MouseWheelScrolled = ManageEventOf(nameof(IModEvents.Input), nameof(IInputEvents.MouseWheelScrolled)); this.PeerContextReceived = ManageEventOf(nameof(IModEvents.Multiplayer), nameof(IMultiplayerEvents.PeerContextReceived)); this.PeerConnected = ManageEventOf(nameof(IModEvents.Multiplayer), nameof(IMultiplayerEvents.PeerConnected)); this.ModMessageReceived = ManageEventOf(nameof(IModEvents.Multiplayer), nameof(IMultiplayerEvents.ModMessageReceived)); this.PeerDisconnected = ManageEventOf(nameof(IModEvents.Multiplayer), nameof(IMultiplayerEvents.PeerDisconnected)); this.InventoryChanged = ManageEventOf(nameof(IModEvents.Player), nameof(IPlayerEvents.InventoryChanged)); this.LevelChanged = ManageEventOf(nameof(IModEvents.Player), nameof(IPlayerEvents.LevelChanged)); this.Warped = ManageEventOf(nameof(IModEvents.Player), nameof(IPlayerEvents.Warped)); this.BuildingListChanged = ManageEventOf(nameof(IModEvents.World), nameof(IWorldEvents.LocationListChanged)); this.DebrisListChanged = ManageEventOf(nameof(IModEvents.World), nameof(IWorldEvents.DebrisListChanged)); this.LargeTerrainFeatureListChanged = ManageEventOf(nameof(IModEvents.World), nameof(IWorldEvents.LargeTerrainFeatureListChanged)); this.LocationListChanged = ManageEventOf(nameof(IModEvents.World), nameof(IWorldEvents.BuildingListChanged)); this.NpcListChanged = ManageEventOf(nameof(IModEvents.World), nameof(IWorldEvents.NpcListChanged)); this.ObjectListChanged = ManageEventOf(nameof(IModEvents.World), nameof(IWorldEvents.ObjectListChanged)); this.ChestInventoryChanged = ManageEventOf(nameof(IModEvents.World), nameof(IWorldEvents.ChestInventoryChanged)); this.TerrainFeatureListChanged = ManageEventOf(nameof(IModEvents.World), nameof(IWorldEvents.TerrainFeatureListChanged)); this.FurnitureListChanged = ManageEventOf(nameof(IModEvents.World), nameof(IWorldEvents.FurnitureListChanged)); this.LoadStageChanged = ManageEventOf(nameof(IModEvents.Specialized), nameof(ISpecializedEvents.LoadStageChanged)); this.UnvalidatedUpdateTicking = ManageEventOf(nameof(IModEvents.Specialized), nameof(ISpecializedEvents.UnvalidatedUpdateTicking)); this.UnvalidatedUpdateTicked = ManageEventOf(nameof(IModEvents.Specialized), nameof(ISpecializedEvents.UnvalidatedUpdateTicked)); } } }