-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPlugin.cs
More file actions
39 lines (27 loc) · 998 Bytes
/
Copy pathPlugin.cs
File metadata and controls
39 lines (27 loc) · 998 Bytes
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
using HarmonyLib;
using System.Security.Permissions;
using UnityEngine;
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
namespace ContentLib;
[ContentWarningPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_VERSION, false)]
public class Plugin {
internal static Harmony? Harmony { get; set; }
public static bool PluginLoaded = false;
public static bool shopInitialized = false;
static Plugin() {
Patch();
PluginLoaded = true;
Logger.LogInfo($"{MyPluginInfo.PLUGIN_GUID} v{MyPluginInfo.PLUGIN_VERSION} has loaded!");
}
internal static void Patch() {
Harmony ??= new Harmony(MyPluginInfo.PLUGIN_GUID);
Logger.LogDebug("Patching...");
Harmony.PatchAll();
Logger.LogDebug("Finished patching!");
}
internal static void Unpatch() {
Logger.LogDebug("Unpatching...");
Harmony?.UnpatchSelf();
Logger.LogDebug("Finished unpatching!");
}
}