-
Notifications
You must be signed in to change notification settings - Fork 0
/
Patcher.cs
50 lines (38 loc) · 1.42 KB
/
Patcher.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
using System.Reflection;
using HarmonyLib;
namespace BetterEducationToolbar {
public static class Patcher {
private const string HarmonyId = "t1a2l.BetterEducationToolbar";
private static bool patched = false;
public static void PatchAll() {
if (patched) return;
UnityEngine.Debug.Log("Better Education Toolbar: Patching...");
patched = true;
// Apply your patches here!
// Harmony.DEBUG = true;
var harmony = new Harmony("t1a2l.BetterEducationToolbar");
harmony.PatchAll(Assembly.GetExecutingAssembly());
}
public static void UnpatchAll() {
if (!patched) return;
var harmony = new Harmony(HarmonyId);
harmony.UnpatchAll(HarmonyId);
patched = false;
UnityEngine.Debug.Log("Better Education Toolbar: Reverted...");
}
}
// Random example patch
[HarmonyPatch(typeof(SimulationManager), "CreateRelay")]
public static class SimulationManagerCreateRelayPatch {
public static void Prefix() {
UnityEngine.Debug.Log("CreateRelay Prefix");
}
}
// Random example patch
[HarmonyPatch(typeof(LoadingManager), "MetaDataLoaded")]
public static class LoadingManagerMetaDataLoadedPatch {
public static void Prefix() {
UnityEngine.Debug.Log("MetaDataLoaded Prefix");
}
}
}