using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BoneLib;
using BoneLib.BoneMenu;
using BoneLib.Notifications;
using MelonLoader;
using MelonLoader.Preferences;
using MelonLoader.Utils;
using Microsoft.CodeAnalysis;
using OBSWebsocketDotNet.Types;
using OBSWebsocketDotNet.Types.Events;
using UnityEngine;
using UnityEngine.Diagnostics;
using WeatherElectric.OBSBridge.OBS;
using WeatherElectric.OBSControl;
using WeatherElectric.OBSControl.Handlers;
using WeatherElectric.OBSControl.Melon;
using WeatherElectric.OBSControl.Menu;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Control OBS from within BONELAB.")]
[assembly: AssemblyDescription("Control OBS from within BONELAB.")]
[assembly: AssemblyCompany("Weather Electric")]
[assembly: AssemblyProduct("OBSControl")]
[assembly: AssemblyCopyright("Developed by Mabel Amber")]
[assembly: AssemblyTrademark("Weather Electric")]
[assembly: AssemblyFileVersion("2.0.0")]
[assembly: MelonInfo(typeof(Main), "OBSControl", "2.0.0", "Mabel Amber", "https://thunderstore.io/c/bonelab/p/SoulWithMae/OBSControl/")]
[assembly: MelonColor(255, 0, 0, 255)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyVersion("2.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace WeatherElectric.OBSControl
{
internal static class ControlHandler
{
private static bool _isFirstTap;
private static float _doubleTapTimer;
public static void Update()
{
if (!ObsBridge.Connected || !ObsBridge.ReplayBufferActive)
{
return;
}
switch (Preferences.ReplayControlHand.Value)
{
case ControlHand.Left:
HandleLeft();
break;
case ControlHand.Right:
HandleRight();
break;
case ControlHand.Both:
HandleBoth();
break;
default:
throw new ArgumentOutOfRangeException();
}
if (_isFirstTap)
{
_doubleTapTimer += Time.deltaTime;
if (_doubleTapTimer > Preferences.DoubleTapTime.Value)
{
_isFirstTap = false;
}
}
static void HandleBoth()
{
if (Player.RightController._menuTap || Player.LeftController._menuTap)
{
if (!_isFirstTap)
{
_isFirstTap = true;
_doubleTapTimer = 0f;
}
else if (_doubleTapTimer < Preferences.DoubleTapTime.Value)
{
ObsBridge.SaveReplayBuffer();
NotificationHandler.SendNotif(NotificationHandler.ReplaySaved);
_isFirstTap = false;
}
}
}
static void HandleLeft()
{
if (Player.LeftController._menuTap)
{
if (!_isFirstTap)
{
_isFirstTap = true;
_doubleTapTimer = 0f;
}
else if (_doubleTapTimer < Preferences.DoubleTapTime.Value)
{
ObsBridge.SaveReplayBuffer();
NotificationHandler.SendNotif(NotificationHandler.ReplaySaved);
_isFirstTap = false;
}
}
}
static void HandleRight()
{
if (Player.RightController._menuTap)
{
if (!_isFirstTap)
{
_isFirstTap = true;
_doubleTapTimer = 0f;
}
else if (_doubleTapTimer < Preferences.DoubleTapTime.Value)
{
ObsBridge.SaveReplayBuffer();
NotificationHandler.SendNotif(NotificationHandler.ReplaySaved);
_isFirstTap = false;
}
}
}
}
}
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.0.0";
internal const string DownloadLink = "https://thunderstore.io/c/bonelab/p/SoulWithMae/OBSControl/";
private static bool _rigExists;
public override void OnInitializeMelon()
{
ModConsole.Setup(((MelonBase)this).LoggerInstance);
Preferences.Setup();
ObsBridge.OnConnected = (Action<object, EventArgs>)Delegate.Combine(ObsBridge.OnConnected, new Action<object, EventArgs>(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 && ObsBridge.Connected)
{
ControlHandler.Update();
}
}
private static void OnLevelLoaded(LevelInfo levelInfo)
{
_rigExists = true;
}
private static void OnLevelUnloaded()
{
_rigExists = false;
}
}
}
namespace WeatherElectric.OBSControl.Melon
{
internal static class ModConsole
{
private static Instance _logger;
public static void Setup(Instance loggerInstance)
{
_logger = loggerInstance;
}
public static void Msg(object obj, int loggingMode = 0)
{
string text = ((loggingMode == 1) ? $"[DEBUG] {obj}" : obj.ToString());
ConsoleColor consoleColor = ((loggingMode == 1) ? ConsoleColor.Yellow : ConsoleColor.Gray);
if (Preferences.LoggingMode.Value >= loggingMode)
{
_logger.Msg(consoleColor, text);
}
}
public static void Msg(string txt, int loggingMode = 0)
{
string text = ((loggingMode == 1) ? ("[DEBUG] " + txt) : txt);
ConsoleColor consoleColor = ((loggingMode == 1) ? ConsoleColor.Yellow : ConsoleColor.Gray);
if (Preferences.LoggingMode.Value >= loggingMode)
{
_logger.Msg(consoleColor, text);
}
}
public static void Msg(ConsoleColor txtcolor, object obj, int loggingMode = 0)
{
string text = ((loggingMode == 1) ? $"[DEBUG] {obj}" : obj.ToString());
if (Preferences.LoggingMode.Value >= loggingMode)
{
_logger.Msg(txtcolor, text);
}
}
public static void Msg(ConsoleColor txtcolor, string txt, int loggingMode = 0)
{
string text = ((loggingMode == 1) ? ("[DEBUG] " + txt) : txt);
if (Preferences.LoggingMode.Value >= loggingMode)
{
_logger.Msg(txtcolor, text);
}
}
public static void Msg(string txt, int loggingMode = 0, params object[] args)
{
string text = ((loggingMode == 1) ? ("[DEBUG] " + txt) : txt);
ConsoleColor consoleColor = ((loggingMode == 1) ? ConsoleColor.Yellow : ConsoleColor.Gray);
if (Preferences.LoggingMode.Value >= loggingMode)
{
_logger.Msg(consoleColor, text, args);
}
}
public static void Msg(ConsoleColor txtcolor, string txt, int loggingMode = 0, params object[] args)
{
string text = ((loggingMode == 1) ? ("[DEBUG] " + txt) : txt);
if (Preferences.LoggingMode.Value >= loggingMode)
{
_logger.Msg(txtcolor, text, args);
}
}
public static void Error(object obj, int loggingMode = 0)
{
string text = ((loggingMode == 1) ? $"[DEBUG] {obj}" : obj.ToString());
if (Preferences.LoggingMode.Value >= loggingMode)
{
_logger.Error(text);
}
}
public static void Error(string txt, int loggingMode = 0)
{
string text = ((loggingMode == 1) ? ("[DEBUG] " + txt) : txt);
if (Preferences.LoggingMode.Value >= loggingMode)
{
_logger.Error(text);
}
}
public static void Error(string txt, int loggingMode = 0, params object[] args)
{
string text = ((loggingMode == 1) ? ("[DEBUG] " + txt) : txt);
if (Preferences.LoggingMode.Value >= loggingMode)
{
_logger.Error(text, args);
}
}
public static void Warning(object obj, int loggingMode = 0)
{
string text = ((loggingMode == 1) ? $"[DEBUG] {obj}" : obj.ToString());
if (Preferences.LoggingMode.Value >= loggingMode)
{
_logger.Warning(text);
}
}
public static void Warning(string txt, int loggingMode = 0)
{
string text = ((loggingMode == 1) ? ("[DEBUG] " + txt) : txt);
if (Preferences.LoggingMode.Value >= loggingMode)
{
_logger.Warning(text);
}
}
public static void Warning(string txt, int loggingMode = 0, params object[] args)
{
string text = ((loggingMode == 1) ? ("[DEBUG] " + txt) : txt);
if (Preferences.LoggingMode.Value >= loggingMode)
{
_logger.Warning(text, args);
}
}
}
internal static class Preferences
{
public static readonly MelonPreferences_Category GlobalCategory = MelonPreferences.CreateCategory("Global");
public static readonly MelonPreferences_Category OwnCategory = MelonPreferences.CreateCategory("OBSControl");
public static MelonPreferences_Entry<int> LoggingMode { get; set; }
public static MelonPreferences_Entry<bool> ShowNotifications { get; set; }
public static MelonPreferences_Entry<ControlHand> ReplayControlHand { get; set; }
public static MelonPreferences_Entry<float> DoubleTapTime { get; set; }
public static void Setup()
{
LoggingMode = GlobalCategory.GetEntry<int>("LoggingMode") ?? GlobalCategory.CreateEntry<int>("LoggingMode", 0, "Logging Mode", "The level of logging to use. 0 = Important Only, 1 = All", false, false, (ValueValidator)null, (string)null);
GlobalCategory.SetFilePath(MelonEnvironment.UserDataDirectory + "/WeatherElectric.cfg");
GlobalCategory.SaveToFile(false);
ShowNotifications = OwnCategory.CreateEntry<bool>("ShowNotifications", true, "Show Notifications", "Whether to show notifications when OBS events occur.", false, false, (ValueValidator)null, (string)null);
ReplayControlHand = OwnCategory.CreateEntry<ControlHand>("ReplayControlHand", ControlHand.Right, "Replay Control Hand", "The hand to use for saving replays. Left = Left hand, Right = Right hand, Both = Both hands.", false, false, (ValueValidator)null, (string)null);
DoubleTapTime = OwnCategory.CreateEntry<float>("DoubleTapTime", 0.3f, "Double Tap Time", "The time to wait between taps to trigger saving a replay.", false, false, (ValueValidator)null, (string)null);
OwnCategory.SetFilePath(MelonEnvironment.UserDataDirectory + "/WeatherElectric.cfg");
OwnCategory.SaveToFile(false);
ModConsole.Msg("Finished preferences setup for OBSControl", 1);
}
}
internal enum ControlHand
{
Left,
Right,
Both
}
}
namespace WeatherElectric.OBSControl.Handlers
{
internal static class NotificationHandler
{
public static Notification SceneChanged { get; } = new Notification
{
Title = NotificationText.op_Implicit("Scene Changed"),
Message = NotificationText.op_Implicit("Scene has been changed."),
Type = (NotificationType)0,
PopupLength = 1f,
ShowTitleOnPopup = true
};
public static Notification RecordingStarted { get; } = new Notification
{
Title = NotificationText.op_Implicit("Recording Started"),
Message = NotificationText.op_Implicit("Recording has started."),
Type = (NotificationType)0,
PopupLength = 1f,
ShowTitleOnPopup = true
};
public static Notification RecordingStopped { get; } = new Notification
{
Title = NotificationText.op_Implicit("Recording Stopped"),
Message = NotificationText.op_Implicit("Recording has stopped."),
Type = (NotificationType)0,
PopupLength = 1f,
ShowTitleOnPopup = true
};
public static Notification RecordingPaused { get; } = new Notification
{
Title = NotificationText.op_Implicit("Recording Paused"),
Message = NotificationText.op_Implicit("Recording has been paused."),
Type = (NotificationType)0,
PopupLength = 1f,
ShowTitleOnPopup = true
};
public static Notification RecordingResumed { get; } = new Notification
{
Title = NotificationText.op_Implicit("Recording Resumed"),
Message = NotificationText.op_Implicit("Recording has been resumed."),
Type = (NotificationType)0,
PopupLength = 1f,
ShowTitleOnPopup = true
};
public static Notification StreamStarted { get; } = new Notification
{
Title = NotificationText.op_Implicit("Stream Started"),
Message = NotificationText.op_Implicit("Stream has started."),
Type = (NotificationType)0,
PopupLength = 1f,
ShowTitleOnPopup = true
};
public static Notification StreamStopped { get; } = new Notification
{
Title = NotificationText.op_Implicit("Stream Stopped"),
Message = NotificationText.op_Implicit("Stream has stopped."),
Type = (NotificationType)0,
PopupLength = 1f,
ShowTitleOnPopup = true
};
public static Notification ReplayBufferStarted { get; } = new Notification
{
Title = NotificationText.op_Implicit("Replay Buffer Started"),
Message = NotificationText.op_Implicit("Replay buffer has started."),
Type = (NotificationType)0,
PopupLength = 1f,
ShowTitleOnPopup = true
};
public static Notification ReplayBufferStopped { get; } = new Notification
{
Title = NotificationText.op_Implicit("Replay Buffer Stopped"),
Message = NotificationText.op_Implicit("Replay buffer has stopped."),
Type = (NotificationType)0,
PopupLength = 1f,
ShowTitleOnPopup = true
};
public static Notification ReplaySaved { get; } = new Notification
{
Title = NotificationText.op_Implicit("Replay Saved"),
Message = NotificationText.op_Implicit("Replay has been saved."),
Type = (NotificationType)0,
PopupLength = 1f,
ShowTitleOnPopup = true
};
public static void SendNotif(Notification notification)
{
if (Preferences.ShowNotifications.Value)
{
Notifier.Send(notification);
}
}
}
}
namespace WeatherElectric.OBSControl.Menu
{
internal static class BoneMenu
{
private static Page _subCat;
private static FunctionElement _recordButton;
private static FunctionElement _pauseButton;
private static FunctionElement _streamButton;
private static FunctionElement _replayButton;
private static FunctionElement _connectButton;
private static Page _scenesPanel;
private static readonly Dictionary<string, FunctionElement> SceneButtons = new Dictionary<string, FunctionElement>();
public static void SetupBaseMenu()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
_subCat = Page.Root.CreatePage("<color=#6FBDFF>Weather Electric</color>", Color.cyan, 0, true).CreatePage("<color=#284cb8>OBSControl</color>", Color.white, 0, true);
_connectButton = _subCat.CreateFunction("If you see this, it failed to connect.", Color.red, (Action)delegate
{
Utils.ForceCrash((ForcedCrashCategory)0);
});
}
public static void SetupObsControls()
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_020f: Unknown result type (might be due to invalid IL or missing references)
//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0260: Unknown result type (might be due to invalid IL or missing references)
//IL_0272: Unknown result type (might be due to invalid IL or missing references)
//IL_028e: Unknown result type (might be due to invalid IL or missing references)
//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
_subCat.Remove((Element)(object)_connectButton);
Page obj = _subCat.CreatePage("Record", Color.green, 0, true);
_recordButton = obj.CreateFunction("Record Button", Color.green, (Action)delegate
{
if (ObsBridge.RecordActive)
{
ObsBridge.StopRecording();
NotificationHandler.SendNotif(NotificationHandler.RecordingStopped);
}
else
{
ObsBridge.StartRecording();
NotificationHandler.SendNotif(NotificationHandler.RecordingStarted);
}
});
SetRecordButton(ObsBridge.RecordActive);
_pauseButton = obj.CreateFunction("Pause Button", Color.yellow, (Action)delegate
{
if (ObsBridge.RecordPaused)
{
ObsBridge.ResumeRecording();
NotificationHandler.SendNotif(NotificationHandler.RecordingResumed);
}
else
{
ObsBridge.PauseRecording();
NotificationHandler.SendNotif(NotificationHandler.RecordingPaused);
}
});
SetPauseButton(ObsBridge.RecordPaused);
_streamButton = _subCat.CreatePage("Stream", Color.blue, 0, true).CreateFunction("Stream Button", Color.blue, (Action)delegate
{
if (ObsBridge.StreamActive)
{
ObsBridge.StopStreaming();
NotificationHandler.SendNotif(NotificationHandler.StreamStopped);
}
else
{
ObsBridge.StartStreaming();
NotificationHandler.SendNotif(NotificationHandler.StreamStarted);
}
});
SetStreamButton(ObsBridge.StreamActive);
Page obj2 = _subCat.CreatePage("Replay", Color.yellow, 0, true);
_replayButton = obj2.CreateFunction("Replay Button", Color.blue, (Action)delegate
{
if (ObsBridge.ReplayBufferActive)
{
ObsBridge.StopReplayBuffer();
NotificationHandler.SendNotif(NotificationHandler.ReplayBufferStopped);
}
else
{
ObsBridge.StartReplayBuffer();
NotificationHandler.SendNotif(NotificationHandler.ReplayBufferStarted);
}
});
SetReplayButton(ObsBridge.ReplayBufferActive);
obj2.CreateFunction("Save Replay", Color.blue, (Action)delegate
{
ObsBridge.SaveReplayBuffer();
NotificationHandler.SendNotif(NotificationHandler.ReplaySaved);
});
_scenesPanel = _subCat.CreatePage("Scenes", Color.red, 0, true);
List<SceneBasicInfo> scenes = ObsBridge.GetScenes();
ModConsole.Msg("Finding scenes", 1);
foreach (SceneBasicInfo scene in scenes)
{
ModConsole.Msg("Found scene: " + scene.Name, 1);
string activeScene = ObsBridge.GetActiveScene();
Color val = Color.white;
if (scene.Name == activeScene)
{
val = Color.cyan;
}
FunctionElement value = _scenesPanel.CreateFunction(scene.Name, val, (Action)delegate
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
ObsBridge.SetScene(scene.Name);
NotificationHandler.SceneChanged.Message = NotificationText.op_Implicit("Scene changed to " + scene.Name);
NotificationHandler.SendNotif(NotificationHandler.SceneChanged);
});
SceneButtons.Add(scene.Name, value);
}
Page obj3 = _subCat.CreatePage("Settings", Color.gray, 0, true);
obj3.CreateBoolPreference("Show Notifications", Color.white, Preferences.ShowNotifications, Preferences.OwnCategory);
obj3.CreateEnum("Replay Control Hand", Color.white, (Enum)Preferences.ReplayControlHand.Value, (Action<Enum>)delegate(Enum v)
{
Preferences.ReplayControlHand.Value = (ControlHand)(object)v;
Preferences.OwnCategory.SaveToFile(false);
});
obj3.CreateFloatPreference("Double Tap Time", Color.white, 0.1f, 0.1f, 1f, Preferences.DoubleTapTime, Preferences.OwnCategory);
ConnectHooks();
}
private static void ConnectHooks()
{
ObsBridge.OnRecordStateChanged = (Action<object, RecordStateChangedEventArgs>)Delegate.Combine(ObsBridge.OnRecordStateChanged, new Action<object, RecordStateChangedEventArgs>(RecordStatusChanged));
ObsBridge.OnStreamStateChanged = (Action<object, StreamStateChangedEventArgs>)Delegate.Combine(ObsBridge.OnStreamStateChanged, new Action<object, StreamStateChangedEventArgs>(StreamStatusChanged));
ObsBridge.OnReplayBufferStateChanged = (Action<object, ReplayBufferStateChangedEventArgs>)Delegate.Combine(ObsBridge.OnReplayBufferStateChanged, new Action<object, ReplayBufferStateChangedEventArgs>(ReplayStatusChanged));
ObsBridge.OnSceneCreated = (Action<object, SceneCreatedEventArgs>)Delegate.Combine(ObsBridge.OnSceneCreated, new Action<object, SceneCreatedEventArgs>(SceneCreated));
ObsBridge.OnSceneRemoved = (Action<object, SceneRemovedEventArgs>)Delegate.Combine(ObsBridge.OnSceneRemoved, new Action<object, SceneRemovedEventArgs>(SceneDeleted));
ObsBridge.OnSceneChanged = (Action<object, ProgramSceneChangedEventArgs>)Delegate.Combine(ObsBridge.OnSceneChanged, new Action<object, ProgramSceneChangedEventArgs>(SceneChanged));
}
private static void RecordStatusChanged(object sender, RecordStateChangedEventArgs e)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected I4, but got Unknown
OutputState state = ((OutputStateChanged)e.OutputState).State;
switch ((int)state)
{
case 0:
case 1:
SetRecordButton(isRecording: true);
break;
case 2:
case 3:
SetRecordButton(isRecording: false);
break;
case 4:
SetPauseButton(isPaused: true);
break;
case 5:
SetPauseButton(isPaused: false);
break;
default:
throw new ArgumentOutOfRangeException();
}
}
private static void StreamStatusChanged(object sender, StreamStateChangedEventArgs e)
{
SetStreamButton(e.OutputState.IsActive);
}
private static void ReplayStatusChanged(object sender, ReplayBufferStateChangedEventArgs e)
{
SetReplayButton(e.OutputState.IsActive);
}
private static void SceneChanged(object sender, ProgramSceneChangedEventArgs e)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
foreach (KeyValuePair<string, FunctionElement> sceneButton in SceneButtons)
{
((Element)sceneButton.Value).ElementColor = Color.white;
}
((Element)SceneButtons[e.SceneName]).ElementColor = Color.cyan;
}
private static void SceneCreated(object sender, SceneCreatedEventArgs e)
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
ModConsole.Msg("Scene created: " + e.SceneName, 1);
FunctionElement value = _scenesPanel.CreateFunction(e.SceneName, Color.white, (Action)delegate
{
ObsBridge.SetScene(e.SceneName);
});
SceneButtons.Add(e.SceneName, value);
}
private static void SceneDeleted(object sender, SceneRemovedEventArgs e)
{
ModConsole.Msg("Scene deleted: " + e.SceneName, 1);
FunctionElement val = SceneButtons[e.SceneName];
if (val != null)
{
_scenesPanel.Remove((Element)(object)val);
SceneButtons.Remove(e.SceneName);
}
else
{
ModConsole.Msg("Scene " + e.SceneName + " not found in dictionary", 1);
}
}
private static void SetRecordButton(bool isRecording)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
if (isRecording)
{
((Element)_recordButton).ElementColor = Color.red;
((Element)_recordButton).ElementName = "Stop Recording";
}
else
{
((Element)_recordButton).ElementColor = Color.green;
((Element)_recordButton).ElementName = "Start Recording";
}
}
private static void SetPauseButton(bool isPaused)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
if (isPaused)
{
((Element)_pauseButton).ElementColor = Color.white;
((Element)_pauseButton).ElementName = "Resume Recording";
}
else
{
((Element)_pauseButton).ElementColor = Color.yellow;
((Element)_pauseButton).ElementName = "Pause Recording";
}
}
private static void SetStreamButton(bool isStreaming)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
if (isStreaming)
{
((Element)_streamButton).ElementColor = Color.red;
((Element)_streamButton).ElementName = "Stop Streaming";
}
else
{
((Element)_streamButton).ElementColor = Color.green;
((Element)_streamButton).ElementName = "Start Streaming";
}
}
private static void SetReplayButton(bool isReplayActive)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
if (isReplayActive)
{
((Element)_replayButton).ElementColor = Color.red;
((Element)_replayButton).ElementName = "Stop Replay Buffer";
}
else
{
((Element)_replayButton).ElementColor = Color.green;
((Element)_replayButton).ElementName = "Start Replay Buffer";
}
}
}
internal static class BoneMenuExtensions
{
public static BoolElement CreateBoolPreference(this Page category, string name, Color color, MelonPreferences_Entry<bool> pref, MelonPreferences_Category prefCategory, bool autoSave = true)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
return category.CreateBool(name, color, pref.Value, (Action<bool>)delegate(bool v)
{
pref.Value = v;
if (autoSave)
{
prefCategory.SaveToFile(false);
}
});
}
public static FloatElement CreateFloatPreference(this Page category, string name, Color color, float increment, float min, float max, MelonPreferences_Entry<float> pref, MelonPreferences_Category prefCategory, bool autoSave = true)
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
return category.CreateFloat(name, color, pref.Value, increment, min, max, (Action<float>)delegate(float v)
{
pref.Value = v;
if (autoSave)
{
prefCategory.SaveToFile(false);
}
});
}
public static IntElement CreateIntPreference(this Page category, string name, Color color, int increment, int min, int max, MelonPreferences_Entry<int> pref, MelonPreferences_Category prefCategory, bool autoSave = true)
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
return category.CreateInt(name, color, pref.Value, increment, min, max, (Action<int>)delegate(int v)
{
pref.Value = v;
if (autoSave)
{
prefCategory.SaveToFile(false);
}
});
}
public static EnumElement CreateEnumPreference(this Page category, string name, Color color, Enum pref, MelonPreferences_Category prefCategory, bool autoSave = true)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
return category.CreateEnum(name, color, pref, (Action<Enum>)delegate(Enum v)
{
pref = v;
if (autoSave)
{
prefCategory.SaveToFile(false);
}
});
}
}
}