Decompiled source of CameraResetter v1.0.0

CameraResetter.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Microsoft.CodeAnalysis;
using PluginConfig.API;
using PluginConfig.API.Fields;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CameraResetter")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Resets the cameras rotation at the push of a button.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+2fea0ccce7dc39971f9e3262b923fd5100411a3a")]
[assembly: AssemblyProduct("CameraResetter")]
[assembly: AssemblyTitle("CameraResetter")]
[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 CameraResetter
{
	[BepInPlugin("Bryan_-000-.CameraResetter", "CameraResetter", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public PluginConfigurator config;

		public KeyCode CamRotBind;

		public bool UseSetOgCamRot;

		public KeyCode SetOgCamRot;

		public Vector3 OriginalCamRotation;

		public void Awake()
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Expected O, but got Unknown
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Expected O, but got Unknown
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Expected O, but got Unknown
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			config = PluginConfigurator.Create("CameraResetter", "Bryan_-000-.CameraResetter");
			config.SetIconWithURL("file://" + Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "icon.png"));
			KeyCodeField val = new KeyCodeField(config.rootPanel, "Reset Camera Position Bind", "rot_field", (KeyCode)112, true, true);
			BoolField val2 = new BoolField(config.rootPanel, "Use Set Original Cam Position Bind?", "useSet_field", false, true);
			KeyCodeField val3 = new KeyCodeField(config.rootPanel, "Set Original Cam Position Bind", "set_field", (KeyCode)108, true, true);
			val.onValueChange += (KeyCodeValueChangeEventDelegate)delegate(KeyCodeValueChangeEvent data)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				CamRotBind = data.value;
			};
			val2.onValueChange += (BoolValueChangeEventDelegate)delegate(BoolValueChangeEvent data)
			{
				UseSetOgCamRot = data.value;
			};
			val3.onValueChange += (KeyCodeValueChangeEventDelegate)delegate(KeyCodeValueChangeEvent data)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				SetOgCamRot = data.value;
			};
			CamRotBind = val.value;
			UseSetOgCamRot = val2.value;
			SetOgCamRot = val3.value;
			SceneManager.sceneLoaded += delegate
			{
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)MonoSingleton<NewMovement>.Instance != (Object)null)
				{
					OriginalCamRotation = new Vector3(MonoSingleton<CameraController>.Instance.rotationX, MonoSingleton<CameraController>.Instance.rotationY);
				}
			};
		}

		public void Update()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: 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)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)MonoSingleton<NewMovement>.Instance != (Object)null && Input.GetKeyDown(CamRotBind))
			{
				MonoSingleton<CameraController>.Instance.rotationX = OriginalCamRotation.x;
				MonoSingleton<CameraController>.Instance.rotationY = OriginalCamRotation.y;
			}
			if (UseSetOgCamRot && (Object)(object)MonoSingleton<NewMovement>.Instance != (Object)null && Input.GetKeyDown(SetOgCamRot))
			{
				OriginalCamRotation = new Vector3(MonoSingleton<CameraController>.Instance.rotationX, MonoSingleton<CameraController>.Instance.rotationY);
			}
		}
	}
}