-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlugin.cs
57 lines (47 loc) · 1.73 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
using HarmonyLib;
using ImBlindedByTheLights.HarmonyPatches;
using ImBlindedByTheLights.UI;
using IPA;
using IPA.Config.Stores;
using System.Reflection;
using UnityEngine.SceneManagement;
using IPALogger = IPA.Logging.Logger;
// BeatmapDataLoader::GetBeatmapDataFromBeatmapSaveData
/*
if (beatmapData.beatmapEventsData.Count == 0) {
beatmapData.AddBeatmapEventData(new BeatmapEventData(0f, BeatmapEventType.Event0, 1, 1f));
beatmapData.AddBeatmapEventData(new BeatmapEventData(0f, BeatmapEventType.Event4, 1, 1f));
}
*/
namespace ImBlindedByTheLights {
[Plugin(RuntimeOptions.SingleStartInit)]
public class Plugin {
internal static Plugin Instance { get; private set; }
internal static IPALogger Log { get; private set; }
internal static Harmony harmony { get; private set; }
[Init]
public void Init(IPALogger logger, IPA.Config.Config conf) {
Instance = this;
Log = logger;
Config.Instance = conf.Generated<Config>();
}
[OnStart]
public void OnApplicationStart() {
harmony = new Harmony("Kinsi55.BeatSaber.ImBlindedByTheLights");
harmony.PatchAll(Assembly.GetExecutingAssembly());
SceneManager.activeSceneChanged += SceneManager_activeSceneChanged;
BeatSaberMarkupLanguage.GameplaySetup.GameplaySetup.instance.AddTab("BlindedByTheLights", "ImBlindedByTheLights.UI.GamePlaySetupTab.bsml", new MAN());
}
private void SceneManager_activeSceneChanged(Scene arg0, Scene arg1) {
if(Config.Instance.enablePlugin && arg1.name == "GameCore" && (Config.Instance.staticInHeadset || Config.Instance.staticOnDesktop)) {
SharedCoroutineStarter.instance.StartCoroutine(LightSwitch.Init());
} else {
LightSwitch.Clear();
}
}
[OnExit]
public void OnApplicationQuit() {
harmony.UnpatchSelf();
}
}
}