Decompiled source of MirrorVision v1.0.0

bitmotte.MirrorVision.dll

Decompiled 18 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PluginConfig.API;
using PluginConfig.API.Decorators;
using PluginConfig.API.Fields;
using PluginConfig.API.Functionals;
using TMPro;
using ULTRAKILL.Cheats;
using ULTRAKILL.Portal;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.AddressableAssets.ResourceLocators;
using UnityEngine.Events;
using UnityEngine.ResourceManagement.ResourceLocations;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[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("bitmotte.MirrorVision")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MirrorVision")]
[assembly: AssemblyTitle("bitmotte.MirrorVision")]
[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;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class ExtensionMarkerAttribute : Attribute
	{
		public ExtensionMarkerAttribute(string name)
		{
		}
	}
}
namespace ModTechnicalName
{
	public static class Configurator
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static OnClick <0>__OpenDiscord;
		}

		public static ButtonField joinDC;

		public static FloatSliderField offset;

		public static EnumField<Directions> direction;

		public static BoolField spin;

		public static FloatSliderField spinX;

		public static FloatSliderField spinY;

		public static FloatSliderField spinZ;

		public static PluginConfigurator CreateConfigurator()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Expected O, but got Unknown
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Expected O, but got Unknown
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Expected O, but got Unknown
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Expected O, but got Unknown
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Expected O, but got Unknown
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Expected O, but got Unknown
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Expected O, but got Unknown
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Expected O, but got Unknown
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Expected O, but got Unknown
			PluginConfigurator val = PluginConfigurator.Create("MirrorVision", "bitmotte.MirrorVision");
			ConfigSpace val2 = new ConfigSpace(val.rootPanel, 15f);
			ConfigHeader val3 = new ConfigHeader(val.rootPanel, "Main", 24);
			direction = new EnumField<Directions>(val.rootPanel, "Direction", "direction", Directions.Right);
			offset = new FloatSliderField(val.rootPanel, "Offset", "offset", new Tuple<float, float>(0f, 10f), 1.5f);
			ConfigSpace val4 = new ConfigSpace(val.rootPanel, 15f);
			ConfigHeader val5 = new ConfigHeader(val.rootPanel, "Spin", 24);
			spin = new BoolField(val.rootPanel, "Spin", "spin", false);
			spinX = new FloatSliderField(val.rootPanel, "X Speed", "spinX", new Tuple<float, float>(-360f, 360f), 0f);
			spinY = new FloatSliderField(val.rootPanel, "Y Speed", "spinY", new Tuple<float, float>(-360f, 360f), 1f);
			spinZ = new FloatSliderField(val.rootPanel, "Z Speed", "spinZ", new Tuple<float, float>(-360f, 360f), 0f);
			ConfigSpace val6 = new ConfigSpace(val.rootPanel, 15f);
			ConfigHeader val7 = new ConfigHeader(val.rootPanel, "Join my discord for sneak peeks,devlogs,and the possibility to test my mods early ! !", 20, (TextAlignmentOptions)513);
			joinDC = new ButtonField(val.rootPanel, "Join my Discord ! ! !", "join_dc");
			ButtonField obj = joinDC;
			object obj2 = <>O.<0>__OpenDiscord;
			if (obj2 == null)
			{
				OnClick val8 = OpenDiscord;
				<>O.<0>__OpenDiscord = val8;
				obj2 = (object)val8;
			}
			obj.onClick += (OnClick)obj2;
			return val;
		}

		private static void OpenDiscord()
		{
			Process.Start("http://discord.gg/pVdr9e6hZ8");
		}
	}
	public class DownStacker : EnemyScript
	{
		public Transform playerPos;

		public GameObject blindEvent;

		public GameObject unblindEvent;

		private Rigidbody rb;

		private EnemyIdentifier eid;

		private bool dead = false;

		private bool blindState = false;

		public void Death()
		{
			dead = true;
		}

		private void Awake()
		{
			rb = ((Component)this).GetComponent<Rigidbody>();
			eid = ((Component)this).GetComponent<EnemyIdentifier>();
		}

		private void FixedUpdate()
		{
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			if (dead)
			{
				return;
			}
			if (BlindEnemies.Blind && !blindState)
			{
				blindEvent.SetActive(true);
				blindState = true;
				return;
			}
			if (!BlindEnemies.Blind && blindState)
			{
				unblindEvent.SetActive(true);
				blindState = false;
			}
			if (!blindState)
			{
				if (rb.velocity.y > 0f)
				{
					rb.velocity = new Vector3(rb.velocity.x, 0f, rb.velocity.z);
				}
				PointAttacksAtPlayer();
			}
		}

		private void PointAttacksAtPlayer()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			playerPos.position = MonoSingleton<PlayerTracker>.Instance.Position;
		}
	}
	public class VerticalShockwave : MonoBehaviour
	{
		private void Start()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.eulerAngles = new Vector3(((Component)this).transform.eulerAngles.x, ((Component)this).transform.eulerAngles.y, 90f);
		}
	}
	public class FollowPositionConfig : MonoBehaviour
	{
		private void FixedUpdate()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.localPosition = new Vector3(Configurator.offset.value, 0f, 0f);
		}
	}
	public enum Directions
	{
		Forward,
		Backward,
		Right,
		Left,
		Up,
		Down
	}
	public class FollowRotationConfig : MonoBehaviour
	{
		private Vector3 forward = new Vector3(0f, -90f, 0f);

		private Vector3 backward = new Vector3(0f, -270f, 0f);

		private Vector3 right = new Vector3(0f, 0f, 0f);

		private Vector3 left = new Vector3(0f, -180f, 0f);

		private Vector3 up = new Vector3(0f, 0f, 90f);

		private Vector3 down = new Vector3(0f, 0f, -90f);

		private float spunX = 0f;

		private float spunY = 0f;

		private float spunZ = 0f;

		private void FixedUpdate()
		{
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			if (Configurator.spin.value)
			{
				spunX += Configurator.spinX.value;
				spunY += Configurator.spinY.value;
				spunZ += Configurator.spinZ.value;
				if (spunX > 360f)
				{
					spunX -= 360f;
				}
				if (spunY > 360f)
				{
					spunY -= 360f;
				}
				if (spunZ > 360f)
				{
					spunZ -= 360f;
				}
				((Component)this).transform.localEulerAngles = new Vector3(spunX, spunY, spunZ);
				return;
			}
			switch (Configurator.direction.value)
			{
			case Directions.Right:
				((Component)this).transform.localEulerAngles = right;
				break;
			case Directions.Left:
				((Component)this).transform.localEulerAngles = left;
				break;
			case Directions.Up:
				((Component)this).transform.localEulerAngles = up;
				break;
			case Directions.Down:
				((Component)this).transform.localEulerAngles = down;
				break;
			case Directions.Forward:
				((Component)this).transform.localEulerAngles = forward;
				break;
			case Directions.Backward:
				((Component)this).transform.localEulerAngles = backward;
				break;
			default:
				((Component)this).transform.localEulerAngles = right;
				break;
			}
		}
	}
	public static class AssHelper
	{
		[SpecialName]
		public sealed class <G>$34505F560D9EACF86A87F3ED1F85E448
		{
			[SpecialName]
			public static class <M>$69FE22D2D9367C6033D7C9FA04F1ABE9
			{
			}

			[ExtensionMarker("<M>$69FE22D2D9367C6033D7C9FA04F1ABE9")]
			public int Occurrences(char lookUp)
			{
				throw null;
			}

			[ExtensionMarker("<M>$69FE22D2D9367C6033D7C9FA04F1ABE9")]
			public IEnumerable<int> Occurences(char lookUp)
			{
				throw null;
			}
		}

		[CompilerGenerated]
		private sealed class <Occurences>d__8 : IEnumerable<int>, IEnumerable, IEnumerator<int>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private int <>2__current;

			private int <>l__initialThreadId;

			private string str;

			public string <>3__str;

			private char lookUp;

			public char <>3__lookUp;

			private int <i>5__1;

			int IEnumerator<int>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <Occurences>d__8(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				int num = <>1__state;
				if (num != 0)
				{
					if (num != 1)
					{
						return false;
					}
					<>1__state = -1;
					goto IL_0062;
				}
				<>1__state = -1;
				<i>5__1 = 0;
				goto IL_0072;
				IL_0062:
				<i>5__1++;
				goto IL_0072;
				IL_0072:
				if (<i>5__1 < str.Length)
				{
					if (str[<i>5__1] == lookUp)
					{
						<>2__current = <i>5__1;
						<>1__state = 1;
						return true;
					}
					goto IL_0062;
				}
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}

			[DebuggerHidden]
			IEnumerator<int> IEnumerable<int>.GetEnumerator()
			{
				<Occurences>d__8 <Occurences>d__;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					<Occurences>d__ = this;
				}
				else
				{
					<Occurences>d__ = new <Occurences>d__8(0);
				}
				<Occurences>d__.str = <>3__str;
				<Occurences>d__.lookUp = <>3__lookUp;
				return <Occurences>d__;
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<int>)this).GetEnumerator();
			}
		}

		public static Dictionary<string, object> CachedAddressableAssets = new Dictionary<string, object>();

		public static IResourceLocator MainAddressablesLocator => Addressables.ResourceLocators.FirstOrDefault((Func<IResourceLocator, bool>)((IResourceLocator loc) => loc.LocatorId == "AddressablesMainContentCatalog"));

		public static IEnumerable<object> GetAddressableKeys()
		{
			IResourceLocator mainAddressablesLocator = MainAddressablesLocator;
			return ((mainAddressablesLocator != null) ? mainAddressablesLocator.Keys : null) ?? Array.Empty<object>();
		}

		public static List<string> GetPrefabAddressableKeys()
		{
			List<string> list = new List<string>();
			IList<IResourceLocation> list2 = default(IList<IResourceLocation>);
			foreach (object addressableKey in GetAddressableKeys())
			{
				if (MainAddressablesLocator.Locate(addressableKey, typeof(GameObject), ref list2) && !list.Contains(list2[0].PrimaryKey))
				{
					list.Add(list2[0].PrimaryKey);
				}
			}
			list.Sort();
			return list;
		}

		public static T Ass<T>(string key)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if (CachedAddressableAssets.TryGetValue(key + typeof(T).Name, out var value))
			{
				return (T)value;
			}
			T val = Addressables.LoadAssetAsync<T>((object)key).WaitForCompletion();
			if (val != null)
			{
				CachedAddressableAssets.Add(key + typeof(T).Name, val);
			}
			else
			{
				Plugin.Logger.LogError((object)("Failed to load asset: " + key));
			}
			return val;
		}

		public static int Occurrences(this string str, char lookUp)
		{
			int num = 0;
			foreach (char c in str)
			{
				if (c == lookUp)
				{
					num++;
				}
			}
			return num;
		}

		[IteratorStateMachine(typeof(<Occurences>d__8))]
		public static IEnumerable<int> Occurences(this string str, char lookUp)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <Occurences>d__8(-2)
			{
				<>3__str = str,
				<>3__lookUp = lookUp
			};
		}
	}
	public class ExecuteOnSceneLoad : MonoBehaviour
	{
		[Tooltip("Lower value ExecuteOnSceneLoad are executed first")]
		public int relativeExecutionOrder = 0;

		public UnityEvent onSceneLoad;

		public void Execute()
		{
			if (onSceneLoad != null)
			{
				onSceneLoad.Invoke();
			}
		}
	}
	[Serializable]
	public class LayerInfo
	{
		public string layerName = "";

		public string[] layerLevels = new string[0];
	}
	public class FirstRoomSpawner : MonoBehaviour, ISerializationCallbackReceiver
	{
		[HideInInspector]
		internal class PlayerForcedMovement : MonoBehaviour
		{
			public NewMovement player;

			private Rigidbody rb;

			public static float defaultMoveForce = 67f;

			public float force = defaultMoveForce;

			public void Awake()
			{
				if ((Object)(object)player == (Object)null)
				{
					player = MonoSingleton<NewMovement>.Instance;
				}
				rb = ((Component)player).GetComponent<Rigidbody>();
				rb.useGravity = false;
			}

			public void LateUpdate()
			{
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				rb.velocity = new Vector3(0f, force, 0f);
			}

			public void DestroyComp()
			{
				rb.useGravity = true;
				Object.Destroy((Object)(object)this);
			}
		}

		[HideInInspector]
		private class LocalMoveTowards : MonoBehaviour
		{
			public Vector3 targetLocalPosition;

			public bool active = false;

			public float speed = 10f;

			public void Update()
			{
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: 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_004a: Unknown result type (might be due to invalid IL or missing references)
				if (active)
				{
					((Component)this).transform.localPosition = Vector3.MoveTowards(((Component)this).transform.localPosition, targetLocalPosition, Time.deltaTime * speed);
					if (((Component)this).transform.localPosition == targetLocalPosition)
					{
						Object.Destroy((Object)(object)this);
					}
				}
			}

			public void Activate()
			{
				active = true;
			}
		}

		[HideInInspector]
		private class CustomHellmapCursor : MonoBehaviour
		{
			public Vector2 targetPosition;

			public Image targetImage;

			public AudioSource aud;

			private bool white = true;

			private RectTransform rect;

			private void Start()
			{
				rect = ((Component)this).GetComponent<RectTransform>();
				((MonoBehaviour)this).Invoke("FlashImage", 0.075f);
			}

			private void Update()
			{
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: 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_0039: 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)
				rect.anchoredPosition = Vector2.MoveTowards(rect.anchoredPosition, targetPosition, Time.deltaTime * 4f * Vector3.Distance(Vector2.op_Implicit(rect.anchoredPosition), Vector2.op_Implicit(targetPosition)));
			}

			private void FlashImage()
			{
				//IL_006a: 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)
				if (white)
				{
					white = false;
					((Graphic)targetImage).color = new Color(0f, 0f, 0f, 0f);
					if (!((Component)this).gameObject.activeSelf)
					{
						return;
					}
					aud.Play();
				}
				else
				{
					white = true;
					((Graphic)targetImage).color = Color.white;
				}
				if (((Component)this).gameObject.activeInHierarchy)
				{
					((MonoBehaviour)this).Invoke("FlashImage", 0.075f);
				}
			}
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static UnityAction <>9__36_5;

			public static Func<GameObject, Transform> <>9__37_1;

			public static Func<GameObject, OnLevelStart> <>9__37_2;

			public static Func<GameObject, bool> <>9__37_4;

			internal void <ConvertToAscendingFirstRoom>b__36_5()
			{
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				MonoSingleton<StatsManager>.Instance.spawnPos = ((Component)MonoSingleton<NewMovement>.Instance).transform.position;
			}

			internal Transform <Spawn>b__37_1(GameObject go)
			{
				return go.transform;
			}

			internal OnLevelStart <Spawn>b__37_2(GameObject go)
			{
				return go.GetComponent<OnLevelStart>();
			}

			internal bool <Spawn>b__37_4(GameObject o)
			{
				return ((Object)o).name == "Canvas";
			}
		}

		[Tooltip("Player will be moved to this position if the room is not ascending variant. If null, default position is used")]
		public Transform playerSpawnPos;

		[Tooltip("If set to true, room will not be deleted. Else, it will be replaced in game")]
		public bool doNotReplace = false;

		[Header("Replace Settings")]
		[Tooltip("Enabling this field causes room to be spawned as the secret variant")]
		public bool secretRoom = false;

		[Tooltip("Enabling this field causes room to be spawned as the prime variant")]
		public bool primeRoom = false;

		[Tooltip("Enabling this field causes room to be spawned as the encore variant")]
		public bool encoreRoom = false;

		[HideInInspector]
		[Tooltip("Enabling this field causes the whole room to be converted into the ascending variant where the player is spawned at the bottom and ascends upwards instead of falling")]
		public bool convertToUpwardRoom = false;

		[HideInInspector]
		[Tooltip("This clip will be played when the trap door closes beneath the player for ascending rooms")]
		public AudioClip upwardRoomDoorCloseClip;

		[HideInInspector]
		[Tooltip("If bottom part of the ascending room collides with out of bounds triggers, this list can temporarely disable them while the player is ascending")]
		public List<GameObject> upwardRoomOutOfBoundsToDisable;

		[Header("Player Fields")]
		[Space(10f)]
		public CameraClearFlags cameraFillMode = (CameraClearFlags)2;

		public Color backgroundColor = Color.black;

		[Header("Level Fields")]
		[Space(10f)]
		[Tooltip("If set to true, level title will be displayed when the door is opened")]
		public bool displayLevelTitle = true;

		[Tooltip("If set to true, music will start when the door is opened")]
		public bool startMusic = true;

		[Header("Hellmap")]
		[Tooltip("Enable the layer and level map when the player spawn")]
		[Space(10f)]
		public bool enableHellMap = false;

		[Tooltip("Sound clip which is played for each beep while falling")]
		public AudioClip hellmapBeepClip;

		[Tooltip("Each layer has a layer name and number of levels. For limbo the header is LIMBO and levels are [1-1, 1-2, 1-3, 1-4]")]
		public List<LayerInfo> layersAndLevels = new List<LayerInfo>();

		[HideInInspector]
		public List<int> levelSizes = new List<int>();

		[HideInInspector]
		public List<string> layerNames = new List<string>();

		[HideInInspector]
		public List<string> levelNames = new List<string>();

		[Tooltip("Which layer the cursor starts from. First layer is 0 and at the top")]
		public int layerIndexToStartFrom;

		[Tooltip("Which level in the layer the cursor starts from. The first level is 0 and is just below the layer title (the uppermost level)")]
		public int levelIndexToStartFrom;

		[Tooltip("Which layer the cursor ends at. First layer is 0 and at the top")]
		public int layerIndexToEndAt;

		[Tooltip("Which level in the layer the cursor ends at. The first level is 0 and is just below the layer title (the uppermost level)")]
		public int levelIndexToEndAt;

		private bool spawned = false;

		public static float upDisablePos = 60f;

		public static float doorClosePos = 10f;

		public static float doorCloseSpeed = 10f;

		public static float actDelay = 0.5f;

		public static float ascendingPlayerSpawnPos = -55f;

		public void OnBeforeSerialize()
		{
			levelSizes.Clear();
			layerNames.Clear();
			levelNames.Clear();
			for (int i = 0; i < layersAndLevels.Count; i++)
			{
				layerNames.Add(layersAndLevels[i].layerName);
				levelSizes.Add(layersAndLevels[i].layerLevels.Length);
				levelNames.AddRange(layersAndLevels[i].layerLevels);
			}
		}

		public void Deserialize()
		{
			layersAndLevels.Clear();
			int num = 0;
			for (int i = 0; i < levelSizes.Count; i++)
			{
				LayerInfo layerInfo = new LayerInfo();
				layerInfo.layerName = layerNames[i];
				int num2 = levelSizes[i];
				layerInfo.layerLevels = new string[num2];
				for (int j = 0; j < num2; j++)
				{
					layerInfo.layerLevels[j] = levelNames[num++];
				}
				layersAndLevels.Add(layerInfo);
			}
		}

		public void OnAfterDeserialize()
		{
		}

		private static Text MakeText(Transform parent)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject();
			RectTransform val2 = val.AddComponent<RectTransform>();
			((Transform)val2).SetParent(parent);
			val.transform.localScale = Vector3.one;
			return val.AddComponent<Text>();
		}

		private static RectTransform MakeRect(Transform parent)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			GameObject val = new GameObject();
			RectTransform val2 = val.AddComponent<RectTransform>();
			((Transform)val2).SetParent(parent);
			return val2;
		}

		public static void ConvertToAscendingFirstRoom(GameObject firstRoom, AudioClip doorCloseAud, List<GameObject> toEnable, List<GameObject> toDisable, bool doNotReplace)
		{
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0357: Unknown result type (might be due to invalid IL or missing references)
			//IL_036d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0377: Unknown result type (might be due to invalid IL or missing references)
			//IL_0394: Unknown result type (might be due to invalid IL or missing references)
			//IL_039b: Expected O, but got Unknown
			//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0401: Unknown result type (might be due to invalid IL or missing references)
			//IL_0451: Unknown result type (might be due to invalid IL or missing references)
			//IL_045b: Expected O, but got Unknown
			//IL_0462: Unknown result type (might be due to invalid IL or missing references)
			//IL_046c: Expected O, but got Unknown
			//IL_047f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0489: Expected O, but got Unknown
			//IL_048a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0491: Expected O, but got Unknown
			//IL_04c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0547: Unknown result type (might be due to invalid IL or missing references)
			//IL_0551: Expected O, but got Unknown
			//IL_0558: Unknown result type (might be due to invalid IL or missing references)
			//IL_0562: Expected O, but got Unknown
			//IL_0575: Unknown result type (might be due to invalid IL or missing references)
			//IL_057f: Expected O, but got Unknown
			//IL_0593: Unknown result type (might be due to invalid IL or missing references)
			//IL_059d: Expected O, but got Unknown
			//IL_05b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bb: Expected O, but got Unknown
			//IL_05d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e1: Expected O, but got Unknown
			//IL_05e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f2: Expected O, but got Unknown
			//IL_0605: Unknown result type (might be due to invalid IL or missing references)
			//IL_060f: Expected O, but got Unknown
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: 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_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0630: Unknown result type (might be due to invalid IL or missing references)
			//IL_0635: Unknown result type (might be due to invalid IL or missing references)
			//IL_063b: Expected O, but got Unknown
			Transform val = firstRoom.transform.Find("Room");
			if (!doNotReplace)
			{
				Transform val2 = val.Find("Pit (3)");
				((Component)val2).transform.localPosition = new Vector3(0f, 2f, 41.72f);
				((Component)val2).transform.localRotation = Quaternion.Euler(0f, 0f, 180f);
				Object.Destroy((Object)(object)((Component)((Component)val).transform.Find("Room/Ceiling")).gameObject);
				Transform val3 = ((Component)val).transform.Find("Room/Floor");
				GameObject gameObject = ((Component)val3.GetChild(0)).gameObject;
				GameObject val4 = Object.Instantiate<GameObject>(gameObject, val3);
				val4.transform.localPosition = new Vector3(-15f, 9.7f, 20.28f);
				val4.transform.localRotation = Quaternion.identity;
				GameObject val5 = Object.Instantiate<GameObject>(gameObject, val3);
				val5.transform.localPosition = new Vector3(5f, 9.7f, 20.28f);
				val5.transform.localRotation = Quaternion.identity;
				GameObject val6 = Object.Instantiate<GameObject>(gameObject, val3);
				val6.transform.localPosition = new Vector3(-5f, 9.7f, 0.2f);
				val6.transform.localRotation = Quaternion.Euler(0f, -90f, 0f);
				GameObject val7 = Object.Instantiate<GameObject>(gameObject, val3);
				val7.transform.localPosition = new Vector3(5f, 9.7f, 10.28f);
				val7.transform.localRotation = Quaternion.identity;
				((Renderer)val7.GetComponent<MeshRenderer>()).materials = Array.Empty<Material>();
				GameObject val8 = Object.Instantiate<GameObject>(gameObject, val3);
				val8.transform.localPosition = new Vector3(-15f, 9.7f, 10.28f);
				val8.transform.localRotation = Quaternion.identity;
				((Renderer)val8.GetComponent<MeshRenderer>()).materials = Array.Empty<Material>();
				GameObject val9 = Object.Instantiate<GameObject>(gameObject, val3);
				val9.transform.localPosition = new Vector3(-5f, -0.3f, 20.28f);
				val9.transform.localRotation = Quaternion.Euler(0f, -90f, -180f);
			}
			Transform val10 = val.Find("Decorations");
			Transform child = val10.GetChild(12);
			child.localPosition = new Vector3(-5f, 2f, 52f);
			LocalMoveTowards floorMover = ((Component)child).gameObject.AddComponent<LocalMoveTowards>();
			floorMover.targetLocalPosition = new Vector3(-5f, 2f, 42f);
			floorMover.speed = doorCloseSpeed;
			AudioSource floorTileAud = ((Component)child).gameObject.AddComponent<AudioSource>();
			floorTileAud.playOnAwake = false;
			floorTileAud.loop = false;
			floorTileAud.clip = doorCloseAud;
			PlayerActivator act = firstRoom.GetComponentsInChildren<PlayerActivator>().First();
			((Component)act).gameObject.SetActive(false);
			NewMovement instance = MonoSingleton<NewMovement>.Instance;
			((Component)instance).transform.localPosition = new Vector3(((Component)instance).transform.localPosition.x, ascendingPlayerSpawnPos, ((Component)instance).transform.localPosition.z);
			PlayerForcedMovement focedMov = ((Component)instance).gameObject.AddComponent<PlayerForcedMovement>();
			GameObject val11 = new GameObject();
			val11.transform.SetParent(((Component)act).transform.parent);
			val11.transform.localPosition = new Vector3(0f, upDisablePos, 0f);
			val11.transform.localRotation = Quaternion.identity;
			val11.transform.localScale = new Vector3(80f, 0.2f, 80f);
			val11.layer = ((Component)act).gameObject.layer;
			BoxCollider val12 = val11.AddComponent<BoxCollider>();
			((Collider)val12).isTrigger = true;
			ObjectActivator val13 = val11.AddComponent<ObjectActivator>();
			val13.dontActivateOnEnable = true;
			val13.oneTime = true;
			val13.events = new UltrakillEvent();
			val13.events.onActivate = new UnityEvent();
			val13.events.onActivate.AddListener((UnityAction)delegate
			{
				focedMov.DestroyComp();
			});
			GameObject val14 = new GameObject();
			val14.transform.SetParent(((Component)act).transform.parent);
			val14.transform.localPosition = new Vector3(0f, doorClosePos, 0f);
			val14.transform.localRotation = Quaternion.identity;
			val14.transform.localScale = new Vector3(80f, 0.2f, 80f);
			val14.layer = ((Component)act).gameObject.layer;
			BoxCollider val15 = val14.AddComponent<BoxCollider>();
			((Collider)val15).isTrigger = true;
			ObjectActivator val16 = val14.AddComponent<ObjectActivator>();
			val16.dontActivateOnEnable = true;
			val16.oneTime = true;
			val16.events = new UltrakillEvent();
			val16.events.onActivate = new UnityEvent();
			val16.events.onActivate.AddListener((UnityAction)delegate
			{
				floorMover.Activate();
			});
			val16.events.onActivate.AddListener((UnityAction)delegate
			{
				floorTileAud.Play();
			});
			val16.events.onActivate.AddListener((UnityAction)delegate
			{
				foreach (GameObject item in toEnable)
				{
					item.SetActive(true);
				}
				foreach (GameObject item2 in toDisable)
				{
					item2.SetActive(false);
				}
			});
			ObjectActivator val17 = val14.AddComponent<ObjectActivator>();
			val17.dontActivateOnEnable = true;
			val17.oneTime = true;
			val17.events = new UltrakillEvent();
			val17.events.onActivate = new UnityEvent();
			val17.events.onActivate.AddListener((UnityAction)delegate
			{
				((Component)act).gameObject.SetActive(true);
			});
			UnityEvent onActivate = val17.events.onActivate;
			object obj = <>c.<>9__36_5;
			if (obj == null)
			{
				UnityAction val18 = delegate
				{
					//IL_000f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0014: Unknown result type (might be due to invalid IL or missing references)
					MonoSingleton<StatsManager>.Instance.spawnPos = ((Component)MonoSingleton<NewMovement>.Instance).transform.position;
				};
				<>c.<>9__36_5 = val18;
				obj = (object)val18;
			}
			onActivate.AddListener((UnityAction)obj);
			val17.delay = actDelay;
		}

		public void Spawn()
		{
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_035d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0362: Unknown result type (might be due to invalid IL or missing references)
			//IL_0366: Unknown result type (might be due to invalid IL or missing references)
			//IL_0375: Unknown result type (might be due to invalid IL or missing references)
			//IL_038a: Unknown result type (might be due to invalid IL or missing references)
			//IL_040d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0412: Unknown result type (might be due to invalid IL or missing references)
			//IL_0416: Unknown result type (might be due to invalid IL or missing references)
			//IL_0575: Unknown result type (might be due to invalid IL or missing references)
			//IL_057a: Unknown result type (might be due to invalid IL or missing references)
			//IL_047a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0495: Unknown result type (might be due to invalid IL or missing references)
			//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0611: Unknown result type (might be due to invalid IL or missing references)
			//IL_0616: Unknown result type (might be due to invalid IL or missing references)
			//IL_0696: Unknown result type (might be due to invalid IL or missing references)
			//IL_069b: Unknown result type (might be due to invalid IL or missing references)
			//IL_069c: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_06dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0723: Unknown result type (might be due to invalid IL or missing references)
			//IL_0730: Unknown result type (might be due to invalid IL or missing references)
			//IL_0747: Unknown result type (might be due to invalid IL or missing references)
			//IL_0754: Unknown result type (might be due to invalid IL or missing references)
			//IL_0761: Unknown result type (might be due to invalid IL or missing references)
			//IL_076e: Unknown result type (might be due to invalid IL or missing references)
			//IL_052d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0532: Unknown result type (might be due to invalid IL or missing references)
			//IL_0536: Unknown result type (might be due to invalid IL or missing references)
			//IL_07bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0801: Unknown result type (might be due to invalid IL or missing references)
			//IL_0825: Unknown result type (might be due to invalid IL or missing references)
			//IL_0863: Unknown result type (might be due to invalid IL or missing references)
			//IL_0868: Unknown result type (might be due to invalid IL or missing references)
			//IL_0882: Unknown result type (might be due to invalid IL or missing references)
			//IL_0898: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f6d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f72: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f89: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cf1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cfa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d2a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d2f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d38: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d61: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d66: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d67: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d6f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d83: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d9a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0db6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dc3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dd0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e28: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e2d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e4c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e4e: Unknown result type (might be due to invalid IL or missing references)
			//IL_091f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0924: Unknown result type (might be due to invalid IL or missing references)
			//IL_0925: Unknown result type (might be due to invalid IL or missing references)
			//IL_092d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0941: Unknown result type (might be due to invalid IL or missing references)
			//IL_094e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0962: Unknown result type (might be due to invalid IL or missing references)
			//IL_0979: Unknown result type (might be due to invalid IL or missing references)
			//IL_09aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_09af: Unknown result type (might be due to invalid IL or missing references)
			//IL_09b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_09b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_09cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_09d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_09f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a1e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a23: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a5e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a63: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a87: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aa2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aaf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ac6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ad3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0af7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b41: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b46: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b47: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b4f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b63: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b7d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ba5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bb2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bf0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bf8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c0c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c23: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c3e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c4b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1199: Unknown result type (might be due to invalid IL or missing references)
			//IL_129e: Unknown result type (might be due to invalid IL or missing references)
			if (spawned)
			{
				return;
			}
			GameObject onLevelStartObj = null;
			bool flag = (Object)(object)MonoSingleton<OnLevelStart>.Instance != (Object)null;
			if (!flag)
			{
				Transform val = ((Component)this).gameObject.transform.Find("OnLevelStart");
				if ((Object)(object)val != (Object)null)
				{
					flag = (Object)(object)((Component)val).GetComponent<OnLevelStart>() != (Object)null;
					onLevelStartObj = ((Component)val).gameObject;
				}
			}
			else
			{
				onLevelStartObj = ((Component)MonoSingleton<OnLevelStart>.Instance).gameObject;
			}
			GameObject val2 = ((Component)this).gameObject;
			GameObject val3 = Addressables.LoadAssetAsync<GameObject>((object)(secretRoom ? "FirstRoom Secret" : (primeRoom ? "FirstRoom Prime" : (encoreRoom ? "Assets/Prefabs/Levels/Special Rooms/FirstRoom Encore.prefab" : "FirstRoom")))).WaitForCompletion();
			Scene activeScene;
			if (!doNotReplace)
			{
				val2 = Object.Instantiate<GameObject>(val3, ((Component)this).transform.parent);
				if (flag)
				{
					Transform? obj = val2.transform.Find("OnLevelStart");
					if (obj == null)
					{
						activeScene = SceneManager.GetActiveScene();
						obj = (from go in ((Scene)(ref activeScene)).GetRootGameObjects()
							where ((Object)go).name == "OnLevelStart" && (Object)(object)go.transform != (Object)(object)onLevelStartObj
							select go.transform).FirstOrDefault();
					}
					Transform val4 = obj;
					if ((Object)(object)val4 != (Object)null)
					{
						Object.Destroy((Object)(object)((Component)val4).gameObject);
					}
					if ((Object)(object)onLevelStartObj != (Object)null)
					{
						onLevelStartObj.transform.SetParent(val2.transform);
					}
				}
			}
			else
			{
				GameObject val5 = Object.Instantiate<GameObject>(val3, ((Component)this).transform.position, ((Component)this).transform.rotation, ((Component)this).transform.parent);
				Object.Destroy((Object)(object)((Component)val5.transform.Find("Room")).gameObject);
				if (flag)
				{
					Transform val6 = val5.transform.Find("OnLevelStart");
					if ((Object)(object)val6 != (Object)null)
					{
						Object.Destroy((Object)(object)((Component)val6).gameObject);
					}
					else
					{
						activeScene = SceneManager.GetActiveScene();
						OnLevelStart val7 = (from go in ((Scene)(ref activeScene)).GetRootGameObjects()
							select go.GetComponent<OnLevelStart>() into ls
							where (Object)(object)ls != (Object)null && (Object)(object)((Component)ls).gameObject != (Object)(object)onLevelStartObj
							select ls).FirstOrDefault();
						if ((Object)(object)val7 != (Object)null)
						{
							Object.Destroy((Object)(object)((Component)val7).gameObject);
						}
					}
				}
			}
			MeshCollider[] componentsInChildren = val2.GetComponentsInChildren<MeshCollider>();
			MeshFilter val9 = default(MeshFilter);
			foreach (MeshCollider val8 in componentsInChildren)
			{
				if (((Component)val8).gameObject.TryGetComponent<MeshFilter>(ref val9))
				{
					val9.mesh = val8.sharedMesh;
				}
			}
			Transform transform = ((Component)MonoSingleton<NewMovement>.Instance).transform;
			((Component)transform).transform.parent = val2.transform;
			val2.transform.position = ((Component)this).transform.position;
			val2.transform.rotation = ((Component)this).transform.rotation;
			((Component)transform).transform.parent = null;
			Transform transform2 = ((Component)MonoSingleton<CameraController>.Instance).transform;
			Quaternion rotation = ((Component)this).transform.rotation;
			transform2.rotation = Quaternion.Euler(0f, ((Quaternion)(ref rotation)).eulerAngles.y, 0f);
			float x = ((Component)MonoSingleton<CameraController>.Instance).transform.localEulerAngles.x;
			float rotationX = x;
			if (x <= 90f && x >= 0f)
			{
				rotationX = 0f - x;
			}
			else if (x >= 270f && x <= 360f)
			{
				rotationX = Mathf.Lerp(0f, 90f, Mathf.InverseLerp(360f, 270f, x));
			}
			rotation = ((Component)MonoSingleton<CameraController>.Instance).transform.rotation;
			float y = ((Quaternion)(ref rotation)).eulerAngles.y;
			MonoSingleton<CameraController>.Instance.rotationX = rotationX;
			MonoSingleton<CameraController>.Instance.rotationY = y;
			if ((Object)(object)playerSpawnPos != (Object)null)
			{
				((Component)transform).transform.parent = ((Component)playerSpawnPos).transform.parent;
				((Component)transform).transform.localPosition = playerSpawnPos.localPosition;
				((Component)MonoSingleton<CameraController>.Instance).transform.rotation = playerSpawnPos.rotation;
				float x2 = ((Component)MonoSingleton<CameraController>.Instance).transform.localEulerAngles.x;
				float rotationX2 = x;
				if (x2 <= 90f && x2 >= 0f)
				{
					rotationX2 = 0f - x;
				}
				else if (x2 >= 270f && x2 <= 360f)
				{
					rotationX2 = Mathf.Lerp(0f, 90f, Mathf.InverseLerp(360f, 270f, x));
				}
				rotation = ((Component)MonoSingleton<CameraController>.Instance).transform.rotation;
				float y2 = ((Quaternion)(ref rotation)).eulerAngles.y;
				MonoSingleton<CameraController>.Instance.rotationX = rotationX2;
				MonoSingleton<CameraController>.Instance.rotationY = y2;
				((Component)transform).transform.SetParent((Transform)null);
			}
			MonoSingleton<StatsManager>.Instance.spawnPos = ((Component)transform).transform.position;
			try
			{
				Transform val10 = val2.transform.Find("Room/FinalDoor");
				FinalDoor component = ((Component)val10).GetComponent<FinalDoor>();
				Camera main = Camera.main;
				main.backgroundColor = backgroundColor;
				main.clearFlags = cameraFillMode;
				FinalDoorOpener component2 = ((Component)val2.transform.Find("Room/FinalDoor/FinalDoorOpener")).GetComponent<FinalDoorOpener>();
				component2.startMusic = startMusic;
				FinalDoor component3 = ((Component)val2.transform.Find("Room/FinalDoor")).GetComponent<FinalDoor>();
				Transform obj2 = ((Component)MonoSingleton<NewMovement>.Instance).transform.Find("Canvas");
				if (obj2 == null)
				{
					activeScene = SceneManager.GetActiveScene();
					obj2 = (from o in ((Scene)(ref activeScene)).GetRootGameObjects()
						where ((Object)o).name == "Canvas"
						select o).First().transform;
				}
				Transform val11 = obj2;
				GameObject val12 = null;
				if (enableHellMap)
				{
					Deserialize();
					RectTransform val13 = MakeRect(val11);
					((Object)val13).name = "Hellmap";
					val12 = ((Component)val13).gameObject;
					Vector2 anchorMin = (val13.anchorMax = new Vector2(0.5f, 0.5f));
					val13.anchorMin = anchorMin;
					val13.pivot = new Vector2(0.5f, 0.5f);
					val13.sizeDelta = new Vector2(250f, 650f);
					val13.anchoredPosition = Vector2.zero;
					((Transform)val13).localScale = Vector3.one * 0.82244f;
					((Transform)val13).SetAsFirstSibling();
					RectTransform val15 = MakeRect(((Component)val13).transform);
					((Object)val15).name = "Hellmap Container";
					val15.anchorMin = Vector2.zero;
					val15.anchorMax = Vector2.one;
					val15.pivot = new Vector2(0.5f, 0.5f);
					val15.sizeDelta = Vector2.zero;
					val15.anchoredPosition = Vector2.zero;
					((Transform)val15).localScale = Vector3.one;
					float num = 0f;
					Stack<RectTransform> stack = new Stack<RectTransform>();
					foreach (LayerInfo layersAndLevel in layersAndLevels)
					{
						RectTransform val16 = MakeRect((Transform)(object)val15);
						anchorMin = (val16.anchorMax = new Vector2(0f, 1f));
						val16.anchorMin = anchorMin;
						val16.sizeDelta = new Vector2(250f, 50f);
						val16.pivot = new Vector2(0f, 1f);
						((Transform)val16).localScale = Vector3.one;
						val16.anchoredPosition = new Vector2(0f, (num == 0f) ? (-3.051758E-05f) : num);
						num -= 50f;
						Text val18 = MakeText((Transform)(object)val16);
						val18.text = layersAndLevel.layerName;
						val18.fontSize = 36;
						val18.font = Addressables.LoadAssetAsync<Font>((object)"Assets/Fonts/VCR_OSD_MONO_1.001.ttf").WaitForCompletion();
						val18.alignment = (TextAnchor)3;
						((Graphic)val18).color = Color.white;
						RectTransform component4 = ((Component)val18).GetComponent<RectTransform>();
						component4.anchorMin = Vector2.zero;
						component4.anchorMax = Vector2.one;
						component4.sizeDelta = Vector2.zero;
						component4.pivot = new Vector2(0.5f, 0.5f);
						((Transform)component4).localScale = Vector3.one;
						component4.anchoredPosition = Vector2.zero;
						string[] layerLevels = layersAndLevel.layerLevels;
						foreach (string text in layerLevels)
						{
							RectTransform val19 = MakeRect((Transform)(object)val15);
							anchorMin = (val19.anchorMax = new Vector2(0f, 1f));
							val19.anchorMin = anchorMin;
							val19.pivot = new Vector2(0f, 1f);
							((Transform)val19).localScale = Vector3.one;
							val19.anchoredPosition = new Vector2(60f, num);
							val19.sizeDelta = new Vector2(125f, 45f);
							num -= 50f;
							RectTransform val21 = MakeRect(((Component)val19).transform);
							anchorMin = (val21.anchorMax = new Vector2(0.5f, 0.5f));
							val21.anchorMin = anchorMin;
							val21.sizeDelta = new Vector2(25f, 9f);
							val21.anchoredPosition = Vector2.zero;
							((Transform)val21).localScale = new Vector3(5f, 5f, 5f);
							Image val23 = ((Component)val21).gameObject.AddComponent<Image>();
							val23.type = (Type)1;
							val23.sprite = Addressables.LoadAssetAsync<Sprite>((object)"Assets/Textures/UI/meter.png").WaitForCompletion();
							val23.pixelsPerUnitMultiplier = 1f;
							Text val24 = MakeText(((Component)val19).transform);
							val24.text = text;
							val24.font = Addressables.LoadAssetAsync<Font>((object)"Assets/Fonts/VCR_OSD_MONO_1.001.ttf").WaitForCompletion();
							val24.fontSize = 32;
							val24.alignment = (TextAnchor)4;
							((Graphic)val24).color = Color.black;
							RectTransform component5 = ((Component)val24).gameObject.GetComponent<RectTransform>();
							component5.anchorMin = Vector2.zero;
							component5.anchorMax = Vector2.one;
							component5.pivot = new Vector2(0.5f, 0.5f);
							component5.sizeDelta = Vector2.zero;
							component5.anchoredPosition = new Vector2(0f, 0f);
							((Transform)component5).localScale = Vector3.one;
						}
						if (layersAndLevel.layerLevels.Length != 0)
						{
							RectTransform val25 = MakeRect((Transform)(object)val15);
							anchorMin = (val25.anchorMax = new Vector2(0.5f, 1f));
							val25.anchorMin = anchorMin;
							val25.pivot = new Vector2(0.5f, 0f);
							val25.anchoredPosition = new Vector2(-95f, num + 25f);
							val25.sizeDelta = new Vector2(3f, (float)layersAndLevel.layerLevels.Length * 50f - 27.5f);
							((Transform)val25).localScale = Vector3.one;
							((Component)val25).gameObject.AddComponent<Image>();
							for (int k = 0; k < layersAndLevel.layerLevels.Length; k++)
							{
								RectTransform val27 = MakeRect((Transform)(object)val25);
								anchorMin = (val27.anchorMax = new Vector2(0.5f, 0f));
								val27.anchorMin = anchorMin;
								val27.pivot = new Vector2(0f, 0.5f);
								val27.sizeDelta = new Vector2(20f, 3f);
								val27.anchoredPosition = new Vector2(-1.5f, (float)k * 50f);
								((Transform)val27).localScale = Vector3.one;
								((Component)val27).gameObject.AddComponent<Image>();
							}
							stack.Push(val25);
						}
					}
					while (stack.Count != 0)
					{
						RectTransform val29 = stack.Pop();
						((Transform)val29).SetAsLastSibling();
					}
					Vector2 anchoredPosition = ((Component)((Transform)val15).GetChild(GetChildIndexFromLayerAndLevel(layerIndexToStartFrom, levelIndexToStartFrom))).GetComponent<RectTransform>().anchoredPosition;
					((Vector2)(ref anchoredPosition))..ctor(210f, anchoredPosition.y - 22.5f);
					Vector2 anchoredPosition2 = ((Component)((Transform)val15).GetChild(GetChildIndexFromLayerAndLevel(layerIndexToEndAt, levelIndexToEndAt))).GetComponent<RectTransform>().anchoredPosition;
					((Vector2)(ref anchoredPosition2))..ctor(210f, anchoredPosition2.y - 22.5f);
					RectTransform val30 = MakeRect((Transform)(object)val13);
					anchorMin = (val30.anchorMax = new Vector2(0f, 1f));
					val30.anchorMin = anchorMin;
					val30.pivot = new Vector2(0.5f, 0.5f);
					val30.sizeDelta = new Vector2(35f, 35f);
					((Transform)val30).rotation = Quaternion.Euler(0f, 0f, 90f);
					((Transform)val30).localScale = Vector3.one;
					val30.anchoredPosition = anchoredPosition;
					AudioSource val32 = ((Component)val30).gameObject.AddComponent<AudioSource>();
					val32.playOnAwake = false;
					val32.loop = false;
					val32.clip = hellmapBeepClip;
					val32.volume = 0.1f;
					Image val33 = ((Component)val30).gameObject.AddComponent<Image>();
					val33.sprite = Addressables.LoadAssetAsync<Sprite>((object)"Assets/Textures/UI/arrow.png").WaitForCompletion();
					CustomHellmapCursor customHellmapCursor = ((Component)val30).gameObject.AddComponent<CustomHellmapCursor>();
					customHellmapCursor.targetPosition = anchoredPosition2;
					customHellmapCursor.aud = val32;
					customHellmapCursor.targetImage = val33;
				}
				if (convertToUpwardRoom)
				{
					foreach (GameObject item in upwardRoomOutOfBoundsToDisable)
					{
						item.SetActive(false);
					}
					List<GameObject> list = new List<GameObject>();
					if ((Object)(object)val12 != (Object)null)
					{
						list.Add(val12);
					}
					List<GameObject> list2 = new List<GameObject>();
					list2.AddRange(upwardRoomOutOfBoundsToDisable);
					ConvertToAscendingFirstRoom(val2, upwardRoomDoorCloseClip, list2, list, doNotReplace);
				}
				if (!encoreRoom)
				{
					return;
				}
				FinalRank instance = MonoSingleton<FinalRank>.Instance;
				if (!((Object)(object)instance != (Object)null))
				{
					return;
				}
				Transform val34 = ((Component)instance).transform.Find("Extra Info");
				RectTransform val35 = default(RectTransform);
				if ((Object)(object)val34 != (Object)null && ((Component)val34).gameObject.TryGetComponent<RectTransform>(ref val35))
				{
					val35.anchoredPosition = Vector2.op_Implicit(new Vector3(0f, 200f, 0f));
					val35.sizeDelta = new Vector2(480f, 180f);
				}
				Transform val36 = ((Component)instance).transform.Find("Secrets -  Title");
				Transform val37 = ((Component)instance).transform.Find("Secrets - Info");
				Transform val38 = (((Object)(object)val37 == (Object)null) ? null : ((Component)val37).transform.Find("Text (1)"));
				Transform val39 = ((Component)instance).transform.Find("Challenge - Title");
				Transform val40 = ((Component)instance).transform.Find("Challenge");
				List<GameObject> list3 = instance.toAppear.ToList();
				if ((Object)(object)val36 != (Object)null && !list3.Contains(((Component)val36).gameObject))
				{
					list3.Insert(list3.Count - 1, ((Component)val36).gameObject);
				}
				if ((Object)(object)val37 != (Object)null && !list3.Contains(((Component)val37).gameObject))
				{
					list3.Insert(list3.Count - 1, ((Component)val37).gameObject);
				}
				if ((Object)(object)val38 != (Object)null && !list3.Contains(((Component)val38).gameObject))
				{
					list3.Insert(list3.Count - 1, ((Component)val38).gameObject);
				}
				if ((Object)(object)val39 != (Object)null && !list3.Contains(((Component)val39).gameObject))
				{
					((Component)val39).gameObject.SetActive(true);
					list3.Insert(list3.Count - 1, ((Component)val39).gameObject);
				}
				if ((Object)(object)val40 != (Object)null && !list3.Contains(((Component)val40).gameObject))
				{
					list3.Insert(list3.Count - 1, ((Component)val40).gameObject);
				}
				instance.toAppear = list3.ToArray();
				Transform val41 = ((Component)val11).transform.Find("Level Stats Controller");
				if (!((Object)(object)val41 != (Object)null))
				{
					return;
				}
				LevelStats componentInChildren = ((Component)val41).GetComponentInChildren<LevelStats>(true);
				((Component)componentInChildren).GetComponent<RectTransform>().sizeDelta = new Vector2(285f, 315f);
				Transform obj3 = ((Component)componentInChildren).transform.Find("Challenge Title/Challenge");
				componentInChildren.challenge = ((obj3 != null) ? ((Component)obj3).GetComponent<TMP_Text>() : null);
				Transform obj4 = ((Component)componentInChildren).transform.Find("Challenge Title");
				if (obj4 != null)
				{
					((Component)obj4).gameObject.SetActive(true);
				}
				Transform obj5 = ((Component)componentInChildren).transform.Find("Secrets Title");
				if (obj5 != null)
				{
					((Component)obj5).gameObject.SetActive(true);
				}
				List<Image> list4 = new List<Image>();
				for (int num2 = 5; num2 >= 1; num2--)
				{
					Transform val42 = ((Component)componentInChildren).transform.Find($"Secrets Title/Secret {num2}");
					if ((Object)(object)val42 != (Object)null)
					{
						list4.Add(((Component)val42).GetComponent<Image>());
					}
				}
				componentInChildren.secrets = list4.ToArray();
				Transform val43 = ((Component)componentInChildren).transform.Find("Assists Title");
				((Component)val43).GetComponent<RectTransform>().anchoredPosition = new Vector2(10f, -275f);
			}
			catch (Exception ex)
			{
				throw ex;
			}
			finally
			{
				spawned = true;
			}
			int GetChildIndexFromLayerAndLevel(int layer, int level)
			{
				int num3 = 0;
				for (int l = 0; l < layer; l++)
				{
					num3 += 1 + levelSizes[l];
				}
				return num3 + 1 + level;
			}
		}

		public void Awake()
		{
			Spawn();
		}

		public void Start()
		{
			if ((Object)(object)MonoSingleton<OnLevelStart>.Instance != (Object)null)
			{
				MonoSingleton<OnLevelStart>.Instance.levelNameOnStart = displayLevelTitle;
			}
			else
			{
				Debug.LogWarning((object)"Could not find OnLevelStart");
			}
			if (!doNotReplace)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
	public class ExamplePatch : MonoBehaviour
	{
		private static void Prefix(Component __instance)
		{
		}

		private static void Postfix(Component __instance)
		{
		}
	}
	[BepInPlugin("bitmotte.MirrorVision", "MirrorVision", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		public static PluginConfigurator config;

		private void Awake()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin bitmotte.MirrorVision is loaded!");
			Harmony val = new Harmony("bitmotte.MirrorVision");
			val.PatchAll();
			config = Configurator.CreateConfigurator();
			SceneManager.sceneLoaded += SceneUtility.OnSceneLoad;
		}
	}
	internal static class BundleTool
	{
		public static AssetBundle Load(string fileName)
		{
			return AssetBundle.LoadFromMemory(EmbeddedAccess.AccessFile(fileName));
		}
	}
	internal static class EmbeddedAccess
	{
		public static byte[] AccessFile(string fileName)
		{
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			byte[] array;
			using (Stream stream = executingAssembly.GetManifestResourceStream("ModTechnicalName.resources." + fileName))
			{
				if (stream == null)
				{
					return null;
				}
				array = new byte[stream.Length];
				stream.Read(array, 0, array.Length);
			}
			return array;
		}
	}
	internal static class SceneUtility
	{
		public static void OnSceneLoad(Scene scene, LoadSceneMode mode)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			GameObject val = new GameObject("Yhagore,The Summoner .");
			val.transform.parent = null;
			val.AddComponent<SummonObject>();
		}
	}
	public class SummonObject : MonoBehaviour
	{
		private static SummonObject instance;

		public static void LoadAsset(string path)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			AssetBundle val = BundleTool.Load("main.bundle");
			GameObject val2 = Object.Instantiate<GameObject>((GameObject)val.LoadAsset(path));
			Plugin.Logger.LogInfo((object)"Yhagore has summoned the object . . .");
			val2.transform.parent = null;
			val2.GetComponent<CopyPositionAndRotation>().target = ((Component)MonoSingleton<CameraController>.Instance).gameObject.transform;
			((Component)val2.transform.GetChild(0)).gameObject.AddComponent<FollowRotationConfig>();
			((Component)val2.transform.GetChild(0).GetChild(0)).gameObject.AddComponent<FollowPositionConfig>();
			((Component)val2.transform.GetChild(0).GetChild(0).GetChild(0)).GetComponent<Portal>().canSeePortalLayer = false;
			val.Unload(false);
		}

		public void Awake()
		{
			instance = this;
			((MonoBehaviour)this).Invoke("Summon", 0.1f);
		}

		public void Summon()
		{
			LoadAsset("Assets/ModTechnicalName/Other/Mirror.prefab");
		}
	}
	public class CoolWeapon : MonoBehaviour
	{
		private InputManager inman;

		private WeaponIdentifier wid;

		private CameraController cc;

		public Transform shootPoint;

		public GameObject projectile;

		private void Start()
		{
			inman = MonoSingleton<InputManager>.Instance;
			wid = ((Component)this).GetComponent<WeaponIdentifier>();
			cc = MonoSingleton<CameraController>.Instance;
		}

		private void Update()
		{
			if (!inman.PerformingCheatMenuCombo() && !GameStateManager.Instance.PlayerInputLocked && inman.InputSource.Fire1.WasPerformedThisFrame)
			{
				Shoot();
			}
		}

		private void Shoot()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(projectile);
			val.transform.parent = null;
			val.transform.position = shootPoint.position;
			val.transform.rotation = shootPoint.rotation;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "bitmotte.MirrorVision";

		public const string PLUGIN_NAME = "MirrorVision";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}