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.Legacy_BeforeCreateSave.Add(value);
remove => SaveEvents.EventManager.Legacy_BeforeCreateSave.Remove(value);
}
/// Raised after the game finishes creating the save file.
public static event EventHandler AfterCreate
{
add => SaveEvents.EventManager.Legacy_AfterCreateSave.Add(value);
remove => SaveEvents.EventManager.Legacy_AfterCreateSave.Remove(value);
}
/// Raised before the game begins writes data to the save file.
public static event EventHandler BeforeSave
{
add => SaveEvents.EventManager.Legacy_BeforeSave.Add(value);
remove => SaveEvents.EventManager.Legacy_BeforeSave.Remove(value);
}
/// Raised after the game finishes writing data to the save file.
public static event EventHandler AfterSave
{
add => SaveEvents.EventManager.Legacy_AfterSave.Add(value);
remove => SaveEvents.EventManager.Legacy_AfterSave.Remove(value);
}
/// Raised after the player loads a save slot.
public static event EventHandler AfterLoad
{
add => SaveEvents.EventManager.Legacy_AfterLoad.Add(value);
remove => SaveEvents.EventManager.Legacy_AfterLoad.Remove(value);
}
/// Raised after the game returns to the title screen.
public static event EventHandler AfterReturnToTitle
{
add => SaveEvents.EventManager.Legacy_AfterReturnToTitle.Add(value);
remove => SaveEvents.EventManager.Legacy_AfterReturnToTitle.Remove(value);
}
/*********
** Public methods
*********/
/// Initialise the events.
/// The core event manager.
internal static void Init(EventManager eventManager)
{
SaveEvents.EventManager = eventManager;
}
}
}