using System;
using StardewModdingAPI.Events;
namespace StardewModdingAPI.Framework.Events
{
/// Events linked to the game's update loop. The update loop runs roughly ≈60 times/second to run game logic like state changes, action handling, etc. These can be useful, but you should consider more semantic events like if possible.
internal class ModGameLoopEvents : ModEventsBase, IGameLoopEvents
{
/*********
** Accessors
*********/
/// Raised after the game is launched, right before the first update tick.
public event EventHandler GameLaunched
{
add => this.EventManager.GameLaunched.Add(value);
remove => this.EventManager.GameLaunched.Remove(value);
}
/// Raised before the game performs its overall update tick (≈60 times per second).
public event EventHandler UpdateTicking
{
add => this.EventManager.UpdateTicking.Add(value);
remove => this.EventManager.UpdateTicking.Remove(value);
}
/// Raised after the game performs its overall update tick (≈60 times per second).
public event EventHandler UpdateTicked
{
add => this.EventManager.UpdateTicked.Add(value);
remove => this.EventManager.UpdateTicked.Remove(value);
}
/// Raised once per second before the game state is updated.
public event EventHandler OneSecondUpdateTicking
{
add => this.EventManager.OneSecondUpdateTicking.Add(value);
remove => this.EventManager.OneSecondUpdateTicking.Remove(value);
}
/// Raised once per second after the game state is updated.
public event EventHandler OneSecondUpdateTicked
{
add => this.EventManager.OneSecondUpdateTicked.Add(value);
remove => this.EventManager.OneSecondUpdateTicked.Remove(value);
}
/// Raised before the game creates a new save file.
public event EventHandler SaveCreating
{
add => this.EventManager.SaveCreating.Add(value);
remove => this.EventManager.SaveCreating.Remove(value);
}
/// Raised after the game finishes creating the save file.
public event EventHandler SaveCreated
{
add => this.EventManager.SaveCreated.Add(value);
remove => this.EventManager.SaveCreated.Remove(value);
}
/// Raised before the game begins writes data to the save file.
public event EventHandler Saving
{
add => this.EventManager.Saving.Add(value);
remove => this.EventManager.Saving.Remove(value);
}
/// Raised after the game finishes writing data to the save file.
public event EventHandler Saved
{
add => this.EventManager.Saved.Add(value);
remove => this.EventManager.Saved.Remove(value);
}
/// Raised after the player loads a save slot and the world is initialized.
public event EventHandler SaveLoaded
{
add => this.EventManager.SaveLoaded.Add(value);
remove => this.EventManager.SaveLoaded.Remove(value);
}
/// Raised after the game begins a new day (including when the player loads a save).
public event EventHandler DayStarted
{
add => this.EventManager.DayStarted.Add(value);
remove => this.EventManager.DayStarted.Remove(value);
}
/// Raised before the game ends the current day. This happens before it starts setting up the next day and before .
public event EventHandler DayEnding
{
add => this.EventManager.DayEnding.Add(value);
remove => this.EventManager.DayEnding.Remove(value);
}
/// Raised after the in-game clock time changes.
public event EventHandler TimeChanged
{
add => this.EventManager.TimeChanged.Add(value);
remove => this.EventManager.TimeChanged.Remove(value);
}
/// Raised after the game returns to the title screen.
public event EventHandler ReturnedToTitle
{
add => this.EventManager.ReturnedToTitle.Add(value);
remove => this.EventManager.ReturnedToTitle.Remove(value);
}
/*********
** Public methods
*********/
/// Construct an instance.
/// The mod which uses this instance.
/// The underlying event manager.
internal ModGameLoopEvents(IModMetadata mod, EventManager eventManager)
: base(mod, eventManager) { }
}
}