Decompiled source of CameraFOV v1.0.0

CameraFOV.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BoneLib;
using BoneLib.BoneMenu;
using CameraFOV;
using MelonLoader;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Core), "CameraFOV", "1.0.0", "Prodiacy", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("CameraFOV")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CameraFOV")]
[assembly: AssemblyTitle("CameraFOV")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 CameraFOV
{
	public class Core : MelonMod
	{
		private bool FOVEnabled;

		private bool FindCameraInUpdate;

		private int FOVSet = 100;

		private Camera camera;

		public override void OnInitializeMelon()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			Hooking.OnLevelLoaded += FindCamera;
			Page obj = Page.Root.CreatePage("CameraFOV", Color.cyan, 0, true);
			obj.CreateBool("Enable CameraFOV", Color.cyan, false, (Action<bool>)delegate(bool v)
			{
				FOVEnabled = v;
			});
			obj.CreateInt("FOV Value", Color.cyan, 100, 1, 1, 150, (Action<int>)delegate(int v)
			{
				FOVSet = v;
			});
		}

		public override void OnUpdate()
		{
			if (FindCameraInUpdate)
			{
				camera = ((Component)Player.RigManager).GetComponentInChildren<Camera>(true);
				if ((Object)(object)camera != (Object)null && FindCameraInUpdate)
				{
					FindCameraInUpdate = false;
					MelonLogger.Msg("Found Camera! Try fov");
				}
				else if ((Object)(object)camera == (Object)null)
				{
					int num = 0;
					num++;
					MelonLogger.Msg($"Trying again.. {num}");
				}
			}
			if ((Object)(object)camera != (Object)null && FOVEnabled)
			{
				camera.fieldOfView = FOVSet;
			}
			else if (!FOVEnabled && (Object)(object)camera != (Object)null)
			{
				camera.fieldOfView = 100f;
			}
		}

		private void FindCamera(LevelInfo levelInfo)
		{
			camera = ((Component)Player.RigManager).GetComponentInChildren<Camera>(true);
			if ((Object)(object)camera == (Object)null)
			{
				MelonLogger.Msg("Camera Couldnt be found in current scene. Trying again");
				camera = ((Component)Player.RigManager).GetComponentInChildren<Camera>(true);
				if ((Object)(object)camera == (Object)null)
				{
					MelonLogger.Msg("Camera couldnt be found, trying again.");
					FindCameraInUpdate = true;
				}
				else if ((Object)(object)camera != (Object)null)
				{
					MelonLogger.Msg("Found Camera! Try fov");
					camera.fieldOfView = FOVSet;
				}
			}
			else if ((Object)(object)camera != (Object)null)
			{
				camera.fieldOfView = FOVSet;
			}
		}
	}
}