-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.cs
53 lines (44 loc) · 1.17 KB
/
Main.cs
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
53
using MuseDashMirror;
using StricterJudge.Properties;
namespace StricterJudge;
public sealed partial class Main : MelonMod
{
internal static void QueueReload(object sender, FileSystemEventArgs e)
{
if (!SceneInfo.IsGameScene)
{
Reload();
return;
}
ReloadEvent = null;
ReloadEvent += Reload;
}
private static void Reload()
{
Load();
ReloadToggle();
Melon<Main>.Logger.Msg($"{MelonBuildInfo.ModName} reloaded successfully!");
}
private static event Action ReloadEvent;
public override void OnApplicationQuit()
{
DisableWatcherEvents();
base.OnApplicationQuit();
}
public override void OnInitializeMelon()
{
Load();
LoggerInstance.Msg($"{MelonBuildInfo.ModName} has loaded correctly!");
}
public override void OnLateInitializeMelon()
{
EnableWatcherEvents();
}
public override void OnSceneWasLoaded(int buildIndex, string sceneName)
{
// Reload if needed outside of GameMain
if (SceneInfo.IsGameScene) return;
ReloadEvent?.Invoke();
ReloadEvent = null;
}
}