using System; using StardewModdingAPI.Framework.Events; namespace StardewModdingAPI.Events { /// Events raised before and after the player saves/loads the game. public static class SaveEvents { /********* ** Properties *********/ /// The core event manager. private static EventManager EventManager; /********* ** Events *********/ /// Raised before the game creates the save file. public static event EventHandler BeforeCreate { add => SaveEvents.EventManager.Save_BeforeCreate.Add(value); remove => SaveEvents.EventManager.Save_BeforeCreate.Remove(value); } /// Raised after the game finishes creating the save file. public static event EventHandler AfterCreate { add => SaveEvents.EventManager.Save_AfterCreate.Add(value); remove => SaveEvents.EventManager.Save_AfterCreate.Remove(value); } /// Raised before the game begins writes data to the save file. public static event EventHandler BeforeSave { add => SaveEvents.EventManager.Save_BeforeSave.Add(value); remove => SaveEvents.EventManager.Save_BeforeSave.Remove(value); } /// Raised after the game finishes writing data to the save file. public static event EventHandler AfterSave { add => SaveEvents.EventManager.Save_AfterSave.Add(value); remove => SaveEvents.EventManager.Save_AfterSave.Remove(value); } /// Raised after the player loads a save slot. public static event EventHandler AfterLoad { add => SaveEvents.EventManager.Save_AfterLoad.Add(value); remove => SaveEvents.EventManager.Save_AfterLoad.Remove(value); } /// Raised after the game returns to the title screen. public static event EventHandler AfterReturnToTitle { add => SaveEvents.EventManager.Save_AfterReturnToTitle.Add(value); remove => SaveEvents.EventManager.Save_AfterReturnToTitle.Remove(value); } /********* ** Public methods *********/ /// Initialise the events. /// The core event manager. internal static void Init(EventManager eventManager) { SaveEvents.EventManager = eventManager; } } }