using EventSystem.Framework; using StardewModdingAPI; using StardewModdingAPI.Events; namespace EventSystem { // TODO: Make Bed/Sleep Event. public class EventSystem : Mod { public static IModHelper ModHelper; public static IMonitor ModMonitor; public static EventManager eventManager; /// The mod entry point, called after the mod is first loaded. /// Provides simplified APIs for writing mods. public override void Entry(IModHelper helper) { ModHelper = this.Helper; ModMonitor = this.Monitor; helper.Events.GameLoop.UpdateTicked += this.OnUpdateTicked; helper.Events.GameLoop.SaveLoaded += this.OnSaveLoaded; } /// Raised after the player loads a save slot and the world is initialised. /// The event sender. /// The event arguments. private void OnSaveLoaded(object sender, SaveLoadedEventArgs e) { eventManager = new EventManager(); } /// Raised after the game state is updated (≈60 times per second). /// The event sender. /// The event arguments. private void OnUpdateTicked(object sender, UpdateTickedEventArgs e) { eventManager?.update(); } } }