summaryrefslogtreecommitdiff
path: root/src/SMAPI/Events/IGameLoopEvents.cs
blob: 52bac3f830b9019f84a8805f5f5126f694057de9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#nullable disable

using System;

namespace StardewModdingAPI.Events
{
    /// <summary>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 <see cref="IInputEvents"/> if possible.</summary>
    public interface IGameLoopEvents
    {
        /// <summary>Raised after the game is launched, right before the first update tick. This happens once per game session (unrelated to loading saves). All mods are loaded and initialized at this point, so this is a good time to set up mod integrations.</summary>
        event EventHandler<GameLaunchedEventArgs> GameLaunched;

        /// <summary>Raised before the game state is updated (≈60 times per second).</summary>
        event EventHandler<UpdateTickingEventArgs> UpdateTicking;

        /// <summary>Raised after the game state is updated (≈60 times per second).</summary>
        event EventHandler<UpdateTickedEventArgs> UpdateTicked;

        /// <summary>Raised once per second before the game state is updated.</summary>
        event EventHandler<OneSecondUpdateTickingEventArgs> OneSecondUpdateTicking;

        /// <summary>Raised once per second after the game state is updated.</summary>
        event EventHandler<OneSecondUpdateTickedEventArgs> OneSecondUpdateTicked;

        /// <summary>Raised before the game creates a new save file.</summary>
        event EventHandler<SaveCreatingEventArgs> SaveCreating;

        /// <summary>Raised after the game finishes creating the save file.</summary>
        event EventHandler<SaveCreatedEventArgs> SaveCreated;

        /// <summary>Raised before the game begins writing data to the save file (except the initial save creation).</summary>
        event EventHandler<SavingEventArgs> Saving;

        /// <summary>Raised after the game finishes writing data to the save file (except the initial save creation).</summary>
        event EventHandler<SavedEventArgs> Saved;

        /// <summary>Raised after the player loads a save slot and the world is initialized.</summary>
        event EventHandler<SaveLoadedEventArgs> SaveLoaded;

        /// <summary>Raised after the game begins a new day (including when the player loads a save).</summary>
        event EventHandler<DayStartedEventArgs> DayStarted;

        /// <summary>Raised before the game ends the current day. This happens before it starts setting up the next day and before <see cref="Saving"/>.</summary>
        event EventHandler<DayEndingEventArgs> DayEnding;

        /// <summary>Raised after the in-game clock time changes.</summary>
        event EventHandler<TimeChangedEventArgs> TimeChanged;

        /// <summary>Raised after the game returns to the title screen.</summary>
        event EventHandler<ReturnedToTitleEventArgs> ReturnedToTitle;
    }
}