-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.cs
More file actions
51 lines (42 loc) · 1.38 KB
/
Main.cs
File metadata and controls
51 lines (42 loc) · 1.38 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
46
47
48
49
50
51
namespace WeatherElectric.OBSControl;
public class Main : MelonMod
{
internal const string Name = "OBSControl";
internal const string Description = "Control OBS from within BONELAB.";
internal const string Author = "Mabel Amber";
internal const string Company = "Weather Electric";
internal const string Version = "2.1.0";
internal const string DownloadLink = "https://thunderstore.io/c/bonelab/p/WeatherElectric/OBSControl/";
private static bool _rigExists;
internal static LoggerInstance Logger;
public override void OnInitializeMelon()
{
Logger = new LoggerInstance(LoggerInstance);
Preferences.Setup();
#if DEBUG
Logger.Log("This is a debug build!", LogLevel.Warning);
#endif
ObsBridge.OnConnected += OnOBSConnected;
Hooking.OnLevelLoaded += OnLevelLoaded;
Hooking.OnLevelUnloaded += OnLevelUnloaded;
BoneMenu.SetupBaseMenu();
}
private static void OnOBSConnected(object sender, EventArgs e)
{
BoneMenu.SetupObsControls();
}
public override void OnUpdate()
{
if (!_rigExists) return;
if (!ObsBridge.Connected) return;
ControlHandler.Update();
}
private static void OnLevelLoaded(LevelInfo levelInfo)
{
_rigExists = true;
}
private static void OnLevelUnloaded()
{
_rigExists = false;
}
}