-
Notifications
You must be signed in to change notification settings - Fork 0
/
TownieLib.cs
57 lines (51 loc) · 1.56 KB
/
TownieLib.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
using System;
namespace TownieLib
{
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
internal static class ModBuildInfo
{
public const string Name = "TownieLib";
public const string Author = "Shin";
public const string GUID = "dev.shinter.tos2.townielib";
public const string Version = "0.0.1";
public const string DownloadLink = "https://github.com/DjShinter/TownieLib/releases";
}
[BepInPlugin(ModBuildInfo.GUID, ModBuildInfo.Name, ModBuildInfo.Version)]
[BepInProcess("TownOfSalem2.exe")]
internal class LoadedTownieLib : BaseUnityPlugin
{
internal static LoadedTownieLib Instance;
internal static void LogInfo(object data)
{
Instance.Logger.LogInfo(data);
}
internal static void LogError(object data)
{
Instance.Logger.LogInfo(data);
}
private LoadedTownieLib()
{
if (Instance != null)
{
string errMsg = "This plugin should only have a single instance";
LogError(errMsg);
throw new System.InvalidOperationException(errMsg);
}
Instance = this;
}
public void Awake()
{
try
{
Harmony.CreateAndPatchAll(typeof(TownieApi));
LogInfo($"{nameof(LoadedTownieLib)} started successfully");
}
catch (Exception e)
{
Console.WriteLine(e);
}
}
}
}