Skip to content

Commit a567855

Browse files
authored
add event for GameLoader.LoadThread (#985)
1 parent 63e662e commit a567855

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Celeste.Mod.mm/Mod/Everest/Everest.Events.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,17 @@ internal static void CreateButtons(_OuiMainMenu menu, List<MenuButton> buttons)
9494
=> OnCreateButtons?.Invoke(menu, buttons);
9595
}
9696

97+
public static class GameLoader {
98+
/// <summary>
99+
/// Called at the end of the game loading thread, <see cref="GameLoader.LoadThread()"/>.<br/>
100+
/// In particular, it is called just before stopping the load timer and setting <c>loaded = true</c>.
101+
/// This event is invoked <b>only once</b>, when starting the game.
102+
/// </summary>
103+
public static event Action OnLoadThread;
104+
internal static void LoadThread()
105+
=> OnLoadThread?.Invoke();
106+
}
107+
97108
public static class LevelLoader {
98109
public delegate void LoadingThreadHandler(_Level level);
99110
/// <summary>

Celeste.Mod.mm/Patches/GameLoader.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,12 @@ private void LoadThread() {
121121
Console.WriteLine(" - FASTTEXTURELOADING LOAD: " + timer.ElapsedMilliseconds + "ms");
122122
timer.Stop();
123123

124+
Everest.Events.GameLoader.LoadThread();
125+
124126
Console.WriteLine("DONE LOADING (in " + Celeste.LoadTimer.ElapsedMilliseconds + "ms)");
125127
Celeste.LoadTimer.Stop();
126128
Celeste.LoadTimer = null;
129+
127130
loaded = true;
128131
}
129132

0 commit comments

Comments
 (0)