-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathModCore.cs
61 lines (45 loc) · 1.35 KB
/
ModCore.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
54
55
56
57
58
59
60
61
using Mod.Loader;
using Mod.Properties;
using Mod.Utils;
using UnityEngine;
namespace Mod;
public static class ModCore
{
public const string MOD_DIRECTORY_NAME = "IntroSkipper";
public static IModLoader Loader { get; private set; } = null!;
public static void Init(IModLoader loader)
{
if (Loader is not null)
{
throw new Exception($"{BuildInfo.NAME} is already initialized");
}
Loader = loader;
SceneTracker.Init();
IntroSkipper.Init();
}
#region LOGGING
public static void Log(object message) => Log(message, LogType.Log);
public static void LogWarning(object message) => Log(message, LogType.Warning);
public static void LogError(object message) => Log(message, LogType.Error);
private static void Log(object message, LogType logType)
{
string log = message?.ToString() ?? "";
switch (logType)
{
case LogType.Log:
case LogType.Assert:
Loader.OnLogMessage(log);
break;
case LogType.Warning:
Loader.OnLogWarning(log);
break;
case LogType.Error:
case LogType.Exception:
Loader.OnLogError(log);
break;
default:
break;
}
}
#endregion
}