Decompiled source of Depth Perception v1.0.0

DepthPerception.dll

Decompiled 3 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BoneLib;
using BoneLib.BoneMenu;
using DepthPerception;
using MelonLoader;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(DPercept), "Depth Perception", "1.0.0", "AMOAM", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("DepthPerception")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DepthPerception")]
[assembly: AssemblyTitle("DepthPerception")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace DepthPerception;

public class DPercept : MelonMod
{
	private float camscale = 1f;

	private bool active = true;

	public override void OnInitializeMelon()
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		((MelonBase)this).OnInitializeMelon();
		Page val = Page.Root.CreatePage("Depth Perception", new Color(1f, 1f, 0f), 0, true);
		val.CreateFloat("DP Scale", Color.cyan, 1f, 0.2f, 0f, 10f, (Action<float>)DPChanged);
		val.CreateBool("Enabled", Color.green, true, (Action<bool>)EnabledChanged);
	}

	private void DPChanged(float newScale)
	{
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		camscale = newScale;
		MelonLogger.Msg("Depth Perception changed to " + camscale);
		if (active)
		{
			((Component)Player.ControllerRig).transform.Find("TrackingSpace/Headset").localScale = new Vector3(camscale, camscale, camscale);
		}
	}

	private void EnabledChanged(bool newEnabled)
	{
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		active = newEnabled;
		MelonLogger.Msg("Depth Perception " + (active ? "enabled" : "disabled"));
		((Component)Player.ControllerRig).transform.Find("TrackingSpace/Headset").localScale = (Vector3)(active ? new Vector3(camscale, camscale, camscale) : Vector3.one);
	}
}