-
Notifications
You must be signed in to change notification settings - Fork 23
/
LightManagerPlugin.cs
43 lines (38 loc) · 1.12 KB
/
LightManagerPlugin.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
using BepInEx;
using BepInEx.Harmony;
using HarmonyLib;
using KKAPI.Studio.SaveLoad;
using UnityEngine;
namespace KeelPlugins
{
[BepInDependency(KKAPI.KoikatuAPI.GUID)]
[BepInProcess(KoikatuConstants.StudioProcessName)]
[BepInPlugin(GUID, "Light Manager", Version)]
public class LightManagerPlugin : BaseUnityPlugin
{
public const string GUID = "keelhauled.lightmanager";
public const string Version = "1.0.0." + BuildNumber.Version;
private Harmony harmony;
private static GameObject bepinex;
private void Awake()
{
bepinex = gameObject;
harmony = HarmonyWrapper.PatchAll(typeof(Hooks));
StudioSaveLoadApi.RegisterExtraBehaviour<SceneDataController>(GUID);
}
#if DEBUG
private void OnDestroy()
{
harmony.UnpatchAll();
}
#endif
private class Hooks
{
[HarmonyPrefix, HarmonyPatch(typeof(StudioScene), "Start")]
public static void Entrypoint()
{
bepinex.GetOrAddComponent<LightManager>();
}
}
}
}