Decompiled source of UltraEditor v0.0.9

UltraEditor.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading;
using BepInEx;
using BepInEx.Logging;
using BlackholeChaos.Scripts;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using ScriptableObjects;
using TMPro;
using UltraEditor;
using UltraEditor.Classes;
using UltraEditor.Classes.Canvas;
using UltraEditor.Classes.Editor;
using UltraEditor.Classes.IO;
using UltraEditor.Classes.IO.SaveObjects;
using UltraEditor.Classes.TempScripts;
using UltraEditor.Classes.World;
using UltraEditor.Libraries;
using Unity.AI.Navigation;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.AddressableAssets;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using plog;
using plog.Models;

[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("UltraEditor")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("WIP in-game level editor for ultrakill")]
[assembly: AssemblyFileVersion("0.0.8.0")]
[assembly: AssemblyInformationalVersion("0.0.8+38c4451f198754d72a71a57d33b2c7cb75fd928a")]
[assembly: AssemblyProduct("UltraEditor")]
[assembly: AssemblyTitle("UltraEditor")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.8.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;
		}
	}
}
public class NonDefaultScriptChecker : MonoBehaviour
{
	public static void CheckScripts()
	{
		MonoBehaviour[] array = Object.FindObjectsOfType<MonoBehaviour>(true);
		MonoBehaviour[] array2 = array;
		foreach (MonoBehaviour val in array2)
		{
			Type type = ((object)val).GetType();
			string name = type.Assembly.GetName().Name;
			if (name != "Assembly-CSharp" && !name.StartsWith("UnityEngine") && !name.StartsWith("Unity") && !name.StartsWith("UnityEditor"))
			{
				Plugin.LogError("Non-default script detected: " + type.FullName + " in assembly " + name + " on GameObject '" + ((Object)((Component)val).gameObject).name + "'");
			}
		}
		Plugin.LogInfo("Script scan complete");
	}
}
public static class AttributeHelper
{
	public static IEnumerable<(Type type, T attr)> GetTypesWithAttribute<T>() where T : Attribute
	{
		return from t in AppDomain.CurrentDomain.GetAssemblies().SelectMany((Assembly a) => a.GetTypes())
			select (t, t.GetCustomAttribute<T>()) into x
			where x.attr != null
			select x;
	}

	public static IEnumerable<(FieldInfo field, T attr)> GetFieldsWithAttribute<T>() where T : Attribute
	{
		return from f in AppDomain.CurrentDomain.GetAssemblies().SelectMany((Assembly a) => a.GetTypes()).SelectMany((Type t) => t.GetFields(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic))
			select (f, f.GetCustomAttribute<T>()) into x
			where x.attr != null
			select x;
	}
}
[AttributeUsage(AttributeTargets.Class)]
public class EditorComp : Attribute
{
	public string description;

	public EditorComp(string description)
	{
		this.description = description;
	}
}
[AttributeUsage(AttributeTargets.Field)]
public class VarDescription : Attribute
{
	public string description;

	public VarDescription(string description)
	{
		this.description = description;
	}
}
[AttributeUsage(AttributeTargets.Field)]
public class EditorVar : Attribute
{
	public string display;

	public EditorVar(string description)
	{
		display = description;
	}
}
namespace UltrakillStupid.Patches
{
	[HarmonyPatch(typeof(GameProgressSaver))]
	[HarmonyPatch("SecretFound")]
	internal class GmameProggressSaverPatch
	{
		public static bool Prefix(int secretNum)
		{
			return true;
		}
	}
	[HarmonyPatch(typeof(LeaderboardController))]
	[HarmonyPatch("SubmitLevelScore")]
	internal class LeaderboardControllerPatch
	{
		public static bool Prefix(string levelName, int difficulty, float seconds, int kills, int style, int restartCount, bool pRank = false)
		{
			return (Object)(object)EditorManager.Instance == (Object)null;
		}
	}
	[HarmonyPatch(typeof(Revolver))]
	[HarmonyPatch("Shoot")]
	internal class LookThisPatchIsNeeded
	{
		public static void Postfix(int shotType = 1)
		{
			((Component)MonoSingleton<CameraController>.Instance).GetComponent<Camera>().fieldOfView = MonoSingleton<CameraController>.Instance.defaultFov;
		}
	}
	[HarmonyPatch(typeof(OptionsManager), "Pause")]
	[HarmonyPatch]
	public class RemovePauseMeun
	{
		public static bool Prefix()
		{
			return (Object)(object)EditorManager.Instance == (Object)null || !EditorManager.Instance.editorOpen;
		}
	}
	[HarmonyPatch(typeof(GetMissionName))]
	[HarmonyPatch("GetMissionNameOnly")]
	internal class GetMissionNamePatch
	{
		public static bool Prefix(int missionNum, ref string __result)
		{
			if (SceneHelper.CurrentScene == "UltraEditor")
			{
				__result = MapInfoBase.Instance.levelName;
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(GetMissionName))]
	[HarmonyPatch("GetMissionNumberOnly")]
	internal class GetMissionNamePatch2
	{
		public static bool Prefix(int missionNum, ref string __result)
		{
			if (SceneHelper.CurrentScene == "UltraEditor")
			{
				__result = "C";
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(GetMissionName))]
	[HarmonyPatch("GetMission")]
	internal class GetMissionNamePatch3
	{
		public static bool Prefix(int missionNum, ref string __result)
		{
			if (SceneHelper.CurrentScene == "UltraEditor")
			{
				__result = MapInfoBase.Instance.levelName;
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(StatsManager))]
	[HarmonyPatch("SecretFound")]
	internal class SecretFoundPatch2
	{
		public static bool Prefix(int i)
		{
			return i != 100000;
		}
	}
}
namespace BlackholeChaos.Scripts
{
	public class Blackhole : MonoBehaviour
	{
		public float range = 0f;

		public float force = 0f;

		public int difficulty = 1;

		public MeshRenderer meshRendeder;

		public MeshRenderer meshRendeder2;

		public MeshRenderer meshRendeder3;

		private bool inHole = false;

		public bool white = false;

		private List<Rigidbody> touchedRigidbodies = new List<Rigidbody>();

		private float A = 0f;

		public void Create()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.position = Vector3.zero + new Vector3(0f, 25f, 0f);
			((Component)this).transform.position = ((Component)MonoSingleton<NewMovement>.Instance).transform.position + new Vector3(0f, 25f, 0f);
			difficulty = MonoSingleton<PrefsManager>.Instance.GetInt("difficulty", 0);
			SetupVisual();
		}

		private void SetupVisual()
		{
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Expected O, but got Unknown
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: 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_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Expected O, but got Unknown
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Expected O, but got Unknown
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Expected O, but got Unknown
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Expected O, but got Unknown
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0385: Unknown result type (might be due to invalid IL or missing references)
			//IL_038c: Expected O, but got Unknown
			//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03db: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e2: Expected O, but got Unknown
			//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
			Color color = default(Color);
			((Color)(ref color))..ctor(0f, 0f, 0f, 0f);
			if (white)
			{
				((Color)(ref color))..ctor(1f, 1f, 1f, 0f);
			}
			MeshFilter val = ((Component)this).gameObject.AddComponent<MeshFilter>();
			MeshRenderer val2 = ((Component)this).gameObject.AddComponent<MeshRenderer>();
			GameObject val3 = GameObject.CreatePrimitive((PrimitiveType)0);
			MeshFilter component = val3.GetComponent<MeshFilter>();
			if ((Object)(object)component != (Object)null)
			{
				val.mesh = component.sharedMesh;
			}
			Object.Destroy((Object)(object)val3);
			((Renderer)val2).enabled = false;
			Material val4 = new Material(Shader.Find("Standard"));
			val4.color = color;
			val4.SetFloat("_Mode", 3f);
			val4.SetInt("_SrcBlend", 5);
			val4.SetInt("_DstBlend", 10);
			val4.SetInt("_ZWrite", 0);
			val4.DisableKeyword("_ALPHATEST_ON");
			val4.EnableKeyword("_ALPHABLEND_ON");
			val4.DisableKeyword("_ALPHAPREMULTIPLY_ON");
			val4.renderQueue = 3000;
			((Renderer)val2).material = val4;
			((Component)this).transform.localScale = Vector3.one * 2f;
			GameObject val5 = new GameObject("BlackholeShell");
			val5.transform.parent = ((Component)this).transform;
			val5.transform.localPosition = Vector3.zero;
			MeshFilter val6 = val5.AddComponent<MeshFilter>();
			MeshRenderer val7 = val5.AddComponent<MeshRenderer>();
			val6.mesh = Object.Instantiate<Mesh>(val.mesh);
			Material val8 = new Material(Shader.Find("Standard"));
			val8.color = color;
			val8.SetFloat("_Mode", 3f);
			val8.SetInt("_SrcBlend", 5);
			val8.SetInt("_DstBlend", 10);
			val8.SetInt("_ZWrite", 0);
			val8.DisableKeyword("_ALPHATEST_ON");
			val8.EnableKeyword("_ALPHABLEND_ON");
			val8.DisableKeyword("_ALPHAPREMULTIPLY_ON");
			val8.renderQueue = 3000;
			val8.shader = MonoSingleton<DefaultReferenceManager>.Instance.masterShader;
			((Renderer)val7).material = val8;
			meshRendeder = val7;
			val5 = new GameObject("BlackholeShell");
			val5.transform.parent = ((Component)this).transform;
			val5.transform.localPosition = Vector3.zero;
			val6 = val5.AddComponent<MeshFilter>();
			val7 = val5.AddComponent<MeshRenderer>();
			val6.mesh = Object.Instantiate<Mesh>(val.mesh);
			val8 = new Material(Shader.Find("Standard"));
			val8.color = color;
			val8.SetFloat("_Mode", 3f);
			val8.SetInt("_SrcBlend", 5);
			val8.SetInt("_DstBlend", 10);
			val8.SetInt("_ZWrite", 0);
			val8.DisableKeyword("_ALPHATEST_ON");
			val8.EnableKeyword("_ALPHABLEND_ON");
			val8.DisableKeyword("_ALPHAPREMULTIPLY_ON");
			val8.renderQueue = 3000;
			val8.shader = MonoSingleton<DefaultReferenceManager>.Instance.masterShader;
			((Renderer)val7).material = val8;
			Mesh val9 = Object.Instantiate<Mesh>(val6.mesh);
			MemoryExtensions.Reverse<int>(val9.triangles);
			val9.RecalculateNormals();
			val6.mesh = val9;
			meshRendeder3 = val7;
			val5 = new GameObject("BlackholeShell");
			val5.transform.parent = ((Component)this).transform;
			val5.transform.localPosition = Vector3.zero;
			val6 = val5.AddComponent<MeshFilter>();
			val7 = val5.AddComponent<MeshRenderer>();
			val6.mesh = val.mesh;
			val8 = new Material(Shader.Find("Standard"));
			val8.color = color;
			val8.SetFloat("_Mode", 3f);
			val8.SetInt("_SrcBlend", 5);
			val8.SetInt("_DstBlend", 10);
			val8.SetInt("_ZWrite", 0);
			val8.DisableKeyword("_ALPHATEST_ON");
			val8.EnableKeyword("_ALPHABLEND_ON");
			val8.DisableKeyword("_ALPHAPREMULTIPLY_ON");
			val8.renderQueue = 3000;
			val8.shader = Shader.Find("Legacy Shaders/Diffuse");
			if (white)
			{
				val8.shader = Shader.Find("Unlit/Texture");
			}
			((Renderer)val7).material = val8;
			meshRendeder2 = val7;
		}

		public void Update()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: 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)
			if (Time.deltaTime != 0f && !((Object)(object)meshRendeder == (Object)null))
			{
				((Component)meshRendeder3).transform.position = ((Component)Camera.main).transform.position;
				((Renderer)meshRendeder3).enabled = Vector3.Distance(((Component)MonoSingleton<NewMovement>.Instance).transform.position, ((Component)this).transform.position) <= range;
			}
		}

		public void FixedUpdate()
		{
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: 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_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0310: Unknown result type (might be due to invalid IL or missing references)
			//IL_031a: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			if (Time.deltaTime == 0f || (Object)(object)meshRendeder == (Object)null)
			{
				return;
			}
			float num = ((float)difficulty + 1f) / 4f;
			force = force * (1f + Time.fixedDeltaTime / 2000f) + Time.fixedDeltaTime * 500f * num;
			range = range * (1f + Time.fixedDeltaTime / 1000f) + Time.fixedDeltaTime * 7f * num;
			((Component)meshRendeder).transform.localScale = new Vector3(1f, 1f, 1f) * range;
			((Component)meshRendeder3).transform.localScale = new Vector3(1f, 1f, 1f);
			((Component)meshRendeder2).transform.localScale = new Vector3(1f, 1f, 1f) * range / 5f;
			if (Vector3.Distance(((Component)MonoSingleton<NewMovement>.Instance).transform.position, ((Component)this).transform.position) < range)
			{
				if (Vector3.Distance(((Component)MonoSingleton<NewMovement>.Instance).transform.position, ((Component)this).transform.position) < range / 5f)
				{
					MonoSingleton<NewMovement>.Instance.GetHurt(1000, false, 1f, false, false, 0.35f, false);
					MonoSingleton<StatsManager>.Instance.currentCheckPoint = null;
					MonoSingleton<CheckPointsController>.Instance.DisableCheckpoints();
				}
				inHole = true;
			}
			else
			{
				inHole = false;
			}
			Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, range);
			int num2 = 0;
			Collider[] array2 = array;
			foreach (Collider val in array2)
			{
				Rigidbody attachedRigidbody = val.attachedRigidbody;
				EnemyIdentifier component = ((Component)val).GetComponent<EnemyIdentifier>();
				if ((Object)(object)attachedRigidbody != (Object)null && (Object)(object)attachedRigidbody != (Object)(object)((Component)this).GetComponent<Rigidbody>())
				{
					num2++;
					if (num2 > 25 && (Object)(object)component == (Object)null)
					{
						continue;
					}
					Vector3 val2 = ((Component)this).transform.position - attachedRigidbody.position;
					Vector3 normalized = ((Vector3)(ref val2)).normalized;
					float num3 = Vector3.Distance(((Component)this).transform.position, attachedRigidbody.position);
					float num4 = (float)((!white) ? 1 : (-1)) * force / Mathf.Max(num3, 1f);
					if (num3 < range / 5f)
					{
						Transform transform = ((Component)attachedRigidbody).transform;
						transform.localScale += 10f * new Vector3(Random.Range(0f, 0.1f), Random.Range(0f, 0.2f), Random.Range(0f, 0.1f)) * Time.fixedDeltaTime;
						if (!touchedRigidbodies.Contains(attachedRigidbody))
						{
							Fat();
							touchedRigidbodies.Add(attachedRigidbody);
						}
						if (num3 <= range / 10f && (Object)(object)component == (Object)null && (Object)(object)((Component)MonoSingleton<NewMovement>.Instance).gameObject != (Object)(object)((Component)attachedRigidbody).gameObject)
						{
							Fat();
							Object.Destroy((Object)(object)((Component)attachedRigidbody).gameObject);
							continue;
						}
					}
					attachedRigidbody.AddForce(normalized * num4, (ForceMode)0);
				}
				if ((Object)(object)component != (Object)null && Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position) < range / 5f)
				{
					Fat();
					DamageEnemy(component);
				}
			}
		}

		private void Fat()
		{
			range += 3f;
			force += 400f;
		}

		public void OnGUI()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			if (inHole)
			{
				float num = Vector3.Distance(((Component)MonoSingleton<NewMovement>.Instance).transform.position, ((Component)this).transform.position);
				float num2 = range;
				float num3 = Mathf.Clamp01(5f - num / num2) * 0.6f + 0.1f;
				A -= (A - num3) / 200f;
			}
			else
			{
				A -= (A - 0f) / 20f;
			}
			Color color = GUI.color;
			float num4 = (white ? 1f : 0f);
			GUI.color = new Color(num4, num4, num4, A / 2f);
			GUI.DrawTexture(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), (Texture)(object)Texture2D.whiteTexture);
			GUI.color = color;
		}

		private void DamageEnemy(EnemyIdentifier eid)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			eid.DeliverDamage(((Component)this).gameObject, Vector3.zero, Vector3.zero, 1000f, false, 0f, (GameObject)null, false, false);
		}
	}
}
namespace UltraEditor
{
	[BepInPlugin("duviz.ultrakill.ultraeditor", "UltraEditor", "0.0.9")]
	public class Plugin : BaseUnityPlugin
	{
		public const string GUID = "duviz.ultrakill.ultraeditor";

		public const string Name = "UltraEditor";

		public const string Version = "0.0.9";

		public static Plugin instance;

		public Logger Log;

		public static KeyCode editorOpenKey = (KeyCode)282;

		public static KeyCode selectCursorKey = (KeyCode)283;

		public static KeyCode selectMoveKey = (KeyCode)284;

		public static KeyCode selectScaleKey = (KeyCode)285;

		public static KeyCode selectRotationKey = (KeyCode)286;

		public static KeyCode toggleEditorCanvasKey = (KeyCode)290;

		public static KeyCode deleteObjectKey = (KeyCode)127;

		public static KeyCode createCubeKey = (KeyCode)270;

		public static KeyCode ctrlKey = (KeyCode)306;

		public static KeyCode shiftKey = (KeyCode)304;

		public static KeyCode altKey = (KeyCode)308;

		private static bool seenWelcomeMessage = false;

		public static bool isToggleEnabledKeyPressed()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKey(altKey) && Input.GetKey(shiftKey) && Input.GetKeyDown((KeyCode)97))
			{
				return true;
			}
			return false;
		}

		public static bool isDuplicateKeyPressed()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKey(ctrlKey) && Input.GetKeyDown((KeyCode)100))
			{
				return true;
			}
			return false;
		}

		public static bool isSelectPressed()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKey(altKey) && Input.GetKeyDown((KeyCode)115))
			{
				return true;
			}
			return false;
		}

		public static bool canMove()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			return !Input.GetKey(ctrlKey) && !Input.GetKey(altKey);
		}

		public void Awake()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			instance = this;
			LogInfo("Hello, the Instagram community!");
			Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
			EditorVariablesList.SetupEditorVariables();
			EditorComponentsList.SetupEditorComponents();
			Harmony val = new Harmony("duviz.ultrakill.ultraeditor");
			val.PatchAll();
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)4;
			SceneManager.sceneLoaded += delegate
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				new GameObject("load pls uwu :3").AddComponent<EmptySceneLoader>();
			};
		}

		public void Start()
		{
			//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("BundlesManager");
			val.AddComponent<BundlesManager>();
			val.AddComponent<ChapterSelectChanger>();
		}

		public void Update()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKeyDown(editorOpenKey) && (SceneHelper.CurrentScene != EditorManager.EditorSceneName || EditorManager.canOpenEditor || EmptySceneLoader.forceLevelCanOpenEditor || ((Object)(object)EditorManager.Instance != (Object)null && EditorManager.Instance.editorCanvas.activeInHierarchy)) && SceneHelper.PendingScene == null)
			{
				EditorManager.Create();
			}
			if (SceneHelper.CurrentScene == "Main Menu" && SceneHelper.PendingScene == null && !seenWelcomeMessage)
			{
				if (PlayerPrefs.GetString("UltraEditor_LastPlayedVersion") != GetVersion().ToString())
				{
					Object.Instantiate<GameObject>(BundlesManager.editorBundle.LoadAsset<GameObject>("WelcomeCanvas"));
					PlayerPrefs.SetString("UltraEditor_LastPlayedVersion", GetVersion().ToString());
				}
				seenWelcomeMessage = true;
			}
		}

		public static T Ass<T>(string path)
		{
			//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)
			return Addressables.LoadAssetAsync<T>((object)path).WaitForCompletion();
		}

		public static T Ast<T>(string path) where T : Object
		{
			T val = Resources.Load<T>(path);
			if ((Object)(object)val == (Object)null)
			{
				LogError("Resources.Load failed for '" + path + "'");
			}
			return val;
		}

		public static void LogInfo(object data, string stackTrace = null)
		{
			//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_0046: Expected O, but got Unknown
			//IL_004b: Expected O, but got Unknown
			ManualLogSource logger = ((BaseUnityPlugin)instance).Logger;
			if (logger != null)
			{
				logger.LogInfo((stackTrace != null) ? $"{data}\n{stackTrace}" : data);
			}
			Plugin plugin = instance;
			Logger obj = plugin.Log;
			if (obj == null)
			{
				Logger val = new Logger("ULTRAEDITOR");
				Logger val2 = val;
				plugin.Log = val;
				obj = val2;
			}
			if (obj != null)
			{
				obj.Info(data.ToString(), (IEnumerable<Tag>)null, stackTrace, (object)null);
			}
		}

		public static void LogError(object data, string stackTrace = null)
		{
			//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_0046: Expected O, but got Unknown
			//IL_004b: Expected O, but got Unknown
			ManualLogSource logger = ((BaseUnityPlugin)instance).Logger;
			if (logger != null)
			{
				logger.LogError((stackTrace != null) ? $"{data}\n{stackTrace}" : data);
			}
			Plugin plugin = instance;
			Logger obj = plugin.Log;
			if (obj == null)
			{
				Logger val = new Logger("ULTRAEDITOR");
				Logger val2 = val;
				plugin.Log = val;
				obj = val2;
			}
			if (obj != null)
			{
				obj.Error(data.ToString(), (IEnumerable<Tag>)null, stackTrace, (object)null);
			}
		}

		public static Version GetVersion()
		{
			return ((BaseUnityPlugin)instance).Info.Metadata.Version;
		}
	}
}
namespace UltraEditor.Libraries
{
	public static class TextPatcher
	{
		private static List<(string, string)> patches = new List<(string, string)>(2)
		{
			("<b>", "<b><color=white>"),
			("</b>", "</b></color>")
		};

		public static string Patch(string originalText)
		{
			string text = originalText;
			foreach (var patch in patches)
			{
				text = text.Replace(patch.Item1, patch.Item2);
			}
			return text;
		}
	}
	public static class TimePatcher
	{
		private static float maxValue = 0.1f;

		public static float DeltaTime()
		{
			return Mathf.Min(Time.deltaTime, maxValue);
		}

		public static float UnscaledDeltaTime()
		{
			return Mathf.Min(Time.unscaledDeltaTime, maxValue);
		}
	}
}
namespace UltraEditor.Classes
{
	public class AssetItem : MonoBehaviour
	{
		public string assetPath;

		public string assetName;

		public TMP_Text assetNameText;

		public GameObject assetItemObject;

		public void Start()
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			if (assetPath == "")
			{
				assetPath = ((Object)assetItemObject).name;
			}
			else
			{
				assetNameText.text = assetName;
			}
			((UnityEvent)((Component)this).GetComponent<Button>().onClick).AddListener((UnityAction)delegate
			{
				EditorManager.Instance.SpawnAsset(assetPath);
			});
		}
	}
	public class Billboard : MonoBehaviour
	{
		public static List<Billboard> billboards = new List<Billboard>();

		public static Sprite entitySprite = null;

		public static Sprite activateArena = null;

		public static Sprite activateNextWave = null;

		public static Sprite activateObject = null;

		public static Sprite deathzone = null;

		public static Sprite hudMessageObject = null;

		public static Sprite levelInfoObject = null;

		public static Sprite light = null;

		public static Sprite musicObject = null;

		public static Sprite teleportObject = null;

		public static Sprite checkpoint = null;

		public static Sprite cubeTilingAnimator = null;

		public static Sprite animator = null;

		public static Sprite sfxObject = null;

		public static Sprite skullTrigger = null;

		public static Sprite bookObject = null;

		public static List<(Sprite, Material, Vector3)> materials = new List<(Sprite, Material, Vector3)>();

		public GameObject target;

		public SphereCollider col;

		public static void DeleteAll()
		{
			foreach (Billboard item in billboards.ToList())
			{
				if ((Object)(object)item != (Object)null)
				{
					Object.DestroyImmediate((Object)(object)((Component)item).gameObject);
				}
			}
			billboards.Clear();
		}

		public static void UpdateBillboards()
		{
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: 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_034a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0386: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0407: Unknown result type (might be due to invalid IL or missing references)
			//IL_041f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0437: Unknown result type (might be due to invalid IL or missing references)
			//IL_044f: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)entitySprite == (Object)null)
			{
				entitySprite = BundlesManager.editorBundle.LoadAsset<Sprite>("entity");
				activateArena = BundlesManager.editorBundle.LoadAsset<Sprite>("ActivateArena");
				activateNextWave = BundlesManager.editorBundle.LoadAsset<Sprite>("ActivateNextWave");
				Billboard.activateObject = BundlesManager.editorBundle.LoadAsset<Sprite>("ActivateObject");
				deathzone = BundlesManager.editorBundle.LoadAsset<Sprite>("deathzone");
				hudMessageObject = BundlesManager.editorBundle.LoadAsset<Sprite>("hudMessageObject");
				Billboard.levelInfoObject = BundlesManager.editorBundle.LoadAsset<Sprite>("info");
				light = BundlesManager.editorBundle.LoadAsset<Sprite>("light");
				Billboard.musicObject = BundlesManager.editorBundle.LoadAsset<Sprite>("music");
				checkpoint = BundlesManager.editorBundle.LoadAsset<Sprite>("checkpoint");
				Billboard.cubeTilingAnimator = BundlesManager.editorBundle.LoadAsset<Sprite>("cubeTilingAnimator");
				animator = BundlesManager.editorBundle.LoadAsset<Sprite>("animator");
				sfxObject = BundlesManager.editorBundle.LoadAsset<Sprite>("sfxObject");
				skullTrigger = BundlesManager.editorBundle.LoadAsset<Sprite>("skullTrigger");
				Billboard.bookObject = BundlesManager.editorBundle.LoadAsset<Sprite>("book");
			}
			DeleteAll();
			Component[] array = Object.FindObjectsOfType<Component>(true);
			Component[] array2 = array;
			foreach (Component val in array2)
			{
				Vector3 position = val.transform.position;
				Component val2 = val;
				Component val3 = val2;
				if (!(val3 is PrefabObject prefabObject))
				{
					ActivateArena val4 = (ActivateArena)(object)((val3 is ActivateArena) ? val3 : null);
					if (val4 == null)
					{
						ActivateNextWave val5 = (ActivateNextWave)(object)((val3 is ActivateNextWave) ? val3 : null);
						if (val5 == null)
						{
							if (!(val3 is ActivateObject))
							{
								DeathZone val6 = (DeathZone)(object)((val3 is DeathZone) ? val3 : null);
								if (val6 == null)
								{
									if (!(val3 is HUDMessageObject))
									{
										if (!(val3 is LevelInfoObject))
										{
											Light val7 = (Light)(object)((val3 is Light) ? val3 : null);
											if (val7 == null)
											{
												if (!(val3 is MusicObject))
												{
													if (!(val3 is TeleportObject))
													{
														if (!(val3 is CheckpointObject))
														{
															if (!(val3 is CubeTilingAnimator))
															{
																if (!(val3 is MovingPlatformAnimator))
																{
																	if (!(val3 is SFXObject))
																	{
																		if (!(val3 is SkullActivatorObject))
																		{
																			if (val3 is BookObject)
																			{
																				NewBillboard(Billboard.bookObject, position, val.gameObject);
																			}
																		}
																		else
																		{
																			NewBillboard(skullTrigger, position, val.gameObject);
																		}
																	}
																	else
																	{
																		NewBillboard(sfxObject, position, val.gameObject);
																	}
																}
																else
																{
																	NewBillboard(animator, position, val.gameObject);
																}
															}
															else
															{
																NewBillboard(Billboard.cubeTilingAnimator, position, val.gameObject);
															}
														}
														else
														{
															NewBillboard(checkpoint, position, val.gameObject);
														}
													}
													else
													{
														NewBillboard(Billboard.teleportObject, position, val.gameObject);
													}
												}
												else
												{
													NewBillboard(Billboard.musicObject, position, val.gameObject);
												}
											}
											else if ((Object)(object)((Component)val7).GetComponent<SavableObject>() != (Object)null && (Object)(object)((Component)val7).GetComponent<PrefabObject>() == (Object)null)
											{
												NewBillboard(light, position, val.gameObject);
											}
										}
										else
										{
											NewBillboard(Billboard.levelInfoObject, position, val.gameObject);
										}
									}
									else
									{
										NewBillboard(hudMessageObject, position, val.gameObject);
									}
								}
								else if ((Object)(object)((Component)val6).GetComponent<SavableObject>() != (Object)null)
								{
									NewBillboard(deathzone, position, val.gameObject);
								}
							}
							else
							{
								NewBillboard(Billboard.activateObject, position, val.gameObject);
							}
						}
						else
						{
							NewBillboard(activateNextWave, position, val.gameObject);
						}
					}
					else
					{
						NewBillboard(activateArena, position, val.gameObject);
					}
				}
				else if (prefabObject.PrefabAsset.StartsWith("Assets/Prefabs/Enemies/"))
				{
					NewBillboard(entitySprite, position, val.gameObject);
				}
			}
		}

		public static void NewBillboard(Sprite spr, Vector3 pos, GameObject target)
		{
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.CreatePrimitive((PrimitiveType)5);
			val.AddComponent<Billboard>();
			Object.Destroy((Object)(object)val.GetComponent<Collider>());
			Renderer component = val.GetComponent<Renderer>();
			Shader val2 = Shader.Find("Sprites/Default");
			if (!Object.op_Implicit((Object)(object)val2))
			{
				Debug.LogError((object)"Sprites/Default shader not found");
				return;
			}
			(Sprite, Material, Vector3) tuple = materials.FirstOrDefault(((Sprite, Material, Vector3) x) => (Object)(object)x.Item1 == (Object)(object)spr);
			if ((Object)(object)tuple.Item2 == (Object)null)
			{
				Material val3 = new Material(val2);
				val3.mainTexture = (Texture)(object)spr.texture;
				Rect rect = spr.rect;
				Texture texture = (Texture)(object)spr.texture;
				val3.mainTextureScale = new Vector2(((Rect)(ref rect)).width / (float)texture.width, ((Rect)(ref rect)).height / (float)texture.height);
				val3.mainTextureOffset = new Vector2(((Rect)(ref rect)).x / (float)texture.width, ((Rect)(ref rect)).y / (float)texture.height);
				component.material = val3;
				float num = ((Rect)(ref rect)).width / spr.pixelsPerUnit;
				float num2 = ((Rect)(ref rect)).height / spr.pixelsPerUnit;
				val.transform.localScale = new Vector3(num, num2, 1f);
				materials.Add((spr, val3, val.transform.localScale));
			}
			else
			{
				component.material = tuple.Item2;
				val.transform.localScale = tuple.Item3;
			}
			val.transform.position = pos;
			val.GetComponent<Billboard>().target = target;
			val.GetComponent<Billboard>().Update();
		}

		public void Awake()
		{
			col = ((Component)this).gameObject.AddComponent<SphereCollider>();
			col.radius = 1f;
			billboards.Add(this);
		}

		public void Update()
		{
			//IL_0089: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: 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_0134: 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_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)EditorManager.Instance == (Object)null)
			{
				DeleteAll();
			}
			if (!EditorManager.Instance.editorCanvas.activeInHierarchy)
			{
				DeleteAll();
			}
			if ((Object)(object)target == (Object)null)
			{
				return;
			}
			Camera editorCamera = EditorManager.Instance.editorCamera;
			if ((Object)(object)editorCamera == (Object)null)
			{
				return;
			}
			((Component)this).transform.LookAt(((Component)editorCamera).transform);
			Renderer component = ((Component)this).GetComponent<Renderer>();
			Color color = component.material.color;
			float num = Math.Clamp(Vector3.Distance(((Component)editorCamera).transform.position, ((Component)this).transform.position) - 1f, 0f, 5f) / (target.activeInHierarchy ? 5f : 20f);
			component.material.color = new Color(color.r, color.g, color.b, num);
			if (Input.GetMouseButtonDown(0) && ((Behaviour)EditorManager.Instance.cameraSelector).enabled && EditorManager.Instance.cameraSelector.selectionMode == CameraSelector.SelectionMode.Cursor)
			{
				Ray val = editorCamera.ScreenPointToRay(Input.mousePosition);
				RaycastHit val2 = default(RaycastHit);
				if (Physics.Raycast(val, ref val2) && (Object)(object)((RaycastHit)(ref val2)).transform == (Object)(object)((Component)this).transform)
				{
					EditorManager.Instance.cameraSelector.SelectObject(target);
					EditorManager.Instance.lastHierarchy = Array.Empty<GameObject>();
				}
			}
		}
	}
	public class BundlesManager : MonoBehaviour
	{
		public static AssetBundle editorBundle;

		public void Awake()
		{
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			string text = "UltraEditor.Assets.editorcanvas.bundle";
			using Stream stream = executingAssembly.GetManifestResourceStream(text);
			if (stream == null)
			{
				Plugin.LogError("Embedded resource '" + text + "' not found!");
				return;
			}
			byte[] array = new byte[stream.Length];
			stream.Read(array, 0, array.Length);
			editorBundle = AssetBundle.LoadFromMemory(array);
			if ((Object)(object)editorBundle != (Object)null)
			{
				Plugin.LogInfo("Loaded embedded AssetBundle!");
			}
			else
			{
				Plugin.LogError("Failed to load AssetBundle from memory!");
			}
		}

		public void OnDestroy()
		{
			AssetBundle obj = editorBundle;
			if (obj != null)
			{
				obj.Unload(false);
			}
		}
	}
	public class CameraMovement : MonoBehaviour
	{
		public float movementSpeed = 30f;

		public float mouseSensitivity = 2f;

		public float shiftMultiplier = 3f;

		private (int x, int y) savedMousePos = (0, 0);

		public Light unlitLight = null;

		public bool moving()
		{
			return Input.GetMouseButton(1) && Plugin.canMove() && !EditorManager.Instance.blocker.activeSelf;
		}

		public void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0024: 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)
			GameObject val = new GameObject("CameraLight");
			val.transform.parent = ((Component)this).transform;
			val.transform.localPosition = Vector3.zero;
			val.transform.localEulerAngles = Vector3.zero;
			unlitLight = val.AddComponent<Light>();
			unlitLight.range = 500f;
			unlitLight.renderMode = (LightRenderMode)1;
			unlitLight.type = (LightType)2;
			((Behaviour)unlitLight).enabled = false;
		}

		public void Update()
		{
			//IL_00a1: 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_0134: Unknown result type (might be due to invalid IL or missing references)
			if (Plugin.canMove() && !EditorManager.Instance.blocker.activeSelf)
			{
				float num = movementSpeed * (Input.GetKey((KeyCode)304) ? shiftMultiplier : 1f) * Mathf.Min(Time.unscaledDeltaTime, 0.1f);
				float num2 = Input.GetAxisRaw("Horizontal") * num;
				float num3 = Input.GetAxisRaw("Vertical") * num;
				float num4 = (float)(Input.GetKey((KeyCode)101) ? 1 : (-(Input.GetKey((KeyCode)113) ? 1 : 0))) * num;
				((Component)this).transform.Translate(new Vector3(num2, num4, num3));
				if (Input.GetMouseButtonDown(1))
				{
					savedMousePos = MouseController.GetMousePos();
					Cursor.visible = false;
				}
				if (Input.GetMouseButton(1))
				{
					float num5 = Input.GetAxisRaw("Mouse X") * mouseSensitivity * (EditorManager.sensitivity / 50f);
					float num6 = Input.GetAxisRaw("Mouse Y") * mouseSensitivity * (EditorManager.sensitivity / 50f);
					((Component)this).transform.Rotate(Vector3.up, num5, (Space)0);
					((Component)this).transform.Rotate(Vector3.right, 0f - num6, (Space)1);
					MouseController.SetCursorPos(savedMousePos.x, savedMousePos.y);
				}
			}
		}

		public void setUnlit(bool unlit)
		{
			((Behaviour)unlitLight).enabled = unlit;
		}
	}
	public class CameraSelector : MonoBehaviour
	{
		public enum SelectionMode
		{
			Cursor,
			Move,
			Scale,
			Rotate
		}

		private struct MeshEntry
		{
			public Mesh mesh;

			public Matrix4x4 localToRoot;

			public Material mat;
		}

		public Camera camera;

		public GameObject selectedObject;

		public Material highlightMaterial;

		private GameObject arrowHolder;

		private bool globalArrows = false;

		private SelectionMode _selectionMode = SelectionMode.Cursor;

		private List<MeshEntry> meshes = new List<MeshEntry>();

		public Material ghostMaterial;

		public Material ghostMaterial2;

		private bool objectActive = false;

		private GameObject hoveredObject;

		private Dictionary<GameObject, Material> originalMaterials = new Dictionary<GameObject, Material>();

		private Transform[] moveArrows;

		public bool dragging = false;

		private int draggingAxis = -1;

		private Vector3 dragStartPos;

		private Vector3 objectStartPos;

		private Vector3 objectStartScale;

		private Vector3 objectStartEuler;

		private (int x, int y) savedMousePos = (0, 0);

		private Vector2 realMousePos = Vector2.zero;

		private float timeToUpdate = 0.1f;

		private float scaleMultiplier = 1f;

		private Vector3 currentArrowRot = Vector3.zero;

		public SelectionMode selectionMode
		{
			get
			{
				return _selectionMode;
			}
			set
			{
				if (value == SelectionMode.Cursor)
				{
					DeleteArrows();
				}
				if (value != 0)
				{
					ClearHover();
				}
				_selectionMode = value;
				ModeButton.UpdateButtons();
			}
		}

		private void CacheMeshes()
		{
			meshes.Clear();
			if (!((Object)(object)selectedObject == (Object)null))
			{
				CacheRecursive(selectedObject.transform, selectedObject.transform);
			}
		}

		private void CacheRecursive(Transform t, Transform root)
		{
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: 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)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: 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_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Expected O, but got Unknown
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: 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_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			MeshFilter component = ((Component)t).GetComponent<MeshFilter>();
			MeshRenderer component2 = ((Component)t).GetComponent<MeshRenderer>();
			Material mat = ghostMaterial;
			if (((Component)t).gameObject.layer == LayerMask.NameToLayer("Invisible"))
			{
				mat = ghostMaterial;
			}
			if (!((Component)t).gameObject.activeInHierarchy)
			{
				mat = ghostMaterial2;
			}
			if ((Object)(object)((Component)t).GetComponent<PrefabObject>() != (Object)null && ((Component)t).GetComponent<PrefabObject>().PrefabAsset.StartsWith("Assets/Prefabs/Enemies/"))
			{
				return;
			}
			if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component2) && Object.op_Implicit((Object)(object)component.sharedMesh) && (!((Component)t).gameObject.activeInHierarchy || ((Component)t).gameObject.layer == LayerMask.NameToLayer("Invisible")))
			{
				float num = 1f;
				Bounds bounds = component.sharedMesh.bounds;
				Vector3 lossyScale = t.lossyScale;
				Vector3 val = Vector3.Scale(((Bounds)(ref bounds)).size, lossyScale);
				if (Mathf.Max(new float[3] { val.x, val.y, val.z }) > 100f && new Func<SavableObject>(((Component)t).GetComponent<SavableObject>) == null)
				{
					num = 0.01f;
				}
				meshes.Add(new MeshEntry
				{
					mesh = component.sharedMesh,
					localToRoot = root.worldToLocalMatrix * t.localToWorldMatrix * Matrix4x4.Scale(Vector3.one * num),
					mat = mat
				});
			}
			SkinnedMeshRenderer component3 = ((Component)t).GetComponent<SkinnedMeshRenderer>();
			if (Object.op_Implicit((Object)(object)component3) && Object.op_Implicit((Object)(object)component3.sharedMesh) && (!((Component)t).gameObject.activeInHierarchy || ((Component)t).gameObject.layer == LayerMask.NameToLayer("Invisible")))
			{
				Mesh val2 = new Mesh();
				component3.BakeMesh(val2);
				float num2 = 1f;
				Bounds bounds2 = val2.bounds;
				Vector3 lossyScale2 = t.lossyScale;
				Vector3 val3 = Vector3.Scale(((Bounds)(ref bounds2)).size, lossyScale2);
				if (Mathf.Max(new float[3] { val3.x, val3.y, val3.z }) > 100f && new Func<SavableObject>(((Component)t).GetComponent<SavableObject>) == null)
				{
					num2 = 0.01f;
				}
				meshes.Add(new MeshEntry
				{
					mesh = val2,
					localToRoot = root.worldToLocalMatrix * t.localToWorldMatrix * Matrix4x4.Scale(Vector3.one * num2),
					mat = mat
				});
			}
			for (int i = 0; i < t.childCount; i++)
			{
				CacheRecursive(t.GetChild(i), root);
			}
		}

		private static Bounds TransformBounds(Bounds b, Matrix4x4 m)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: 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)
			//IL_002f: 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_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: 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_00b4: 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_00d3: 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)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((Matrix4x4)(ref m)).MultiplyPoint3x4(((Bounds)(ref b)).center);
			Vector3 extents = ((Bounds)(ref b)).extents;
			Vector3 val2 = ((Matrix4x4)(ref m)).MultiplyVector(new Vector3(extents.x, 0f, 0f));
			Vector3 val3 = ((Matrix4x4)(ref m)).MultiplyVector(new Vector3(0f, extents.y, 0f));
			Vector3 val4 = ((Matrix4x4)(ref m)).MultiplyVector(new Vector3(0f, 0f, extents.z));
			extents.x = Mathf.Abs(val2.x) + Mathf.Abs(val3.x) + Mathf.Abs(val4.x);
			extents.y = Mathf.Abs(val2.y) + Mathf.Abs(val3.y) + Mathf.Abs(val4.y);
			extents.z = Mathf.Abs(val2.z) + Mathf.Abs(val3.z) + Mathf.Abs(val4.z);
			return new Bounds(val, extents * 2f);
		}

		public void Awake()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)camera))
			{
				camera = ((Component)this).GetComponent<Camera>();
			}
			arrowHolder = new GameObject("MoveArrow_Holder");
			highlightMaterial = new Material(MonoSingleton<DefaultReferenceManager>.Instance.blankMaterial);
			highlightMaterial.color = new Color(0.5f, 0.5f, 1f);
			ghostMaterial = CreateGhostMaterial(new Color(0.25f, 0.25f, 1f));
			ghostMaterial2 = CreateGhostMaterial(new Color(0.25f, 0.25f, 0.25f));
			ModeButton.UpdateButtons();
		}

		private Material CreateGhostMaterial(Color color, float thickness = 30f)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			Shader val = BundlesManager.editorBundle.LoadAsset<Shader>("GhostDottedOutline");
			Material val2 = new Material(val);
			val2.SetColor("_Color", color);
			val2.SetFloat("_Thickness", 0.02f);
			val2.SetFloat("_DotScale", thickness);
			val2.SetFloat("_DotCutoff", 0f);
			val2.SetFloat("_Offset", 0f);
			return val2;
		}

		public void Update()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKeyDown(Plugin.selectCursorKey))
			{
				selectionMode = SelectionMode.Cursor;
			}
			if (Input.GetKeyDown(Plugin.selectMoveKey))
			{
				selectionMode = SelectionMode.Move;
			}
			if (Input.GetKeyDown(Plugin.selectScaleKey))
			{
				selectionMode = SelectionMode.Scale;
			}
			if (Input.GetKeyDown(Plugin.selectRotationKey))
			{
				selectionMode = SelectionMode.Rotate;
			}
			if (selectionMode == SelectionMode.Cursor)
			{
				HandleCursorMode();
			}
			if (selectionMode != 0 && Object.op_Implicit((Object)(object)selectedObject))
			{
				HandleMoveMode();
			}
			if ((Object)(object)selectedObject == (Object)null || !EditorManager.Instance.IsObjectEditable())
			{
				if (selectionMode != 0)
				{
					DeleteArrows();
				}
				selectionMode = SelectionMode.Cursor;
			}
			if ((Object)(object)selectedObject != (Object)null && objectActive != selectedObject.activeInHierarchy)
			{
				objectActive = selectedObject.activeInHierarchy;
				CacheMeshes();
			}
		}

		public void RenderInsides()
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: 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_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			highlightMaterial.SetFloat("_Offset", highlightMaterial.GetFloat("_Offset") + Time.unscaledDeltaTime);
			if ((Object)(object)selectedObject == (Object)null)
			{
				return;
			}
			Matrix4x4 localToWorldMatrix = selectedObject.transform.localToWorldMatrix;
			ghostMaterial.SetFloat("_Offset", ghostMaterial.GetFloat("_Offset") + Time.unscaledDeltaTime);
			ghostMaterial2.SetFloat("_Offset", ghostMaterial2.GetFloat("_Offset") + Time.unscaledDeltaTime);
			timeToUpdate -= Time.unscaledDeltaTime;
			if (timeToUpdate <= 0f)
			{
				timeToUpdate = 0.1f;
				CacheMeshes();
			}
			foreach (MeshEntry mesh in meshes)
			{
				if (!((Object)(object)mesh.mesh == (Object)null))
				{
					Matrix4x4 val = localToWorldMatrix * mesh.localToRoot;
					Bounds val2 = TransformBounds(mesh.mesh.bounds, val);
					if (!((Bounds)(ref val2)).Contains(((Component)camera).transform.position))
					{
						Graphics.DrawMesh(mesh.mesh, val, mesh.mat, 0);
					}
				}
			}
		}

		private void OnDisable()
		{
			ClearHover();
		}

		private void HandleCursorMode()
		{
			//IL_0043: 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)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)hoveredObject != (Object)null && (Object)(object)hoveredObject != (Object)(object)selectedObject)
			{
				RestoreMaterial(hoveredObject);
				hoveredObject = null;
			}
			Ray val = camera.ScreenPointToRay(Input.mousePosition);
			RaycastHit val2 = default(RaycastHit);
			if (!Physics.Raycast(val, ref val2, 1000f, camera.cullingMask) || !(((RaycastHit)(ref val2)).distance > 0.1f))
			{
				return;
			}
			GameObject gameObject = ((Component)((RaycastHit)(ref val2)).collider).gameObject;
			if ((Object)(object)gameObject != (Object)(object)selectedObject)
			{
				hoveredObject = gameObject;
				Renderer component = gameObject.GetComponent<Renderer>();
				if (Object.op_Implicit((Object)(object)component) && (EditorManager.Instance.IsObjectEditable(gameObject) || EditorManager.advancedInspector))
				{
					if (!originalMaterials.ContainsKey(gameObject))
					{
						originalMaterials[gameObject] = component.material;
					}
					component.material = highlightMaterial;
				}
			}
			if (Input.GetMouseButtonDown(0))
			{
				if (Input.GetKey(Plugin.altKey))
				{
					EditorManager.Instance.SelectObject(gameObject);
				}
				else if (EditorManager.Instance.IsObjectEditable(gameObject) || EditorManager.advancedInspector)
				{
					SelectObject(gameObject);
				}
			}
		}

		public void ClearHover()
		{
			if (Object.op_Implicit((Object)(object)hoveredObject))
			{
				RestoreMaterial(hoveredObject);
			}
			hoveredObject = null;
		}

		private void RestoreMaterial(GameObject obj)
		{
			Material value;
			if ((Object)(object)obj.GetComponent<CubeObject>() != (Object)null && (Object)(object)obj.GetComponent<MaterialChoser>() != (Object)null)
			{
				obj.GetComponent<MaterialChoser>().ProcessMaterial(obj.GetComponent<CubeObject>().matType, obj.GetComponent<CubeObject>().matTiling, obj.GetComponent<CubeObject>().shape, obj.GetComponent<CubeObject>().fixMaterialTiling, obj.GetComponent<CubeObject>().customTextureUrl);
			}
			else if (Object.op_Implicit((Object)(object)obj) && originalMaterials.TryGetValue(obj, out value))
			{
				Renderer component = obj.GetComponent<Renderer>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.material = value;
				}
			}
		}

		public void ClearSelectedMaterial()
		{
			if (Object.op_Implicit((Object)(object)selectedObject))
			{
				RestoreMaterial(selectedObject);
			}
		}

		public void UnselectObject()
		{
			if (Object.op_Implicit((Object)(object)selectedObject))
			{
				RestoreMaterial(selectedObject);
			}
			selectedObject = null;
			EditorManager.PlayAudio(EditorManager.unselectObject);
			ClearHover();
			if (moveArrows != null)
			{
				Transform[] array = moveArrows;
				foreach (Transform val in array)
				{
					Object.Destroy((Object)(object)((Component)val).gameObject);
				}
				moveArrows = null;
			}
		}

		private void HandleMoveMode()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_031a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: 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_0363: Unknown result type (might be due to invalid IL or missing references)
			//IL_0368: 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_0399: Unknown result type (might be due to invalid IL or missing references)
			//IL_039e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_03db: 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_0407: Unknown result type (might be due to invalid IL or missing references)
			//IL_040c: Unknown result type (might be due to invalid IL or missing references)
			//IL_041f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0424: Unknown result type (might be due to invalid IL or missing references)
			//IL_0426: Unknown result type (might be due to invalid IL or missing references)
			//IL_042b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0441: Unknown result type (might be due to invalid IL or missing references)
			//IL_0446: Unknown result type (might be due to invalid IL or missing references)
			//IL_044b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0450: Unknown result type (might be due to invalid IL or missing references)
			//IL_045a: Unknown result type (might be due to invalid IL or missing references)
			//IL_045c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0461: Unknown result type (might be due to invalid IL or missing references)
			//IL_0463: Unknown result type (might be due to invalid IL or missing references)
			//IL_0465: Unknown result type (might be due to invalid IL or missing references)
			//IL_046c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0473: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0490: 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_0499: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a0: 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_04af: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0515: Unknown result type (might be due to invalid IL or missing references)
			//IL_051a: Unknown result type (might be due to invalid IL or missing references)
			//IL_051e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0525: Unknown result type (might be due to invalid IL or missing references)
			//IL_052f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0534: Unknown result type (might be due to invalid IL or missing references)
			//IL_0539: Unknown result type (might be due to invalid IL or missing references)
			//IL_0542: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: 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_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_059a: Unknown result type (might be due to invalid IL or missing references)
			//IL_059f: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0559: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0580: Unknown result type (might be due to invalid IL or missing references)
			//IL_056a: Unknown result type (might be due to invalid IL or missing references)
			//IL_056e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0573: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f1: Unknown result type (might be due to invalid IL or missing references)
			if (moveArrows == null)
			{
				CreateMoveArrows();
			}
			if (selectedObject.isStatic)
			{
				selectionMode = SelectionMode.Cursor;
				EditorManager.Log("Can't move an static object");
			}
			UpdateMoveArrows();
			Vector3 mousePosition = Input.mousePosition;
			if (!dragging)
			{
				int num = -1;
				float num2 = 999f;
				for (int i = 0; i < moveArrows.Length; i++)
				{
					Vector3 val = camera.WorldToScreenPoint(moveArrows[i].position);
					float num3 = Vector2.Distance(Vector2.op_Implicit(mousePosition), Vector2.op_Implicit(val));
					if (num3 < 40f && num3 < num2)
					{
						num = i;
						num2 = num3;
					}
				}
				if (num != -1)
				{
					Color val2 = default(Color);
					for (int j = 0; j < moveArrows.Length; j++)
					{
						Renderer component = ((Component)moveArrows[j]).GetComponent<Renderer>();
						Material material = component.material;
						Color color;
						if (j != num)
						{
							Material material2 = component.material;
							((Color)(ref val2))..ctor(component.material.color.r, component.material.color.g, component.material.color.b, 0.5f);
							material2.color = val2;
							color = val2;
						}
						else
						{
							Material material3 = component.material;
							((Color)(ref val2))..ctor(component.material.color.r, component.material.color.g, component.material.color.b, 1f);
							material3.color = val2;
							color = val2;
						}
						material.color = color;
					}
					if (Input.GetMouseButtonDown(0))
					{
						dragging = true;
						draggingAxis = num;
						currentArrowRot = ((Component)moveArrows[num]).transform.position - arrowHolder.transform.position;
						objectStartPos = selectedObject.transform.position;
						objectStartScale = selectedObject.transform.localScale;
						objectStartEuler = selectedObject.transform.eulerAngles;
						dragStartPos = mousePosition;
						scaleMultiplier = moveArrows[0].localScale.y;
						savedMousePos = MouseController.GetMousePos();
						realMousePos = Vector2.op_Implicit(mousePosition);
						Cursor.visible = false;
						Billboard.DeleteAll();
					}
				}
				else
				{
					for (int k = 0; k < moveArrows.Length; k++)
					{
						Renderer component2 = ((Component)moveArrows[k]).GetComponent<Renderer>();
						Color color2 = (Color)(k switch
						{
							1 => Color.green, 
							0 => Color.red, 
							_ => Color.blue, 
						});
						component2.material.color = color2;
					}
				}
				return;
			}
			if (Input.GetMouseButton(0))
			{
				realMousePos += new Vector2(Input.GetAxisRaw("Mouse X"), Input.GetAxisRaw("Mouse Y"));
				Vector3 val3 = new Vector3(realMousePos.x, realMousePos.y, 0f) - dragStartPos;
				MouseController.SetCursorPos(savedMousePos.x, savedMousePos.y);
				float num4 = scaleMultiplier * 0.1f;
				Vector3 val4 = Vector3.zero;
				float num5 = 0f;
				if (draggingAxis == 0)
				{
					val4 = ((Vector3)(ref currentArrowRot)).normalized;
				}
				if (draggingAxis == 1)
				{
					val4 = ((Vector3)(ref currentArrowRot)).normalized;
				}
				if (draggingAxis == 2)
				{
					val4 = ((Vector3)(ref currentArrowRot)).normalized;
				}
				Vector3 normalized = ((Vector3)(ref currentArrowRot)).normalized;
				Vector3 val5 = camera.WorldToScreenPoint(arrowHolder.transform.position + normalized) - camera.WorldToScreenPoint(arrowHolder.transform.position);
				((Vector3)(ref val5)).Normalize();
				Vector2 val6 = Vector2.op_Implicit(val3);
				num5 = Vector2.Dot(val6, new Vector2(val5.x, val5.y));
				if (selectionMode == SelectionMode.Move)
				{
					Vector3 val7 = objectStartPos + val4 * num5 * num4 * 3f;
					float s = 0.25f;
					if (Input.GetKey(Plugin.shiftKey))
					{
						s = 1f;
					}
					if (Input.GetKey(Plugin.ctrlKey))
					{
						val7 = Snap(val7, s);
					}
					selectedObject.transform.position = val7;
				}
				if (selectionMode == SelectionMode.Scale)
				{
					Vector3 val8 = objectStartScale + val4 * num5 * num4 * 3f;
					float s2 = 0.25f;
					if (Input.GetKey(Plugin.shiftKey))
					{
						s2 = 1f;
					}
					if (Input.GetKey(Plugin.ctrlKey))
					{
						val8 = Snap(val8, s2);
					}
					selectedObject.transform.localScale = val8;
				}
				if (selectionMode == SelectionMode.Rotate)
				{
					Vector3 val9 = objectStartEuler + val4 * num5 * 5f;
					float s3 = 15f;
					if (Input.GetKey(Plugin.shiftKey))
					{
						s3 = 45f;
					}
					if (Input.GetKey(Plugin.ctrlKey))
					{
						val9 = Snap(val9, s3);
					}
					selectedObject.transform.eulerAngles = val9;
				}
			}
			if (Input.GetMouseButtonUp(0))
			{
				dragging = false;
				draggingAxis = -1;
				EditorManager.Instance.UpdateInspector();
				Cursor.visible = true;
				Billboard.UpdateBillboards();
			}
		}

		public void SelectObject(GameObject obj)
		{
			EditorManager.PlayAudio(EditorManager.selectObject);
			if ((Object)(object)selectedObject != (Object)null)
			{
				RestoreMaterial(selectedObject);
			}
			selectedObject = obj;
			Plugin.LogInfo("[CameraSelector] Selected object: " + ((Object)obj).name);
			selectionMode = SelectionMode.Move;
			if (moveArrows == null)
			{
				CreateMoveArrows();
			}
			UpdateMoveArrows();
			CacheMeshes();
		}

		private void CreateMoveArrows()
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Expected O, but got Unknown
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			if (moveArrows != null)
			{
				DeleteArrows();
			}
			globalArrows = PlayerPrefs.GetInt("GlobalArrows", 1) == 1;
			moveArrows = (Transform[])(object)new Transform[3];
			for (int i = 0; i < 3; i++)
			{
				GameObject val = GameObject.CreatePrimitive((PrimitiveType)2);
				val.transform.localScale = new Vector3(0.5f, 1f, 0.5f);
				val.transform.parent = arrowHolder.transform;
				val.GetComponent<Renderer>().material = new Material(MonoSingleton<DefaultReferenceManager>.Instance.masterShader);
				val.GetComponent<Collider>().isTrigger = true;
				GameObjectExtensions.GetOrAddComponent<NavMeshModifier>(val).ignoreFromBuild = true;
				((Object)val).name = "MoveArrow_" + i;
				Material val2 = new Material(Shader.Find("Hidden/Internal-Colored"));
				val2.SetInt("_ZTest", 8);
				val2.SetInt("_ZWrite", 0);
				val2.SetColor("_Color", (Color)(i switch
				{
					1 => Color.green, 
					0 => Color.red, 
					_ => Color.blue, 
				}));
				val.GetComponent<Renderer>().material = val2;
				moveArrows[i] = val.transform;
			}
		}

		public void DeleteArrows()
		{
			if (moveArrows != null)
			{
				Transform[] array = moveArrows;
				foreach (Transform val in array)
				{
					Object.Destroy((Object)(object)((Component)val).gameObject);
				}
				moveArrows = null;
			}
		}

		public void FocusOnSelected()
		{
			//IL_001c: 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)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: 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_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)selectedObject))
			{
				Vector3 val = ((Component)camera).transform.position - selectedObject.transform.position;
				Vector3 normalized = ((Vector3)(ref val)).normalized;
				((Component)camera).transform.position = selectedObject.transform.position + normalized * 5f;
			}
		}

		private void UpdateMoveArrows()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: 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)
			//IL_010c: 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_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: 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_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)selectedObject == (Object)null) && moveArrows != null)
			{
				Vector3 position = selectedObject.transform.position;
				arrowHolder.transform.position = selectedObject.transform.position;
				arrowHolder.transform.rotation = Quaternion.identity;
				moveArrows[0].position = position + Vector3.right * moveArrows[0].localScale.y * 2f;
				moveArrows[0].rotation = Quaternion.Euler(0f, 0f, 90f);
				moveArrows[1].position = position + Vector3.up * moveArrows[0].localScale.y * 2f;
				moveArrows[1].rotation = Quaternion.identity;
				moveArrows[2].position = position + Vector3.forward * moveArrows[0].localScale.y * 2f;
				moveArrows[2].rotation = Quaternion.Euler(90f, 0f, 0f);
				float num = Vector3.Distance(((Component)camera).transform.position, position);
				float num2 = 2f * num * Mathf.Tan(camera.fieldOfView * 0.5f * (MathF.PI / 180f));
				float num3 = num2 * 0.1f;
				float num4 = num3 * 0.1f;
				Transform[] array = moveArrows;
				foreach (Transform val in array)
				{
					val.localScale = Vector3.one * num4;
				}
				if (!globalArrows)
				{
					arrowHolder.transform.rotation = selectedObject.transform.rotation;
				}
			}
		}

		private Vector3 GetMouseWorldPos()
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: 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_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: 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)
			Plane val = default(Plane);
			((Plane)(ref val))..ctor(Vector3.up, Vector3.zero);
			Ray val2 = camera.ScreenPointToRay(Input.mousePosition);
			float num = default(float);
			((Plane)(ref val)).Raycast(val2, ref num);
			return ((Ray)(ref val2)).GetPoint(num);
		}

		private Vector3 Snap(Vector3 v, float s = 0.25f)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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_0047: Unknown result type (might be due to invalid IL or missing references)
			v.x = Mathf.Round(v.x / s) * s;
			v.y = Mathf.Round(v.y / s) * s;
			v.z = Mathf.Round(v.z / s) * s;
			return v;
		}
	}
	public class ChapterSelectChanger : MonoBehaviour
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static UnityAction <>9__5_0;

			public static UnityAction <>9__5_1;

			public static UnityAction <>9__5_2;

			internal void <ChangeLayout>b__5_0()
			{
				EmptySceneLoader.forceEditor = true;
				EmptySceneLoader.Instance.LoadLevel();
			}

			internal void <ChangeLayout>b__5_1()
			{
				GameObject canvas = Object.Instantiate<GameObject>(BundlesManager.editorBundle.LoadAsset<GameObject>("OpenLevelCanvas"));
				EditorManager.StaticLoadPopup(canvas);
			}

			internal void <ChangeLayout>b__5_2()
			{
				GameObject val = Object.Instantiate<GameObject>(BundlesManager.editorBundle.LoadAsset<GameObject>("ExploreLevelsCanvas"));
			}
		}

		public GameObject topLeftCS;

		public GameObject topRightCS;

		public GameObject bottomMiddleCS;

		private int frameCount = 0;

		public void Update()
		{
			if (!(SceneHelper.CurrentScene == "Main Menu") || !Object.CurrentThreadIsMainThread())
			{
				return;
			}
			if ((Object)(object)topLeftCS != (Object)null || (Object)(object)topRightCS != (Object)null || (Object)(object)bottomMiddleCS != (Object)null)
			{
				frameCount = 0;
				return;
			}
			frameCount++;
			if (frameCount >= 60)
			{
				ChangeLayout();
			}
		}

		public void ChangeLayout()
		{
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Expected O, but got Unknown
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Expected O, but got Unknown
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Expected O, but got Unknown
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0634: Unknown result type (might be due to invalid IL or missing references)
			//IL_0670: Unknown result type (might be due to invalid IL or missing references)
			//IL_067a: Expected O, but got Unknown
			//IL_0704: Unknown result type (might be due to invalid IL or missing references)
			//IL_0740: Unknown result type (might be due to invalid IL or missing references)
			//IL_074a: Expected O, but got Unknown
			//IL_06ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b8: Expected O, but got Unknown
			//IL_07c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_07fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0808: Expected O, but got Unknown
			//IL_076b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0770: Unknown result type (might be due to invalid IL or missing references)
			//IL_0776: Expected O, but got Unknown
			//IL_0829: Unknown result type (might be due to invalid IL or missing references)
			//IL_082e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0834: Expected O, but got Unknown
			if ((Object)(object)topLeftCS != (Object)null || (Object)(object)topRightCS != (Object)null || (Object)(object)bottomMiddleCS != (Object)null)
			{
				return;
			}
			Object.Destroy((Object)(object)topLeftCS);
			Object.Destroy((Object)(object)topRightCS);
			Object.Destroy((Object)(object)bottomMiddleCS);
			VerticalLayoutGroup[] array = Object.FindObjectsOfType<VerticalLayoutGroup>(true);
			foreach (VerticalLayoutGroup val in array)
			{
				if (!(((Object)val).name == "Chapters"))
				{
					continue;
				}
				((Component)val).gameObject.SetActive(true);
				GameObject val2 = new GameObject("TopLeftChapterSelect", new Type[2]
				{
					typeof(RectTransform),
					typeof(VerticalLayoutGroup)
				});
				val2.SetActive(false);
				val2.transform.SetParent(((Component)val).transform.parent);
				topLeftCS = val2;
				GameObject val3 = new GameObject("TopRightChapterSelect", new Type[2]
				{
					typeof(RectTransform),
					typeof(VerticalLayoutGroup)
				});
				val3.transform.SetParent(((Component)val).transform.parent);
				topRightCS = val3;
				GameObject val4 = new GameObject("BottomMiddleChapterSelect", new Type[2]
				{
					typeof(RectTransform),
					typeof(VerticalLayoutGroup)
				});
				val4.transform.SetParent(((Component)val).transform.parent);
				bottomMiddleCS = val4;
				ObjectActivateInSequence val5 = topLeftCS.AddComponent<ObjectActivateInSequence>();
				val5.delay = 0.025f;
				val5.objectsToActivate = (GameObject[])(object)new GameObject[0];
				topLeftCS.SetActive(true);
				((Transform)topLeftCS.GetComponent<RectTransform>()).localPosition = Vector2.op_Implicit(new Vector2(-200f, 200f));
				((Transform)topRightCS.GetComponent<RectTransform>()).localPosition = Vector2.op_Implicit(new Vector2(200f, 212f));
				((Transform)bottomMiddleCS.GetComponent<RectTransform>()).localPosition = Vector2.op_Implicit(new Vector2(-200f, -50f));
				((Transform)topLeftCS.GetComponent<RectTransform>()).localScale = Vector3.one;
				((Transform)topRightCS.GetComponent<RectTransform>()).localScale = Vector3.one;
				((Transform)bottomMiddleCS.GetComponent<RectTransform>()).localScale = Vector3.one;
				((HorizontalOrVerticalLayoutGroup)topLeftCS.GetComponent<VerticalLayoutGroup>()).spacing = 4f;
				((LayoutGroup)topLeftCS.GetComponent<VerticalLayoutGroup>()).childAlignment = (TextAnchor)1;
				((HorizontalOrVerticalLayoutGroup)topLeftCS.GetComponent<VerticalLayoutGroup>()).childForceExpandHeight = false;
				((HorizontalOrVerticalLayoutGroup)topLeftCS.GetComponent<VerticalLayoutGroup>()).childForceExpandWidth = false;
				((HorizontalOrVerticalLayoutGroup)topLeftCS.GetComponent<VerticalLayoutGroup>()).childControlHeight = false;
				((HorizontalOrVerticalLayoutGroup)topLeftCS.GetComponent<VerticalLayoutGroup>()).childControlWidth = false;
				((HorizontalOrVerticalLayoutGroup)topLeftCS.GetComponent<VerticalLayoutGroup>()).childScaleHeight = false;
				((HorizontalOrVerticalLayoutGroup)topLeftCS.GetComponent<VerticalLayoutGroup>()).childScaleWidth = false;
				((HorizontalOrVerticalLayoutGroup)topRightCS.GetComponent<VerticalLayoutGroup>()).spacing = 4f;
				((LayoutGroup)topRightCS.GetComponent<VerticalLayoutGroup>()).childAlignment = (TextAnchor)1;
				((HorizontalOrVerticalLayoutGroup)topRightCS.GetComponent<VerticalLayoutGroup>()).childForceExpandHeight = false;
				((HorizontalOrVerticalLayoutGroup)topRightCS.GetComponent<VerticalLayoutGroup>()).childForceExpandWidth = false;
				((HorizontalOrVerticalLayoutGroup)topRightCS.GetComponent<VerticalLayoutGroup>()).childControlHeight = false;
				((HorizontalOrVerticalLayoutGroup)topRightCS.GetComponent<VerticalLayoutGroup>()).childControlWidth = false;
				((HorizontalOrVerticalLayoutGroup)topRightCS.GetComponent<VerticalLayoutGroup>()).childScaleHeight = false;
				((HorizontalOrVerticalLayoutGroup)topRightCS.GetComponent<VerticalLayoutGroup>()).childScaleWidth = false;
				((HorizontalOrVerticalLayoutGroup)bottomMiddleCS.GetComponent<VerticalLayoutGroup>()).spacing = 4f;
				((LayoutGroup)bottomMiddleCS.GetComponent<VerticalLayoutGroup>()).childAlignment = (TextAnchor)1;
				((HorizontalOrVerticalLayoutGroup)bottomMiddleCS.GetComponent<VerticalLayoutGroup>()).childForceExpandHeight = false;
				((HorizontalOrVerticalLayoutGroup)bottomMiddleCS.GetComponent<VerticalLayoutGroup>()).childForceExpandWidth = false;
				((HorizontalOrVerticalLayoutGroup)bottomMiddleCS.GetComponent<VerticalLayoutGroup>()).childControlHeight = false;
				((HorizontalOrVerticalLayoutGroup)bottomMiddleCS.GetComponent<VerticalLayoutGroup>()).childControlWidth = false;
				((HorizontalOrVerticalLayoutGroup)bottomMiddleCS.GetComponent<VerticalLayoutGroup>()).childScaleHeight = false;
				((HorizontalOrVerticalLayoutGroup)bottomMiddleCS.GetComponent<VerticalLayoutGroup>()).childScaleWidth = false;
				int num = 0;
				GameObject val6 = null;
				GameObject val7 = null;
				for (int j = 0; j < ((Component)val).transform.childCount; j++)
				{
					GameObject gameObject = ((Component)((Component)val).transform.GetChild(j)).gameObject;
					if (((Object)gameObject).name == "Secondary")
					{
						val7 = gameObject;
						num = 1;
					}
					switch (num)
					{
					case 0:
					{
						GameObject val9 = Object.Instantiate<GameObject>(gameObject.gameObject, topLeftCS.transform);
						val9.transform.SetParent(topLeftCS.transform);
						val6 = val9;
						List<GameObject> list2 = val5.objectsToActivate.ToList();
						list2.Add(val9);
						val5.objectsToActivate = list2.ToArray();
						break;
					}
					case 1:
					{
						GameObject val8 = null;
						val8 = ((!((Object)gameObject).name.Contains("(Clone)") && !(((Object)gameObject).name == "Boss Rush Button")) ? Object.Instantiate<GameObject>(gameObject.gameObject, topRightCS.transform) : gameObject);
						val8.transform.SetParent(topRightCS.transform);
						val6 = val8;
						List<GameObject> list = val5.objectsToActivate.ToList();
						list.Add(val8);
						val5.objectsToActivate = list.ToArray();
						break;
					}
					}
				}
				GameObject val10 = Object.Instantiate<GameObject>(val7.gameObject, bottomMiddleCS.transform);
				((Transform)val10.GetComponent<RectTransform>()).localScale = Vector3.one;
				val10.transform.SetParent(bottomMiddleCS.transform);
				val10.GetComponentInChildren<TMP_Text>().text = "LEVEL EDITOR";
				List<GameObject> list3 = val5.objectsToActivate.ToList();
				list3.Add(val10);
				val5.objectsToActivate = list3.ToArray();
				val10 = Object.Instantiate<GameObject>(val6.gameObject, bottomMiddleCS.transform);
				((Transform)val10.GetComponent<RectTransform>()).localScale = Vector3.one;
				val10.transform.SetParent(bottomMiddleCS.transform);
				val10.GetComponentInChildren<TMP_Text>().text = "CREATE LEVEL";
				val10.GetComponent<Button>().onClick = new ButtonClickedEvent();
				((UnityEventBase)val10.GetComponent<Button>().onClick).RemoveAllListeners();
				ButtonClickedEvent onClick = val10.GetComponent<Button>().onClick;
				object obj = <>c.<>9__5_0;
				if (obj == null)
				{
					UnityAction val11 = delegate
					{
						EmptySceneLoader.forceEditor = true;
						EmptySceneLoader.Instance.LoadLevel();
					};
					<>c.<>9__5_0 = val11;
					obj = (object)val11;
				}
				((UnityEvent)onClick).AddListener((UnityAction)obj);
				list3 = val5.objectsToActivate.ToList();
				list3.Add(val10);
				val5.objectsToActivate = list3.ToArray();
				val10 = Object.Instantiate<GameObject>(val6.gameObject, bottomMiddleCS.transform);
				((Transform)val10.GetComponent<RectTransform>()).localScale = Vector3.one;
				val10.transform.SetParent(bottomMiddleCS.transform);
				val10.GetComponentInChildren<TMP_Text>().text = "OPEN LEVEL";
				val10.GetComponent<Button>().onClick = new ButtonClickedEvent();
				ButtonClickedEvent onClick2 = val10.GetComponent<Button>().onClick;
				object obj2 = <>c.<>9__5_1;
				if (obj2 == null)
				{
					UnityAction val12 = delegate
					{
						GameObject canvas = Object.Instantiate<GameObject>(BundlesManager.editorBundle.LoadAsset<GameObject>("OpenLevelCanvas"));
						EditorManager.StaticLoadPopup(canvas);
					};
					<>c.<>9__5_1 = val12;
					obj2 = (object)val12;
				}
				((UnityEvent)onClick2).AddListener((UnityAction)obj2);
				list3 = val5.objectsToActivate.ToList();
				list3.Add(val10);
				val5.objectsToActivate = list3.ToArray();
				val10 = Object.Instantiate<GameObject>(val6.gameObject, bottomMiddleCS.transform);
				((Transform)val10.GetComponent<RectTransform>()).localScale = Vector3.one;
				val10.transform.SetParent(bottomMiddleCS.transform);
				val10.GetComponentInChildren<TMP_Text>().text = "EXPLORE LEVELS";
				val10.GetComponent<Button>().onClick = new ButtonClickedEvent();
				ButtonClickedEvent onClick3 = val10.GetComponent<Button>().onClick;
				object obj3 = <>c.<>9__5_2;
				if (obj3 == null)
				{
					UnityAction val13 = delegate
					{
						GameObject val14 = Object.Instantiate<GameObject>(BundlesManager.editorBundle.LoadAsset<GameObject>("ExploreLevelsCanvas"));
					};
					<>c.<>9__5_2 = val13;
					obj3 = (object)val13;
				}
				((UnityEvent)onClick3).AddListener((UnityAction)obj3);
				list3 = val5.objectsToActivate.ToList();
				list3.Add(val10);
				val5.objectsToActivate = list3.ToArray();
				((Component)val).gameObject.SetActive(false);
				break;
			}
		}
	}
	public class EditorManager : MonoBehaviour
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static UnityAction <>9__24_2;

			public static Func<FieldInfo, bool> <>9__41_0;

			public static Func<(string, Type, float), float> <>9__51_6;

			public static Func<(string, float), float> <>9__72_2;

			public static UnityAction<string> <>9__74_0;

			public static Func<(string, float), float> <>9__75_2;

			internal void <SetupButtons>b__24_2()
			{
				string text = Application.persistentDataPath + "/ULTRAEDITOR";
				if (!Directory.Exists(text))
				{
					Directory.CreateDirectory(text);
				}
				Application.OpenURL("file://" + text);
			}