-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlugin.cs
More file actions
45 lines (33 loc) · 1.24 KB
/
Copy pathPlugin.cs
File metadata and controls
45 lines (33 loc) · 1.24 KB
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
using System.IO;
namespace PulseLib;
[BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]
public class Plugin : BaseUnityPlugin
{
// ReSharper disable once NullableWarningSuppressionIsUsed
internal static new ManualLogSource Logger = null!;
private readonly string _localizationPath = Path.Join(Paths.GameRootPath, "Localization");
private Harmony _harmony = new(MyPluginInfo.PLUGIN_GUID);
private void Awake()
{
Logger = base.Logger;
Logger.LogInfo($"Loading {MyPluginInfo.PLUGIN_NAME} version {MyPluginInfo.PLUGIN_VERSION}");
Setup();
Logger.LogInfo("Binding configuration");
Configuration.Bind(Config);
if (Configuration.LoadLocalizationFromDisk.Value)
{
Logger.LogInfo("Discovering localization");
CustomLocalizationHelper.SearchAndRegisterDirectory(_localizationPath);
}
Logger.LogInfo("Creating links to events");
_harmony.PatchAll(typeof(EventsLink));
Logger.LogInfo("Applying patches");
_harmony.PatchAll(typeof(CustomLocalizationPatch));
_harmony.PatchAll(typeof(MainMenuPatch));
Logger.LogInfo($"{MyPluginInfo.PLUGIN_NAME} loaded!");
}
private void Setup()
{
Directory.CreateDirectory(_localizationPath);
}
}