Decompiled source of Editor Expanded v1.1.2

EditorExpanded.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Events;
using Events.Stunt;
using HarmonyLib;
using LevelEditorActions;
using LevelEditorTools;
using Serializers;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("EditorExpanded")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EditorExpanded")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a5276705-fc20-4b5d-b06a-173f5528845c")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
public static class LevelEditorExtensions
{
	public static void ClearAndSelect(this LevelEditor editor, GameObject prefab)
	{
		editor.ClearSelectedList(true);
		editor.SelectObject(prefab);
	}
}
public static class System__TypeExtensions
{
	public static IEnumerable<T> GetCustomAttributes<T>(this Type type, bool inherit = true) where T : Attribute
	{
		return type.GetCustomAttributes(inherit).OfType<T>();
	}

	public static T GetCustomAttribute<T>(this Type type, bool inherit = true) where T : Attribute
	{
		return type.GetCustomAttributes<T>(inherit).FirstOrDefault();
	}

	public static bool GetAttribute<T>(this Type type, out T attribute, bool inherit = true) where T : Attribute
	{
		attribute = null;
		object[] customAttributes = type.GetCustomAttributes(inherit);
		foreach (object obj in customAttributes)
		{
			if (obj is T)
			{
				attribute = obj as T;
				return true;
			}
		}
		return false;
	}

	public static bool HasAttribute<T>(this Type type, bool inherit = true) where T : Attribute
	{
		T attribute;
		return type.GetAttribute<T>(out attribute, inherit);
	}
}
namespace EditorExpanded
{
	[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
	public sealed class EditorToolAttribute : Attribute
	{
	}
	public static class EditorUtil
	{
		public static Dictionary<ToolCategory, int> CategorySort = new Dictionary<ToolCategory, int>();

		public static Dictionary<int, GameObject> QuickSelectMemory = new Dictionary<int, GameObject>();

		public static void SetQuickMemory(int index, GameObject instance)
		{
			QuickSelectMemory[index] = instance;
		}

		public static GameObject GetQuickMemory(int index)
		{
			if (QuickSelectMemory.ContainsKey(index))
			{
				return QuickSelectMemory[index];
			}
			return null;
		}

		public static void ClearQuickMemory()
		{
			QuickSelectMemory.Clear();
		}

		public static void Inspect(GameObject Target)
		{
			NGUIObjectInspectorTab val = Object.FindObjectOfType<NGUIObjectInspectorTab>();
			LevelEditor levelEditor_ = G.Sys.LevelEditor_;
			if (Object.op_Implicit((Object)(object)levelEditor_) && Object.op_Implicit((Object)(object)val))
			{
				levelEditor_.ClearOutlines();
				levelEditor_.SelectedObjects_.Clear();
				levelEditor_.SelectedObjects_.Add(Target);
				levelEditor_.AddOutline(Target);
				levelEditor_.UpdateOutlines();
				levelEditor_.activeObject_ = Target;
				((NGUIObjectInspectorTabAbstract)val).targetObject_ = Target;
				((NGUIObjectInspectorTabAbstract)val).ClearComponentInspectors();
				((NGUIObjectInspectorTabAbstract)val).InitComponentInspectorsOnTargetObject();
				val.InitAddComponentButton();
				val.propertiesNeedToBeUpdated_ = false;
				val.objectNameLabel_.text = GameObjectEx.GetDisplayName(((NGUIObjectInspectorTabAbstract)val).targetObject_);
			}
		}

		public static void InspectRoot()
		{
			LevelEditor levelEditor_ = G.Sys.LevelEditor_;
			GameObject activeObject_ = levelEditor_.activeObject_;
			if (Object.op_Implicit((Object)(object)levelEditor_) && Object.op_Implicit((Object)(object)activeObject_))
			{
				Inspect(GameObjectEx.Root(activeObject_));
				levelEditor_.ClearSelectedList(true);
				levelEditor_.SelectObject(GameObjectEx.Root(activeObject_));
			}
		}

		public static bool IsSelectionRoot()
		{
			GameObject activeObject_ = G.Sys.LevelEditor_.activeObject_;
			if (Object.op_Implicit((Object)(object)activeObject_))
			{
				return TransformExtensionOnly.IsRoot(activeObject_.transform);
			}
			return true;
		}

		public static void PrintToolInspectionStackError()
		{
			MessageBox.Create("You can't run this tool while inspecting a group stack.\nPlease select a root level object.", "ERROR").SetButtons((ButtonType)0).Show();
		}
	}
	public class FileSystem
	{
		public string RootDirectory { get; }

		public string VirtualFileSystemRoot => Path.Combine(RootDirectory, "Data");

		public FileSystem()
		{
			RootDirectory = Path.GetDirectoryName(Assembly.GetCallingAssembly().Location);
			if (!Directory.Exists(VirtualFileSystemRoot))
			{
				Directory.CreateDirectory(VirtualFileSystemRoot);
			}
		}

		public bool FileExists(string path)
		{
			string path2 = Path.Combine(VirtualFileSystemRoot, path);
			return File.Exists(path2);
		}

		public bool DirectoryExists(string path)
		{
			string path2 = Path.Combine(VirtualFileSystemRoot, path);
			return Directory.Exists(path2);
		}

		public bool PathExists(string path)
		{
			return FileExists(path) || DirectoryExists(path);
		}

		public byte[] ReadAllBytes(string filePath)
		{
			string text = Path.Combine(VirtualFileSystemRoot, filePath);
			if (!File.Exists(text))
			{
				Mod.Log.LogInfo((object)("Couldn't read a file for path '" + text + "'. File does not exist."));
				return null;
			}
			return File.ReadAllBytes(text);
		}

		public FileStream CreateFile(string filePath, bool overwrite = false)
		{
			string text = Path.Combine(VirtualFileSystemRoot, filePath);
			if (File.Exists(text))
			{
				if (!overwrite)
				{
					Mod.Log.LogInfo((object)("Couldn't create a mod VFS file for path '" + text + "'. The file already exists."));
					return null;
				}
				Mod.Log.LogInfo((object)("Couldn't delete a mod VFS file for path '" + text + "'. File does not exist."));
				RemoveFile(filePath);
			}
			try
			{
				return File.Create(text);
			}
			catch (Exception ex)
			{
				Mod.Log.LogInfo((object)("Couldn't create a mod VFS file for path '" + text + "'."));
				Mod.Log.LogInfo((object)ex);
				return null;
			}
		}

		public void RemoveFile(string filePath)
		{
			string text = Path.Combine(VirtualFileSystemRoot, filePath);
			if (!File.Exists(text))
			{
				Mod.Log.LogInfo((object)("Couldn't delete a mod VFS file for path '" + text + "'. File does not exist."));
				return;
			}
			try
			{
				File.Delete(text);
			}
			catch (Exception ex)
			{
				Mod.Log.LogInfo((object)("Couldn't delete a mod VFS file for path '" + text + "'."));
				Mod.Log.LogInfo((object)ex);
			}
		}

		public void IterateOver(string directoryPath, Action<string, bool> action, bool sort = true)
		{
			string text = Path.Combine(VirtualFileSystemRoot, directoryPath);
			if (!Directory.Exists(text))
			{
				Mod.Log.LogInfo((object)("Cannot iterate over directory at '" + text + "'. It doesn't exist."));
				return;
			}
			List<string> list = Directory.GetFiles(text).ToList();
			list.AddRange(Directory.GetDirectories(text));
			if (sort)
			{
				list = list.OrderBy((string x) => x).ToList();
			}
			foreach (string item in list)
			{
				try
				{
					bool arg = Directory.Exists(item);
					action(item, arg);
				}
				catch (Exception ex)
				{
					Mod.Log.LogInfo((object)("Action for the element at path '" + item + "' failed. See file system exception log for details."));
					Mod.Log.LogInfo((object)ex);
					break;
				}
			}
		}

		public List<string> GetDirectories(string directoryPath, string searchPattern)
		{
			string text = Path.Combine(VirtualFileSystemRoot, directoryPath);
			if (!Directory.Exists(text))
			{
				Mod.Log.LogInfo((object)("Cannot get directories in directory at '" + text + "'. It doesn't exist."));
				return null;
			}
			return Directory.GetDirectories(text, searchPattern).ToList();
		}

		public List<string> GetDirectories(string directoryPath)
		{
			return GetDirectories(directoryPath, "*");
		}

		public List<string> GetFiles(string directoryPath, string searchPattern)
		{
			string text = Path.Combine(VirtualFileSystemRoot, directoryPath);
			if (!Directory.Exists(text))
			{
				Mod.Log.LogInfo((object)("Cannot get files in directory at '" + text + "'. It doesn't exist."));
				return null;
			}
			return Directory.GetFiles(text, searchPattern).ToList();
		}

		public List<string> GetFiles(string directoryPath)
		{
			return GetFiles(directoryPath, "*");
		}

		public FileStream OpenFile(string filePath, FileMode fileMode, FileAccess fileAccess, FileShare fileShare)
		{
			string text = Path.Combine(VirtualFileSystemRoot, filePath);
			if (!File.Exists(text))
			{
				Mod.Log.LogInfo((object)("Couldn't open a VFS file. The requested file: '" + text + "' does not exist."));
				return null;
			}
			try
			{
				return File.Open(text, fileMode, fileAccess, fileShare);
			}
			catch (Exception ex)
			{
				Mod.Log.LogInfo((object)("Couldn't open a VFS file for path '" + text + "'."));
				Mod.Log.LogInfo((object)ex);
				return null;
			}
		}

		public FileStream OpenFile(string filePath)
		{
			return OpenFile(filePath, FileMode.Open, FileAccess.ReadWrite, FileShare.Read);
		}

		public string CreateDirectory(string directoryName)
		{
			string text = Path.Combine(VirtualFileSystemRoot, directoryName);
			try
			{
				Directory.CreateDirectory(text);
				return text;
			}
			catch (Exception ex)
			{
				Mod.Log.LogInfo((object)("Couldn't create a VFS directory for path '" + text + "'."));
				Mod.Log.LogInfo((object)ex);
				return string.Empty;
			}
		}

		public void RemoveDirectory(string directoryPath)
		{
			string text = Path.Combine(VirtualFileSystemRoot, directoryPath);
			if (!Directory.Exists(text))
			{
				Mod.Log.LogInfo((object)("Couldn't remove a VFS directory for path '" + text + "'. Directory does not exist."));
				return;
			}
			try
			{
				Directory.Delete(text, recursive: true);
			}
			catch (Exception ex)
			{
				Mod.Log.LogInfo((object)("Couldn't remove a VFS directory for path '" + text + "'."));
				Mod.Log.LogInfo((object)ex);
			}
		}

		public static string GetValidFileName(string dirtyFileName, string replaceInvalidCharsWith = "_")
		{
			return Regex.Replace(dirtyFileName, "[^\\w\\s\\.]", replaceInvalidCharsWith, RegexOptions.None);
		}

		public static string GetValidFileNameToLower(string dirtyFileName, string replaceInvalidCharsWith = "_")
		{
			return GetValidFileName(dirtyFileName, replaceInvalidCharsWith).ToLower();
		}
	}
	[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
	public sealed class KeyboardShortcutAttribute : Attribute
	{
		public InputEvent SchemeA { get; }

		public InputEvent SchemeB { get; }

		public KeyboardShortcutAttribute(string A)
		{
			SchemeA = (SchemeB = InputEvent.Create(A));
		}

		public KeyboardShortcutAttribute(string A, string B)
		{
			SchemeA = InputEvent.Create(A);
			SchemeB = InputEvent.Create(B);
		}

		public InputEvent Get(char scheme)
		{
			return (InputEvent)(scheme switch
			{
				'A' => SchemeA, 
				'B' => SchemeB, 
				_ => null, 
			});
		}
	}
	public sealed class MessageBox
	{
		private readonly string Message = "";

		private readonly string Title = "";

		private float Time = 0f;

		private ButtonType Buttons = (ButtonType)0;

		private Action Confirm;

		private Action Cancel;

		private MessageBox(string message, string title)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			Message = message;
			Title = title;
			Confirm = EmptyAction;
			Cancel = EmptyAction;
		}

		public static MessageBox Create(string content, string title = "")
		{
			return new MessageBox(content, title);
		}

		public MessageBox SetButtons(ButtonType buttons)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			Buttons = buttons;
			return this;
		}

		public MessageBox SetTimeout(float delay)
		{
			Time = delay;
			return this;
		}

		public MessageBox OnConfirm(Action action)
		{
			Confirm = action;
			return this;
		}

		public MessageBox OnCancel(Action action)
		{
			Cancel = action;
			return this;
		}

		public void Show()
		{
			//IL_001e: 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_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			//IL_0042: Expected O, but got Unknown
			G.Sys.MenuPanelManager_.ShowMessage(Message, Title, (OnButtonClicked)delegate
			{
				Confirm();
			}, (OnButtonClicked)delegate
			{
				Cancel();
			}, Buttons, false, (Pivot)4, Time);
		}

		private void EmptyAction()
		{
		}
	}
	[BepInPlugin("Distance.EditorExpanded", "Editor Expanded", "1.1.2")]
	public class Mod : BaseUnityPlugin
	{
		private const string modGUID = "Distance.EditorExpanded";

		private const string modName = "Editor Expanded";

		private const string modVersion = "1.1.2";

		public static string DevFolderKey = "Enable Dev Folder";

		public static string AdvancedMusicSelectionKey = "Advanced Music Selection";

		public static string DisplayWorkshopKey = "Display Workshop Levels";

		public static string EditorIconKey = "Editor Icon Size";

		public static string EnableGroupKey = "Enable Group Centerpoint Mover";

		public static string UnlimitedMedalKey = "Unlimited Medal Times";

		public static string RemoveLimitsKey = "Remove Editor Number Limits";

		public static string RemoveRequirementsKey = "Remove Mode Requirements";

		public static string MultipleCarKey = "Multiple Car Spawners";

		public static string HiddenFolderKey = "Enable Hidden Folder";

		public static string UnlimitedComponentKey = "Unlimited Add Component";

		public static string AllChangeTrackKey = "Change Track Type Includes All Splines";

		public static string SubTextureKey = "Enable Sub Materials";

		public static string EditorPrecisionKey = "Decimal Precision";

		public static string CursorBackgroundKey = "Cursor Ignores Background Layer";

		public static string EnableHiddenComponentKey = "Enable Hidden Components";

		public static string RemoveCreatorKey = "Remove Level Creator Field";

		public static string EnableAllModesKey = "Enable All Modes";

		private static readonly Harmony harmony = new Harmony("Distance.EditorExpanded");

		public static ManualLogSource Log = new ManualLogSource("Editor Expanded");

		public static Mod Instance;

		public static ConfigEntry<bool> DevFolderEnabled { get; set; }

		public static ConfigEntry<bool> AdvancedMusicSelection { get; set; }

		public static ConfigEntry<bool> DisplayWorkshopLevels { get; set; }

		public static ConfigEntry<float> EditorIconSize { get; set; }

		public static ConfigEntry<bool> EnableGroupCenterMover { get; set; }

		public static ConfigEntry<bool> UnlimitedMedalTimes { get; set; }

		public static ConfigEntry<bool> RemoveNumberLimits { get; set; }

		public static ConfigEntry<bool> RemoveModeRequirements { get; set; }

		public static ConfigEntry<bool> MultipleCarSpawners { get; set; }

		public static ConfigEntry<bool> HiddenFolderEnabled { get; set; }

		public static ConfigEntry<bool> UnlimitedAddComponent { get; set; }

		public static ConfigEntry<bool> IncludeAllSplinesInChangeTrackType { get; set; }

		public static ConfigEntry<bool> EnableSubTextures { get; set; }

		public static ConfigEntry<int> EditorDecimalPrecision { get; set; }

		public static ConfigEntry<bool> CursorIgnoresBackground { get; set; }

		public static ConfigEntry<bool> EnableHiddenComponent { get; set; }

		public static ConfigEntry<bool> RemoveCreatorField { get; set; }

		public static ConfigEntry<bool> EnableAllModes { get; set; }

		public static bool DevMode => IsCommandLineSwitchPresent("-dev");

		public static bool DevBuildForCreatorName { get; set; }

		public static bool IsCommandLineSwitchPresent(string item)
		{
			return (from arg in Environment.GetCommandLineArgs()
				select arg.ToLower()).Contains(item);
		}

		private void Awake()
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Expected O, but got Unknown
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Expected O, but got Unknown
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Expected O, but got Unknown
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Expected O, but got Unknown
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Expected O, but got Unknown
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Expected O, but got Unknown
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Expected O, but got Unknown
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Expected O, but got Unknown
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Expected O, but got Unknown
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Expected O, but got Unknown
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Expected O, but got Unknown
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Expected O, but got Unknown
			//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Expected O, but got Unknown
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_0310: Expected O, but got Unknown
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Expected O, but got Unknown
			//IL_0372: Unknown result type (might be due to invalid IL or missing references)
			//IL_037c: Expected O, but got Unknown
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			Log = Logger.CreateLogSource("Distance.EditorExpanded");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Thanks for using Editor Expanded!");
			RegisterExportedTypes();
			DevFolderEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", DevFolderKey, true, new ConfigDescription("Enables the Dev folder in the level editor Library tab.\nSome of the objects in this folder might not work properly, be careful when using them!", (AcceptableValueBase)null, new object[0]));
			RemoveNumberLimits = ((BaseUnityPlugin)this).Config.Bind<bool>("General", RemoveLimitsKey, true, new ConfigDescription("Removes number limits from the editor. This will allow negative values for many settings. Be sure to get test the level in sprint mode. Some values do not get interpreted properly.", (AcceptableValueBase)null, new object[0]));
			EnableGroupCenterMover = ((BaseUnityPlugin)this).Config.Bind<bool>("General", EnableGroupKey, true, new ConfigDescription("Enables the group centerpoint mover option.", (AcceptableValueBase)null, new object[0]));
			AdvancedMusicSelection = ((BaseUnityPlugin)this).Config.Bind<bool>("General", AdvancedMusicSelectionKey, true, new ConfigDescription("Display hidden dev music cues in the level editor music selector window.", (AcceptableValueBase)null, new object[0]));
			DisplayWorkshopLevels = ((BaseUnityPlugin)this).Config.Bind<bool>("General", DisplayWorkshopKey, false, new ConfigDescription("Allows to open the workshop levels from the level editor (read only).", (AcceptableValueBase)null, new object[0]));
			IncludeAllSplinesInChangeTrackType = ((BaseUnityPlugin)this).Config.Bind<bool>("General", AllChangeTrackKey, true, new ConfigDescription("All splines are now included in the Change Track Type tool", (AcceptableValueBase)null, new object[0]));
			EnableSubTextures = ((BaseUnityPlugin)this).Config.Bind<bool>("General", SubTextureKey, false, new ConfigDescription("Now displays sub textures in the properties menu for objects. This is good for coloring individual parts of an object you couldn't before.", (AcceptableValueBase)null, new object[0]));
			CursorIgnoresBackground = ((BaseUnityPlugin)this).Config.Bind<bool>("General", CursorBackgroundKey, false, new ConfigDescription("The Level Editor Cursor will no longer collide with background objects.", (AcceptableValueBase)null, new object[0]));
			EditorDecimalPrecision = ((BaseUnityPlugin)this).Config.Bind<int>("General", EditorPrecisionKey, 3, new ConfigDescription("Sets the precision of decimals displayed in the editor. Range 0-10.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), new object[0]));
			EnableHiddenComponent = ((BaseUnityPlugin)this).Config.Bind<bool>("General", EnableHiddenComponentKey, false, new ConfigDescription("Enables the visibility of components that normally are ignored. The box trigger on a killgridbox for example.", (AcceptableValueBase)null, new object[0]));
			UnlimitedMedalTimes = ((BaseUnityPlugin)this).Config.Bind<bool>("General", UnlimitedMedalKey, false, new ConfigDescription("Uncaps the medal time limit and allows any time to be set. So for example, a diamond medal can have a lower time than a bronze medal.", (AcceptableValueBase)null, new object[0]));
			UnlimitedAddComponent = ((BaseUnityPlugin)this).Config.Bind<bool>("General", UnlimitedComponentKey, false, new ConfigDescription("Allows components to be added to any object. \nWARNING: This can create very strange behaviour with certain objects, test the level in arcade mode to make sure it works!", (AcceptableValueBase)null, new object[0]));
			RemoveCreatorField = ((BaseUnityPlugin)this).Config.Bind<bool>("General", RemoveCreatorKey, false, new ConfigDescription("Disables the visibility of the Level Creator Name field in the level settings. This field is only used by Official tier community levels.", (AcceptableValueBase)null, new object[0]));
			RemoveModeRequirements = ((BaseUnityPlugin)this).Config.Bind<bool>("General", RemoveRequirementsKey, false, new ConfigDescription("Removes the requirements needed to save a level. \nRemember to playtest your level in arcade mode before uploading to the workshop.", (AcceptableValueBase)null, new object[0]));
			MultipleCarSpawners = ((BaseUnityPlugin)this).Config.Bind<bool>("General", MultipleCarKey, false, new ConfigDescription("Allows the use of multiple Level Editor Car Spawners as well as multiple Tag Bubbles. The extra ones are unused by the game if placed.", (AcceptableValueBase)null, new object[0]));
			EnableAllModes = ((BaseUnityPlugin)this).Config.Bind<bool>("General", EnableAllModesKey, false, new ConfigDescription("Allows all modes to be visible in the Level Settings menu. Modes outside of Sprint, Challenge, Stunt, Reverse Tag, and Trackmogrify are unplayable. \nIt might be a good idea to keep this disabled.", (AcceptableValueBase)null, new object[0]));
			HiddenFolderEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", HiddenFolderKey, false, new ConfigDescription("Adds a folder to titled \"Hidden\" to the editor that contains objects not listed anywhere; including the dev folder. \nWARNING: These objects are not meant to be editor objects, they may corrupt level files or crash the game.", (AcceptableValueBase)null, new object[0]));
			EditorIconSize = ((BaseUnityPlugin)this).Config.Bind<float>("General", EditorIconKey, 67f, new ConfigDescription("Adjusts the size of editor icons in the Library tab. \nThis value should be adjusted from the zoom slider in the library tab, not in this menu.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(32f, 256f), new object[0]));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loading...");
			harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded!");
		}

		private void OnConfigChanged(object sender, EventArgs e)
		{
			SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((e is SettingChangedEventArgs) ? e : null);
			if (val != null)
			{
			}
		}

		private void RegisterExportedTypes()
		{
			TypeExportManager.Register<ISerializable>();
			TypeExportManager.Register<LevelEditorTool>((Type type) => type.HasAttribute<EditorToolAttribute>());
		}

		private void ReloadTrackNodeColors(object sender, EventArgs e)
		{
			TrackManipulatorNode[] array = Object.FindObjectsOfType<TrackManipulatorNode>();
			foreach (TrackManipulatorNode val in array)
			{
				val.SetColorAndMesh();
			}
		}

		public static bool CheckWhichIsHiddenFolder(LevelPrefabFileInfo info)
		{
			if ((PrimitiveEx.IsNullOrWhiteSpace(info.name_) ? "null" : info.name_).Equals("Hidden"))
			{
				return true;
			}
			return false;
		}
	}
	internal static class TypeExportManager
	{
		private static readonly Dictionary<Type, Func<Type, bool>> types_ = new Dictionary<Type, Func<Type, bool>>();

		private static bool enabled_ = true;

		internal static IEnumerable<Type> Types => GetTypes();

		internal static void Register<T>()
		{
			Type typeFromHandle = typeof(T);
			if (!types_.ContainsKey(typeFromHandle))
			{
				types_.Add(typeFromHandle, null);
			}
		}

		internal static void Register<T>(Func<Type, bool> validator)
		{
			Type typeFromHandle = typeof(T);
			if (!types_.ContainsKey(typeFromHandle))
			{
				types_.Add(typeFromHandle, validator);
			}
		}

		internal static void Unregister<T>()
		{
			Type typeFromHandle = typeof(T);
			types_.Remove(typeFromHandle);
		}

		internal static void UnregisterAll()
		{
			types_.Clear();
		}

		internal static IEnumerable<Type> GetTypes()
		{
			if (enabled_)
			{
				return ICollectionEx.CopyToArray<Type>((ICollection<Type>)types_.Keys);
			}
			return new Type[0];
		}

		internal static bool PerformTypeCheck(Type baseType, Type type)
		{
			Func<Type, bool> value;
			return !types_.TryGetValue(baseType, out value) || (value?.Invoke(type) ?? true);
		}

		internal static IEnumerable<Type> GetTypesOfType(Type baseType)
		{
			IList<Type> list = new List<Type>();
			Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
			foreach (Assembly assembly in assemblies)
			{
				try
				{
					Type[] types = assembly.GetTypes();
					foreach (Type type in types)
					{
						if (baseType.IsAssignableFrom(type) && ValidateType(type) && PerformTypeCheck(baseType, type))
						{
							list.Add(type);
						}
					}
				}
				catch (ReflectionTypeLoadException)
				{
				}
			}
			return new ReadOnlyCollection<Type>(list);
		}

		internal static bool ValidateType(Type type)
		{
			bool flag = true;
			flag &= !type.IsAbstract;
			flag &= !type.IsGenericTypeDefinition;
			return flag & !type.IsInterface;
		}

		internal static void SetState(bool value)
		{
			enabled_ = value;
		}

		internal static bool GetState()
		{
			return enabled_;
		}

		internal static void Enable()
		{
			SetState(value: true);
		}

		internal static void Disable()
		{
			SetState(value: false);
		}
	}
}
namespace EditorExpanded.Patches
{
	[HarmonyPatch(typeof(Set), "ShouldBeIgnored")]
	internal static class DontInspectComponentsSet__ShouldBeIgnored
	{
		[HarmonyPostfix]
		internal static void Postfix(ref bool __result, Component comp)
		{
			if (Mod.EnableHiddenComponent.Value)
			{
				if ((Object)(object)comp == (Object)null)
				{
					__result = true;
				}
				else
				{
					__result = false;
				}
			}
		}
	}
	[HarmonyPatch(typeof(GameManager), "GetModeShowInLevelEditor")]
	internal static class GameManager__GetModeShowInLevelEditor
	{
		[HarmonyPostfix]
		internal static void Postfix(ref bool __result, GameModeID ID)
		{
			if (Mod.EnableAllModes.Value)
			{
				__result = true;
			}
		}
	}
	[HarmonyPatch(typeof(GUtils), "GetExportedTypesOfType")]
	internal static class GUtils__GetExportedTypesOfType
	{
		[HarmonyPostfix]
		internal static void Postfix(Type baseType, ref Type[] __result)
		{
			IEnumerable<Type> enumerable = __result;
			if (TypeExportManager.Types.Contains(baseType))
			{
				enumerable = enumerable.Concat(TypeExportManager.GetTypesOfType(baseType));
			}
			__result = enumerable.Distinct().ToArray();
		}
	}
	[HarmonyPatch(typeof(AddAnimatedComponentTool), "ValidateObject")]
	internal static class AddAnimatedComponentTool__ValidateObject
	{
		[HarmonyPostfix]
		internal static void Postfix(ref bool __result)
		{
			if (Mod.UnlimitedAddComponent.Value)
			{
				__result = true;
			}
		}
	}
	[HarmonyPatch(typeof(AddAnimatorAudioComponentTool), "ValidateObject")]
	internal static class AddAnimatorAudioComponentTool__ValidateObject
	{
		[HarmonyPostfix]
		internal static void Postfix(ref bool __result)
		{
			if (Mod.UnlimitedAddComponent.Value)
			{
				__result = true;
			}
		}
	}
	[HarmonyPatch(typeof(AddAnimatorCameraShakeComponentTool), "ValidateObject")]
	internal static class AddAnimatorCameraShakeComponentTool__ValidateObject
	{
		[HarmonyPostfix]
		internal static void Postfix(ref bool __result)
		{
			if (Mod.UnlimitedAddComponent.Value)
			{
				__result = true;
			}
		}
	}
	[HarmonyPatch(typeof(AddComponentTool<AddedComponent>), "Run")]
	internal static class AddComponentTool__Run
	{
		[HarmonyPrefix]
		internal static bool Prefix(ref bool __result)
		{
			if (!EditorUtil.IsSelectionRoot())
			{
				EditorUtil.PrintToolInspectionStackError();
				__result = false;
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(AddEngageBrokenPiecesComponentTool), "ValidateObject")]
	internal static class AddEngageBrokenPiecesComponentTool__ValidateObject
	{
		[HarmonyPostfix]
		internal static void Postfix(ref bool __result)
		{
			if (Mod.UnlimitedAddComponent.Value)
			{
				__result = true;
			}
		}
	}
	[HarmonyPatch(typeof(AddExcludeFromEMPComponentTool), "ValidateObject")]
	internal static class AddExcludeFromEMPComponentTool__ValidateObject
	{
		[HarmonyPostfix]
		internal static void Postfix(ref bool __result)
		{
			if (Mod.UnlimitedAddComponent.Value)
			{
				__result = true;
			}
		}
	}
	[HarmonyPatch(typeof(AddFadeOutComponentTool), "ValidateObject")]
	internal static class AddFadeOutComponentTool__ValidateObject
	{
		[HarmonyPostfix]
		internal static void Postfix(ref bool __result)
		{
			if (Mod.UnlimitedAddComponent.Value)
			{
				__result = true;
			}
		}
	}
	[HarmonyPatch(typeof(AddGoldenAnimatorComponentTool), "ValidateObject")]
	internal static class AddGoldenAnimatorComponentTool__ValidateObject
	{
		[HarmonyPostfix]
		internal static void Postfix(ref bool __result)
		{
			if (Mod.UnlimitedAddComponent.Value)
			{
				__result = true;
			}
		}
	}
	[HarmonyPatch(typeof(AddIgnoreInCullGroupsComponentTool), "ValidateObject")]
	internal static class AddIgnoreInCullGroupsComponentTool__ValidateObject
	{
		[HarmonyPostfix]
		internal static void Postfix(ref bool __result)
		{
			if (Mod.UnlimitedAddComponent.Value)
			{
				__result = true;
			}
		}
	}
	[HarmonyPatch(typeof(AddLookAtCameraComponentTool), "ValidateObject")]
	internal static class AddLookAtCameraComponentTool__ValidateObject
	{
		[HarmonyPostfix]
		internal static void Postfix(ref bool __result)
		{
			if (Mod.UnlimitedAddComponent.Value)
			{
				__result = true;
			}
		}
	}
	[HarmonyPatch(typeof(AddPulseAllComponentTool), "ValidateObject")]
	internal static class AddPulseAllComponentTool__ValidateObject
	{
		[HarmonyPostfix]
		internal static void Postfix(ref bool __result)
		{
			if (Mod.UnlimitedAddComponent.Value)
			{
				__result = true;
			}
		}
	}
	[HarmonyPatch(typeof(AddSetActiveAfterWarpComponentTool), "ValidateObject")]
	internal static class AddSetActiveAfterWarpComponentTool__ValidateObject
	{
		[HarmonyPostfix]
		internal static void Postfix(ref bool __result)
		{
			if (Mod.UnlimitedAddComponent.Value)
			{
				__result = true;
			}
		}
	}
	[HarmonyPatch(typeof(AddShowDuringGlitchComponentTool), "ValidateObject")]
	internal static class AddShowDuringGlitchComponentTool__ValidateObject
	{
		[HarmonyPostfix]
		internal static void Postfix(ref bool __result)
		{
			if (Mod.UnlimitedAddComponent.Value)
			{
				__result = true;
			}
		}
	}
	[HarmonyPatch(typeof(AddTurnLightOnNearCarComponentTool), "ValidateObject")]
	internal static class AddTurnLightOnNearCarComponentTool__ValidateObject
	{
		[HarmonyPostfix]
		internal static void Postfix(ref bool __result)
		{
			if (Mod.UnlimitedAddComponent.Value)
			{
				__result = true;
			}
		}
	}
	[HarmonyPatch(typeof(AddZEventListenerComponentTool), "ValidateObject")]
	internal static class AddZEventListenerComponentTool__ValidateObject
	{
		[HarmonyPostfix]
		internal static void Postfix(ref bool __result)
		{
			if (Mod.UnlimitedAddComponent.Value)
			{
				__result = true;
			}
		}
	}
	[HarmonyPatch(typeof(ChangeLayerTool), "OnSelectLayer")]
	internal static class ChangeLayerTool__OnSelectLayer
	{
		[HarmonyPrefix]
		internal static bool Prefix(ChangeLayerTool __instance)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if (!EditorUtil.IsSelectionRoot())
			{
				EditorUtil.PrintToolInspectionStackError();
				__instance.state_ = (ToolState)3;
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(ChangeTrackTypeTool), "Start")]
	internal static class ChangeTrackTypeTool__Start
	{
		[HarmonyPostfix]
		internal static void Postfix()
		{
			//IL_0021: 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_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_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_035e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0374: Unknown result type (might be due to invalid IL or missing references)
			//IL_055d: 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_0589: 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_07e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_080f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0825: Unknown result type (might be due to invalid IL or missing references)
			if (Mod.IncludeAllSplinesInChangeTrackType.Value)
			{
				ChangeTrackTypeTool.roadEntries_ = new KeyValuePair<string, string>[34]
				{
					ChangeTrackTypeTool.Folder("Roads", ChangeTrackTypeTool.selectedFolderColor_),
					ChangeTrackTypeTool.Folder("Shapes", ChangeTrackTypeTool.folderColor_),
					ChangeTrackTypeTool.Folder("Decorations", ChangeTrackTypeTool.folderColor_),
					ChangeTrackTypeTool.Folder("Utility", ChangeTrackTypeTool.folderColor_),
					ChangeTrackTypeTool.KVP("Ancient Road", "SplineRoad"),
					ChangeTrackTypeTool.KVP("Ancient Road Sideless", "AncientSidelessRoad"),
					ChangeTrackTypeTool.KVP("Empire Road", "EmpireSplineRoad"),
					ChangeTrackTypeTool.KVP("Empire Road Sideless", "EmpireSplineRoadSideless"),
					ChangeTrackTypeTool.KVP("Glass Road", "GlassSplineRoad"),
					ChangeTrackTypeTool.KVP("Glass Road 2", "GlassSplineRoad002"),
					ChangeTrackTypeTool.KVP("Glass Road Sideless", "GlassSplineRoadSideless"),
					ChangeTrackTypeTool.KVP("Glass Road Sideless 2", "GlassSplineRoadSideless002"),
					ChangeTrackTypeTool.KVP("Virus Road", "VirusSplineRoad"),
					ChangeTrackTypeTool.KVP("Virus Road Sideless", "VirusSplineSidelessRoad"),
					ChangeTrackTypeTool.KVP("Nitronic Road", "NitronicSplineRoadStraight"),
					ChangeTrackTypeTool.KVP("Nitronic Sideless Road", "NitronicSidelessSplineRoadStraight 1"),
					ChangeTrackTypeTool.KVP("Nitronic Glass Road", "NitronicGlassSplineRoadStraight"),
					ChangeTrackTypeTool.KVP("Nitronic Glass Sideless Road", "NitronicGlassSidelessSplineRoadStraight"),
					ChangeTrackTypeTool.KVP("Nitronic Core Road", "NitronicCorePanelSidelessSplineRoadStraight"),
					ChangeTrackTypeTool.KVP("Nitronic Platform Road", "NitronicPlatformPiece"),
					ChangeTrackTypeTool.KVP("Golden Road", "SplineRoadSimple"),
					ChangeTrackTypeTool.KVP("Golden Tunnel", "TunnelFlat"),
					ChangeTrackTypeTool.KVP("Empire Transit Wall", "EmpireTransitWall"),
					ChangeTrackTypeTool.KVP("Empire Transit Window 1", "EmpireTransitWindow001"),
					ChangeTrackTypeTool.KVP("Empire Transit Window 2", "EmpireTransitWindow002"),
					ChangeTrackTypeTool.KVP("Empire Transit Half Wall", "EmpireTransitHalfWall"),
					ChangeTrackTypeTool.KVP("Empire Transit Half Window", "EmpireTransitHalfWindow"),
					ChangeTrackTypeTool.KVP("Empire Pipe Tunnel", "EmpirePipeTunnel"),
					ChangeTrackTypeTool.KVP("Empire Tunnel", "EmpireTunnel"),
					ChangeTrackTypeTool.KVP("Empire Tunnel 2", "EmpireTunnel2"),
					ChangeTrackTypeTool.KVP("Empire Tunnel 3", "EmpireTunnel3"),
					ChangeTrackTypeTool.KVP("Virus Tunnel", "VirusTunnel"),
					ChangeTrackTypeTool.KVP("Sky Islands Tunnel", "SkyIslandsTunnel01"),
					ChangeTrackTypeTool.KVP("Nitronic Tunnel", "NitronicEchoTunnel")
				};
				ChangeTrackTypeTool.shapeEntries_ = new KeyValuePair<string, string>[24]
				{
					ChangeTrackTypeTool.Folder("Roads", ChangeTrackTypeTool.folderColor_),
					ChangeTrackTypeTool.Folder("Shapes", ChangeTrackTypeTool.selectedFolderColor_),
					ChangeTrackTypeTool.Folder("Decorations", ChangeTrackTypeTool.folderColor_),
					ChangeTrackTypeTool.Folder("Utility", ChangeTrackTypeTool.folderColor_),
					ChangeTrackTypeTool.KVP("Cylinder", "SplineCylinder"),
					ChangeTrackTypeTool.KVP("Hexagon", "SplineHexagon"),
					ChangeTrackTypeTool.KVP("Square", "SplineQuad"),
					ChangeTrackTypeTool.KVP("Scales", "SplineScales"),
					ChangeTrackTypeTool.KVP("Girder 2D", "SplineGirder2D"),
					ChangeTrackTypeTool.KVP("Girder 3D", "SplineGirder3D"),
					ChangeTrackTypeTool.KVP("Golden Wires 1", "SplineWires1"),
					ChangeTrackTypeTool.KVP("Golden Wires 2", "SplineWirse2"),
					ChangeTrackTypeTool.KVP("Quarter Pipe", "SplineQPipe"),
					ChangeTrackTypeTool.KVP("40 Pipe", "Spline40Pipe"),
					ChangeTrackTypeTool.KVP("Half Pipe", "SplineHalfPipe"),
					ChangeTrackTypeTool.KVP("Quarter Tube", "SplineQTube"),
					ChangeTrackTypeTool.KVP("Half Tube", "SplineHalfTube"),
					ChangeTrackTypeTool.KVP("Tube", "SplineTube"),
					ChangeTrackTypeTool.KVP("Square Tube", "SplineQuadTube"),
					ChangeTrackTypeTool.KVP("Hexagon Tube", "SplineHexTube"),
					ChangeTrackTypeTool.KVP("Tape", "SplineTape"),
					ChangeTrackTypeTool.KVP("Cylinder HD", "SplineCylinderHD"),
					ChangeTrackTypeTool.KVP("Golden Road", "SplineRoadSimple"),
					ChangeTrackTypeTool.KVP("Golden Tunnel", "TunnelFlat")
				};
				ChangeTrackTypeTool.decorationEntries_ = new KeyValuePair<string, string>[28]
				{
					ChangeTrackTypeTool.Folder("Roads", ChangeTrackTypeTool.folderColor_),
					ChangeTrackTypeTool.Folder("Shapes", ChangeTrackTypeTool.folderColor_),
					ChangeTrackTypeTool.Folder("Decorations", ChangeTrackTypeTool.selectedFolderColor_),
					ChangeTrackTypeTool.Folder("Utility", ChangeTrackTypeTool.folderColor_),
					ChangeTrackTypeTool.KVP("TrafficPlane", "TrafficPlane (Slow)"),
					ChangeTrackTypeTool.KVP("Traffic Plane (not slow)", "TrafficPlane"),
					ChangeTrackTypeTool.KVP("TrafficTube", "TrafficTube (Slow)"),
					ChangeTrackTypeTool.KVP("Traffic Tube (not slow)", "TrafficTube"),
					ChangeTrackTypeTool.KVP("Traffic Tube Plane", "TrafficTubePlane"),
					ChangeTrackTypeTool.KVP("Traffic Plane Nitronic", "TrafficPlaneNitronic"),
					ChangeTrackTypeTool.KVP("Wire", "ElectroPulseWire"),
					ChangeTrackTypeTool.KVP("Wire (Thick)", "ElectroPulseWireThick"),
					ChangeTrackTypeTool.KVP("Wire (Animated)", "ElectroPulseWireAnimated"),
					ChangeTrackTypeTool.KVP("Nitronic Wire 1", "NitronicSplineWire01"),
					ChangeTrackTypeTool.KVP("Nitronic Wire 2", "NitronicSplineWire02"),
					ChangeTrackTypeTool.KVP("Nitronic Wire 3", "NitronicSplineWire03"),
					ChangeTrackTypeTool.KVP("Nitronic Wire 4", "NitronicSplineWire04"),
					ChangeTrackTypeTool.KVP("Nitronic Wire 5", "NitronicSplineWire05"),
					ChangeTrackTypeTool.KVP("Nitronic Wire (Animated)", "Wire (Animated)"),
					ChangeTrackTypeTool.KVP("Vine Leaf High", "VineLeafHi"),
					ChangeTrackTypeTool.KVP("Vine Leaf Medium", "VineLeafMid"),
					ChangeTrackTypeTool.KVP("Vine Leaf Low", "VineLeafLow"),
					ChangeTrackTypeTool.KVP("Vine Leaf Sparse High", "VineLeafSparseHi"),
					ChangeTrackTypeTool.KVP("Vine Leaf Sparse Medium", "VineLeafSparseMid"),
					ChangeTrackTypeTool.KVP("Vine Leaf Sparse Low", "VineLeafSparseLow"),
					ChangeTrackTypeTool.KVP("Vine Leaf Stagger Low", "VineLeafStaggerLow"),
					ChangeTrackTypeTool.KVP("Halcyon Wall Edge Spline", "HalcyonWallEdgeSpline"),
					ChangeTrackTypeTool.KVP("Halcyon Wall Spline", "HalcyonWallSpline")
				};
				ChangeTrackTypeTool.utilityEntries_ = new KeyValuePair<string, string>[6]
				{
					ChangeTrackTypeTool.Folder("Roads", ChangeTrackTypeTool.folderColor_),
					ChangeTrackTypeTool.Folder("Shapes", ChangeTrackTypeTool.folderColor_),
					ChangeTrackTypeTool.Folder("Decorations", ChangeTrackTypeTool.folderColor_),
					ChangeTrackTypeTool.Folder("Utility", ChangeTrackTypeTool.selectedFolderColor_),
					ChangeTrackTypeTool.KVP("Invisible Spline", "InvisibleSpline"),
					ChangeTrackTypeTool.KVP("Killgrid Spline", "KillGridSplineCylinder")
				};
			}
		}
	}
	[HarmonyPatch(typeof(CreateCustomObjectTool), "Start")]
	internal static class CreateCustomObjectTool__Start
	{
		internal static bool Prefix()
		{
			if (!EditorUtil.IsSelectionRoot())
			{
				EditorUtil.PrintToolInspectionStackError();
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(CreditsNameOrbLogic), "Visit")]
	internal static class CreditsNameOrbLogic__Visit
	{
		[HarmonyPrefix]
		internal static bool Prefix(CreditsNameOrbLogic __instance, IVisitor visitor, ISerializable prefabComp, int version)
		{
			if (version != 0)
			{
				visitor.Visit("name_", ref __instance.name_, (string)null);
				if (visitor is ISerializer)
				{
					visitor.Visit("key_", ref __instance.key_, (string)null);
					visitor.Visit("linkedKey_", ref __instance.linkedKey_, (string)null);
				}
			}
			if (__instance.initialized_ || !G.Sys.GameManager_.IsLevelEditorMode_)
			{
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(DeleteTool), "Run")]
	internal static class DeleteTool__Run
	{
		[HarmonyPrefix]
		internal static bool Prefix(ref bool __result)
		{
			if (!EditorUtil.IsSelectionRoot())
			{
				EditorUtil.PrintToolInspectionStackError();
				__result = false;
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(GameManager), "GetModeCheckRequirements")]
	internal static class GameManager__GetModeCheckRequirements
	{
		[HarmonyPrefix]
		internal static bool Prefix(ref CheckModeRequirements __result)
		{
			if (Mod.RemoveModeRequirements.Value)
			{
				__result = null;
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	internal static class GameManager__IsDevBuild_get
	{
		internal static bool Prefix(ref bool __result)
		{
			if (Mod.DevMode)
			{
				__result = true;
				return false;
			}
			return true;
		}

		[HarmonyPostfix]
		internal static void Postfix(ref bool __result)
		{
			if (!Mod.RemoveCreatorField.Value)
			{
				if (Mod.DevBuildForCreatorName)
				{
					__result = true;
				}
				Mod.DevBuildForCreatorName = false;
			}
		}
	}
	[HarmonyPatch(typeof(GenerateTrackmogrifyLevelTool), "Finish")]
	internal static class GenerateTrackmogrifyLevelTool__Finish
	{
		[HarmonyPrefix]
		internal static void Prefix()
		{
			EditorUtil.ClearQuickMemory();
		}
	}
	[HarmonyPatch(typeof(GroupTool), "Run")]
	internal static class GroupTool__Run
	{
		[HarmonyPrefix]
		internal static bool Prefix(ref bool __result)
		{
			if (!EditorUtil.IsSelectionRoot())
			{
				EditorUtil.PrintToolInspectionStackError();
				__result = false;
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(Group), "Visit")]
	internal static class Group__Visit
	{
		[HarmonyPrefix]
		internal static bool Prefix(Group __instance, IVisitor visitor)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			if (!(visitor is Serializer) && !(visitor is Deserializer))
			{
				GameObject[] children = GameObjectEx.GetChildren(((Component)__instance).gameObject);
				if (children.Length == 0)
				{
					IVisitorEx.VisualLabel(visitor, NGUIEx.Colorize("No child objects found!", Color.white));
					return false;
				}
				if (children.Length != 0)
				{
					IVisitorEx.VisualLabel(visitor, "Group Hierarchy");
					int num = 1;
					GameObject[] array = children;
					foreach (GameObject Children in array)
					{
						string arg = ((Object)Children).name;
						if (GameObjectEx.HasComponent<CustomName>(Children))
						{
							CustomName component = Children.GetComponent<CustomName>();
							arg = NGUIEx.Colorize("[b]" + component.CustomName_ + "[/b]", Color.white);
						}
						IVisitorEx.VisitAction(visitor, $"Inspect {arg} (#{num})", (Action)delegate
						{
							EditorUtil.Inspect(Children);
						}, (string)null);
						num++;
					}
				}
			}
			return true;
		}

		[HarmonyPostfix]
		internal static void Postfix(Group __instance, IVisitor visitor, ISerializable prefabComp)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: 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_0066: 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_0086: 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_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: 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_012a: 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_0134: 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_0149: 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_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			if (Mod.EnableGroupCenterMover.Value && (Object)prefabComp == (Object)null)
			{
				Vector3 val = default(Vector3);
				((Vector3)(ref val))..ctor(((Component)__instance).transform.localPosition.x, ((Component)__instance).transform.localPosition.y, ((Component)__instance).transform.localPosition.z);
				Quaternion rotation = default(Quaternion);
				((Quaternion)(ref rotation))..ctor(((Component)__instance).transform.rotation.x, ((Component)__instance).transform.rotation.y, ((Component)__instance).transform.rotation.z, ((Component)__instance).transform.rotation.w);
				List<Vector3> list = new List<Vector3>();
				List<Quaternion> list2 = new List<Quaternion>();
				GameObject[] children = GameObjectEx.GetChildren(((Component)__instance).gameObject);
				foreach (GameObject val2 in children)
				{
					list.Add(val2.transform.position);
					list2.Add(val2.transform.rotation);
				}
				visitor.Visit("Centerpoint Position", ref val, (string)null);
				visitor.Visit("Centerpoint Rotation", ref rotation, (string)null);
				Vector3 val3 = val - ((Component)__instance).transform.localPosition;
				((Component)__instance).transform.localPosition = ((Component)__instance).transform.localPosition + val3;
				((Component)__instance).transform.rotation = rotation;
				int num = 0;
				GameObject[] children2 = GameObjectEx.GetChildren(((Component)__instance).gameObject);
				foreach (GameObject val4 in children2)
				{
					val4.transform.position = list.ToArray()[num];
					val4.transform.rotation = list2.ToArray()[num];
					num++;
				}
				__instance.localBounds_ = Group.CalculateBoundsFromImmediateChildren(__instance);
			}
		}
	}
	[HarmonyPatch(typeof(LevelEditorCarSpawner), "LevelEditorStartVirtual")]
	internal static class LevelEditorCarSpawner__LevelEditorStartVirtual
	{
		[HarmonyPrefix]
		internal static bool Prefix(LevelEditorCarSpawner __instance)
		{
			if (Mod.MultipleCarSpawners.Value)
			{
				LevelEditor levelEditor_ = G.Sys.LevelEditor_;
				foreach (LevelEditorCarSpawner item in levelEditor_.WorkingLevel_.FindComponentsOfType<LevelEditorCarSpawner>())
				{
					if (item == __instance)
					{
					}
				}
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(LevelEditorLevelNameSelectMenuLogic), "GenerateLevelNameList")]
	internal static class LevelEditorLevelNameSelectMenuLogic__GenerateLevelNameList
	{
		[HarmonyPostfix]
		internal static void Postfix(LevelEditorLevelNameSelectMenuLogic __instance)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			if (Mod.DisplayWorkshopLevels.Value && !G.Sys.GameManager_.IsDevBuild_)
			{
				LevelSetsManager levelSets_ = G.Sys.LevelSets_;
				__instance.CreateButtons(levelSets_.LevelsLevelFilePaths_.ToList(), YellowColors.gold, (DisplayOption)0);
				__instance.CreateButtons(levelSets_.WorkshopLevelFilePaths_.ToList(), GConstants.communityLevelColor_, (DisplayOption)2);
				((UIExButtonContainer)__instance.buttonList_).SortAndUpdateVisibleButtons();
			}
		}
	}
	[HarmonyPatch(typeof(LevelEditorMusicTrackSelectMenuLogic), "GenerateMusicNameList")]
	internal static class LevelEditorMusicTrackSelectMenuLogic__GenerateMusicNameList
	{
		[HarmonyPostfix]
		internal static void Postfix(LevelEditorMusicTrackSelectMenuLogic __instance)
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			if (!Mod.AdvancedMusicSelection.Value || G.Sys.GameManager_.IsDevBuild_)
			{
				return;
			}
			((UIExButtonContainer)__instance.buttonList_).Clear();
			List<MusicCue> musicCues_ = G.Sys.AudioManager_.MusicCues_;
			if (!Mod.AdvancedMusicSelection.Value)
			{
				musicCues_.RemoveAll((MusicCue x) => x.devEvent_);
			}
			__instance.CreateButtons(musicCues_, Color.white);
			((UIExButtonContainer)__instance.buttonList_).SortAndUpdateVisibleButtons();
		}
	}
	[HarmonyPatch(typeof(LevelEditor), "SelectObject")]
	internal static class LevelEditor__SelectObject
	{
		[HarmonyPrefix]
		internal static bool Prefix(LevelEditor __instance, ref bool __result, ref GameObject newObj)
		{
			if (newObj == null)
			{
				Mod.Log.LogWarning((object)"Trying to select a null object");
				__result = false;
				return false;
			}
			if (TransformExtensionOnly.IsRoot(newObj.transform) && false)
			{
				Mod.Log.LogWarning((object)"Trying to select a child object");
				__result = false;
				return false;
			}
			if (!__instance.selectedObjects_.Contains(newObj))
			{
				LevelLayer layerOfObject = __instance.workingLevel_.GetLayerOfObject(newObj);
				if (layerOfObject != null && !layerOfObject.Frozen_)
				{
					__instance.AddObjectToSelectedList(newObj);
					__result = true;
					return false;
				}
			}
			else
			{
				__instance.SetActiveObject(newObj);
			}
			__result = false;
			return false;
		}
	}
	[HarmonyPatch(typeof(LevelEditor), "UpdateOutlines")]
	internal static class LevelEditor__UpdateOutlines
	{
		[HarmonyPrefix]
		internal static bool Prefix(LevelEditor __instance)
		{
			int count = __instance.selectedObjects_.List_.Count;
			if (count != __instance.outlines_.Count)
			{
				Mod.Log.LogInfo((object)$"Object Count: {count} Outline Count: {__instance.outlines_.Count}");
				Mod.Log.LogInfo((object)"List of selected Objects: ");
				foreach (GameObject item in __instance.selectedObjects_.List_)
				{
					Mod.Log.LogInfo((object)((Object)item).name);
				}
				Debug.LogError((object)"Outlines Count is different than Selected Objects Count");
			}
			else
			{
				for (int i = 0; i < count; i++)
				{
					__instance.UpdateOutlineColor(i);
				}
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(LevelSettings), "GetDefaultModesMap")]
	internal static class LevelSettings__GetDefaultModesMap
	{
		[HarmonyPostfix]
		internal static void Postfix(ref Dictionary<int, bool> __result)
		{
			if (Mod.EnableAllModes.Value)
			{
				__result.Add(0, value: false);
				__result.Add(4, value: false);
				__result.Add(7, value: false);
				__result.Add(17, value: false);
			}
		}
	}
	[HarmonyPatch(typeof(LevelSettings), "MedalTimeSpanToString")]
	internal static class LevelSettings__MedalTimeSpanToString
	{
		[HarmonyPrefix]
		internal static bool Prefix(ref string __result, TimeSpan timeSpan)
		{
			if (Mod.UnlimitedMedalTimes.Value)
			{
				int num = timeSpan.Milliseconds / 10;
				__result = $"{timeSpan.Minutes + timeSpan.Hours * 60 + timeSpan.Days * 1440:00}:{timeSpan.Seconds:00}.{num:00}";
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(LevelSettings), "MedalTimeSpanTryParse")]
	internal static class LevelSettings__MedalTimeSpanTryParse
	{
		[HarmonyPrefix]
		internal static bool Prefix(ref bool __result, string timeSpanStr, out TimeSpan span)
		{
			if (string.IsNullOrEmpty(timeSpanStr))
			{
				span = TimeSpan.Zero;
				__result = false;
				return false;
			}
			if (timeSpanStr.StartsWith("-") || timeSpanStr.StartsWith("$") || timeSpanStr.StartsWith("I") || timeSpanStr.StartsWith("+"))
			{
				span = TimeSpan.Zero;
				__result = false;
				return false;
			}
			int num = timeSpanStr.IndexOf(':');
			int num2 = timeSpanStr.LastIndexOf(':');
			if (num == -1 || num != num2)
			{
				span = TimeSpan.Zero;
				__result = false;
				return false;
			}
			int num3 = timeSpanStr.IndexOf('.');
			int num4 = timeSpanStr.LastIndexOf('.');
			if (num3 == -1 || num3 != num4 || num3 < num || num == timeSpanStr.Length - 1)
			{
				span = TimeSpan.Zero;
				__result = false;
				return false;
			}
			if (!int.TryParse(timeSpanStr.Substring(0, num), out var result))
			{
				span = TimeSpan.Zero;
				__result = false;
				return false;
			}
			if (!int.TryParse(timeSpanStr.Substring(num + 1, num3 - num - 1), out var result2))
			{
				span = TimeSpan.Zero;
				__result = false;
				return false;
			}
			if (!int.TryParse(timeSpanStr.Substring(num3 + 1, Mathf.Min(timeSpanStr.Length - num3 - 1, 2)), out var result3))
			{
				span = TimeSpan.Zero;
				__result = false;
				return false;
			}
			int minutes = result;
			result2 = Mathf.Min(Mathf.Max(result2, 0), 59);
			result3 = Mathf.Min(Mathf.Max(result3, 0), 99) * 10;
			span = new TimeSpan(0, 0, minutes, result2, result3);
			__result = true;
			return false;
		}
	}
	[HarmonyPatch(typeof(LevelSettings), "NGUIVisitMedalTime")]
	internal static class LevelSettings__NGUIVisitMedalTime
	{
		[HarmonyPrefix]
		internal static bool Prefix(ref LevelSettings __instance, IVisitor visitor, string timeName, ref float time)
		{
			if (Mod.UnlimitedMedalTimes.Value)
			{
				string text = "";
				text = (float.IsNegativeInfinity(time) ? "-I" : (float.IsPositiveInfinity(time) ? "+I" : (float.IsNaN(time) ? "NaN" : ((!(time < 0f)) ? __instance.MedalTimeSpanToString(TimeSpan.FromMilliseconds(Mathf.Max(time, 0f))) : ("-" + __instance.MedalTimeSpanToString(TimeSpan.FromMilliseconds(Mathf.Abs(time))))))));
				string text2 = text;
				visitor.Visit(timeName, ref text2, LevelSettings.medalTimeOptions_);
				TimeSpan timeSpan = default(TimeSpan);
				if (text2 != text && __instance.MedalTimeSpanTryParse(text2, ref timeSpan))
				{
					time = ((timeSpan.TotalMilliseconds <= 0.0) ? 0f : ((float)timeSpan.TotalMilliseconds));
				}
				else if (text2 != text && text2.StartsWith("-") && __instance.MedalTimeSpanTryParse(text2.Substring(1, text2.Length - 1), ref timeSpan))
				{
					time = 0f - (float)timeSpan.TotalMilliseconds;
				}
				else if (text2 != text && text2.StartsWith("$") && text2.EndsWith("$") && text2.Length > 1)
				{
					try
					{
						time = float.Parse(text2.Substring(1, text2.Length - 2));
					}
					catch
					{
						time = float.NaN;
					}
				}
				else if (text2 != text && (text2.StartsWith("I") || text2.StartsWith("+I")))
				{
					time = float.PositiveInfinity;
				}
				else if (text2 != text && text2.StartsWith("-I"))
				{
					time = float.NegativeInfinity;
				}
				else if (text2 != text && text2.StartsWith("N"))
				{
					time = float.NaN;
				}
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(LevelSettings), "Visit")]
	internal static class LevelSettings__Visit
	{
		[HarmonyPrefix]
		internal static void Prefix(LevelSettings __instance, IVisitor visitor, ISerializable prefabComp, int version)
		{
			if (!Mod.RemoveCreatorField.Value)
			{
				Mod.DevBuildForCreatorName = true;
			}
		}
	}
	[HarmonyPatch(typeof(LibraryTab), "Start")]
	internal static class LibraryTab__Start
	{
		[HarmonyPrefix]
		internal static bool Prefix(LibraryTab __instance)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			((UIProgressBar)__instance.iconSizeSlider_).onChange.Add(new EventDelegate((Callback)delegate
			{
				Mod.EditorIconSize.Value = __instance.IconSize_;
			}));
			__instance.iconSize_ = Mod.EditorIconSize.Value;
			__instance.rootFileData_ = G.Sys.ResourceManager_.LevelPrefabFileInfosRoot_;
			if (!Mod.DevFolderEnabled.Value && !G.Sys.GameManager_.IsDevBuild_)
			{
				__instance.rootFileData_.RemoveAllChildInfos((Predicate<LevelPrefabFileInfo>)((LevelPrefabFileInfo x) => x.IsDirectory_ && x.Name_ == "Dev"));
			}
			__instance.currentDirectory_ = __instance.rootFileData_;
			((UIProgressBar)__instance.iconSizeSlider_).value = Mathf.InverseLerp(32f, 256f, __instance.iconSize_);
			__instance.searchInput_ = ((Component)__instance).GetComponentInChildren<UIExInput>();
			((MonoBehaviour)__instance).StartCoroutine(__instance.CreateIconsAfterAFrame());
			return false;
		}
	}
	[HarmonyPatch(typeof(LoadLevelTool), "Update")]
	internal static class LoadLevelTool__Update
	{
		[HarmonyPrefix]
		internal static void Prefix()
		{
			EditorUtil.ClearQuickMemory();
		}
	}
	[HarmonyPatch(typeof(NewLevelTool), "CreateNewLevel")]
	internal static class NewLevelTool__CreateNewLevel
	{
		[HarmonyPrefix]
		internal static void Prefix()
		{
			EditorUtil.ClearQuickMemory();
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	internal static class MaterialWrapper__ComponentName_
	{
		[HarmonyPostfix]
		internal static void Postfix(ref string __result, MaterialWrapper __instance)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			if (Mod.EnableSubTextures.Value)
			{
				__result = "Material: " + NGUIEx.Colorize(__instance.matInfo_.matName_ + __instance.materialIndex_, GreenColors.seaGreen);
			}
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	internal static class MaterialWrapper__MaterialName_
	{
		[HarmonyPostfix]
		internal static void Postfix(ref string __result, MaterialWrapper __instance)
		{
			if (Mod.EnableSubTextures.Value)
			{
				__result = __instance.matInfo_.matName_ + __instance.materialIndex_ + ((Object)__instance.renderer_).GetInstanceID();
			}
		}
	}
	[HarmonyPatch(typeof(MoveCursorTool), "Run")]
	internal static class MoveCursorTool__Run
	{
		[HarmonyPrefix]
		internal static bool Prefix(ref bool __result)
		{
			//IL_00db: 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_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: 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_00f2: 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_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: 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_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: 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)
			LevelEditor levelEditor_ = G.Sys.LevelEditor_;
			Transform transform = levelEditor_.Cursor_.transform;
			int num = (int)LayerEx.CreateExcludeMask((Layers[])(object)new Layers[4]
			{
				(Layers)2,
				(Layers)11,
				(Layers)20,
				(Layers)8
			});
			if (Mod.CursorIgnoresBackground.Value)
			{
				num = (int)LayerEx.CreateExcludeMask((Layers[])(object)new Layers[6]
				{
					(Layers)2,
					(Layers)11,
					(Layers)20,
					(Layers)8,
					(Layers)29,
					(Layers)30
				});
			}
			RaycastHit val = default(RaycastHit);
			if (levelEditor_.RaycastMousePosition(ref val, num))
			{
				transform.localRotation = MoveCursorTool.GetRayCastHitOrientation(val);
				transform.localPosition = ((RaycastHit)(ref val)).point + ((RaycastHit)(ref val)).normal * 0.01f;
			}
			else
			{
				Camera camera_ = G.Sys.LevelEditor_.Camera_;
				Transform transform2 = ((Component)camera_).transform;
				float nearClipPlane = camera_.nearClipPlane;
				Vector3 val2 = transform2.InverseTransformPoint(transform.localPosition);
				Vector3 mousePosition = Input.mousePosition;
				mousePosition.z = nearClipPlane + val2.z;
				transform.localPosition = camera_.ScreenToWorldPoint(mousePosition);
				transform.up = Vector3.up;
			}
			Vector3 localPosition = transform.localPosition;
			LevelEditorTool.PrintMessage("Moved the cursor to: " + ((object)(Vector3)(ref localPosition)).ToString());
			__result = false;
			return false;
		}
	}
	[HarmonyPatch(typeof(NGUIFloatInspector), "AddOptions")]
	internal static class NGUIFloatInspector__AddOptions
	{
		[HarmonyPostfix]
		internal static void Postfix(NGUIFloatInspector __instance)
		{
			if (Mod.RemoveNumberLimits.Value)
			{
				((NGUIGenericNumericInpectorOf<float>)(object)__instance).SetMin(float.MinValue);
				((NGUIGenericNumericInpectorOf<float>)(object)__instance).SetMax(float.MaxValue);
			}
		}
	}
	[HarmonyPatch(typeof(NGUIIntInspector), "AddOptions")]
	internal static class NGUIIntInspector__AddOptions
	{
		[HarmonyPostfix]
		internal static void Postfix(NGUIIntInspector __instance)
		{
			if (Mod.RemoveNumberLimits.Value)
			{
				((NGUIGenericNumericInpectorOf<int>)(object)__instance).SetMin(int.MinValue);
				((NGUIGenericNumericInpectorOf<int>)(object)__instance).SetMax(int.MaxValue);
			}
		}
	}
	[HarmonyPatch(typeof(NGUIObjectInspectorTabAbstract), "CreateComponentInspectorsOnObject")]
	internal static class NGUIObjectInspectorTabAbstract__CreateComponentInspectorsOnObject
	{
		[HarmonyPrefix]
		internal static bool Prefix(NGUIObjectInspectorTabAbstract __instance, ref Set ignoreList, ref bool objectSupportsUndo, ref GameObject obj)
		{
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Invalid comparison between Unknown and I4
			//IL_00bd: 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_014f: Invalid comparison between Unknown and I4
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Invalid comparison between Unknown and I4
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Expected O, but got Unknown
			bool flag = ((object)obj).Equals((object?)__instance.targetObject_);
			bool flag2 = TransformExtensionOnly.IsRoot(obj.transform) || flag;
			if (flag2 && (!ignoreList.ShouldBeIgnored((Component)(object)obj.transform) || flag))
			{
				__instance.CreateISerializableInspector((ISerializable)(object)ComponentSerializeWrapper.Create((Component)(object)obj.transform, true), objectSupportsUndo);
			}
			Group component = obj.GetComponent<Group>();
			bool flag3 = (Object)(object)component == (Object)null;
			bool flag4 = flag2 && ((Object)(object)component == (Object)null || (int)component.inspectChildren_ > 0);
			if (Object.op_Implicit((Object)(object)component))
			{
				__instance.CreateISerializableInspector((ISerializable)(object)component, objectSupportsUndo);
			}
			if (Object.op_Implicit((Object)(object)component) && GameObjectEx.GetChildren(((Component)component).gameObject).Length == 0)
			{
				component.inspectChildren_ = (InspectChildrenType)0;
			}
			if (flag4)
			{
				__instance.CreateMaterialWrappers(ArrayEx.EncapsulateInArray<GameObject>(obj), ignoreList, objectSupportsUndo);
			}
			List<ISerializable> list = new List<ISerializable>();
			__instance.GetSerializables((ICollection<ISerializable>)list, ignoreList, obj, flag3);
			foreach (ISerializable item in list)
			{
				__instance.CreateISerializableInspector(item, objectSupportsUndo);
			}
			if (!Object.op_Implicit((Object)(object)component))
			{
				return false;
			}
			if ((int)component.inspectChildren_ == 2)
			{
				foreach (Transform item2 in obj.transform)
				{
					Transform val = item2;
					if (((Component)val).gameObject.activeSelf)
					{
						__instance.CreateComponentInspectorsOnObject(ignoreList, objectSupportsUndo, ((Component)val).gameObject);
					}
				}
			}
			else
			{
				if ((int)component.inspectChildren_ != 1)
				{
					return false;
				}
				__instance.CreateComponentInspectorsForObjects(ignoreList, objectSupportsUndo, GameObjectEx.GetChildren(obj));
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(NGUIObjectInspectorTabAbstract), "CreateISerializableInspector", new Type[]
	{
		typeof(ISerializable),
		typeof(bool)
	})]
	internal static class NGUIObjectInspectorTabAbstract__CreateISerializableInspector
	{
		[HarmonyPrefix]
		internal static bool Prefix(ISerializable serializable)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			Group val = (Group)(object)((serializable is Group) ? serializable : null);
			if (val != null && GameObjectEx.GetChildren(((Component)val).gameObject).Length == 0)
			{
				val.inspectChildren_ = (InspectChildrenType)0;
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(NGUIVector3Inspector), "AddOptions")]
	internal static class NGUIVector3Inspector__AddOptions
	{
		[HarmonyPostfix]
		internal static void Postfix(NGUIVector3Inspector __instance)
		{
			if (!Mod.RemoveNumberLimits.Value)
			{
				return;
			}
			List<UIExNumericInput> list = new List<UIExNumericInput> { __instance.inputX_, __instance.inputY_, __instance.inputZ_ };
			foreach (UIExNumericInput item in list)
			{
				((UIExGenericNumericInput<float>)(object)item).Min_ = float.MinValue;
				((UIExGenericNumericInput<float>)(object)item).Max_ = float.MaxValue;
			}
		}
	}
	[HarmonyPatch(typeof(QuitToMainMenuTool), "Finish")]
	internal static class QuitToMainMenuTool__Finish
	{
		[HarmonyPrefix]
		internal static void Prefix()
		{
			EditorUtil.ClearQuickMemory();
		}
	}
	[HarmonyPatch(typeof(RemoveComponentTool<AddedComponent>), "Run")]
	internal static class RemoveComponentTool__Run
	{
		[HarmonyPrefix]
		internal static bool Prefix(ref bool __result)
		{
			if (!EditorUtil.IsSelectionRoot())
			{
				EditorUtil.PrintToolInspectionStackError();
				__result = false;
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	internal static class ResourceManager__LevelPrefabFileInfosRoot_
	{
		[HarmonyPostfix]
		internal static void Postfix(ref LevelPrefabFileInfo __result)
		{
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Expected O, but got Unknown
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Expected O, but got Unknown
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Expected O, but got Unknown
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Expected O, but got Unknown
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Expected O, but got Unknown
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Expected O, but got Unknown
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Expected O, but got Unknown
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Expected O, but got Unknown
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Expected O, but got Unknown
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Expected O, but got Unknown
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Expected O, but got Unknown
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Expected O, but got Unknown
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Expected O, but got Unknown
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Expected O, but got Unknown
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Expected O, but got Unknown
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Expected O, but got Unknown
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Expected O, but got Unknown
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Expected O, but got Unknown
			//IL_055a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0561: Expected O, but got Unknown
			//IL_053b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0542: Expected O, but got Unknown
			bool flag = false;
			foreach (LevelPrefabFileInfo item in __result.childInfos_)
			{
				if ((PrimitiveEx.IsNullOrWhiteSpace(item.name_) ? "null" : item.name_).Equals("Hidden"))
				{
					flag = true;
					if (!Mod.HiddenFolderEnabled.Value)
					{
						Predicate<LevelPrefabFileInfo> predicate = Mod.CheckWhichIsHiddenFolder;
						__result.RemoveAllChildInfos(predicate);
						return;
					}
				}
			}
			if ((flag && Mod.HiddenFolderEnabled.Value) || !Mod.HiddenFolderEnabled.Value)
			{
				return;
			}
			ResourceManager resourceManager_ = G.Sys.ResourceManager_;
			Dictionary<string, List<string>> resourceMap_ = resourceManager_.resourceMap_;
			LevelPrefabFileInfo val = new LevelPrefabFileInfo("Hidden", __result);
			LevelPrefabFileInfo val2 = new LevelPrefabFileInfo("Audio", val);
			LevelPrefabFileInfo val3 = new LevelPrefabFileInfo("Car", val);
			LevelPrefabFileInfo val4 = new LevelPrefabFileInfo("Archive", val3);
			LevelPrefabFileInfo val5 = new LevelPrefabFileInfo("Catalyst", val3);
			LevelPrefabFileInfo val6 = new LevelPrefabFileInfo("Hats", val3);
			LevelPrefabFileInfo val7 = new LevelPrefabFileInfo("Refractor", val3);
			val3.AddChildInfo(val4);
			val3.AddChildInfo(val5);
			val3.AddChildInfo(val6);
			val3.AddChildInfo(val7);
			LevelPrefabFileInfo val8 = new LevelPrefabFileInfo("Detonator", val);
			LevelPrefabFileInfo val9 = new LevelPrefabFileInfo("DirtyLens", val);
			LevelPrefabFileInfo val10 = new LevelPrefabFileInfo("GameAnalytics", val);
			LevelPrefabFileInfo val11 = new LevelPrefabFileInfo("GameModes", val);
			LevelPrefabFileInfo val12 = new LevelPrefabFileInfo("HoverScreen", val);
			LevelPrefabFileInfo val13 = new LevelPrefabFileInfo("LegacyGUI", val);
			LevelPrefabFileInfo val14 = new LevelPrefabFileInfo("LevelEditorPrivate", val);
			LevelPrefabFileInfo val15 = new LevelPrefabFileInfo("Managers", val);
			LevelPrefabFileInfo val16 = new LevelPrefabFileInfo("Replays", val);
			LevelPrefabFileInfo val17 = new LevelPrefabFileInfo("Settings", val);
			LevelPrefabFileInfo val18 = new LevelPrefabFileInfo("Trackmogrify", val);
			val.AddChildInfo(val2);
			val.AddChildInfo(val3);
			val.AddChildInfo(val8);
			val.AddChildInfo(val9);
			val.AddChildInfo(val10);
			val.AddChildInfo(val11);
			val.AddChildInfo(val12);
			val.AddChildInfo(val13);
			val.AddChildInfo(val14);
			val.AddChildInfo(val15);
			val.AddChildInfo(val16);
			val.AddChildInfo(val17);
			val.AddChildInfo(val18);
			foreach (KeyValuePair<string, List<string>> item2 in resourceMap_)
			{
				foreach (string item3 in item2.Value)
				{
					if (!item3.Contains("Prefabs") || item3.Contains("LevelBackups") || item3.Contains("/Custom/") || item3.Contains("/LevelEditor/") || item3.Contains("LevelEditorMenus") || item3.Contains("Menus") || item3.Contains("Managers") || item3.Contains("wheel") || item3.Contains("ExampleListView"))
					{
						continue;
					}
					LevelPrefabFileInfo val19 = null;
					if (item3.Contains("/Audio/"))
					{
						val19 = val2;
					}
					else if (item3.Contains("/Car/"))
					{
						val19 = (item3.Contains("/Archive/") ? val4 : (item3.Contains("/Catalyst/") ? val5 : (item3.Contains("/Hats/") ? val6 : ((!item3.Contains("/Refractor/")) ? val3 : val7))));
					}
					else if (item3.Contains("/Detonator/"))
					{
						val19 = val8;
					}
					else if (item3.Contains("/DirtyLens/"))
					{
						val19 = val9;
					}
					else if (item3.Contains("/GameAnalytics/"))
					{
						val19 = val10;
					}
					else if (item3.Contains("/GameModes/"))
					{
						val19 = val11;
					}
					else if (item3.Contains("/HoverScreen/"))
					{
						val19 = val12;
					}
					else if (item3.Contains("/LegacyGUI/"))
					{
						val19 = val13;
					}
					else if (item3.Contains("/LevelEditorPrivate/"))
					{
						val19 = val14;
					}
					else if (item3.Contains("/Managers/"))
					{
						val19 = val15;
					}
					else if (item3.Contains("/Replays/"))
					{
						val19 = val16;
					}
					else if (item3.Contains("/Settings/"))
					{
						val19 = val17;
					}
					else if (item3.Contains("/Trackmogrify/"))
					{
						val19 = val18;
					}
					Object val20 = Resources.Load(item3, typeof(Object));
					if (val20 != (Object)null)
					{
						GameObject val21 = (((Object)(object)resourceManager_ != (Object)null) ? resourceManager_.GetResource<GameObject>(item2.Key, true) : Resources.Load<GameObject>(item2.Key));
						if (val19 == null)
						{
							LevelPrefabFileInfo val22 = new LevelPrefabFileInfo(item2.Key, val21, val);
							val.AddChildInfo(val22);
						}
						else
						{
							LevelPrefabFileInfo val22 = new LevelPrefabFileInfo(item2.Key, val21, val19);
							val19.AddChildInfo(val22);
						}
					}
				}
			}
			__result.AddChildInfo(val);
		}
	}
	[HarmonyPatch(typeof(ResourceManager), "SetupPrefabFileDatas")]
	internal static class ResourceManger__SetupPrefabFileDatas
	{
		[HarmonyPrefix]
		public static bool Prefix(ResourceManager __instance)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected O, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			__instance.levelPrefabFileInfosRoot_ = new LevelPrefabFileInfo("Default", (LevelPrefabFileInfo)null);
			DirectoryInfo directoryInfo = new DirectoryInfo(Resource.PersonalCustomObjectsDirPath_);
			if (directoryInfo.Exists)
			{
				__instance.customObjectFileInfosRoot_ = new LevelPrefabFileInfo("Custom", __instance.levelPrefabFileInfosRoot_);
				__instance.levelPrefabFileInfosRoot_.AddChildInfo(__instance.customObjectFileInfosRoot_);
				AddSubfoldersRecursive(directoryInfo, __instance.customObjectFileInfosRoot_);
			}
			string text = Application.dataPath + "/Resources/LevelEditorPrefabDirectoryInfo.xml";
			XmlDeserializer val = new XmlDeserializer(text);
			while (val.Read("LevelEditorPrefabDirectoryInformation"))
			{
				__instance.ReadFileDataRecursive(val, __instance.levelPrefabFileInfosRoot_);
			}
			if (val != null)
			{
				((Deserializer)val).Finish();
			}
			return false;
		}

		public static void AddSubfoldersRecursive(DirectoryInfo directory, LevelPrefabFileInfo parent)
		{
			DirectoryInfo[] directories = directory.GetDirectories();
			foreach (DirectoryInfo directoryInfo in directories)
			{
				AddSubfoldersRecursive(directoryInfo, CreateSubdirectory(parent, directoryInfo.Name));
			}
			FileInfo[] files = directory.GetFiles("*.bytes");
			foreach (FileInfo file in files)
			{
				AddOrUpdatePrefabInfo(parent, file);
			}
		}

		public static LevelPrefabFileInfo CreateSubdirectory(LevelPrefabFileInfo parent, string name)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Expected O, but got Unknown
			LevelPrefabFileInfo val = new LevelPrefabFileInfo(name, parent);
			parent.AddChildInfo(val);
			return val;
		}

		public static LevelPrefabFileInfo AddOrUpdatePrefabInfo(LevelPrefabFileInfo parent, FileInfo file)
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			string text = Resource.NormalizePath(file.FullName);
			string name = Path.GetFileNameWithoutExtension(text);
			LevelPrefabFileInfo val = parent.GetChildFileInfo((Predicate<LevelPrefabFileInfo>)((LevelPrefabFileInfo value) => value.Name_ == name));
			if (val == null)
			{
				val = new LevelPrefabFileInfo(name, text, parent);
				parent.AddChildInfo(val);
			}
			else
			{
				val.CustomPrefabPath_ = text;
			}
			return val;
		}
	}
	[HarmonyPatch(typeof(SaveTool), "SortMedalRequirements")]
	internal static class SaveTool__SortMedalRequirements
	{
		[HarmonyPrefix]
		internal static bool Prefix()
		{
			if (Mod.UnlimitedMedalTimes.Value)
			{
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	internal static class SelectionGroupData__ctor_
	{
		[HarmonyPostfix]
		internal static void Postfix(ref Vector3 ___position_, ref Quaternion ___rotation_, IEnumerable<GameObject> selectedObjects, GameObject activeObject)
		{
			//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)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_0058: 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_0084: 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_0090: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			___position_ = Vector3.zero;
			___rotation_ = (Object.op_Implicit((Object)(object)activeObject) ? activeObject.transform.rotation : Quaternion.identity);
			int num = 0;
			foreach (GameObject selectedObject in selectedObjects)
			{
				if (Object.op_Implicit((Object)(object)selectedObject))
				{
					___position_ += selectedObject.transform.position;
				}
				num++;
			}
			___position_ /= (float)num;
			if (!GUtils.IsValid(___position_))
			{
				___position_ = Vector3.zero;
			}
		}
	}
	[HarmonyPatch(typeof(SelectMusicTrackNameFromListTool), "AddEntries")]
	internal static class SelectMusicTrackNameFromListTool__AddEntries
	{
		[HarmonyPrefix]
		internal static bool Prefix(ref Dictionary<string, string> entryList)
		{
			if (Mod.AdvancedMusicSelection.Value)
			{
				foreach (MusicCue item in G.Sys.AudioManager_.MusicCues_)
				{
					entryList.Add(item.displayName_, item.displayName_);
				}
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(StuntBubbleLogic), "Awake")]
	internal static class StuntBubbleLogic__Awake
	{
		[HarmonyPrefix]
		internal static bool Prefix(StuntBubbleLogic __instance)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			__instance.col_ = ((Component)__instance).GetComponent<SphereCollider>();
			__instance.color_ = ((Renderer)__instance.bubbleRend_).material.GetColor("_Color");
			__instance.alpha_ = __instance.color_.a;
			__instance.emitColor_ = ((Renderer)__instance.bubbleRend_).material.GetColor("_EmitColor");
			__instance.emitAlpha_ = __instance.emitColor_.a;
			__instance.outlineColor_ = ((Renderer)__instance.bubbleOutlineRend_).material.GetColor("_Color");
			__instance.scale_ = ((Component)__instance).transform.localScale;
			__instance.SetAlpha(0f);
			return false;
		}
	}
	[HarmonyPatch(typeof(StuntCollectibleLogic), "Awake")]
	internal static class StuntCollectibleLogic__Awake
	{
		[HarmonyPrefix]
		internal static bool Prefix(StuntCollectibleLogic __instance)
		{
			StaticEvent<Data>.Subscribe((Delegate<Data>)__instance.OnEventStuntCollectibleSpawned);
			StaticEvent<Data>.Subscribe((Delegate<Data>)__instance.OnHitTagStuntCollectible);
			__instance.col_ = ((Component)__instance).GetComponent<SphereCollider>();
			((Collider)__instance.col_).enabled = false;
			__instance.phantom_ = ((Component)__instance).GetComponent<Phantom>();
			return false;
		}
	}
	[HarmonyPatch(typeof(ToolInputCombos), "Load")]
	internal static class ToolInputCombos__Load
	{
		[HarmonyPostfix]
		internal static void Postfix(ref ToolInputCombos __result, ref string fileName)
		{
			if (__result == null)
			{
				return;
			}
			string text = fileName;
			string text2 = text;
			if (!(text2 == "BlenderToolInputCombos"))
			{
				if (text2 == "UnityToolInputCombos")
				{
					AddCustomHotkeys(ref __result, 'B');
				}
			}
			else
			{
				AddCustomHotkeys(ref __result, 'A');
			}
		}

		internal static void AddCustomHotkeys(ref ToolInputCombos __result, char scheme)
		{
			Assembly assemblyCS = typeof(G).Assembly;
			foreach (Type item in TypeExportManager.GetTypesOfType(typeof(LevelEditorTool)).Where(filterType))
			{
				ToolInfo toolInfo = GetToolInfo(item);
				if (toolInfo != null)
				{
					KeyboardShortcutAttribute customAttribute = item.GetCustomAttribute<KeyboardShortcutAttribute>(inherit: false);
					if (customAttribute != null)
					{
						__result.Add(((object)customAttribute.Get(scheme)).ToString(), toolInfo.Name_);
					}
				}
			}
			bool filterType(Type type)
			{
				return (object)assemblyCS != type.Assembly && type.GetCustomAttribute<EditorToolAttribute>(inherit: false) != null;
			}
		}

		internal static ToolInfo GetToolInfo(Type toolType)
		{
			if ((object)toolType == null)
			{
				return null;
			}
			FieldInfo field = toolType.GetField("info_", BindingFlags.Static | BindingFlags.NonPublic);
			if ((object)field != null)
			{
				object? value = field.GetValue(null);
				return (ToolInfo)((value is ToolInfo) ? value : null);
			}
			object? obj = Activator.CreateInstance(toolType);
			LevelEditorTool val = (LevelEditorTool)((obj is LevelEditorTool) ? obj : null);
			return (val != null) ? val.Info_ : null;
		}
	}
	[HarmonyPatch(typeof(TransformWrapper), "Visit")]
	internal static class TransformWrapper__Visit
	{
		[HarmonyPrefix]
		internal static void Prefix(TransformWrapper __instance, IVisitor visitor)
		{
			if (visitor is Serializer || visitor is Deserializer)
			{
				return;
			}
			Transform ObjectTransform = ((GenericComponentSerializeWrapper<Transform>)(object)__instance).tComponent_;
			if (TransformExtensionOnly.IsRoot(ObjectTransform))
			{
				return;
			}
			IVisitorEx.VisitAction(visitor, "Inspect Parent", (Action)delegate
			{
				LevelEditor levelEditor_ = G.Sys.LevelEditor_;
				List<GameObject> selectedObjects_ = levelEditor_.SelectedObjects_;
				if (selectedObjects_.Count == 1)
				{
					EditorUtil.Inspect(((Component)ObjectTransform.parent).gameObject);
				}
				else
				{
					MessageBox.Create("You must select only 1 object to use this tool.", "ERROR").SetButtons((ButtonType)0).Show();
				}
			}, (string)null);
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	internal static class UIExGenericNumericInput__Max__set
	{
		[HarmonyPrefix]
		internal static void Prefix(UIExGenericNumericInput<float> __instance)
		{
			if (Mod.RemoveNumberLimits.Value)
			{
				UIExNumericInput val = (UIExNumericInput)(object)((__instance is UIExNumericInput) ? __instance : null);
				if (val != null)
				{
					((UIExGenericNumericInput<float>)(object)val).max_ = float.MaxValue;
				}
			}
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	internal static class UIExGenericNumericInput__Min__set
	{
		[HarmonyPrefix]
		internal static void Prefix(UIExGenericNumericInput<float> __instance)
		{
			if (Mod.RemoveNumberLimits.Value)
			{
				UIExNumericInput val = (UIExNumericInput)(object)((__instance is UIExNumericInput) ? __instance : null);
				if (val != null)
				{
					((UIExGenericNumericInput<float>)(object)val).min_ = float.MinValue;
				}
			}
		}
	}
	[HarmonyPatch(typeof(UIExNumericInput), "ConvertValueToString")]
	internal static class UIExNumericInput__ConvertValueToString
	{
		[HarmonyPostfix]
		internal static void Postfix(ref string __result, float val)
		{
			string text = "0.0";
			for (int i = 0; i < Mod.EditorDecimalPrecision.Value; i++)
			{
				text += "#";
			}
			__result = val.ToString(text);
		}
	}
	[HarmonyPatch(typeof(UIExNumericInput), "ValidateValue")]
	internal static class UIExNumericInput__ValidateValue
	{
		[HarmonyPrefix]
		internal static bool Prefix(ref float __result, float val)
		{
			if (Mod.RemoveNumberLimits.Value)
			{
				if (float.IsNaN(val))
				{
					__result = 0f;
				}
				else
				{
					__result = val;
				}
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(UngroupTool), "Run")]
	internal static class UngroupTool__Run
	{
		[HarmonyPrefix]
		internal static bool Prefix(ref bool __result)
		{
			if (!EditorUtil.IsSelectionRoot())
			{
				EditorUtil.PrintToolInspectionStackError();
				__result = false;
				return false;
			}
			return true;
		}
	}
}
namespace EditorExpanded.Editor.Tools
{
	internal class CubeToPlaneAction : SimplerAction
	{
		private Handle<GameObject> originalObjectHandle_;

		private Handle<GameObject>[] newObjectHandles_;

		private byte[] deletedObjectBytes_;

		private GroupAction groupAction_;

		private List<GroupAction> groupActions_2 = new List<GroupAction>();

		private List<Handle<GameObject>> newgrouphandles = new List<Handle<GameObject>>();

		private bool nothingtodo = false;

		public override string Description_ => "Turns cubes into planes.";

		public CubeToPlaneAction(GameObject[] gameObjects)
		{
			//IL_0095: 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)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: 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)
			//IL_00c6: Expected O, but got Unknown
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			ReferenceMap referenceMap_ = G.Sys.LevelEditor_.ReferenceMap_;
			List<GameObject> list = new List<GameObject>();
			int num = 0;
			foreach (GameObject val in gameObjects)
			{
				if (((Object)val).name.Equals("CubeGS"))
				{
					num += 6;
					list.Add(val);
				}
			}
			if (list.Count > 0)
			{
				InitData val2 = default(InitData);
				((InitData)(ref val2))..ctor(Vector3.zero, Quaternion.identity, Vector3.one, default(Bounds));
				groupAction_ = new GroupAction(list.ToArray(), val2);
				Group val3 = groupAction_.GroupObjects();
				originalObjectHandle_ = referenceMap_.GetHandle<GameObject>(((Component)val3).gameObject);
				deletedObjectBytes_ = BinarySerializer.SaveGameObjectToBytes(((Component)val3).gameObject, Resource.LoadPrefab("Group", true), true);
				((SimplerAction)groupAction_).Undo();
			}
			else
			{
				nothingtodo = true;
			}
			newObjectHandles_ = new Handle<GameObject>[num];
		}

		public override void Undo()
		{
			UnturnCubeFromPlanes();
		}

		public override void Redo()
		{
			TurnCubeIntoPlanes();
		}

		public void TurnCubeIntoPlanes()
		{
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: 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_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: 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_0134: 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_0159: 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_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: 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_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: 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_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: 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_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: 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)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_0360: Unknown result type (might be due to invalid IL or missing references)
			//IL_0367: Unknown result type (might be due to invalid IL or missing references)
			//IL_038d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_041a: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_04de: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_050a: Unknown result type (might be due to invalid IL or missing references)
			//IL_050f: Unknown result type (might be due to invalid IL or missing references)
			//IL_051b: Unknown result type (might be due to invalid IL or missing references)
			//IL_051d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0524: Expected O, but got Unknown
			//IL_0539: Unknown result type (might be due to invalid IL or missing references)
			//IL_056f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0574: Unknown result type (might be due to invalid IL or missing references)
			//IL_0585: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ca: Unknown result type (might be due to invalid IL or missing references)
			if (nothingtodo)
			{
				return;
			}
			int num = 0;
			List<GameObject> list = new List<GameObject>();
			groupAction_.GroupObjects();
			GameObject[] array = groupAction_.UngroupObjects();
			LevelEditor levelEditor_ = G.Sys.LevelEditor_;
			ResourceManager resourceManager_ = G.Sys.ResourceManager_;
			groupAction_.GroupObjects();
			levelEditor_.DeleteGameObject(originalObjectHandle_.Get());
			List<LevelLayer> list2 = new List<LevelLayer>();
			GameObject[] array2 = array;
			InitData val3 = default(InitData);
			foreach (GameObject val in array2)
			{
				LevelLayer layerOfObject = levelEditor_.WorkingLevel_.GetLayerOfObject(val);
				GoldenSimples component = val.GetComponent<GoldenSimples>();
				List<GameObject> list3 = new List<GameObject>();
				Vector3 localPosition = val.transform.localPosition;
				Quaternion localRotation = val.transform.localRotation;
				Vector3 localScale = val.transform.localScale;
				GameObject val2 = DuplicateObjectsAction.Duplicate(val);
				val2.GetComponent<Transform>().rotation = new Quaternion(0f, 0f, 0f, 1f);
				GameObject gameObject = Resource.LoadPrefabInstance("PlaneGS", true);
				gameObject.GetComponent<Transform>().localPosition = new Vector3(localPosition.x, localPosition.y + 32f * localScale.y, localPosition.z);
				gameObject.GetComponent<Transform>().localScale = new Vector3(localScale.x, 1f, localScale.z);
				GameObject gameObject2 = Resource.LoadPrefabInstance("PlaneGS", true);
				gameObject2.GetComponent<Transform>().localPosition = new Vector3(localPosition.x, localPosition.y, localPosition.z - 32f * localScale.z);
				gameObject2.GetComponent<Transform>().localScale = new Vector3(localScale.x, 1f, localScale.y);
				gameObject2.GetComponent<Transform>().localRotation = new Quaternion(0f, 0.7f, -0.7f, 0f);
				GameObject gameObject3 = Resource.LoadPrefabInstance("PlaneGS", true);
				gameObject3.GetComponent<Transform>().localPosition = new Vector3(localPosition.x, localPosition.y, localPosition.z + 32f * localScale.z);
				gameObject3.GetComponent<Transform>().localScale = new Vector3(localScale.x, 1f, localScale.y);
				gameObject3.GetComponent<Transform>().localRotation = new Quaternion(-0.7f, 0f, 0f, -0.7f);
				GameObject gameObject4 = Resource.LoadPrefabInstance("PlaneGS", true);
				gameObject4.GetComponent<Transform>().localPosition = new Vector3(localPosition.x + 32f * localScale.x, localPosition.y, localPosition.z);
				gameObject4.GetComponent<Transform>().localScale = new Vector3(localScale.z, 1f, localScale.y);