-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathPlugin.cs
62 lines (50 loc) · 1.67 KB
/
Plugin.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
62
using HarmonyLib;
using IPA;
using IPA.Config;
using IPA.Config.Stores;
using IPA.Loader;
using IPALogger = IPA.Logging.Logger;
using JDFixer.Installers;
using SiraUtil.Zenject;
namespace JDFixer
{
[Plugin(RuntimeOptions.DynamicInit)]
public sealed class Plugin
{
public static Harmony harmony;
//internal static string game_version = "";
internal static IPALogger Log { get; private set; }
[Init]
public Plugin(IPALogger logger, Config conf, Zenjector zenjector)
{
Plugin.Log = logger;
PluginConfig.Instance = conf.Generated<PluginConfig>();
zenjector.Install<JDFixerMenuInstaller>(Location.Menu);
//TimeSetup.Inject(zenjector);
}
[OnEnable]
public void OnApplicationStart()
{
//Plugin.Log.Debug("OnApplicationStart()");
//game_version = IPA.Utilities.UnityGame.GameVersion.ToString();
//Plugin.Log.Debug(game_version);
harmony = new Harmony("com.zephyr.BeatSaber.JDFixer");
//TimeSetup.Patch();
harmony.PatchAll(System.Reflection.Assembly.GetExecutingAssembly());
CheckForCustomCampaigns();
UI.Donate.Refresh_Text();
}
[OnDisable]
public void OnApplicationQuit()
{
PluginConfig.Instance.Changed();
harmony.UnpatchSelf();
}
internal static bool CheckForCustomCampaigns()
{
var cc_installed = PluginManager.GetPluginFromId("CustomCampaigns");
Plugin.Log.Debug("CC installed: " + cc_installed);
return cc_installed != null;
}
}
}