Decompiled source of Mirror v1.0.1

Mods/Mirror.dll

Decompiled 4 days ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppRUMBLE.Interactions.InteractionBase;
using Il2CppRUMBLE.Managers;
using Il2CppRUMBLE.Utilities;
using MelonLoader;
using Microsoft.CodeAnalysis;
using Mirror;
using RumbleModdingAPI;
using UnityEngine;
using UnityEngine.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(MirrorClass), "Mirror", "1.0.1", "UlvakSkillz", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: MelonColor(255, 195, 0, 255)]
[assembly: MelonAuthorColor(255, 195, 0, 255)]
[assembly: VerifyLoaderVersion(0, 6, 6, true)]
[assembly: AssemblyDescription("Creates a Mirror for the Dressing Room and Parks")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3b03f008-9dbb-4382-a110-b59ee8b632ca")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("Mirror")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Mirror")]
[assembly: AssemblyTitle("Mirror")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace Mirror
{
	public static class BuildInfo
	{
		public const string ModName = "Mirror";

		public const string ModVersion = "1.0.1";

		public const string Description = "Creates a Mirror for the Dressing Room and Parks";

		public const string Author = "UlvakSkillz";

		public const string Company = "";
	}
	public class MirrorClass : MelonMod
	{
		private string currentScene = "Loader";

		private bool mirrorToggled = false;

		private GameObject ddolMirror;

		private GameObject mirror;

		private GameObject camera;

		public GameObject LoadAssetBundle(string bundleName, string objectName)
		{
			using Stream stream = ((MelonBase)this).MelonAssembly.Assembly.GetManifestResourceStream(bundleName);
			byte[] array = new byte[stream.Length];
			stream.Read(array, 0, array.Length);
			Il2CppAssetBundle val = Il2CppAssetBundleManager.LoadFromMemory(Il2CppStructArray<byte>.op_Implicit(array));
			return Object.Instantiate<GameObject>(val.LoadAsset<GameObject>(objectName));
		}

		public override void OnLateInitializeMelon()
		{
			Calls.onMapInitialized += loadMirror;
			ddolMirror = LoadAssetBundle("Mirror.mirror", "Mirror");
			ddolMirror.SetActive(false);
			((Object)ddolMirror).name = "Mirror";
			Object.DontDestroyOnLoad((Object)(object)ddolMirror);
		}

		public override void OnSceneWasLoaded(int buildIndex, string sceneName)
		{
			currentScene = sceneName;
			mirrorToggled = false;
		}

		private void loadMirror()
		{
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			if (currentScene == "Gym" || currentScene == "Park")
			{
				mirror = Object.Instantiate<GameObject>(ddolMirror);
				GameObject val = Create.NewButton();
				((Object)val).name = "Mirror Toggle";
				if (currentScene == "Gym")
				{
					mirror.transform.position = new Vector3(-1.4f, 1f, 0.3f);
					mirror.transform.rotation = Quaternion.Euler(0f, 223f, 0f);
					val.transform.position = new Vector3(-1.69f, 1.3f, -2.09f);
					val.transform.rotation = Quaternion.Euler(90f, 0.6424f, 0f);
				}
				else
				{
					mirror.transform.position = new Vector3(-13.5155f, -5.1345f, -8.6418f);
					mirror.transform.rotation = Quaternion.Euler(0f, 62.2366f, 0f);
					val.transform.position = new Vector3(-12.0155f, -5.2345f, -9.0418f);
					val.transform.rotation = Quaternion.Euler(90f, 334.3802f, 0f);
				}
				camera = ((Component)mirror.transform.GetChild(1)).gameObject;
				((Component)val.transform.GetChild(0)).gameObject.GetComponent<InteractionButton>().onPressed.AddListener(UnityAction.op_Implicit((Action)delegate
				{
					mirrorToggled = !mirrorToggled;
					mirror.SetActive(mirrorToggled);
				}));
			}
		}

		public override void OnFixedUpdate()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			if (mirrorToggled)
			{
				Vector3 val = mirror.transform.InverseTransformPoint(((Component)Singleton<PlayerManager>.instance.localPlayer.Controller).gameObject.transform.GetChild(1).GetChild(0).position);
				camera.transform.position = mirror.transform.TransformPoint(new Vector3(val.x, val.y, 0f - val.z));
				Vector3 val2 = mirror.transform.TransformPoint(new Vector3(0f - val.x, val.y, val.z));
				camera.transform.LookAt(val2);
			}
		}
	}
}