Decompiled source of Unity Analyzer v1.0.1

ModdingHelper.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using ModdingHelper.CustomEditor;
using ModdingHelper.UnityEditor;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("ModdingHelper")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+1c1faa1fa993969ef3ffab53a412d4df76030e37")]
[assembly: AssemblyProduct("ModdingHelper")]
[assembly: AssemblyTitle("ModdingHelper")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace ModdingHelper
{
	[HarmonyPatch]
	internal class Patches
	{
		[HarmonyPatch(typeof(GameCanvas), "Awake")]
		[HarmonyPostfix]
		private static void Postfix(GameCanvas __instance)
		{
			Plugin.mls.LogInfo((object)"Setting up Unity Editor on Canvas parent...");
			CustomCameraController component = ((Component)Camera.main).GetComponent<CustomCameraController>();
			AccessTools.Method(typeof(CustomCameraController), "ShowCharacter", new Type[1] { typeof(bool) }, (Type[])null)?.Invoke(component, new object[1] { true });
			((Component)__instance).gameObject.AddComponent<CustomEditorManager>();
		}
	}
	[BepInPlugin("com.kroes.moddinghelper", "Modding Helper", "1.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		private const string GUID = "com.kroes.moddinghelper";

		private const string NAME = "Modding Helper";

		private const string VERSION = "1.0.1";

		internal static ManualLogSource mls;

		internal static Plugin instance;

		internal static Harmony harmony = new Harmony("com.kroes.moddinghelper");

		private void Awake()
		{
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
			}
			harmony.PatchAll(typeof(Patches));
			mls = ((BaseUnityPlugin)this).Logger;
			mls.LogInfo((object)"Loaded succesfully!");
		}
	}
}
namespace ModdingHelper.CustomEditor
{
	internal class EditorCard_BoxCollider : MonoBehaviour
	{
		private TextMeshProUGUI titleText;

		private TextMeshProUGUI triggerText;

		private TextMeshProUGUI contactsText;

		private TextMeshProUGUI centerText;

		private TextMeshProUGUI sizeText;

		private string GetColoredBoolean(bool b)
		{
			return b ? $"<#00FF00>{b}</color>" : $"<#FF0000>{b}</color>";
		}

		public void Initialize(TextMeshProUGUI titleText, TextMeshProUGUI triggerText, TextMeshProUGUI contactsText, TextMeshProUGUI centerText, TextMeshProUGUI sizeText)
		{
			this.titleText = titleText;
			this.triggerText = triggerText;
			this.contactsText = contactsText;
			this.centerText = centerText;
			this.sizeText = sizeText;
		}

		public void SetTitle(string newTitle)
		{
			if ((Object)(object)titleText != (Object)null)
			{
				((TMP_Text)titleText).text = newTitle;
			}
		}

		public void SetTriggerText(bool isTrigger)
		{
			if ((Object)(object)triggerText != (Object)null)
			{
				((TMP_Text)triggerText).text = "Is Trigger: " + GetColoredBoolean(isTrigger);
			}
		}

		public void SetContactsText(bool providesContacts)
		{
			if ((Object)(object)contactsText != (Object)null)
			{
				((TMP_Text)contactsText).text = "Provides Contacts: " + GetColoredBoolean(providesContacts);
			}
		}

		public void SetCenterText(Vector3 v)
		{
			if ((Object)(object)centerText != (Object)null)
			{
				((TMP_Text)centerText).text = "Center: " + ((Vector3)(ref v)).ToString("F2");
			}
		}

		public void SetSizeText(Vector3 v)
		{
			if ((Object)(object)sizeText != (Object)null)
			{
				((TMP_Text)sizeText).text = "Size: " + ((Vector3)(ref v)).ToString("F2");
			}
		}

		public void SetValues(bool isTrigger, bool providesContacts, Vector3 center, Vector3 size)
		{
			//IL_0012: 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)
			SetTriggerText(isTrigger);
			SetContactsText(providesContacts);
			SetCenterText(center);
			SetSizeText(size);
		}

		public void Show()
		{
			((Component)this).gameObject.SetActive(true);
		}

		public void Hide()
		{
			((Component)this).gameObject.SetActive(false);
		}

		public static EditorCard_BoxCollider Create(Transform parent, string title, bool? isTrigger = false, bool? providesContacts = false, Vector3? defaultCenter = null, Vector3? defaultSize = null)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Expected O, but got Unknown
			//IL_00f7: 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: Expected O, but got Unknown
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Card_BoxCollider");
			val.transform.SetParent(parent, false);
			Image val2 = val.AddComponent<Image>();
			((Graphic)val2).color = new Color(0.05f, 0.05f, 0.05f);
			ContentSizeFitter val3 = val.AddComponent<ContentSizeFitter>();
			val3.verticalFit = (FitMode)2;
			VerticalLayoutGroup val4 = val.AddComponent<VerticalLayoutGroup>();
			((LayoutGroup)val4).padding = new RectOffset(10, 10, 10, 10);
			((HorizontalOrVerticalLayoutGroup)val4).spacing = 8f;
			((HorizontalOrVerticalLayoutGroup)val4).childControlWidth = true;
			LayoutElement val5 = val.AddComponent<LayoutElement>();
			val5.preferredWidth = 330f;
			val5.flexibleHeight = 0f;
			GameObject val6 = new GameObject("Text_Title");
			val6.transform.SetParent(val.transform, false);
			TextMeshProUGUI val7 = val6.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val7).text = title;
			((TMP_Text)val7).fontSize = 15f;
			((TMP_Text)val7).fontStyle = (FontStyles)1;
			((TMP_Text)val7).alignment = (TextAlignmentOptions)513;
			((Graphic)val7).color = Color.white;
			GameObject bodyObj = new GameObject("Body_VerticalLayout");
			bodyObj.transform.SetParent(val.transform, false);
			VerticalLayoutGroup val8 = bodyObj.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val8).spacing = 4f;
			((HorizontalOrVerticalLayoutGroup)val8).childControlWidth = true;
			TextMeshProUGUI val9 = CreateVectorLine("IsTrigger");
			TextMeshProUGUI val10 = CreateVectorLine("ProvidesContacts");
			TextMeshProUGUI val11 = CreateVectorLine("Center");
			TextMeshProUGUI val12 = CreateVectorLine("Scale");
			EditorCard_BoxCollider editorCard_BoxCollider = val.AddComponent<EditorCard_BoxCollider>();
			editorCard_BoxCollider.Initialize(val7, val9, val10, val11, val12);
			editorCard_BoxCollider.SetValues(isTrigger == true, providesContacts == true, (Vector3)(((??)defaultCenter) ?? Vector3.zero), (Vector3)(((??)defaultSize) ?? Vector3.one));
			return editorCard_BoxCollider;
			TextMeshProUGUI CreateVectorLine(string name)
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Expected O, but got Unknown
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				GameObject val13 = new GameObject("Text_" + name);
				val13.transform.SetParent(bodyObj.transform, false);
				TextMeshProUGUI val14 = val13.AddComponent<TextMeshProUGUI>();
				((TMP_Text)val14).fontSize = 13f;
				((Graphic)val14).color = new Color(0.6f, 0.6f, 0.6f);
				((TMP_Text)val14).alignment = (TextAlignmentOptions)513;
				return val14;
			}
		}
	}
	internal class EditorCard_CapsuleCollider : MonoBehaviour
	{
		private TextMeshProUGUI titleText;

		private TextMeshProUGUI triggerText;

		private TextMeshProUGUI contactsText;

		private TextMeshProUGUI centerText;

		private TextMeshProUGUI radiusText;

		private TextMeshProUGUI heightText;

		private string GetColoredBoolean(bool b)
		{
			return b ? $"<#00FF00>{b}</color>" : $"<#FF0000>{b}</color>";
		}

		public void Initialize(TextMeshProUGUI titleText, TextMeshProUGUI triggerText, TextMeshProUGUI contactsText, TextMeshProUGUI centerText, TextMeshProUGUI radiusText, TextMeshProUGUI heightText)
		{
			this.titleText = titleText;
			this.triggerText = triggerText;
			this.contactsText = contactsText;
			this.centerText = centerText;
			this.radiusText = radiusText;
			this.heightText = heightText;
		}

		public void SetTitle(string newTitle)
		{
			if ((Object)(object)titleText != (Object)null)
			{
				((TMP_Text)titleText).text = newTitle;
			}
		}

		public void SetTriggerText(bool isTrigger)
		{
			if ((Object)(object)triggerText != (Object)null)
			{
				((TMP_Text)triggerText).text = "Is Trigger: " + GetColoredBoolean(isTrigger);
			}
		}

		public void SetContactsText(bool providesContacts)
		{
			if ((Object)(object)contactsText != (Object)null)
			{
				((TMP_Text)contactsText).text = "Provides Contacts: " + GetColoredBoolean(providesContacts);
			}
		}

		public void SetCenterText(Vector3 v)
		{
			if ((Object)(object)centerText != (Object)null)
			{
				((TMP_Text)centerText).text = "Center: " + ((Vector3)(ref v)).ToString("F2");
			}
		}

		public void SetRadiusText(float f)
		{
			if ((Object)(object)radiusText != (Object)null)
			{
				((TMP_Text)radiusText).text = $"Radius: {f}";
			}
		}

		public void SetHeightText(float f)
		{
			if ((Object)(object)heightText != (Object)null)
			{
				((TMP_Text)heightText).text = $"Height: {f}";
			}
		}

		public void SetValues(bool isTrigger, bool providesContacts, Vector3 center, float radius, float height)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			SetTriggerText(isTrigger);
			SetContactsText(providesContacts);
			SetCenterText(center);
			SetRadiusText(radius);
			SetHeightText(height);
		}

		public void Show()
		{
			((Component)this).gameObject.SetActive(true);
		}

		public void Hide()
		{
			((Component)this).gameObject.SetActive(false);
		}

		public static EditorCard_CapsuleCollider Create(Transform parent, string title, bool? isTrigger = false, bool? providesContacts = false, Vector3? defaultCenter = null, float? defaultRadius = null, float? defaultHeight = null)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Expected O, but got Unknown
			//IL_00f7: 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: Expected O, but got Unknown
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Card_CapsuleCollider");
			val.transform.SetParent(parent, false);
			Image val2 = val.AddComponent<Image>();
			((Graphic)val2).color = new Color(0.05f, 0.05f, 0.05f);
			ContentSizeFitter val3 = val.AddComponent<ContentSizeFitter>();
			val3.verticalFit = (FitMode)2;
			VerticalLayoutGroup val4 = val.AddComponent<VerticalLayoutGroup>();
			((LayoutGroup)val4).padding = new RectOffset(10, 10, 10, 10);
			((HorizontalOrVerticalLayoutGroup)val4).spacing = 8f;
			((HorizontalOrVerticalLayoutGroup)val4).childControlWidth = true;
			LayoutElement val5 = val.AddComponent<LayoutElement>();
			val5.preferredWidth = 330f;
			val5.flexibleHeight = 0f;
			GameObject val6 = new GameObject("Text_Title");
			val6.transform.SetParent(val.transform, false);
			TextMeshProUGUI val7 = val6.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val7).text = title;
			((TMP_Text)val7).fontSize = 15f;
			((TMP_Text)val7).fontStyle = (FontStyles)1;
			((TMP_Text)val7).alignment = (TextAlignmentOptions)513;
			((Graphic)val7).color = Color.white;
			GameObject bodyObj = new GameObject("Body_VerticalLayout");
			bodyObj.transform.SetParent(val.transform, false);
			VerticalLayoutGroup val8 = bodyObj.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val8).spacing = 4f;
			((HorizontalOrVerticalLayoutGroup)val8).childControlWidth = true;
			TextMeshProUGUI val9 = CreateVectorLine("IsTrigger");
			TextMeshProUGUI val10 = CreateVectorLine("ProvidesContacts");
			TextMeshProUGUI val11 = CreateVectorLine("Center");
			TextMeshProUGUI val12 = CreateVectorLine("Radius");
			TextMeshProUGUI val13 = CreateVectorLine("Height");
			EditorCard_CapsuleCollider editorCard_CapsuleCollider = val.AddComponent<EditorCard_CapsuleCollider>();
			editorCard_CapsuleCollider.Initialize(val7, val9, val10, val11, val12, val13);
			editorCard_CapsuleCollider.SetValues(isTrigger == true, providesContacts == true, (Vector3)(((??)defaultCenter) ?? Vector3.zero), defaultRadius.GetValueOrDefault(), defaultHeight.GetValueOrDefault());
			return editorCard_CapsuleCollider;
			TextMeshProUGUI CreateVectorLine(string name)
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Expected O, but got Unknown
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				GameObject val14 = new GameObject("Text_" + name);
				val14.transform.SetParent(bodyObj.transform, false);
				TextMeshProUGUI val15 = val14.AddComponent<TextMeshProUGUI>();
				((TMP_Text)val15).fontSize = 13f;
				((Graphic)val15).color = new Color(0.6f, 0.6f, 0.6f);
				((TMP_Text)val15).alignment = (TextAlignmentOptions)513;
				return val15;
			}
		}
	}
	internal class SelectionOutline : MonoBehaviour
	{
		private LineRenderer lineRenderer;

		private Renderer targetRenderer;

		private GameObject lineChildContainer;

		private static readonly Vector3[] BoxVertices = (Vector3[])(object)new Vector3[16]
		{
			new Vector3(-0.5f, -0.5f, -0.5f),
			new Vector3(0.5f, -0.5f, -0.5f),
			new Vector3(0.5f, -0.5f, 0.5f),
			new Vector3(-0.5f, -0.5f, 0.5f),
			new Vector3(-0.5f, -0.5f, -0.5f),
			new Vector3(-0.5f, 0.5f, -0.5f),
			new Vector3(0.5f, 0.5f, -0.5f),
			new Vector3(0.5f, -0.5f, -0.5f),
			new Vector3(0.5f, 0.5f, -0.5f),
			new Vector3(0.5f, 0.5f, 0.5f),
			new Vector3(0.5f, -0.5f, 0.5f),
			new Vector3(0.5f, 0.5f, 0.5f),
			new Vector3(-0.5f, 0.5f, 0.5f),
			new Vector3(-0.5f, -0.5f, 0.5f),
			new Vector3(-0.5f, 0.5f, 0.5f),
			new Vector3(-0.5f, 0.5f, -0.5f)
		};

		private void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			lineChildContainer = new GameObject("SelectionOutlineContainer");
			lineChildContainer.transform.SetParent(((Component)this).transform, false);
			lineRenderer = lineChildContainer.AddComponent<LineRenderer>();
			lineRenderer.useWorldSpace = true;
			lineRenderer.startWidth = 0.03f;
			lineRenderer.endWidth = 0.03f;
			lineRenderer.positionCount = BoxVertices.Length;
			Material val = new Material(Shader.Find("Sprites/Default"));
			val.color = Color.green;
			((Renderer)lineRenderer).material = val;
			lineRenderer.startColor = Color.green;
			lineRenderer.endColor = Color.green;
			targetRenderer = ((Component)this).GetComponentInChildren<Renderer>();
		}

		private void LateUpdate()
		{
			UpdateOutline();
		}

		private void UpdateOutline()
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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_005f: 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_0032: 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_003b: 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_0043: 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_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: 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_0087: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: 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)
			if (!((Object)(object)lineRenderer == (Object)null))
			{
				Vector3 val;
				Vector3 val2;
				if ((Object)(object)targetRenderer != (Object)null)
				{
					Bounds bounds = targetRenderer.bounds;
					val = ((Bounds)(ref bounds)).center;
					val2 = ((Bounds)(ref bounds)).size;
				}
				else
				{
					val = ((Component)this).transform.position;
					val2 = ((Component)this).transform.lossyScale;
				}
				for (int i = 0; i < BoxVertices.Length; i++)
				{
					Vector3 val3 = Vector3.Scale(BoxVertices[i], val2);
					Vector3 val4 = val + ((Component)this).transform.rotation * val3;
					lineRenderer.SetPosition(i, val4);
				}
			}
		}

		private void OnDestroy()
		{
			if ((Object)(object)lineChildContainer != (Object)null)
			{
				Object.Destroy((Object)(object)lineChildContainer);
			}
		}
	}
	internal class UIHelper
	{
		public static GameObject CreatePanel(string name, Transform parent, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, Vector2 sizeDelta, Color bgColor)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: 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_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			Image val2 = val.AddComponent<Image>();
			((Graphic)val2).color = bgColor;
			RectTransform component = val.GetComponent<RectTransform>();
			component.anchorMin = anchorMin;
			component.anchorMax = anchorMax;
			component.pivot = pivot;
			component.anchoredPosition = Vector2.zero;
			component.sizeDelta = sizeDelta;
			return val;
		}

		public static Button CreateButton(string name, Transform parent, string labelText, UnityAction onClick, float height = 35f)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			Image val2 = val.AddComponent<Image>();
			((Graphic)val2).color = new Color(0.2f, 0.2f, 0.2f);
			Button val3 = val.AddComponent<Button>();
			((UnityEvent)val3.onClick).AddListener(onClick);
			LayoutElement val4 = val.AddComponent<LayoutElement>();
			val4.preferredHeight = height;
			val4.flexibleHeight = 0f;
			GameObject val5 = new GameObject("Text");
			val5.transform.SetParent(val.transform, false);
			TextMeshProUGUI val6 = val5.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val6).text = labelText;
			((TMP_Text)val6).fontSize = 14f;
			((TMP_Text)val6).fontStyle = (FontStyles)1;
			((Graphic)val6).color = Color.white;
			((TMP_Text)val6).alignment = (TextAlignmentOptions)514;
			return val3;
		}
	}
}
namespace ModdingHelper.UnityEditor
{
	internal class CustomEditorManager : MonoBehaviour
	{
		private Camera playerCamera;

		private Camera sceneCamera;

		private Camera previewCamera;

		private RenderTexture previewRenderTexture;

		private float sceneCameraX;

		private float sceneCameraY;

		private float sceneCameraSensitivity = 70f;

		private float sceneCameraSpeed = 8f;

		public static bool isSceneCameraActive;

		private bool isCursorLocked;

		private Canvas moddedCanvas;

		private GameObject previewUIObject;

		private GameObject leftPanelObj;

		private GameObject hierarchyContent;

		private List<GameObject> activeHierarchyNodes = new List<GameObject>();

		private GameObject rightPanelObj;

		private List<GameObject> dynamicCards = new List<GameObject>();

		private Transform selectedTransform;

		private SelectionOutline currentOutline;

		private void Start()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Expected O, but got Unknown
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Expected O, but got Unknown
			playerCamera = Camera.main;
			GameObject val = new GameObject("SceneCamera");
			sceneCamera = val.AddComponent<Camera>();
			sceneCameraX = 0f;
			sceneCameraY = 0f;
			((Component)sceneCamera).transform.position = new Vector3(0f, 5f, -10f);
			((Component)sceneCamera).transform.rotation = Quaternion.Euler(15f, 0f, 0f);
			GameObject val2 = new GameObject("PreviewCamera");
			previewCamera = val2.AddComponent<Camera>();
			previewRenderTexture = new RenderTexture(320, 180, 16);
			previewCamera.targetTexture = previewRenderTexture;
			CreateUI();
			previewUIObject.SetActive(false);
			((Behaviour)previewCamera).enabled = false;
			playerCamera.cullingMask = 0;
			((Behaviour)sceneCamera).enabled = true;
			isSceneCameraActive = true;
			isCursorLocked = true;
		}

		private void CreateUI()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: 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_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Expected O, but got Unknown
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Expected O, but got Unknown
			//IL_01d7: 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_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Expected O, but got Unknown
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Expected O, but got Unknown
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Expected O, but got Unknown
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Expected O, but got Unknown
			//IL_038a: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ae: Expected O, but got Unknown
			//IL_03fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0404: Expected O, but got Unknown
			//IL_0438: Unknown result type (might be due to invalid IL or missing references)
			//IL_0460: Unknown result type (might be due to invalid IL or missing references)
			//IL_046d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0484: Unknown result type (might be due to invalid IL or missing references)
			//IL_0491: Unknown result type (might be due to invalid IL or missing references)
			//IL_049e: 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_04b9: Expected O, but got Unknown
			//IL_0536: Unknown result type (might be due to invalid IL or missing references)
			//IL_054d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0564: Unknown result type (might be due to invalid IL or missing references)
			//IL_057b: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05aa: Expected O, but got Unknown
			GameObject val = new GameObject("ModdedCanvas");
			moddedCanvas = val.AddComponent<Canvas>();
			moddedCanvas.renderMode = (RenderMode)0;
			moddedCanvas.sortingOrder = 999;
			CanvasScaler val2 = val.AddComponent<CanvasScaler>();
			val2.uiScaleMode = (ScaleMode)1;
			val2.referenceResolution = new Vector2(1920f, 1080f);
			val.AddComponent<GraphicRaycaster>();
			rightPanelObj = new GameObject("RightPanel");
			rightPanelObj.transform.SetParent(((Component)moddedCanvas).transform, false);
			Image val3 = rightPanelObj.AddComponent<Image>();
			((Graphic)val3).color = new Color(0.1f, 0.1f, 0.1f);
			RectTransform component = rightPanelObj.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(1f, 0f);
			component.anchorMax = new Vector2(1f, 1f);
			component.pivot = new Vector2(1f, 1f);
			component.anchoredPosition = new Vector2(0f, 0f);
			component.sizeDelta = new Vector2(360f, 0f);
			VerticalLayoutGroup val4 = rightPanelObj.AddComponent<VerticalLayoutGroup>();
			((LayoutGroup)val4).padding = new RectOffset(15, 15, 20, 20);
			((HorizontalOrVerticalLayoutGroup)val4).spacing = 10f;
			((LayoutGroup)val4).childAlignment = (TextAnchor)1;
			((HorizontalOrVerticalLayoutGroup)val4).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val4).childForceExpandWidth = true;
			((HorizontalOrVerticalLayoutGroup)val4).childControlHeight = true;
			((HorizontalOrVerticalLayoutGroup)val4).childForceExpandHeight = false;
			leftPanelObj = new GameObject("LeftPanel");
			leftPanelObj.transform.SetParent(((Component)moddedCanvas).transform, false);
			Image val5 = leftPanelObj.AddComponent<Image>();
			((Graphic)val5).color = new Color(0.1f, 0.1f, 0.1f);
			RectTransform component2 = leftPanelObj.GetComponent<RectTransform>();
			component2.anchorMin = new Vector2(0f, 0f);
			component2.anchorMax = new Vector2(0f, 1f);
			component2.pivot = new Vector2(0f, 1f);
			component2.anchoredPosition = new Vector2(0f, 0f);
			component2.sizeDelta = new Vector2(360f, 0f);
			VerticalLayoutGroup val6 = leftPanelObj.AddComponent<VerticalLayoutGroup>();
			((LayoutGroup)val6).padding = new RectOffset(10, 10, 10, 10);
			((HorizontalOrVerticalLayoutGroup)val6).spacing = 10f;
			((HorizontalOrVerticalLayoutGroup)val6).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val6).childControlHeight = true;
			((HorizontalOrVerticalLayoutGroup)val6).childForceExpandHeight = false;
			GameObject val7 = new GameObject("Button_RefreshHierarchy");
			val7.transform.SetParent(leftPanelObj.transform, false);
			Image val8 = val7.AddComponent<Image>();
			((Graphic)val8).color = new Color(0.2f, 0.2f, 0.2f);
			Button val9 = val7.AddComponent<Button>();
			((UnityEvent)val9.onClick).AddListener(new UnityAction(RefreshSceneHierarchy));
			LayoutElement val10 = val7.AddComponent<LayoutElement>();
			val10.preferredHeight = 35f;
			val10.flexibleHeight = 0f;
			GameObject val11 = new GameObject("Text");
			val11.transform.SetParent(val7.transform, false);
			TextMeshProUGUI val12 = val11.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val12).text = "Refresh Hierarchy";
			((TMP_Text)val12).fontSize = 14f;
			((TMP_Text)val12).fontStyle = (FontStyles)1;
			((Graphic)val12).color = Color.white;
			((TMP_Text)val12).alignment = (TextAlignmentOptions)514;
			GameObject val13 = new GameObject("Hierarchy_ScrollView");
			val13.transform.SetParent(leftPanelObj.transform, false);
			ScrollRect val14 = val13.AddComponent<ScrollRect>();
			val14.horizontal = false;
			val14.vertical = true;
			LayoutElement val15 = val13.AddComponent<LayoutElement>();
			val15.flexibleHeight = 1f;
			GameObject val16 = new GameObject("Viewport");
			val16.transform.SetParent(val13.transform, false);
			Image val17 = val16.AddComponent<Image>();
			((Graphic)val17).color = new Color(0.05f, 0.05f, 0.05f, 0.5f);
			Mask val18 = val16.AddComponent<Mask>();
			val18.showMaskGraphic = true;
			RectTransform component3 = val16.GetComponent<RectTransform>();
			component3.anchorMin = Vector2.zero;
			component3.anchorMax = Vector2.one;
			component3.pivot = new Vector2(0.5f, 0.5f);
			component3.anchoredPosition = Vector2.zero;
			component3.sizeDelta = Vector2.zero;
			hierarchyContent = new GameObject("Content");
			hierarchyContent.transform.SetParent(val16.transform, false);
			VerticalLayoutGroup val19 = hierarchyContent.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val19).spacing = 2f;
			((HorizontalOrVerticalLayoutGroup)val19).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val19).childControlHeight = true;
			((HorizontalOrVerticalLayoutGroup)val19).childForceExpandHeight = false;
			ContentSizeFitter val20 = hierarchyContent.AddComponent<ContentSizeFitter>();
			val20.verticalFit = (FitMode)2;
			RectTransform component4 = hierarchyContent.GetComponent<RectTransform>();
			component4.anchorMin = new Vector2(0f, 1f);
			component4.anchorMax = new Vector2(1f, 1f);
			component4.pivot = new Vector2(0f, 1f);
			component4.sizeDelta = new Vector2(0f, 0f);
			val14.content = component4;
			val14.viewport = component3;
			previewUIObject = new GameObject("Preview_RawImage");
			previewUIObject.transform.SetParent(rightPanelObj.transform, false);
			RawImage val21 = previewUIObject.AddComponent<RawImage>();
			val21.texture = (Texture)(object)previewRenderTexture;
			LayoutElement val22 = previewUIObject.AddComponent<LayoutElement>();
			val22.preferredWidth = 320f;
			val22.preferredHeight = 180f;
			val22.flexibleHeight = 0f;
		}

		private void RefreshSceneHierarchy()
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			foreach (GameObject activeHierarchyNode in activeHierarchyNodes)
			{
				if ((Object)(object)activeHierarchyNode != (Object)null)
				{
					Object.Destroy((Object)(object)activeHierarchyNode);
				}
			}
			activeHierarchyNodes.Clear();
			Scene activeScene = SceneManager.GetActiveScene();
			GameObject[] rootGameObjects = ((Scene)(ref activeScene)).GetRootGameObjects();
			GameObject[] array = rootGameObjects;
			foreach (GameObject val in array)
			{
				if (!((Object)(object)val == (Object)(object)((Component)moddedCanvas).gameObject) && !(((Object)val).name == "SceneCamera") && !(((Object)val).name == "PreviewCamera"))
				{
					BuildNodeRecursive(val.transform, hierarchyContent.transform, 0);
				}
			}
		}

		private GameObject BuildNodeRecursive(Transform target, Transform parentUI, int indentLevel)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			GameObject val = new GameObject("Node_" + ((Object)target).name);
			val.transform.SetParent(parentUI, false);
			VerticalLayoutGroup val2 = val.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val2).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val2).childControlHeight = true;
			((HorizontalOrVerticalLayoutGroup)val2).childForceExpandHeight = false;
			LayoutElement val3 = val.AddComponent<LayoutElement>();
			val3.flexibleHeight = 0f;
			EditorNode_Hierarchy editorNode_Hierarchy = val.AddComponent<EditorNode_Hierarchy>();
			editorNode_Hierarchy.Initialize(target, indentLevel, SelectTransform, (Transform childTransform, Transform childParentUI) => BuildNodeRecursive(childTransform, childParentUI, indentLevel + 1));
			activeHierarchyNodes.Add(val);
			return val;
		}

		private void Update()
		{
			//IL_003e: 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)
			if (Input.GetMouseButtonDown(1))
			{
				ToggleMouseLock();
			}
			else if (isCursorLocked)
			{
				CameraMovement();
				RaycastHit val = default(RaycastHit);
				if (Input.GetMouseButtonDown(0) && Physics.Raycast(((Component)sceneCamera).transform.position, ((Component)sceneCamera).transform.forward, ref val, 100f))
				{
					SelectTransform(((RaycastHit)(ref val)).transform);
				}
			}
		}

		private void LateUpdate()
		{
			if ((Object)(object)selectedTransform == (Object)null && (Object)(object)currentOutline != (Object)null)
			{
				Deselect();
			}
			else if ((Object)(object)selectedTransform != (Object)null && (Object)(object)previewCamera != (Object)null && ((Behaviour)previewCamera).enabled)
			{
				UpdatePreviewCameraPosition();
			}
		}

		private void UpdatePreviewCameraPosition()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: 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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = selectedTransform.position;
			float num = 1f;
			Renderer componentInChildren = ((Component)selectedTransform).GetComponentInChildren<Renderer>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				Bounds bounds = componentInChildren.bounds;
				val = ((Bounds)(ref bounds)).center;
				float[] array = new float[3];
				bounds = componentInChildren.bounds;
				array[0] = ((Bounds)(ref bounds)).extents.x;
				bounds = componentInChildren.bounds;
				array[1] = ((Bounds)(ref bounds)).extents.y;
				bounds = componentInChildren.bounds;
				array[2] = ((Bounds)(ref bounds)).extents.z;
				num = Mathf.Max(array);
			}
			float num2 = Mathf.Clamp(num * 3f, 2f, 15f);
			Vector3 val2 = default(Vector3);
			((Vector3)(ref val2))..ctor(0f, num * 0.5f, 0f - num2);
			((Component)previewCamera).transform.position = val + val2;
			((Component)previewCamera).transform.LookAt(val);
		}

		private void CameraMovement()
		{
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: 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_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: 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_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: 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_0159: 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_0165: Unknown result type (might be due to invalid IL or missing references)
			sceneCameraX += Input.GetAxis("Mouse X") * sceneCameraSensitivity * Time.deltaTime;
			sceneCameraY -= Input.GetAxis("Mouse Y") * sceneCameraSensitivity * Time.deltaTime;
			sceneCameraY = Mathf.Clamp(sceneCameraY, -90f, 90f);
			((Component)sceneCamera).transform.rotation = Quaternion.Euler(sceneCameraY, sceneCameraX, 0f);
			float axis = Input.GetAxis("Horizontal");
			float axis2 = Input.GetAxis("Vertical");
			Vector3 forward = ((Component)sceneCamera).transform.forward;
			Vector3 right = ((Component)sceneCamera).transform.right;
			forward.y = 0f;
			right.y = 0f;
			((Vector3)(ref forward)).Normalize();
			((Vector3)(ref right)).Normalize();
			float num = 0f;
			if (Input.GetKey((KeyCode)32))
			{
				num += 1f;
			}
			if (Input.GetKey((KeyCode)306))
			{
				num -= 1f;
			}
			Vector3 val = forward * axis2 + right * axis + Vector3.up * num;
			if (Input.GetKey((KeyCode)304))
			{
				val *= 2f;
			}
			Transform transform = ((Component)sceneCamera).transform;
			transform.position += val * sceneCameraSpeed * Time.deltaTime;
		}

		private void ToggleMouseLock()
		{
			isCursorLocked = !isCursorLocked;
			Cursor.lockState = (CursorLockMode)(isCursorLocked ? 1 : 0);
			Cursor.visible = !isCursorLocked;
		}

		private void SelectTransform(Transform target)
		{
			if ((Object)(object)currentOutline != (Object)null)
			{
				Object.Destroy((Object)(object)currentOutline);
			}
			selectedTransform = target;
			currentOutline = ((Component)target).gameObject.AddComponent<SelectionOutline>();
			previewUIObject.SetActive(true);
			((Behaviour)previewCamera).enabled = true;
			ClearDynamicCards();
			CreateDynamicCards();
		}

		private void CreateDynamicCards()
		{
			//IL_013a: 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_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			string title = ((Object)((Component)selectedTransform).gameObject).name + " <#AAAAAA>(" + ((object)((Component)selectedTransform).gameObject).GetType().Name + ")</color>";
			dynamicCards.Add(((Component)EditorCard_Title.Create(rightPanelObj.transform, title)).gameObject);
			int layer = ((Component)selectedTransform).gameObject.layer;
			string arg = LayerMask.LayerToName(layer);
			string title2 = $"Layer: <#AAAAAA>({layer}) {arg}</color>";
			dynamicCards.Add(((Component)EditorCard_Title.Create(rightPanelObj.transform, title2)).gameObject);
			Component[] components = ((Component)selectedTransform).GetComponents<Component>();
			Component[] array = components;
			foreach (Component val in array)
			{
				if ((Object)(object)val == (Object)null)
				{
					continue;
				}
				Component val2 = val;
				Component val3 = val2;
				Transform val4 = (Transform)(object)((val3 is Transform) ? val3 : null);
				if (val4 == null)
				{
					BoxCollider val5 = (BoxCollider)(object)((val3 is BoxCollider) ? val3 : null);
					if (val5 == null)
					{
						CapsuleCollider val6 = (CapsuleCollider)(object)((val3 is CapsuleCollider) ? val3 : null);
						if (val6 == null)
						{
							SelectionOutline selectionOutline = val3 as SelectionOutline;
							if (selectionOutline == null)
							{
								dynamicCards.Add(((Component)EditorCard_Title.Create(rightPanelObj.transform, ((object)val).GetType().Name)).gameObject);
							}
						}
						else
						{
							dynamicCards.Add(((Component)EditorCard_CapsuleCollider.Create(rightPanelObj.transform, "Capsule Collider", ((Collider)val6).isTrigger, ((Collider)val6).providesContacts, val6.center, val6.radius, val6.height)).gameObject);
						}
					}
					else
					{
						dynamicCards.Add(((Component)EditorCard_BoxCollider.Create(rightPanelObj.transform, "Box Collider", ((Collider)val5).isTrigger, ((Collider)val5).providesContacts, val5.center, val5.size)).gameObject);
					}
				}
				else
				{
					dynamicCards.Add(((Component)EditorCard_Transform.Create(rightPanelObj.transform, "Transform", val4.position, val4.eulerAngles, val4.localScale)).gameObject);
				}
			}
		}

		private void ClearDynamicCards()
		{
			foreach (GameObject dynamicCard in dynamicCards)
			{
				if ((Object)(object)dynamicCard != (Object)null)
				{
					Object.Destroy((Object)(object)dynamicCard);
				}
			}
			dynamicCards.Clear();
		}

		private void Deselect()
		{
			selectedTransform = null;
			if ((Object)(object)currentOutline != (Object)null)
			{
				Object.Destroy((Object)(object)currentOutline);
				currentOutline = null;
			}
			previewUIObject.SetActive(false);
			((Behaviour)previewCamera).enabled = false;
			ClearDynamicCards();
		}
	}
	internal class EditorCard_Title : MonoBehaviour
	{
		private TextMeshProUGUI titleText;

		public void Initialize(TextMeshProUGUI titleText)
		{
			this.titleText = titleText;
		}

		public void SetTitle(string newTitle)
		{
			if ((Object)(object)titleText != (Object)null)
			{
				((TMP_Text)titleText).text = newTitle;
			}
		}

		public void Show()
		{
			((Component)this).gameObject.SetActive(true);
		}

		public void Hide()
		{
			((Component)this).gameObject.SetActive(false);
		}

		public static EditorCard_Title Create(Transform parent, string title)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Expected O, but got Unknown
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Card_Title");
			val.transform.SetParent(parent, false);
			Image val2 = val.AddComponent<Image>();
			((Graphic)val2).color = new Color(0.05f, 0.05f, 0.05f);
			ContentSizeFitter val3 = val.AddComponent<ContentSizeFitter>();
			val3.verticalFit = (FitMode)2;
			VerticalLayoutGroup val4 = val.AddComponent<VerticalLayoutGroup>();
			((LayoutGroup)val4).padding = new RectOffset(10, 10, 8, 8);
			((HorizontalOrVerticalLayoutGroup)val4).childControlWidth = true;
			LayoutElement val5 = val.AddComponent<LayoutElement>();
			val5.preferredWidth = 330f;
			val5.flexibleHeight = 0f;
			GameObject val6 = new GameObject("Text_Title");
			val6.transform.SetParent(val.transform, false);
			TextMeshProUGUI val7 = val6.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val7).text = title;
			((TMP_Text)val7).fontSize = 16f;
			((TMP_Text)val7).fontStyle = (FontStyles)1;
			((Graphic)val7).color = Color.white;
			((TMP_Text)val7).alignment = (TextAlignmentOptions)513;
			EditorCard_Title editorCard_Title = val.AddComponent<EditorCard_Title>();
			editorCard_Title.Initialize(val7);
			return editorCard_Title;
		}
	}
	internal class EditorCard_Transform : MonoBehaviour
	{
		private TextMeshProUGUI titleText;

		private TextMeshProUGUI positionText;

		private TextMeshProUGUI rotationText;

		private TextMeshProUGUI scaleText;

		public void Initialize(TextMeshProUGUI titleText, TextMeshProUGUI positionText, TextMeshProUGUI rotationText, TextMeshProUGUI scaleText)
		{
			this.titleText = titleText;
			this.positionText = positionText;
			this.rotationText = rotationText;
			this.scaleText = scaleText;
		}

		public void SetTitle(string newTitle)
		{
			if ((Object)(object)titleText != (Object)null)
			{
				((TMP_Text)titleText).text = newTitle;
			}
		}

		public void SetPosition(Vector3 v)
		{
			if ((Object)(object)positionText != (Object)null)
			{
				((TMP_Text)positionText).text = "Position: " + ((Vector3)(ref v)).ToString("F2");
			}
		}

		public void SetRotation(Vector3 v)
		{
			if ((Object)(object)rotationText != (Object)null)
			{
				((TMP_Text)rotationText).text = "Rotation: " + ((Vector3)(ref v)).ToString("F2");
			}
		}

		public void SetScale(Vector3 v)
		{
			if ((Object)(object)scaleText != (Object)null)
			{
				((TMP_Text)scaleText).text = "Scale: " + ((Vector3)(ref v)).ToString("F2");
			}
		}

		public void SetValues(Vector3 pos, Vector3 rot, Vector3 scale)
		{
			//IL_0002: 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_0012: Unknown result type (might be due to invalid IL or missing references)
			SetPosition(pos);
			SetRotation(rot);
			SetScale(scale);
		}

		public void Show()
		{
			((Component)this).gameObject.SetActive(true);
		}

		public void Hide()
		{
			((Component)this).gameObject.SetActive(false);
		}

		public static EditorCard_Transform Create(Transform parent, string title, Vector3? defaultPos = null, Vector3? defaultRot = null, Vector3? defaultScale = null)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Expected O, but got Unknown
			//IL_00f7: 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: Expected O, but got Unknown
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Card_Transform");
			val.transform.SetParent(parent, false);
			Image val2 = val.AddComponent<Image>();
			((Graphic)val2).color = new Color(0.05f, 0.05f, 0.05f);
			ContentSizeFitter val3 = val.AddComponent<ContentSizeFitter>();
			val3.verticalFit = (FitMode)2;
			VerticalLayoutGroup val4 = val.AddComponent<VerticalLayoutGroup>();
			((LayoutGroup)val4).padding = new RectOffset(10, 10, 10, 10);
			((HorizontalOrVerticalLayoutGroup)val4).spacing = 8f;
			((HorizontalOrVerticalLayoutGroup)val4).childControlWidth = true;
			LayoutElement val5 = val.AddComponent<LayoutElement>();
			val5.preferredWidth = 330f;
			val5.flexibleHeight = 0f;
			GameObject val6 = new GameObject("Text_Title");
			val6.transform.SetParent(val.transform, false);
			TextMeshProUGUI val7 = val6.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val7).text = title;
			((TMP_Text)val7).fontSize = 15f;
			((TMP_Text)val7).fontStyle = (FontStyles)1;
			((TMP_Text)val7).alignment = (TextAlignmentOptions)513;
			((Graphic)val7).color = Color.white;
			GameObject bodyObj = new GameObject("Body_VerticalLayout");
			bodyObj.transform.SetParent(val.transform, false);
			VerticalLayoutGroup val8 = bodyObj.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val8).spacing = 4f;
			((HorizontalOrVerticalLayoutGroup)val8).childControlWidth = true;
			TextMeshProUGUI val9 = CreateVectorLine("Position");
			TextMeshProUGUI val10 = CreateVectorLine("Rotation");
			TextMeshProUGUI val11 = CreateVectorLine("Scale");
			EditorCard_Transform editorCard_Transform = val.AddComponent<EditorCard_Transform>();
			editorCard_Transform.Initialize(val7, val9, val10, val11);
			editorCard_Transform.SetValues((Vector3)(((??)defaultPos) ?? Vector3.zero), (Vector3)(((??)defaultRot) ?? Vector3.zero), (Vector3)(((??)defaultScale) ?? Vector3.one));
			return editorCard_Transform;
			TextMeshProUGUI CreateVectorLine(string name)
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Expected O, but got Unknown
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				GameObject val12 = new GameObject("Text_" + name);
				val12.transform.SetParent(bodyObj.transform, false);
				TextMeshProUGUI val13 = val12.AddComponent<TextMeshProUGUI>();
				((TMP_Text)val13).fontSize = 13f;
				((Graphic)val13).color = new Color(0.6f, 0.6f, 0.6f);
				((TMP_Text)val13).alignment = (TextAlignmentOptions)513;
				return val13;
			}
		}
	}
	internal class EditorNode_Hierarchy : MonoBehaviour
	{
		private Transform targetTransform;

		private Action<Transform> onSelectCallback;

		private bool isExpanded = false;

		private Button expandButton;

		private TextMeshProUGUI expandText;

		private TextMeshProUGUI nameText;

		private GameObject childrenContainer;

		private List<EditorNode_Hierarchy> childNodes = new List<EditorNode_Hierarchy>();

		public void Initialize(Transform target, int indentLevel, Action<Transform> onSelect, Func<Transform, Transform, GameObject> createNodeFunc)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Expected O, but got Unknown
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Expected O, but got Unknown
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Expected O, but got Unknown
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Expected O, but got Unknown
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Expected O, but got Unknown
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Expected O, but got Unknown
			targetTransform = target;
			onSelectCallback = onSelect;
			GameObject val = new GameObject("Row");
			val.transform.SetParent(((Component)this).transform, false);
			HorizontalLayoutGroup val2 = val.AddComponent<HorizontalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val2).spacing = 2f;
			((HorizontalOrVerticalLayoutGroup)val2).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val2).childControlHeight = true;
			((HorizontalOrVerticalLayoutGroup)val2).childForceExpandWidth = false;
			((HorizontalOrVerticalLayoutGroup)val2).childForceExpandHeight = false;
			LayoutElement val3 = val.AddComponent<LayoutElement>();
			val3.preferredHeight = 22f;
			val3.flexibleHeight = 0f;
			if (indentLevel > 0)
			{
				GameObject val4 = new GameObject("Indent");
				val4.transform.SetParent(val.transform, false);
				LayoutElement val5 = val4.AddComponent<LayoutElement>();
				val5.preferredWidth = indentLevel * 10;
			}
			GameObject val6 = new GameObject("ExpandButton");
			val6.transform.SetParent(val.transform, false);
			expandButton = val6.AddComponent<Button>();
			expandText = val6.AddComponent<TextMeshProUGUI>();
			((TMP_Text)expandText).fontSize = 11f;
			((TMP_Text)expandText).alignment = (TextAlignmentOptions)514;
			LayoutElement val7 = val6.AddComponent<LayoutElement>();
			val7.preferredWidth = 14f;
			int childCount = target.childCount;
			if (childCount > 0)
			{
				((TMP_Text)expandText).text = ">";
				((UnityEvent)expandButton.onClick).AddListener(new UnityAction(ToggleExpand));
			}
			else
			{
				((TMP_Text)expandText).text = " ";
				((Selectable)expandButton).interactable = false;
			}
			GameObject val8 = new GameObject("NameButton");
			val8.transform.SetParent(val.transform, false);
			Button val9 = val8.AddComponent<Button>();
			nameText = val8.AddComponent<TextMeshProUGUI>();
			((TMP_Text)nameText).text = ((Object)target).name;
			((TMP_Text)nameText).fontSize = 13f;
			((Graphic)nameText).color = (Color)(((Component)target).gameObject.activeInHierarchy ? Color.white : new Color(0.5f, 0.5f, 0.5f));
			((TMP_Text)nameText).alignment = (TextAlignmentOptions)513;
			LayoutElement val10 = val8.AddComponent<LayoutElement>();
			val10.preferredWidth = 200f;
			val10.flexibleWidth = 1f;
			((UnityEvent)val9.onClick).AddListener((UnityAction)delegate
			{
				onSelectCallback?.Invoke(targetTransform);
			});
			childrenContainer = new GameObject("ChildrenContainer");
			childrenContainer.transform.SetParent(((Component)this).transform, false);
			VerticalLayoutGroup val11 = childrenContainer.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val11).spacing = 2f;
			((HorizontalOrVerticalLayoutGroup)val11).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val11).childControlHeight = true;
			((HorizontalOrVerticalLayoutGroup)val11).childForceExpandHeight = false;
			for (int num = 0; num < childCount; num++)
			{
				Transform child = target.GetChild(num);
				createNodeFunc(child, childrenContainer.transform);
			}
			childrenContainer.SetActive(false);
		}

		public void ToggleExpand()
		{
			isExpanded = !isExpanded;
			childrenContainer.SetActive(isExpanded);
			((TMP_Text)expandText).text = (isExpanded ? "v" : ">");
		}
	}
}