Decompiled source of ChromaCam v1.0.0

ChromaCam.dll

Decompiled 8 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Reptile;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("ChromaCam")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+731db2996e75261093f73656bc7f4ec62edf422a")]
[assembly: AssemblyProduct("ChromaCam")]
[assembly: AssemblyTitle("ChromaCam")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[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 ChromaCam
{
	[BepInPlugin("trpg.brc.chromacam", "ChromaCam", "1.0.0")]
	public class Core : BaseUnityPlugin
	{
		public const string PluginGUID = "trpg.brc.chromacam";

		public const string PluginName = "ChromaCam";

		public const string PluginVersion = "1.0.0";

		public static ConfigEntry<KeyCode> toggleKey;

		public static ConfigEntry<Color> bgColor;

		private void Awake()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			toggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "Toggle Key", (KeyCode)61, (ConfigDescription)null);
			bgColor = ((BaseUnityPlugin)this).Config.Bind<Color>("General", "Background Color", Color.green, (ConfigDescription)null);
		}

		private void Update()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Invalid comparison between Unknown and I4
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKeyDown(toggleKey.Value) && Core.Instance.BaseModule.IsPlayingInStage && !Core.Instance.BaseModule.IsLoading)
			{
				Camera value = Traverse.Create((object)WorldHandler.instance.GetCurrentPlayer()).Field("cam").Field<Camera>("cam")
					.Value;
				if ((int)value.clearFlags != 2)
				{
					value.clearFlags = (CameraClearFlags)2;
					value.backgroundColor = bgColor.Value;
					value.cullingMask = 32768;
				}
				else
				{
					value.clearFlags = (CameraClearFlags)1;
					value.backgroundColor = EffectsUI.niceBlack;
					value.cullingMask = -1292392941;
				}
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "ChromaCam";

		public const string PLUGIN_NAME = "ChromaCam";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}