Decompiled source of AngryLevelLoader v4.0.1

plugins/AngryLevelLoader/AngryLevelLoader.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using AngryLevelLoader;
using AngryLevelLoader.Containers;
using AngryLevelLoader.DataTypes;
using AngryLevelLoader.DataTypes.MapVarHandlers;
using AngryLevelLoader.Extensions;
using AngryLevelLoader.Fields;
using AngryLevelLoader.Managers;
using AngryLevelLoader.Managers.BannedMods;
using AngryLevelLoader.Managers.LegacyPatches;
using AngryLevelLoader.Managers.ServerManager;
using AngryLevelLoader.Notifications;
using AngryLevelLoader.Patches;
using AngryLevelLoader.UserInterface;
using AngryLevelLoader.Utils;
using AngryUiComponents;
using BananaDifficulty;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using BillionDifficulty;
using Configgy;
using FasterPunch;
using HarmonyLib;
using Logic;
using LucasMeshCombine;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using PluginConfig;
using PluginConfig.API;
using PluginConfig.API.Decorators;
using PluginConfig.API.Fields;
using PluginConfig.API.Functionals;
using ProjectProphet;
using RudeLevelScript;
using RudeLevelScripts;
using RudeLevelScripts.Essentials;
using Steamworks;
using Steamworks.Data;
using TMPro;
using The_Timestopper;
using TimeStop;
using ULTRAKILL.Portal;
using Ultracoins;
using Ultrapain;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.AddressableAssets.ResourceLocators;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Utilities;
using UnityEngine.Networking;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.ResourceManagement.ResourceProviders;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using UnityExplorer.ObjectExplorer;
using UnityExplorer.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("AngryLevelLoader")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Loads level made with Rude level editor")]
[assembly: AssemblyFileVersion("4.0.1.0")]
[assembly: AssemblyInformationalVersion("4.0.1+a718d8188edea69dce0c0053800abf75b2cda0ce")]
[assembly: AssemblyProduct("AngryLevelLoader")]
[assembly: AssemblyTitle("AngryLevelLoader")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("4.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
internal class CrossThreadInvoker : ISynchronizeInvoke
{
	private class BackgroundUpdater : MonoBehaviour
	{
		public void Update()
		{
			ProcessQueue();
		}
	}

	private class AsyncResult : IAsyncResult
	{
		public Delegate method;

		public object[] args;

		public ManualResetEvent manualResetEvent;

		public Thread invokingThread;

		public bool IsCompleted { get; set; }

		public WaitHandle AsyncWaitHandle => manualResetEvent;

		public object AsyncState { get; set; }

		public bool CompletedSynchronously { get; set; }

		public void Invoke()
		{
			AsyncState = method.DynamicInvoke(args);
			IsCompleted = true;
			manualResetEvent.Set();
		}
	}

	private static CrossThreadInvoker instance;

	private static Thread mainThread;

	private static readonly Queue<AsyncResult> ToExecute = new Queue<AsyncResult>();

	public static CrossThreadInvoker Instance => instance;

	public bool InvokeRequired => mainThread.ManagedThreadId != Thread.CurrentThread.ManagedThreadId;

	public static void Init()
	{
		if (instance == null)
		{
			mainThread = Thread.CurrentThread;
			instance = new CrossThreadInvoker();
			((Component)Plugin.instance).gameObject.AddComponent<BackgroundUpdater>();
		}
	}

	private static void ProcessQueue()
	{
		if (Thread.CurrentThread != mainThread)
		{
			throw new Exception("must be called from the same thread it was created on (created on thread id: " + mainThread.ManagedThreadId + ", called from thread id: " + Thread.CurrentThread.ManagedThreadId);
		}
		AsyncResult asyncResult = null;
		while (true)
		{
			lock (ToExecute)
			{
				if (ToExecute.Count == 0)
				{
					break;
				}
				asyncResult = ToExecute.Dequeue();
			}
			asyncResult.Invoke();
		}
	}

	public IAsyncResult BeginInvoke(Delegate method, object[] args)
	{
		AsyncResult asyncResult = new AsyncResult
		{
			method = method,
			args = args,
			IsCompleted = false,
			manualResetEvent = new ManualResetEvent(initialState: false),
			invokingThread = Thread.CurrentThread
		};
		if (mainThread.ManagedThreadId != asyncResult.invokingThread.ManagedThreadId)
		{
			lock (ToExecute)
			{
				ToExecute.Enqueue(asyncResult);
			}
		}
		else
		{
			asyncResult.Invoke();
			asyncResult.CompletedSynchronously = true;
		}
		return asyncResult;
	}

	public object EndInvoke(IAsyncResult result)
	{
		if (!result.IsCompleted)
		{
			result.AsyncWaitHandle.WaitOne();
		}
		return result.AsyncState;
	}

	public object Invoke(Delegate method, object[] args)
	{
		if (InvokeRequired)
		{
			IAsyncResult result = BeginInvoke(method, args);
			return EndInvoke(result);
		}
		return method.DynamicInvoke(args);
	}
}
namespace AngryLevelLoader
{
	public static class AngryPaths
	{
		internal enum Repo
		{
			AngryLevelLoader,
			AngryLevels
		}

		public const string SERVER_ROOT_GLOBAL = "https://angry.dnzsoft.com";

		public const string SERVER_ROOT_LOCAL = "http://localhost:3000";

		public static string SERVER_ROOT
		{
			get
			{
				if (!ConfigManager.useLocalServer.value)
				{
					return "https://angry.dnzsoft.com";
				}
				return "http://localhost:3000";
			}
		}

		public static string ConfigFolderPath => Path.Combine(Paths.ConfigPath, "AngryLevelLoader");

		public static string OnlineCacheFolderPath => Path.Combine(ConfigFolderPath, "OnlineCache");

		public static string ThumbnailCachePath => Path.Combine(OnlineCacheFolderPath, "thumbnailCacheHashes.txt");

		public static string LevelCatalogCachePath => Path.Combine(OnlineCacheFolderPath, "V2", "LevelCatalog.json");

		public static string ScriptsPath => Path.Combine(Plugin.workingDir, "Scripts");

		public static string ScriptCatalogCachePath => Path.Combine(OnlineCacheFolderPath, "ScriptCatalog.json");

		public static string ThumbnailCacheFolderPath => Path.Combine(OnlineCacheFolderPath, "ThumbnailCache");

		public static string LastPlayedMapPath => Path.Combine(ConfigFolderPath, "lastPlayedMap.txt");

		public static string LastUpdateMapPath => Path.Combine(ConfigFolderPath, "lastUpdateMap.txt");

		internal static string GetGithubURL(Repo repo, string path)
		{
			string text = "release";
			if (ConfigManager.useDevelopmentBranch.value)
			{
				text = "dev";
			}
			string text2 = "AngryLevels";
			switch (repo)
			{
			case Repo.AngryLevels:
				text2 = "AngryLevels";
				break;
			case Repo.AngryLevelLoader:
				text2 = "AngryLevelLoader";
				break;
			}
			return "https://raw.githubusercontent.com/eternalUnion/" + text2 + "/" + text + "/" + path;
		}

		internal static void TryCreateAllPaths()
		{
			AngryIOUtils.TryCreateDirectory(ConfigFolderPath);
			AngryIOUtils.TryCreateDirectory(OnlineCacheFolderPath);
			AngryIOUtils.TryCreateDirectory(ThumbnailCacheFolderPath);
			AngryIOUtils.TryCreateDirectory(ScriptsPath);
		}
	}
	internal class SpaceField : CustomConfigField
	{
		public SpaceField(ConfigPanel parentPanel, float space)
			: base(parentPanel, 60f, space)
		{
		}
	}
	[BepInPlugin("com.eternalUnion.angryLevelLoader", "AngryLevelLoader", "4.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		[CompilerGenerated]
		private sealed class <<InitializeFileWatcher>g__LoadLevelInstantly|26_5>d : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			private <>c__DisplayClass26_0 <>8__1;

			private BundleContainer <bundle>5__2;

			private LevelContainer <level>5__3;

			private Transform <optionsMenu>5__4;

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

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

			[DebuggerHidden]
			public <<InitializeFileWatcher>g__LoadLevelInstantly|26_5>d(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>8__1 = null;
				<bundle>5__2 = null;
				<level>5__3 = null;
				<optionsMenu>5__4 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bc: Expected O, but got Unknown
				//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
				//IL_0322: Unknown result type (might be due to invalid IL or missing references)
				//IL_032c: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass26_0();
					<>2__current = null;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if (!TryGetAngryBundleByGuid(InternalConfigManager.instantLoadLevelGuid.value, out <bundle>5__2))
					{
						logger.LogInfo((object)"Bundle not found");
						return false;
					}
					<>8__1.handler = <bundle>5__2.ReloadBundle(forceReload: false, lazyLoad: false);
					<>2__current = (object)new WaitUntil((Func<bool>)(() => <>8__1.handler.IsCompleted));
					<>1__state = 2;
					return true;
				case 2:
				{
					<>1__state = -1;
					if (!<bundle>5__2.TryGetLevelContainer(InternalConfigManager.instantLoadLevelId.value, out <level>5__3))
					{
						logger.LogInfo((object)"Level not found");
						return false;
					}
					Scene activeScene = SceneManager.GetActiveScene();
					GameObject val = (from obj in ((Scene)(ref activeScene)).GetRootGameObjects()
						where ((Object)obj).name == "Canvas"
						select obj).FirstOrDefault();
					if ((Object)(object)val == (Object)null)
					{
						logger.LogWarning((object)"Angry tried to create main menu buttons, but root canvas was not found!");
						return false;
					}
					<optionsMenu>5__4 = val.transform.Find("OptionsMenu");
					if ((Object)(object)<optionsMenu>5__4 == (Object)null)
					{
						logger.LogError((object)"Angry tried to find the options menu but failed!");
						return false;
					}
					((Component)<optionsMenu>5__4).gameObject.SetActive(true);
					<>2__current = null;
					<>1__state = 3;
					return true;
				}
				case 3:
				{
					<>1__state = -1;
					Transform val2 = ((Component)<optionsMenu>5__4).transform.Find("Navigation Rail/PluginConfiguratorButton(Clone)");
					if ((Object)(object)val2 == (Object)null)
					{
						val2 = ((Component)<optionsMenu>5__4).transform.Find("Navigation Rail/PluginConfiguratorButton");
					}
					if ((Object)(object)val2 == (Object)null)
					{
						logger.LogError((object)"Angry tried to find the plugin configurator button but failed!");
						return false;
					}
					Transform val3 = <optionsMenu>5__4.Find("Navigation Rail");
					ButtonHighlightParent val4 = default(ButtonHighlightParent);
					if ((Object)(object)val3 != (Object)null && ((Component)val3).gameObject.TryGetComponent<ButtonHighlightParent>(ref val4) && (val4.buttons == null || val4.buttons.Length == 0))
					{
						val4.Start();
						val4.targetOnStart = null;
					}
					((UnityEvent)((Component)val2).gameObject.GetComponent<Button>().onClick).Invoke();
					<>2__current = null;
					<>1__state = 4;
					return true;
				}
				case 4:
					<>1__state = -1;
					if ((Object)(object)PluginConfiguratorController.activePanel != (Object)null)
					{
						PluginConfiguratorController.activePanel.SetActive(false);
					}
					<>2__current = null;
					<>1__state = 5;
					return true;
				case 5:
					<>1__state = -1;
					((Component)PluginConfiguratorController.mainPanel).gameObject.SetActive(false);
					<>2__current = null;
					<>1__state = 6;
					return true;
				case 6:
					<>1__state = -1;
					ConfigManager.config.rootPanel.OpenPanelInternally(false);
					<>2__current = null;
					<>1__state = 7;
					return true;
				case 7:
					<>1__state = -1;
					if (!<bundle>5__2.Loaded)
					{
						<>2__current = (object)new WaitUntil((Func<bool>)new <>c__DisplayClass26_1
						{
							reloadTask = <bundle>5__2.ReloadBundle(forceReload: false, lazyLoad: false)
						}.<InitializeFileWatcher>b__9);
						<>1__state = 8;
						return true;
					}
					goto IL_033c;
				case 8:
					<>1__state = -1;
					goto IL_033c;
				case 9:
					{
						<>1__state = -1;
						AngrySceneManager.LevelButtonPressed(<level>5__3);
						return false;
					}
					IL_033c:
					<>2__current = null;
					<>1__state = 9;
					return true;
				}
			}

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

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

		[CompilerGenerated]
		private sealed class <>c__DisplayClass26_0
		{
			public Task<bool> handler;

			internal bool <InitializeFileWatcher>b__7()
			{
				return handler.IsCompleted;
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass26_1
		{
			public Task reloadTask;

			internal bool <InitializeFileWatcher>b__9()
			{
				return reloadTask.IsCompleted;
			}
		}

		public const string PLUGIN_NAME = "AngryLevelLoader";

		public const string PLUGIN_GUID = "com.eternalUnion.angryLevelLoader";

		public const string PLUGIN_VERSION = "4.0.1";

		public const string PLUGIN_CONFIG_MIN_VERSION = "1.8.0";

		internal static string workingDir;

		public static string tempFolderPath;

		internal static string dataPath;

		internal static string levelsPath;

		internal static string mapVarsFolderPath;

		public static string angryCatalogPath;

		internal static Plugin instance;

		internal static Harmony harmony;

		internal static ManualLogSource logger;

		private static readonly Dictionary<string, BundleContainer> angryBundles = new Dictionary<string, BundleContainer>();

		private static int numOfOldBundles = 0;

		internal static FileSystemWatcher levelsWatcher;

		internal static FileSystemWatcher scriptsWatcher;

		private float lastPress;

		public static IEnumerable<BundleContainer> GetAllBundleContainers()
		{
			return angryBundles.Values;
		}

		public static bool TryGetAngryBundleByGuid(string guid, out BundleContainer bundleContainer)
		{
			bundleContainer = angryBundles.Values.Where((BundleContainer bundle) => bundle.bundleGuid == guid).FirstOrDefault();
			return bundleContainer != null;
		}

		public static bool TryGetAngryLevel(string id, out LevelContainer level)
		{
			level = null;
			foreach (BundleContainer allBundleContainer in GetAllBundleContainers())
			{
				foreach (LevelContainer allLevelContainer in allBundleContainer.GetAllLevelContainers())
				{
					if (allLevelContainer.levelId == id)
					{
						level = allLevelContainer;
						return true;
					}
				}
			}
			return false;
		}

		private static void ProcessPath(string path, FolderButtonField folder)
		{
			if (AngryFileUtils.TryGetAngryBundleData(path, out var data, out var error))
			{
				if (angryBundles.TryGetValue(data.bundleGuid, out var value))
				{
					if (value.HasValidAngryFile && !AngryIOUtils.PathEquals(path, value.pathToAngryBundle))
					{
						logger.LogError((object)("Duplicate angry files. Original: " + Path.GetFileName(value.pathToAngryBundle) + ". Duplicate: " + Path.GetFileName(path)));
						if (!string.IsNullOrEmpty(ConfigManager.errorText.text))
						{
							ConfigHeader errorText = ConfigManager.errorText;
							errorText.text += "\n";
						}
						ConfigHeader errorText2 = ConfigManager.errorText;
						errorText2.text = errorText2.text + "<color=red>Error loading " + Path.GetFileName(path) + "</color> Duplicate file, original is " + Path.GetFileName(value.pathToAngryBundle);
						return;
					}
					folder.bundles.Add(value);
					if (data.bundleVersion < 6)
					{
						numOfOldBundles++;
					}
					value.pathToAngryBundle = path;
					if (value.LazyLoaded && value.BuildHash != data.buildHash)
					{
						if (value.Loaded && AngrySceneManager.isInCustomLevel && AngrySceneManager.currentBundleContainer == value)
						{
							value.FileChanged();
						}
						else
						{
							value.ReloadBundle(forceReload: false, lazyLoad: true);
						}
					}
					return;
				}
				value = new BundleContainer(path, data);
				angryBundles[data.bundleGuid] = value;
				folder.bundles.Add(value);
				try
				{
					value.ReloadBundle(forceReload: false, lazyLoad: true);
				}
				catch (Exception arg)
				{
					logger.LogWarning((object)$"Exception thrown while loading level bundle: {arg}");
					if (!string.IsNullOrEmpty(ConfigManager.errorText.text))
					{
						ConfigHeader errorText3 = ConfigManager.errorText;
						errorText3.text += "\n";
					}
					ConfigHeader errorText4 = ConfigManager.errorText;
					errorText4.text = errorText4.text + "<color=red>Error loading " + Path.GetFileNameWithoutExtension(path) + "</color>. Check the logs for more information";
				}
				if (data.bundleVersion < 6)
				{
					numOfOldBundles++;
				}
			}
			else if (AngryFileUtils.IsV1LegacyFile(path))
			{
				if (!string.IsNullOrEmpty(ConfigManager.errorText.text))
				{
					ConfigHeader errorText5 = ConfigManager.errorText;
					errorText5.text += "\n";
				}
				ConfigHeader errorText6 = ConfigManager.errorText;
				errorText6.text = errorText6.text + "<color=yellow>" + Path.GetFileName(path) + " is a V1 legacy file. Support for legacy files were dropped after 2.5.0</color>";
			}
			else
			{
				logger.LogError((object)$"Could not load the bundle at {path}\n{error}");
				if (!string.IsNullOrEmpty(ConfigManager.errorText.text))
				{
					ConfigHeader errorText7 = ConfigManager.errorText;
					errorText7.text += "\n";
				}
				ConfigHeader errorText8 = ConfigManager.errorText;
				errorText8.text = errorText8.text + "<color=yellow>Failed to load " + Path.GetFileNameWithoutExtension(path) + "</color>";
			}
		}

		private static void ScanForLevelsRecursive(string folderPath, FolderButtonField folder)
		{
			string[] files = Directory.GetFiles(folderPath);
			foreach (string text in files)
			{
				if (text.EndsWith(".angry"))
				{
					ProcessPath(Path.Combine(folderPath, text), folder);
				}
			}
			files = Directory.GetDirectories(folderPath);
			foreach (string obj in files)
			{
				string fileName = Path.GetFileName(obj);
				ScanForLevelsRecursive(obj, folder.GetOrCreateFolder(fileName));
			}
		}

		public static void ScanForLevels()
		{
			numOfOldBundles = 0;
			ConfigManager.errorText.text = "";
			ConfigManager.searchBar.value = "";
			if (!Directory.Exists(levelsPath))
			{
				logger.LogWarning((object)("Could not find the Levels folder at " + levelsPath));
				ConfigManager.errorText.text = "<color=red>Error: </color>Levels folder not found";
				return;
			}
			AngryBundleList.ResetFolders();
			ScanForLevelsRecursive(levelsPath, AngryBundleList.rootFolder);
			AngryBundleList.SortBundles();
			AngryBundleList.UpdateFolderIcons();
			if (numOfOldBundles != 0)
			{
				if (!string.IsNullOrEmpty(ConfigManager.errorText.text))
				{
					ConfigHeader errorText = ConfigManager.errorText;
					errorText.text += "\n";
				}
				ConfigHeader errorText2 = ConfigManager.errorText;
				errorText2.text += $"<color=yellow>Hidden {numOfOldBundles} old angry file(s). These files can be deleted at the bottom of the settings page.</color>";
			}
			AngryBundleList.DisplayFolder(AngryBundleList.rootFolder);
			OnlineLevelsList.UpdateUI();
		}

		private static bool LoadEssentialScripts()
		{
			bool result = true;
			switch (ScriptManager.AttemptLoadScriptWithCertificate("AngryLoaderAPI.dll"))
			{
			case ScriptManager.LoadScriptResult.NotFound:
				logger.LogError((object)"Required script AngryLoaderAPI.dll not found");
				result = false;
				break;
			case ScriptManager.LoadScriptResult.NoCertificate:
				logger.LogError((object)"Required script AngryLoaderAPI.dll is not signed");
				result = false;
				break;
			case ScriptManager.LoadScriptResult.InvalidCertificate:
				logger.LogError((object)"Required script AngryLoaderAPI.dll signature is invalid");
				result = false;
				break;
			default:
				logger.LogError((object)"Required script AngryLoaderAPI.dll could not be loaded");
				result = false;
				break;
			case ScriptManager.LoadScriptResult.Loaded:
				break;
			}
			switch (ScriptManager.AttemptLoadScriptWithCertificate("RudeLevelScripts.dll"))
			{
			case ScriptManager.LoadScriptResult.NotFound:
				logger.LogError((object)"Required script RudeLevelScripts.dll not found");
				result = false;
				break;
			case ScriptManager.LoadScriptResult.NoCertificate:
				logger.LogError((object)"Required script RudeLevelScripts.dll is not signed");
				result = false;
				break;
			case ScriptManager.LoadScriptResult.InvalidCertificate:
				logger.LogError((object)"Required script RudeLevelScripts.dll signature is invalid");
				result = false;
				break;
			default:
				logger.LogError((object)"Required script RudeLevelScripts.dll could not be loaded");
				result = false;
				break;
			case ScriptManager.LoadScriptResult.Loaded:
				break;
			}
			return result;
		}

		private void ForceLoadAddressableDependencies()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			Addressables.LoadAssetAsync<GameObject>((object)"Assets/Prefabs/Attacks and Projectiles/Projectile Decorative.prefab").WaitForCompletion();
			Addressables.LoadAssetAsync<GameObject>((object)"FirstRoom").WaitForCompletion();
			Addressables.LoadAssetAsync<GameObject>((object)"FirstRoom Secret").WaitForCompletion();
			Addressables.LoadAssetAsync<GameObject>((object)"FirstRoom Prime").WaitForCompletion();
			Addressables.LoadAssetAsync<GameObject>((object)"Assets/Prefabs/Levels/Special Rooms/FirstRoom Encore.prefab").WaitForCompletion();
			Addressables.LoadAssetAsync<Font>((object)"Assets/Fonts/VCR_OSD_MONO_1.001.ttf").WaitForCompletion();
			Addressables.LoadAssetAsync<Sprite>((object)"Assets/Textures/UI/meter.png").WaitForCompletion();
			Addressables.LoadAssetAsync<Sprite>((object)"Assets/Textures/UI/arrow.png").WaitForCompletion();
			Addressables.LoadAssetAsync<Material>((object)"Assets/Materials/Environment/Metal/Metal Decoration 20.mat").WaitForCompletion();
		}

		private static void RefreshCatalogOnMainMenu(Scene newScene, LoadSceneMode mode)
		{
			if (!(SceneHelper.CurrentScene != "Main Menu"))
			{
				if (ConfigManager.refreshCatalogOnBoot.value)
				{
					OnlineLevelsList.RefreshAsync();
				}
				SceneManager.sceneLoaded -= RefreshCatalogOnMainMenu;
			}
		}

		private static void InitializeFileWatcher()
		{
			if (levelsWatcher != null)
			{
				return;
			}
			levelsWatcher = new FileSystemWatcher(levelsPath);
			levelsWatcher.SynchronizingObject = CrossThreadInvoker.Instance;
			levelsWatcher.Changed += delegate(object sender, FileSystemEventArgs e)
			{
				string fullPath4 = e.FullPath;
				foreach (BundleContainer value2 in angryBundles.Values)
				{
					if (AngryIOUtils.PathEquals(fullPath4, value2.pathToAngryBundle))
					{
						logger.LogWarning((object)("Bundle " + fullPath4 + " was updated, container notified"));
						value2.FileChanged();
						break;
					}
				}
			};
			levelsWatcher.Renamed += delegate(object sender, RenamedEventArgs e)
			{
				string oldFullPath = e.OldFullPath;
				foreach (BundleContainer value3 in angryBundles.Values)
				{
					if (AngryIOUtils.PathEquals(oldFullPath, value3.pathToAngryBundle))
					{
						logger.LogWarning((object)("Bundle " + oldFullPath + " was renamed, path updated"));
						value3.pathToAngryBundle = e.FullPath;
						break;
					}
				}
			};
			levelsWatcher.Deleted += delegate(object sender, FileSystemEventArgs e)
			{
				string fullPath3 = e.FullPath;
				foreach (BundleContainer value4 in angryBundles.Values)
				{
					if (AngryIOUtils.PathEquals(fullPath3, value4.pathToAngryBundle))
					{
						logger.LogWarning((object)("Bundle " + fullPath3 + " was deleted, unlinked"));
						value4.pathToAngryBundle = "";
						break;
					}
				}
			};
			levelsWatcher.Created += delegate(object sender, FileSystemEventArgs e)
			{
				string fullPath2 = e.FullPath;
				if (AngryFileUtils.TryGetAngryBundleData(fullPath2, out var data, out var _) && angryBundles.TryGetValue(data.bundleGuid, out var value) && value.bundleGuid == data.bundleGuid && !value.HasValidAngryFile)
				{
					logger.LogWarning((object)("Bundle " + fullPath2 + " was just added, and a container with the same guid had no file linked. Linked, container notified"));
					value.pathToAngryBundle = fullPath2;
					value.FileChanged();
				}
			};
			levelsWatcher.Filter = "*";
			levelsWatcher.IncludeSubdirectories = true;
			levelsWatcher.EnableRaisingEvents = true;
			scriptsWatcher = new FileSystemWatcher(AngryPaths.ScriptsPath);
			scriptsWatcher.SynchronizingObject = CrossThreadInvoker.Instance;
			scriptsWatcher.Changed += delegate(object sender, FileSystemEventArgs e)
			{
				string fullPath = e.FullPath;
				if (fullPath.EndsWith(".dll") && ScriptManager.ScriptChanged(Path.GetFileName(fullPath)))
				{
					logger.LogMessage((object)("Detected script change " + Path.GetFileName(fullPath)));
					AngryUI.UpdatedScript = Path.GetFileName(fullPath);
				}
			};
			scriptsWatcher.Filter = "*";
			scriptsWatcher.IncludeSubdirectories = false;
			scriptsWatcher.EnableRaisingEvents = true;
			SceneManager.sceneLoaded += CheckForInstantLoad;
			static void CheckForInstantLoad(Scene scene, LoadSceneMode mode)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0002: Invalid comparison between Unknown and I4
				if ((int)mode != 1 && !AngrySceneManager.isInCustomLevel && !(SceneHelper.CurrentScene != "Main Menu"))
				{
					if (!InternalConfigManager.instantLoadLevel.value)
					{
						SceneManager.sceneLoaded -= CheckForInstantLoad;
					}
					else
					{
						InternalConfigManager.instantLoadLevel.value = false;
						logger.LogInfo((object)"Starting custom level instantly");
						((MonoBehaviour)instance).StartCoroutine(LoadLevelInstantly());
					}
				}
			}
			[IteratorStateMachine(typeof(<<InitializeFileWatcher>g__LoadLevelInstantly|26_5>d))]
			static IEnumerator LoadLevelInstantly()
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return new <<InitializeFileWatcher>g__LoadLevelInstantly|26_5>d(0);
			}
		}

		private void DisplayPluginConfigVersionError()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			PluginConfigurator obj = PluginConfigurator.Create("Angry Level Loader", "com.eternalUnion.angryLevelLoader");
			obj.SetIconWithURL("file://" + Path.Combine(workingDir, "plugin-icon.png"));
			new ConfigHeader(obj.rootPanel, "<color=red>Plugin config version too low, 1.8.0 or above needed</color>", 24);
		}

		private void Start()
		{
			instance = this;
			logger = ((BaseUnityPlugin)this).Logger;
			workingDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			if (Chainloader.PluginInfos.TryGetValue("com.eternalUnion.pluginConfigurator", out var value))
			{
				if (!(value.Metadata.Version < new Version("1.8.0")))
				{
					try
					{
						PostAwake();
						return;
					}
					catch (Exception ex)
					{
						logger.LogError((object)ex);
						ConfigManager.InitializeErrorConfig("Encountered an unknown error, cannot recover!", ex);
						((Behaviour)this).enabled = false;
						return;
					}
				}
				logger.LogError((object)"Angry level loader needs Plugin Configurator minimum version 1.8.0 to work properly. Disabled.");
				DisplayPluginConfigVersionError();
				((Behaviour)this).enabled = false;
			}
			else
			{
				logger.LogError((object)"Angry level loader needs Plugin Configurator minimum version 1.8.0 to work properly. Disabled.");
				((Behaviour)this).enabled = false;
			}
		}

		private void PostAwake()
		{
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Expected O, but got Unknown
			InternalConfigManager.InitializeInternalConfig();
			if (!InternalConfigManager.askedPermissionForLeaderboards.value)
			{
				NotificationPanel.Open((Notification)(object)new LeaderboardPermissionNotification());
			}
			dataPath = InternalConfigManager.configDataPath.value;
			try
			{
				AngryIOUtils.TryCreateDirectory(dataPath);
			}
			catch (IOException ex)
			{
				logger.LogError((object)("Failed to create data path at '" + dataPath + "'! Overwriting with the default value '" + InternalConfigManager.configDataPath.defaultValue + "'"));
				logger.LogError((object)ex);
				InternalConfigManager.configDataPath.value = InternalConfigManager.configDataPath.defaultValue;
				dataPath = InternalConfigManager.configDataPath.defaultValue;
				try
				{
					AngryIOUtils.TryCreateDirectory(dataPath);
				}
				catch (IOException ex2)
				{
					logger.LogError((object)("Failed to create data path at '" + dataPath + "'! Cannot recover, disabling plugin."));
					ConfigManager.InitializeErrorConfig("Error! Failed to create plugin's data folder at '" + dataPath + "'", ex2);
					((Behaviour)this).enabled = false;
					return;
				}
			}
			levelsPath = Path.Combine(dataPath, "Levels");
			AngryIOUtils.TryCreateDirectory(levelsPath);
			tempFolderPath = Path.Combine(dataPath, "LevelsUnpacked");
			AngryIOUtils.TryCreateDirectory(tempFolderPath);
			mapVarsFolderPath = Path.Combine(dataPath, "MapVars");
			AngryIOUtils.TryCreateDirectory(mapVarsFolderPath);
			AngryPaths.TryCreateAllPaths();
			CrossThreadInvoker.Init();
			InitializeFileWatcher();
			Addressables.InitializeAsync().WaitForCompletion();
			ForceLoadAddressableDependencies();
			angryCatalogPath = Path.Combine(workingDir, "Assets");
			Addressables.LoadContentCatalogAsync(Path.Combine(angryCatalogPath, "catalog.json"), true, (string)null).WaitForCompletion();
			AssetManager.Init();
			LegacyPatchManager.Init();
			if (!LoadEssentialScripts())
			{
				logger.LogError((object)"Disabling AngryLevelLoader because one or more of its dependencies have failed to load");
				((Behaviour)this).enabled = false;
				return;
			}
			LastPlayedMapManager.LoadLastPlayedMap();
			LastPlayedMapManager.LoadLastUpdateMap();
			harmony = new Harmony("com.eternalUnion.angryLevelLoader");
			harmony.PatchAll();
			AngrySceneManager.Init();
			SceneManager.sceneLoaded += RefreshCatalogOnMainMenu;
			ConfigManager.InitializeConfig();
			BannedModsManager.Init();
			MeshCombineManagerPatches.Initialize();
			PluginUpdateHandler.Check();
			ScanForLevels();
			AngryUser.Init();
			AngryUser.GetPermissionsTask().ContinueWith(delegate(Task<AngryUser.GetPermissionsResult> res)
			{
				if (!res.IsCompletedSuccessfully || !res.Result.completedSuccessfully)
				{
					logger.LogError((object)"Could not obtain user permissions");
				}
				else
				{
					AngryUser.GetPermissionsResult result = res.Result;
					if (result.status != 0)
					{
						logger.LogError((object)("Could not obtain user permissions: " + result.message));
					}
					else
					{
						AngryUser.hasLeaderboardPermissions = result.response.hasLeaderboardModificationPermission;
					}
				}
			}, TaskScheduler.FromCurrentSynchronizationContext());
			AngryCustomLevelButton.Init();
			AngryUI.Init();
			AngryBundleList.Init();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin com.eternalUnion.angryLevelLoader is loaded!");
		}

		private void OnGUI()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: 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_0031: Invalid comparison between Unknown and I4
			//IL_005e: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: 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_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			if (((int)ConfigManager.reloadFileKeybind.value == 0 && (int)ConfigManager.reloadScriptKeybind.value == 0) || !AngrySceneManager.isInCustomLevel)
			{
				return;
			}
			Event current = Event.current;
			KeyCode val = (KeyCode)0;
			if ((int)current.keyCode == 27)
			{
				return;
			}
			if (current.isKey || current.isMouse || current.button > 2 || current.shift)
			{
				if (current.isKey)
				{
					val = current.keyCode;
				}
				else if (Input.GetKey((KeyCode)304))
				{
					val = (KeyCode)304;
				}
				else if (Input.GetKey((KeyCode)303))
				{
					val = (KeyCode)303;
				}
				else if (current.button <= 6)
				{
					val = (KeyCode)(323 + current.button);
				}
			}
			else if (Input.GetKey((KeyCode)326) || Input.GetKey((KeyCode)327) || Input.GetKey((KeyCode)328) || Input.GetKey((KeyCode)329))
			{
				val = (KeyCode)326;
				if (Input.GetKey((KeyCode)327))
				{
					val = (KeyCode)327;
				}
				else if (Input.GetKey((KeyCode)328))
				{
					val = (KeyCode)328;
				}
				else if (Input.GetKey((KeyCode)329))
				{
					val = (KeyCode)329;
				}
			}
			else if (Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303))
			{
				val = (KeyCode)304;
				if (Input.GetKey((KeyCode)303))
				{
					val = (KeyCode)303;
				}
			}
			if ((int)val == 0)
			{
				return;
			}
			if (val == ConfigManager.reloadFileKeybind.value)
			{
				if (Time.time - lastPress < 3f)
				{
					return;
				}
				lastPress = Time.time;
				if (NotificationPanel.CurrentNotificationCount() == 0 && AngrySceneManager.currentBundleContainer != null)
				{
					AngrySceneManager.currentBundleContainer.ReloadBundle(forceReload: false, lazyLoad: false);
				}
			}
			if (val == ConfigManager.reloadScriptKeybind.value)
			{
				AngryUI.ReloadScript();
			}
		}
	}
	public static class RudeLevelInterface
	{
		public static char INCOMPLETE_LEVEL_CHAR = '-';

		public static char GetLevelRank(string levelId)
		{
			if (Plugin.TryGetAngryLevel(levelId, out var level))
			{
				return level.FinalRank;
			}
			return INCOMPLETE_LEVEL_CHAR;
		}

		public static bool GetLevelChallenge(string levelId)
		{
			if (Plugin.TryGetAngryLevel(levelId, out var level))
			{
				return level.ChallengeDone;
			}
			return false;
		}

		public static bool GetLevelSecret(string levelId, int secretIndex)
		{
			if (secretIndex < 0)
			{
				return false;
			}
			if (Plugin.TryGetAngryLevel(levelId, out var level))
			{
				return level.SecretDiscovered(secretIndex);
			}
			return false;
		}

		public static string GetCurrentLevelId()
		{
			if (!AngrySceneManager.isInCustomLevel)
			{
				return "";
			}
			return AngrySceneManager.currentLevelData.uniqueIdentifier;
		}
	}
	public static class RudeBundleInterface
	{
		public static bool BundleExists(string bundleGuid)
		{
			return (from bundle in Plugin.GetAllBundleContainers()
				where bundle.bundleGuid == bundleGuid
				select bundle).FirstOrDefault() != null;
		}

		public static string GetBundleBuildHash(string bundleGuid)
		{
			BundleContainer bundleContainer = (from bundle in Plugin.GetAllBundleContainers()
				where bundle.bundleGuid == bundleGuid
				select bundle).FirstOrDefault();
			if (bundleContainer != null)
			{
				return bundleContainer.BuildHash;
			}
			return "";
		}
	}
	public static class RudeGamemodeInterface
	{
		public static AngryGamemodeManager.Gamemode GetCurrentGamemode()
		{
			return AngryGamemodeManager.SelectedGamemode;
		}
	}
	internal static class PluginUpdateHandler
	{
		public static async Task CheckPluginUpdate(bool userRequested = true)
		{
			UnityWebRequest infoReq = new UnityWebRequest(AngryPaths.GetGithubURL(AngryPaths.Repo.AngryLevelLoader, "AngryLevelLoader/PluginInfo.json"));
			infoReq.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer();
			await (AsyncOperation)(object)infoReq.SendWebRequest();
			if ((int)infoReq.result != 1)
			{
				Plugin.logger.LogError((object)"Could not download plugin data");
				infoReq.Dispose();
				ConfigManager.openButtons.SetButtonInteractable(1, true);
				return;
			}
			string text = infoReq.downloadHandler.text;
			int num = text.IndexOf('{');
			if (num > 0)
			{
				text = text.Substring(num);
			}
			PluginInfoJson pluginInfoJson = JsonConvert.DeserializeObject<PluginInfoJson>(text);
			ConfigManager.openButtons.SetButtonInteractable(1, true);
			infoReq.Dispose();
			if (!userRequested)
			{
				bool num2 = InternalConfigManager.lastVersion.value != "4.0.1";
				bool flag = new Version("4.0.1") < new Version(pluginInfoJson.latestVersion) && !InternalConfigManager.ignoreUpdates.value;
				bool flag2 = pluginInfoJson.latestVersion != InternalConfigManager.updateLastVersion.value;
				if (!(num2 || flag || flag2))
				{
					return;
				}
			}
			NotificationPanel.Open((Notification)(object)new PluginUpdateNotification(pluginInfoJson));
		}

		public static void Check()
		{
			string path = Path.Combine(Plugin.workingDir, "Levels");
			if (Directory.Exists(path) && !Path.GetFullPath(InternalConfigManager.configDataPath.value).StartsWith(Path.GetFullPath(Plugin.workingDir)))
			{
				Plugin.logger.LogWarning((object)"Version 2.3.0 migration: Moving levels from working dir to data folder");
				string[] files = Directory.GetFiles(path);
				foreach (string text in files)
				{
					string text2 = Path.Combine(Plugin.levelsPath, Path.GetFileName(text));
					if (File.Exists(text2))
					{
						File.Delete(text);
						continue;
					}
					Plugin.logger.LogInfo((object)(text + " => " + text2));
					File.Move(text, text2);
				}
				Directory.Delete(path, recursive: true);
				string path2 = Path.Combine(Plugin.workingDir, "LevelsUnpacked");
				if (Directory.Exists(path2))
				{
					files = Directory.GetDirectories(path2);
					foreach (string text3 in files)
					{
						string text4 = Path.Combine(Plugin.tempFolderPath, Path.GetFileName(text3));
						if (Directory.Exists(text4))
						{
							Directory.Delete(text3, recursive: true);
							continue;
						}
						Plugin.logger.LogInfo((object)(text3 + " => " + text4));
						AngryIOUtils.DirectoryCopy(text3, text4, copySubDirs: true, deleteSource: true);
					}
					Directory.Delete(path2, recursive: true);
				}
			}
			string text5 = Path.Combine(Plugin.workingDir, "OnlineCache");
			if (Directory.Exists(text5))
			{
				Plugin.logger.LogWarning((object)"Moving online cache folder to config (update 2.5.x)");
				string onlineCacheFolderPath = AngryPaths.OnlineCacheFolderPath;
				if (!Directory.Exists(onlineCacheFolderPath))
				{
					AngryIOUtils.TryCreateDirectoryForFile(onlineCacheFolderPath);
					AngryIOUtils.DirectoryCopy(text5, onlineCacheFolderPath, copySubDirs: true, deleteSource: true);
				}
				else
				{
					Directory.Delete(text5, recursive: true);
				}
			}
			string text6 = Path.Combine(Plugin.workingDir, "lastPlayedMap.txt");
			if (File.Exists(text6))
			{
				Plugin.logger.LogWarning((object)"Moving last played map to config (update 2.5.x)");
				string lastPlayedMapPath = AngryPaths.LastPlayedMapPath;
				if (!File.Exists(lastPlayedMapPath))
				{
					AngryIOUtils.TryCreateDirectoryForFile(lastPlayedMapPath);
					File.Move(text6, lastPlayedMapPath);
				}
				else
				{
					File.Delete(text6);
				}
				LastPlayedMapManager.LoadLastPlayedMap();
			}
			if (string.IsNullOrEmpty(InternalConfigManager.lastVersion.value) || new Version(InternalConfigManager.lastVersion.value) <= new Version("2.7.3"))
			{
				ConfigManager.defaultLeaderboardDifficulty.value = ConfigManager.DefaultLeaderboardDifficulty.Any;
			}
			if ("4.0.1" != InternalConfigManager.lastVersion.value)
			{
				InternalConfigManager.ignoreUpdates.value = false;
			}
			if (ConfigManager.checkForUpdates.value)
			{
				CheckPluginUpdate(userRequested: false);
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "AngryLevelLoader";

		public const string PLUGIN_NAME = "AngryLevelLoader";

		public const string PLUGIN_VERSION = "4.0.1";
	}
}
namespace AngryLevelLoader.Utils
{
	internal static class AngryCryptographyUtils
	{
		public static byte[] Encrypt(string data, string keyXml)
		{
			RSA rSA = RSA.Create();
			rSA.FromXmlString(keyXml);
			return rSA.Encrypt(Encoding.UTF8.GetBytes(data), RSAEncryptionPadding.Pkcs1);
		}

		public static byte[] Encrypt(byte[] data, string keyXml)
		{
			RSA rSA = RSA.Create();
			rSA.FromXmlString(keyXml);
			return rSA.Encrypt(data, RSAEncryptionPadding.Pkcs1);
		}

		public static bool VerifyFileCertificate(string filePath, string certificatePath)
		{
			RSA rSA = RSA.Create();
			rSA.FromXmlString("<RSAKeyValue><Modulus>+/ueeOpso05dA+5GjKbjQ0VpM+JAHmRRgYRw36G4dXqmpCGfVDNVdjjBBkVWO+6lJoSNaaG4Yprn4uQVslUQ7OYWAw6Y+9E0Ezvr1quWE7i0KGxG6weplRTsu9aO0/9gJgP/gWQxC0Cf83NwyvMPsThtCruAQFT+cW0LGghtFgrBr++aknI06SJI5ydrbZgEtU5i4FfjrV1ms4CRRojhydJglfGQfG8W3pTDge4jVdND+RGB6F01QGi0+Bnq5DfKdjvb3/Zh1ko7WocWgavDaIgLYj88AgbGdC0lidLMIgzdnGxkLyxbTzsgi/mvUpB2foy4uHoV22EaWMj+6H+oXQ==</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>");
			return rSA.VerifyData(signature: File.ReadAllBytes(certificatePath), data: File.ReadAllBytes(filePath), hashAlgorithm: HashAlgorithmName.SHA256, padding: RSASignaturePadding.Pkcs1);
		}

		private static string ByteArrayToString(byte[] ba)
		{
			return BitConverter.ToString(ba).Replace("-", "");
		}

		public static string GetSHA256Hash(string filePath)
		{
			SHA256 sHA = SHA256.Create();
			sHA.Initialize();
			return ByteArrayToString(sHA.ComputeHash(File.ReadAllBytes(filePath))).ToLower();
		}

		public static string GetMD5String(string text)
		{
			return ByteArrayToString(MD5.Create().ComputeHash(Encoding.ASCII.GetBytes(text))).ToLower();
		}

		public static string GetMD5String(byte[] data)
		{
			return ByteArrayToString(MD5.Create().ComputeHash(data)).ToLower();
		}
	}
	public static class AngryFileUtils
	{
		public static bool TryGetAngryBundleData(string filePath, out AngryBundleData data, out Exception error)
		{
			error = null;
			data = null;
			try
			{
				data = GetAngryBundleData(filePath);
				return true;
			}
			catch (Exception ex)
			{
				error = ex;
			}
			return false;
		}

		private static AngryBundleData GetAngryBundleData(string filePath)
		{
			using FileStream stream = File.Open(filePath, FileMode.Open, FileAccess.Read);
			using ZipArchive zipArchive = new ZipArchive(stream);
			ZipArchiveEntry entry = zipArchive.GetEntry("data.json");
			if (entry == null)
			{
				return null;
			}
			using StreamReader streamReader = new StreamReader(entry.Open());
			return JsonConvert.DeserializeObject<AngryBundleData>(streamReader.ReadToEnd());
		}

		public static bool IsV1LegacyFile(string pathToAngryBundle)
		{
			try
			{
				using FileStream fileStream = File.Open(pathToAngryBundle, FileMode.Open, FileAccess.Read);
				try
				{
					BinaryReader binaryReader = new BinaryReader(fileStream);
					fileStream.Seek(0L, SeekOrigin.Begin);
					int num = binaryReader.ReadInt32();
					if (num * 4 + 4 >= fileStream.Length)
					{
						return false;
					}
					int num2 = 4 + num * 4;
					for (int i = 0; i < num; i++)
					{
						if (num2 >= fileStream.Length)
						{
							break;
						}
						num2 += binaryReader.ReadInt32();
					}
					if (num2 == fileStream.Length)
					{
						return true;
					}
				}
				catch (Exception)
				{
					return false;
				}
			}
			catch (Exception ex2)
			{
				Plugin.logger.LogError((object)ex2);
				return false;
			}
			return false;
		}
	}
	internal static class AngryIOUtils
	{
		private static string _AppData;

		public static string AppData
		{
			get
			{
				if (_AppData != null)
				{
					return _AppData;
				}
				_AppData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
				Regex regex = new Regex("^[^:]+:\\\\Users\\\\User\\\\AppData\\\\Roaming");
				if (regex.IsMatch(_AppData))
				{
					Plugin.logger.LogWarning((object)("Bad username for AppData (got '" + _AppData + "', expected user '" + Environment.UserName + "'), falling back to local AppData"));
					_AppData = Path.Combine(Directory.GetParent(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)).FullName, "Roaming");
					if (regex.IsMatch(_AppData) && Environment.UserName != "User")
					{
						Plugin.logger.LogWarning((object)("Bad username for local AppData (got '" + Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "', expected user '" + Environment.UserName + "'), falling back to absolute path"));
						char c = ((_AppData.Length > 0) ? _AppData[0] : 'C');
						_AppData = $"{c}:\\Users\\{Environment.UserName}\\AppData\\Roaming";
					}
				}
				return _AppData;
			}
		}

		public static string GetUniqueFileName(string folder, string name)
		{
			string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(name);
			string text = fileNameWithoutExtension;
			string extension = Path.GetExtension(name);
			int num = 0;
			while (File.Exists(Path.Combine(folder, text + extension)))
			{
				text = $"{fileNameWithoutExtension}_{num++}";
			}
			return text + extension;
		}

		public static string GetUniqueFileName(string path)
		{
			return Path.Combine(Path.GetDirectoryName(path), GetUniqueFileName(Path.GetDirectoryName(path), Path.GetFileName(path)));
		}

		public static string GetPathSafeName(string name)
		{
			StringBuilder stringBuilder = new StringBuilder();
			for (int i = 0; i < name.Length; i++)
			{
				char c = name[i];
				if (!char.IsLetterOrDigit(c))
				{
					switch (c)
					{
					case '-':
					case '_':
						break;
					case ' ':
						if (i > 0 && name[i - 1] != ' ')
						{
							stringBuilder.Append('_');
						}
						continue;
					default:
						continue;
					}
				}
				stringBuilder.Append(c);
			}
			string text = stringBuilder.ToString();
			if (string.IsNullOrEmpty(text))
			{
				return "file";
			}
			return text;
		}

		public static bool TryCreateDirectory(string path)
		{
			if (Directory.Exists(path))
			{
				return false;
			}
			Directory.CreateDirectory(path);
			return true;
		}

		public static bool TryCreateDirectoryForFile(string path)
		{
			return TryCreateDirectory(Path.GetDirectoryName(path));
		}

		public static void DirectoryCopy(string sourceDirName, string destDirName, bool copySubDirs, bool deleteSource)
		{
			DirectoryInfo directoryInfo = new DirectoryInfo(sourceDirName);
			DirectoryInfo[] directories = directoryInfo.GetDirectories();
			if (!directoryInfo.Exists)
			{
				throw new DirectoryNotFoundException("Source directory does not exist or could not be found: " + sourceDirName);
			}
			if (!Directory.Exists(destDirName))
			{
				Directory.CreateDirectory(destDirName);
			}
			FileInfo[] files = directoryInfo.GetFiles();
			foreach (FileInfo fileInfo in files)
			{
				string destFileName = Path.Combine(destDirName, fileInfo.Name);
				if (deleteSource)
				{
					fileInfo.MoveTo(destFileName);
				}
				else
				{
					fileInfo.CopyTo(destFileName, overwrite: false);
				}
			}
			if (copySubDirs)
			{
				DirectoryInfo[] array = directories;
				foreach (DirectoryInfo directoryInfo2 in array)
				{
					string destDirName2 = Path.Combine(destDirName, directoryInfo2.Name);
					DirectoryCopy(directoryInfo2.FullName, destDirName2, copySubDirs, deleteSource);
				}
			}
		}

		public static bool PathEquals(string path1, string path2)
		{
			if (string.IsNullOrEmpty(path1))
			{
				return string.IsNullOrEmpty(path2);
			}
			if (string.IsNullOrEmpty(path2))
			{
				return false;
			}
			return Path.GetFullPath(path1) == Path.GetFullPath(path2);
		}
	}
	public static class AngryRankUtils
	{
		private static Dictionary<char, Color> rankColors = new Dictionary<char, Color>
		{
			{
				'D',
				new Color(0f, 0.5803922f, 1f)
			},
			{
				'C',
				new Color(0.29803923f, 1f, 0f)
			},
			{
				'B',
				new Color(1f, 72f / 85f, 0f)
			},
			{
				'A',
				new Color(1f, 0.41568628f, 0f)
			},
			{
				'S',
				Color.red
			},
			{
				'P',
				Color.white
			},
			{
				'-',
				Color.gray
			},
			{
				' ',
				Color.gray
			}
		};

		public static int GetRankScore(char rank)
		{
			return rank switch
			{
				'D' => 1, 
				'C' => 2, 
				'B' => 3, 
				'A' => 4, 
				'S' => 5, 
				'P' => 6, 
				'-' => -1, 
				' ' => 0, 
				_ => -1, 
			};
		}

		public static char GetRankChar(int score)
		{
			return score switch
			{
				1 => 'D', 
				2 => 'C', 
				3 => 'B', 
				4 => 'A', 
				5 => 'S', 
				6 => 'P', 
				-1 => '-', 
				0 => ' ', 
				_ => '-', 
			};
		}

		public static Color GetRankColor(char rank, Color fallback)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			if (rankColors.TryGetValue(rank, out var value))
			{
				return value;
			}
			return fallback;
		}

		public static string GetFormattedRankText(char rank)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			if (!rankColors.TryGetValue(rank, out var value))
			{
				value = Color.gray;
			}
			return $"<color=#{ColorUtility.ToHtmlStringRGB(value)}>{rank}</color>";
		}
	}
	internal static class AngryUIUtils
	{
		public static void AddMouseEvents(GameObject field, Button btn, Action<BaseEventData> mouseOnEvent, Action<BaseEventData> mouseOffEvent)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			EventTrigger val = field.GetComponent<EventTrigger>();
			if ((Object)(object)val == (Object)null)
			{
				val = field.AddComponent<EventTrigger>();
				Utils.AddScrollEvents(val, Utils.GetComponentInParent<ScrollRect>(((Component)btn).transform));
			}
			Entry val2 = new Entry
			{
				eventID = (EventTriggerType)0
			};
			((UnityEvent<BaseEventData>)(object)val2.callback).AddListener((UnityAction<BaseEventData>)delegate(BaseEventData e)
			{
				mouseOnEvent(e);
			});
			Entry val3 = new Entry
			{
				eventID = (EventTriggerType)1
			};
			((UnityEvent<BaseEventData>)(object)val3.callback).AddListener((UnityAction<BaseEventData>)delegate(BaseEventData e)
			{
				mouseOffEvent(e);
			});
			val.triggers.Add(val2);
			val.triggers.Add(val3);
		}
	}
	internal class CachedTask
	{
		private Func<Task> task;

		private Task currentTask;

		public bool Running
		{
			get
			{
				if (currentTask != null)
				{
					return !currentTask.IsCompleted;
				}
				return false;
			}
		}

		public CachedTask(Func<Task> task)
		{
			this.task = task;
		}

		public async Task GetTask(CancellationToken cancellationToken = default(CancellationToken))
		{
			if (!Running)
			{
				currentTask = task();
			}
			await Task.Run(async delegate
			{
				await currentTask;
			}, cancellationToken);
		}
	}
	internal class CachedTask<T>
	{
		private Func<Task<T>> task;

		private Task<T> currentTask;

		public bool Running
		{
			get
			{
				if (currentTask != null)
				{
					return !currentTask.IsCompleted;
				}
				return false;
			}
		}

		public CachedTask(Func<Task<T>> task)
		{
			this.task = task;
		}

		public async Task<T> GetTask(CancellationToken cancellationToken = default(CancellationToken))
		{
			if (!Running)
			{
				currentTask = task();
			}
			return await Task.Run(async () => await currentTask, cancellationToken);
		}
	}
	internal class WordHighlighter
	{
		public List<(int, int)> highlights = new List<(int, int)>();

		public string rawText { get; private set; }

		public WordHighlighter(string text)
		{
			rawText = text;
		}

		public void Highlight(int index, int endIndex)
		{
			int i;
			for (i = 0; i < highlights.Count && index > highlights[i].Item1; i++)
			{
			}
			bool flag = false;
			if (i > 0 && highlights[i - 1].Item2 >= index - 1)
			{
				if (highlights[i - 1].Item2 >= endIndex)
				{
					return;
				}
				index = highlights[i - 1].Item1;
				flag = true;
			}
			int j;
			for (j = 0; i < highlights.Count - j && endIndex >= highlights[i + j].Item1 - 1; j++)
			{
				endIndex = Mathf.Max(endIndex, highlights[i + j].Item2);
			}
			highlights.Insert(i, (index, endIndex));
			for (int k = 0; k < j; k++)
			{
				highlights.RemoveAt(i + 1);
			}
			if (flag)
			{
				highlights.RemoveAt(i - 1);
			}
		}

		public string GenerateFormattedText(string prefix, string postfix)
		{
			if (rawText.Length == 0)
			{
				return string.Empty;
			}
			StringBuilder stringBuilder = new StringBuilder();
			string text = rawText;
			int num = 0;
			foreach (var (num2, num3) in highlights)
			{
				if (num < num2)
				{
					stringBuilder.Append(text.Substring(num, num2 - num));
				}
				stringBuilder.Append(prefix);
				stringBuilder.Append(text.Substring(num2, num3 - num2 + 1));
				stringBuilder.Append(postfix);
				num = num3 + 1;
			}
			if (num < text.Length)
			{
				stringBuilder.Append(text.Substring(num));
			}
			return stringBuilder.ToString();
		}
	}
}
namespace AngryLevelLoader.UserInterface
{
	internal static class AngryBundleList
	{
		private class BundleNameComparer : IComparer<BundleContainer>
		{
			public static readonly BundleNameComparer Instance = new BundleNameComparer();

			public int Compare(BundleContainer b1, BundleContainer b2)
			{
				if (ConfigManager.bundleFavSort.value)
				{
					if (b1.Favourite && !b2.Favourite)
					{
						return -1;
					}
					if (!b1.Favourite && b2.Favourite)
					{
						return 1;
					}
				}
				return StringComparer.OrdinalIgnoreCase.Compare(richText.Replace(b1.BundleName, string.Empty), richText.Replace(b2.BundleName, string.Empty));
			}
		}

		private class BundleAuthorComparer : IComparer<BundleContainer>
		{
			public static readonly BundleAuthorComparer Instance = new BundleAuthorComparer();

			public int Compare(BundleContainer b1, BundleContainer b2)
			{
				if (ConfigManager.bundleFavSort.value)
				{
					if (b1.Favourite && !b2.Favourite)
					{
						return -1;
					}
					if (!b1.Favourite && b2.Favourite)
					{
						return 1;
					}
				}
				return StringComparer.OrdinalIgnoreCase.Compare(richText.Replace(b1.BundleAuthor, string.Empty), richText.Replace(b2.BundleAuthor, string.Empty));
			}
		}

		private class BundleLastUpdateComparer : IComparer<BundleContainer>
		{
			public static readonly BundleLastUpdateComparer Instance = new BundleLastUpdateComparer();

			public int Compare(BundleContainer b1, BundleContainer b2)
			{
				if (ConfigManager.bundleFavSort.value)
				{
					if (b1.Favourite && !b2.Favourite)
					{
						return -1;
					}
					if (!b1.Favourite && b2.Favourite)
					{
						return 1;
					}
				}
				if (!LastPlayedMapManager.lastUpdate.TryGetValue(b1.bundleGuid, out var value))
				{
					value = 0L;
				}
				if (!LastPlayedMapManager.lastUpdate.TryGetValue(b2.bundleGuid, out var value2))
				{
					value2 = 0L;
				}
				return (int)(value2 - value);
			}
		}

		private class BundleLastPlayedComparer : IComparer<BundleContainer>
		{
			public static readonly BundleLastPlayedComparer Instance = new BundleLastPlayedComparer();

			public int Compare(BundleContainer b1, BundleContainer b2)
			{
				if (ConfigManager.bundleFavSort.value)
				{
					if (b1.Favourite && !b2.Favourite)
					{
						return -1;
					}
					if (!b1.Favourite && b2.Favourite)
					{
						return 1;
					}
				}
				if (!LastPlayedMapManager.lastPlayed.TryGetValue(b1.bundleGuid, out var value))
				{
					value = 0L;
				}
				if (!LastPlayedMapManager.lastPlayed.TryGetValue(b2.bundleGuid, out var value2))
				{
					value2 = 0L;
				}
				return (int)(value2 - value);
			}
		}

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

			public static Func<BundleContainer, BundleContainer> <>9__5_0;

			public static Func<string, bool> <>9__17_0;

			public static Func<string, string> <>9__20_0;

			public static OpenPanelEventDelegate <>9__21_0;

			public static Action <>9__21_2;

			public static Action<bool> <>9__21_3;

			internal BundleContainer <SortBundles>b__5_0(BundleContainer b)
			{
				return b;
			}

			internal bool <UpdateFolderIcons>b__17_0(string path)
			{
				return validImageExts.Contains<string>(Path.GetExtension(path));
			}

			internal string <UpdateBundleSearch>b__20_0(string keyword)
			{
				return keyword.ToLower();
			}

			internal void <Init>b__21_0(bool externally)
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Expected O, but got Unknown
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Expected O, but got Unknown
				<>c__DisplayClass21_0 CS$<>8__locals0 = new <>c__DisplayClass21_0
				{
					backButtonEvent = PluginConfiguratorController.backButton.onClick
				};
				PluginConfiguratorController.backButton.onClick = new ButtonClickedEvent();
				((UnityEvent)PluginConfiguratorController.backButton.onClick).AddListener((UnityAction)delegate
				{
					if (displayedFolder == null || displayedFolder == rootFolder || !string.IsNullOrEmpty(ConfigManager.searchBar.value))
					{
						((UnityEvent)CS$<>8__locals0.backButtonEvent).Invoke();
					}
					else
					{
						PopFolder();
					}
				});
			}

			internal void <Init>b__21_2()
			{
				ConfigManager.searchBar.value = "";
			}

			internal void <Init>b__21_3(bool wasCanceled)
			{
				if (wasCanceled)
				{
					if (!string.IsNullOrWhiteSpace(ConfigManager.searchBar.value))
					{
						ConfigManager.searchBar.value = "";
					}
					else if (displayedFolder == null || displayedFolder == rootFolder)
					{
						ConfigManager.config.rootPanel.ClosePanel();
					}
				}
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass21_0
		{
			public ButtonClickedEvent backButtonEvent;

			internal void <Init>b__1()
			{
				if (displayedFolder == null || displayedFolder == rootFolder || !string.IsNullOrEmpty(ConfigManager.searchBar.value))
				{
					((UnityEvent)backButtonEvent).Invoke();
				}
				else
				{
					PopFolder();
				}
			}
		}

		[CompilerGenerated]
		private sealed class <GetAllFolders>d__12 : IEnumerable<FolderButtonField>, IEnumerable, IEnumerator<FolderButtonField>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private FolderButtonField <>2__current;

			private int <>l__initialThreadId;

			private Stack<FolderButtonField> <folders>5__2;

			private FolderButtonField <folder>5__3;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<folders>5__2 = null;
				<folder>5__3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<folders>5__2 = new Stack<FolderButtonField>();
					<folders>5__2.Push(rootFolder);
					break;
				case 1:
					<>1__state = -1;
					foreach (FolderButtonField allSubfolder in <folder>5__3.GetAllSubfolders())
					{
						<folders>5__2.Push(allSubfolder);
					}
					<folder>5__3 = null;
					break;
				}
				if (<folders>5__2.Count != 0)
				{
					<folder>5__3 = <folders>5__2.Pop();
					<>2__current = <folder>5__3;
					<>1__state = 1;
					return true;
				}
				return false;
			}

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

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

			[DebuggerHidden]
			IEnumerator<FolderButtonField> IEnumerable<FolderButtonField>.GetEnumerator()
			{
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					return this;
				}
				return new <GetAllFolders>d__12(0);
			}

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

		private static Regex richText;

		internal static readonly FolderButtonField rootFolder;

		private static string[] validImageExts;

		private static string[] currentSearchKeywords;

		private static char[] whitespaceSeparator;

		internal static FolderButtonField displayedFolder { get; private set; }

		internal static void SortBundles()
		{
			IComparer<BundleContainer> comparer = ConfigManager.bundleSortingMode.value switch
			{
				ConfigManager.BundleSorting.Author => BundleAuthorComparer.Instance, 
				ConfigManager.BundleSorting.LastUpdate => BundleLastUpdateComparer.Instance, 
				ConfigManager.BundleSorting.LastPlayed => BundleLastPlayedComparer.Instance, 
				_ => BundleNameComparer.Instance, 
			};
			int num = 0;
			foreach (BundleContainer item in Plugin.GetAllBundleContainers().OrderBy((BundleContainer b) => b, comparer))
			{
				item.SiblingIndex = num++;
			}
		}

		static AngryBundleList()
		{
			richText = new Regex("<[^>]*>");
			displayedFolder = null;
			validImageExts = new string[3] { ".jpg", ".jpeg", ".png" };
			currentSearchKeywords = new string[0];
			whitespaceSeparator = new char[1] { ' ' };
			ConfigManager.InitializeConfig();
			rootFolder = new FolderButtonField(string.Empty, null);
			((ConfigField)rootFolder).hidden = true;
		}

		[IteratorStateMachine(typeof(<GetAllFolders>d__12))]
		private static IEnumerable<FolderButtonField> GetAllFolders()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <GetAllFolders>d__12(-2);
		}

		internal static void DisplayFolder(FolderButtonField folderField)
		{
			if (folderField == null)
			{
				folderField = rootFolder;
			}
			foreach (BundleContainer allBundleContainer in Plugin.GetAllBundleContainers())
			{
				allBundleContainer.Hidden = true;
			}
			foreach (FolderButtonField allFolder in GetAllFolders())
			{
				((ConfigField)allFolder).hidden = true;
			}
			foreach (BundleContainer bundle in folderField.bundles)
			{
				if (bundle.LazyLoaded)
				{
					bundle.Hidden = false;
				}
			}
			foreach (FolderButtonField allSubfolder in folderField.GetAllSubfolders())
			{
				if (allSubfolder.Any())
				{
					((ConfigField)allSubfolder).hidden = false;
				}
			}
			if (folderField == rootFolder)
			{
				ConfigManager.levelBundlesHeader.text = "Level Bundles";
			}
			else
			{
				ConfigManager.levelBundlesHeader.text = "Level Bundles <color=grey>" + folderField.GetRelativeFolderPath() + "</color>";
			}
			displayedFolder = folderField;
		}

		internal static void ResetFolders()
		{
			foreach (FolderButtonField allFolder in GetAllFolders())
			{
				allFolder.bundles.Clear();
			}
		}

		internal static bool PopFolder()
		{
			if (displayedFolder == null || displayedFolder == rootFolder)
			{
				return false;
			}
			DisplayFolder(displayedFolder.parent ?? rootFolder);
			return true;
		}

		internal static void UpdateFolderIcons()
		{
			foreach (FolderButtonField allFolder in GetAllFolders())
			{
				if (allFolder == rootFolder)
				{
					continue;
				}
				string absoluteFolderPath = allFolder.GetAbsoluteFolderPath(Plugin.levelsPath);
				if (Directory.Exists(absoluteFolderPath))
				{
					string text = (from path in Directory.GetFiles(absoluteFolderPath)
						where validImageExts.Contains<string>(Path.GetExtension(path))
						select path).FirstOrDefault();
					if (!string.IsNullOrEmpty(text))
					{
						allFolder.CreateIcon(text);
						continue;
					}
				}
				allFolder.CreateIcon(allFolder);
			}
		}

		private static void UpdateBundleSearch(string newVal)
		{
			string[] array = (from keyword in newVal.Split(whitespaceSeparator, StringSplitOptions.RemoveEmptyEntries)
				select keyword.ToLower()).ToArray();
			if (array.Length == currentSearchKeywords.Length && array.SequenceEqual(currentSearchKeywords))
			{
				return;
			}
			currentSearchKeywords = array;
			if (currentSearchKeywords.Length == 0)
			{
				((ConfigField)ConfigManager.folderDivision).hidden = false;
				((ConfigField)ConfigManager.searchInfo).hidden = true;
				foreach (BundleContainer allBundleContainer in Plugin.GetAllBundleContainers())
				{
					allBundleContainer.SearchKeywords = new string[0];
				}
				DisplayFolder(displayedFolder);
				return;
			}
			((ConfigField)ConfigManager.folderDivision).hidden = true;
			((ConfigField)ConfigManager.searchInfo).hidden = false;
			int num = 0;
			int num2 = 0;
			foreach (BundleContainer allBundleContainer2 in Plugin.GetAllBundleContainers())
			{
				allBundleContainer2.SearchKeywords = currentSearchKeywords;
				if (allBundleContainer2.HasValidAngryFile)
				{
					num2++;
					if (allBundleContainer2.SearchMatch)
					{
						num++;
					}
				}
			}
			ConfigManager.levelBundlesHeader.text = "Level Bundles";
			ConfigManager.searchInfo.text = $"Showing {num} of {num2} bundles";
		}

		internal static void Init()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			ConfigManager.InitializeConfig();
			ConfigPanel rootPanel = ConfigManager.config.rootPanel;
			object obj = <>c.<>9__21_0;
			if (obj == null)
			{
				OpenPanelEventDelegate val = delegate
				{
					//IL_001b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0025: Expected O, but got Unknown
					//IL_0036: Unknown result type (might be due to invalid IL or missing references)
					//IL_0040: Expected O, but got Unknown
					ButtonClickedEvent backButtonEvent = PluginConfiguratorController.backButton.onClick;
					PluginConfiguratorController.backButton.onClick = new ButtonClickedEvent();
					((UnityEvent)PluginConfiguratorController.backButton.onClick).AddListener((UnityAction)delegate
					{
						if (displayedFolder == null || displayedFolder == rootFolder || !string.IsNullOrEmpty(ConfigManager.searchBar.value))
						{
							((UnityEvent)backButtonEvent).Invoke();
						}
						else
						{
							PopFolder();
						}
					});
				};
				<>c.<>9__21_0 = val;
				obj = (object)val;
			}
			rootPanel.onPannelOpenEvent += (OpenPanelEventDelegate)obj;
			SearchBarField searchBar = ConfigManager.searchBar;
			searchBar.onValueChange = (Action<string>)Delegate.Combine(searchBar.onValueChange, new Action<string>(UpdateBundleSearch));
			SearchBarField searchBar2 = ConfigManager.searchBar;
			searchBar2.onReset = (Action)Delegate.Combine(searchBar2.onReset, (Action)delegate
			{
				ConfigManager.searchBar.value = "";
			});
			SearchBarField searchBar3 = ConfigManager.searchBar;
			searchBar3.onEndEdit = (Action<bool>)Delegate.Combine(searchBar3.onEndEdit, (Action<bool>)delegate(bool wasCanceled)
			{
				if (wasCanceled)
				{
					if (!string.IsNullOrWhiteSpace(ConfigManager.searchBar.value))
					{
						ConfigManager.searchBar.value = "";
					}
					else if (displayedFolder == null || displayedFolder == rootFolder)
					{
						ConfigManager.config.rootPanel.ClosePanel();
					}
				}
			});
		}
	}
	internal static class AngryCustomLevelButton
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

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

			public static UnityAction<Scene, LoadSceneMode> <>9__5_0;

			public static PostEnumValueChangeEvent<ConfigManager.CustomLevelButtonPosition> <>9__5_1;

			public static PostColorValueChangeEvent <>9__5_2;

			public static PostColorValueChangeEvent <>9__5_3;

			internal bool <CreateCustomLevelButtonOnMainMenuAsync>b__4_0(GameObject obj)
			{
				return ((Object)obj).name == "Canvas";
			}

			internal void <Init>b__5_0(Scene scene, LoadSceneMode mode)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0002: Invalid comparison between Unknown and I4
				if ((int)mode != 1 && SceneHelper.CurrentScene == "Main Menu")
				{
					CreateCustomLevelButtonOnMainMenu();
				}
			}

			internal void <Init>b__5_1(ConfigManager.CustomLevelButtonPosition pos)
			{
				//IL_00a1: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: 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_0195: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b8: 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_01d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_0212: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
				//IL_011c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0130: Unknown result type (might be due to invalid IL or missing references)
				//IL_013a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0153: Unknown result type (might be due to invalid IL or missing references)
				//IL_0176: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)currentCustomLevelButton == (Object)null)
				{
					return;
				}
				((Component)currentCustomLevelButton).gameObject.SetActive(true);
				switch (pos)
				{
				case ConfigManager.CustomLevelButtonPosition.Disabled:
					((Component)currentCustomLevelButton).gameObject.SetActive(false);
					break;
				case ConfigManager.CustomLevelButtonPosition.Bottom:
					((Component)currentCustomLevelButton).transform.localPosition = new Vector3(((Component)currentCustomLevelButton).transform.localPosition.x, -303f, ((Component)currentCustomLevelButton).transform.localPosition.z);
					break;
				case ConfigManager.CustomLevelButtonPosition.Top:
					((Component)currentCustomLevelButton).transform.localPosition = new Vector3(((Component)currentCustomLevelButton).transform.localPosition.x, 192f, ((Component)currentCustomLevelButton).transform.localPosition.z);
					break;
				}
				if ((Object)(object)bossRushButton != (Object)null)
				{
					if (pos == ConfigManager.CustomLevelButtonPosition.Bottom)
					{
						currentCustomLevelButton.rect.sizeDelta = new Vector2(187.5f, 50f);
						((Component)currentCustomLevelButton).transform.localPosition = new Vector3(-96.25f, ((Component)currentCustomLevelButton).transform.localPosition.y, ((Component)currentCustomLevelButton).transform.localPosition.z);
						bossRushButton.sizeDelta = new Vector2(187.5f, 50f);
						((Component)bossRushButton).transform.localPosition = new Vector3(96.25f, -303f, 0f);
					}
					else
					{
						currentCustomLevelButton.rect.sizeDelta = new Vector2(380f, 50f);
						((Component)currentCustomLevelButton).transform.localPosition = new Vector3(0f, ((Component)currentCustomLevelButton).transform.localPosition.y, ((Component)currentCustomLevelButton).transform.localPosition.z);
						bossRushButton.sizeDelta = new Vector2(380f, 50f);
						((Component)bossRushButton).transform.localPosition = new Vector3(0f, -303f, 0f);
					}
				}
			}

			internal void <Init>b__5_2(Color clr)
			{
				//IL_0010: 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_0038: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_005c: 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_006e: 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)
				if (!((Object)(object)currentCustomLevelButton == (Object)null))
				{
					ColorBlock colors = default(ColorBlock);
					((ColorBlock)(ref colors)).colorMultiplier = 1f;
					((ColorBlock)(ref colors)).fadeDuration = 0.1f;
					((ColorBlock)(ref colors)).normalColor = clr;
					((ColorBlock)(ref colors)).selectedColor = clr * 0.8f;
					((ColorBlock)(ref colors)).highlightedColor = clr * 0.8f;
					((ColorBlock)(ref colors)).pressedColor = clr * 0.5f;
					((ColorBlock)(ref colors)).disabledColor = Color.gray;
					((Selectable)currentCustomLevelButton.button).colors = colors;
				}
			}

			internal void <Init>b__5_3(Color clr)
			{
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)currentCustomLevelButton == (Object)null))
				{
					((Graphic)currentCustomLevelButton.text).color = clr;
				}
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass4_0
		{
			public GameObject canvasObj;

			public Transform chapterSelect;

			internal void <CreateCustomLevelButtonOnMainMenuAsync>b__1()
			{
				//IL_013d: Unknown result type (might be due to invalid IL or missing references)
				Transform val = canvasObj.transform.Find("OptionsMenu");
				if ((Object)(object)val == (Object)null)
				{
					Plugin.logger.LogError((object)"Angry tried to find the options menu but failed!");
					return;
				}
				((Component)chapterSelect).gameObject.SetActive(false);
				((Component)val).gameObject.SetActive(true);
				Transform val2 = ((Component)val).transform.Find("Navigation Rail/PluginConfiguratorButton(Clone)");
				if ((Object)(object)val2 == (Object)null)
				{
					val2 = ((Component)val).transform.Find("Navigation Rail/PluginConfiguratorButton");
				}
				if ((Object)(object)val2 == (Object)null)
				{
					Plugin.logger.LogError((object)"Angry tried to find the plugin configurator button but failed!");
					return;
				}
				Transform val3 = val.Find("Navigation Rail");
				ButtonHighlightParent val4 = default(ButtonHighlightParent);
				if ((Object)(object)val3 != (Object)null && ((Component)val3).gameObject.TryGetComponent<ButtonHighlightParent>(ref val4) && (val4.buttons == null || val4.buttons.Length == 0))
				{
					val4.Start();
					val4.targetOnStart = null;
				}
				((UnityEvent)((Component)val2).gameObject.GetComponent<Button>().onClick).Invoke();
				if ((Object)(object)PluginConfiguratorController.activePanel != (Object)null)
				{
					PluginConfiguratorController.activePanel.SetActive(false);
				}
				((Component)PluginConfiguratorController.mainPanel).gameObject.SetActive(false);
				ConfigManager.config.rootPanel.OpenPanelInternally(false);
				ConfigManager.config.rootPanel.currentPanel.rect.normalizedPosition = new Vector2(0f, 1f);
				AngryDifficultyManager.SetDifficultyFromPrefs();
			}
		}

		[CompilerGenerated]
		private sealed class <CreateCustomLevelButtonOnMainMenuAsync>d__4 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			private <>c__DisplayClass4_0 <>8__1;

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

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

			[DebuggerHidden]
			public <CreateCustomLevelButtonOnMainMenuAsync>d__4(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

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

			private bool MoveNext()
			{
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
				//IL_0139: Unknown result type (might be due to invalid IL or missing references)
				//IL_0143: Expected O, but got Unknown
				//IL_015e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0168: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass4_0();
					<>2__current = null;
					<>1__state = 1;
					return true;
				case 1:
				{
					<>1__state = -1;
					<>c__DisplayClass4_0 <>c__DisplayClass4_ = <>8__1;
					Scene activeScene = SceneManager.GetActiveScene();
					<>c__DisplayClass4_.canvasObj = (from obj in ((Scene)(ref activeScene)).GetRootGameObjects()
						where ((Object)obj).name == "Canvas"
						select obj).FirstOrDefault();
					if ((Object)(object)<>8__1.canvasObj == (Object)null)
					{
						Plugin.logger.LogWarning((object)"Angry tried to create main menu buttons, but root canvas was not found!");
						return false;
					}
					Transform val = <>8__1.canvasObj.transform.Find("Chapter Select/Chapters");
					if ((Object)(object)val != (Object)null)
					{
						<>8__1.chapterSelect = <>8__1.canvasObj.transform.Find("Chapter Select");
						GameObject obj2 = Addressables.InstantiateAsync((object)"AngryLevelLoader/UI/CustomLevels.prefab", val, false, true).WaitForCompletion();
						Transform val2 = val.Find("Boss Rush Button");
						if ((Object)(object)val2 != (Object)null)
						{
							bossRushButton = ((Component)val2).gameObject.GetComponent<RectTransform>();
						}
						currentCustomLevelButton = obj2.GetComponent<AngryCustomLevelButtonComponent>();
						currentCustomLevelButton.button.onClick = new ButtonClickedEvent();
						((UnityEvent)currentCustomLevelButton.button.onClick).AddListener((UnityAction)delegate
						{
							//IL_013d: Unknown result type (might be due to invalid IL or missing references)
							Transform val3 = <>8__1.canvasObj.transform.Find("OptionsMenu");
							if ((Object)(object)val3 == (Object)null)
							{
								Plugin.logger.LogError((object)"Angry tried to find the options menu but failed!");
							}
							else
							{
								((Component)<>8__1.chapterSelect).gameObject.SetActive(false);
								((Component)val3).gameObject.SetActive(true);
								Transform val4 = ((Component)val3).transform.Find("Navigation Rail/PluginConfiguratorButton(Clone)");
								if ((Object)(object)val4 == (Object)null)
								{
									val4 = ((Component)val3).transform.Find("Navigation Rail/PluginConfiguratorButton");
								}
								if ((Object)(object)val4 == (Object)null)
								{
									Plugin.logger.LogError((object)"Angry tried to find the plugin configurator button but failed!");
								}
								else
								{
									Transform val5 = val3.Find("Navigation Rail");
									ButtonHighlightParent val6 = default(ButtonHighlightParent);
									if ((Object)(object)val5 != (Object)null && ((Component)val5).gameObject.TryGetComponent<ButtonHighlightParent>(ref val6) && (val6.buttons == null || val6.buttons.Length == 0))
									{
										val6.Start();
										val6.targetOnStart = null;
									}
									((UnityEvent)((Component)val4).gameObject.GetComponent<Button>().onClick).Invoke();
									if ((Object)(object)PluginConfiguratorController.activePanel != (Object)null)
									{
										PluginConfiguratorController.activePanel.SetActive(false);
									}
									((Component)PluginConfiguratorController.mainPanel).gameObject.SetActive(false);
									ConfigManager.config.rootPanel.OpenPanelInternally(false);
									ConfigManager.config.rootPanel.currentPanel.rect.normalizedPosition = new Vector2(0f, 1f);
									AngryDifficultyManager.SetDifficultyFromPrefs();
								}
							}
						});
						ConfigManager.customLevelButtonPosition.TriggerPostValueChangeEvent();
						ConfigManager.customLevelButtonFrameColor.TriggerPostValueChangeEvent();
						ConfigManager.customLevelButtonTextColor.TriggerPostValueChangeEvent();
					}
					else
					{
						Plugin.logger.LogWarning((object)"Angry tried to find chapter select menu, but root canvas was not found!");
					}
					return false;
				}
				}
			}

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

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

		internal const string CUSTOM_LEVEL_BUTTON_ASSET_PATH = "AngryLevelLoader/UI/CustomLevels.prefab";

		internal static AngryCustomLevelButtonComponent currentCustomLevelButton;

		internal static RectTransform bossRushButton;

		private static void CreateCustomLevelButtonOnMainMenu()
		{
			((MonoBehaviour)Plugin.instance).StartCoroutine(CreateCustomLevelButtonOnMainMenuAsync());
		}

		[IteratorStateMachine(typeof(<CreateCustomLevelButtonOnMainMenuAsync>d__4))]
		private static IEnumerator CreateCustomLevelButtonOnMainMenuAsync()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <CreateCustomLevelButtonOnMainMenuAsync>d__4(0);
		}

		internal static void Init()
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Expected O, but got Unknown
			SceneManager.sceneLoaded += delegate(Scene scene, LoadSceneMode mode)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0002: Invalid comparison between Unknown and I4
				if ((int)mode != 1 && SceneHelper.CurrentScene == "Main Menu")
				{
					CreateCustomLevelButtonOnMainMenu();
				}
			};
			ConfigManager.InitializeConfig();
			ConfigManager.customLevelButtonPosition.postValueChangeEvent += delegate(ConfigManager.CustomLevelButtonPosition pos)
			{
				//IL_00a1: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: 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_0195: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b8: 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_01d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_0212: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
				//IL_011c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0130: Unknown result type (might be due to invalid IL or missing references)
				//IL_013a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0153: Unknown result type (might be due to invalid IL or missing references)
				//IL_0176: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)currentCustomLevelButton == (Object)null))
				{
					((Component)currentCustomLevelButton).gameObject.SetActive(true);
					switch (pos)
					{
					case ConfigManager.CustomLevelButtonPosition.Disabled:
						((Component)currentCustomLevelButton).gameObject.SetActive(false);
						break;
					case ConfigManager.CustomLevelButtonPosition.Bottom:
						((Component)currentCustomLevelButton).transform.localPosition = new Vector3(((Component)currentCustomLevelButton).transform.localPosition.x, -303f, ((Component)currentCustomLevelButton).transform.localPosition.z);
						break;
					case ConfigManager.CustomLevelButtonPosition.Top:
						((Component)currentCustomLevelButton).transform.localPosition = new Vector3(((Component)currentCustomLevelButton).transform.localPosition.x, 192f, ((Component)currentCustomLevelButton).transform.localPosition.z);
						break;
					}
					if ((Object)(object)bossRushButton != (Object)null)
					{
						if (pos == ConfigManager.CustomLevelButtonPosition.Bottom)
						{
							currentCustomLevelButton.rect.sizeDelta = new Vector2(187.5f, 50f);
							((Component)currentCustomLevelButton).transform.localPosition = new Vector3(-96.25f, ((Component)currentCustomLevelButton).transform.localPosition.y, ((Component)currentCustomLevelButton).transform.localPosition.z);
							bossRushButton.sizeDelta = new Vector2(187.5f, 50f);
							((Component)bossRushButton).transform.localPosition = new Vector3(96.25f, -303f, 0f);
						}
						else
						{
							currentCustomLevelButton.rect.sizeDelta = new Vector2(380f, 50f);
							((Component)currentCustomLevelButton).transform.localPosition = new Vector3(0f, ((Component)currentCustomLevelButton).transform.localPosition.y, ((Component)currentCustomLevelButton).transform.localPosition.z);
							bossRushButton.sizeDelta = new Vector2(380f, 50f);
							((Component)bossRushButton).transform.localPosition = new Vector3(0f, -303f, 0f);
						}
					}
				}
			};
			ColorField customLevelButtonFrameColor = ConfigManager.customLevelButtonFrameColor;
			object obj = <>c.<>9__5_2;
			if (obj == null)
			{
				PostColorValueChangeEvent val = delegate(Color clr)
				{
					//IL_0010: 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_0038: Unknown result type (might be due to invalid IL or missing references)
					//IL_003e: Unknown result type (might be due to invalid IL or missing references)
					//IL_004a: Unknown result type (might be due to invalid IL or missing references)
					//IL_0050: Unknown result type (might be due to invalid IL or missing references)
					//IL_005c: 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_006e: 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)
					if (!((Object)(object)currentCustomLevelButton == (Object)null))
					{
						ColorBlock colors = default(ColorBlock);
						((ColorBlock)(ref colors)).colorMultiplier = 1f;
						((ColorBlock)(ref colors)).fadeDuration = 0.1f;
						((ColorBlock)(ref colors)).normalColor = clr;
						((ColorBlock)(ref colors)).selectedColor = clr * 0.8f;
						((ColorBlock)(ref colors)).highlightedColor = clr * 0.8f;
						((ColorBlock)(ref colors)).pressedColor = clr * 0.5f;
						((ColorBlock)(ref colors)).disabledColor = Color.gray;
						((Selectable)currentCustomLevelButton.button).colors = colors;
					}
				};
				<>c.<>9__5_2 = val;
				obj = (object)val;
			}
			customLevelButtonFrameColor.postValueChangeEvent += (PostColorValueChangeEvent)obj;
			ColorField customLevelButtonTextColor = ConfigManager.customLevelButtonTextColor;
			object obj2 = <>c.<>9__5_3;
			if (obj2 == null)
			{
				PostColorValueChangeEvent val2 = delegate(Color clr)
				{
					//IL_0018: Unknown result type (might be due to invalid IL or missing references)
					if (!((Object)(object)currentCustomLevelButton == (Object)null))
					{
						((Graphic)currentCustomLevelButton.text).color = clr;
					}
				};
				<>c.<>9__5_3 = val2;
				obj2 = (object)val2;
			}
			customLevelButtonTextColor.postValueChangeEvent += (PostColorValueChangeEvent)obj2;
		}
	}
	internal static class AngryUI
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

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

			public static UnityAction <>9__5_0;

			public static UnityAction <>9__5_1;

			public static UnityAction <>9__6_0;

			public static UnityAction <>9__6_1;

			public static UnityAction<Scene, LoadSceneMode> <>9__12_0;

			internal bool <CreateAngryUIAsync>b__3_0(GameObject obj)
			{
				return ((Object)obj).name == "Canvas";
			}

			internal void <ShowReloadScriptPrompt>b__5_0()
			{
				ReloadScript();
			}

			internal void <ShowReloadScriptPrompt>b__5_1()
			{
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Expected O, but got Unknown
				currentPanel.reloadScriptPrompt.reloadButton.onClick = new ButtonClickedEvent();
				((Component)currentPanel.reloadScriptPrompt).gameObject.SetActive(false);
				UpdatedScript = string.Empty;
			}

			internal void <ShowReloadBundlePrompt>b__6_0()
			{
				AngrySceneManager.currentBundleContainer.ReloadBundle(forceReload: false, lazyLoad: false);
			}

			internal void <ShowReloadBundlePrompt>b__6_1()
			{
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Expected O, but got Unknown
				AngrySceneManager.currentBundleContainer.IgnoreFileChange = true;
				currentPanel.reloadBundlePrompt.reloadButton.onClick = new ButtonClickedEvent();
				((Component)currentPanel.reloadBundlePrompt).gameObject.SetActive(false);
			}

			internal void <Init>b__12_0(Scene scene, LoadSceneMode mode)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0002: Invalid comparison between Unknown and I4
				if ((int)mode != 1 && AngrySceneManager.isInCustomLevel)
				{
					Plugin.logger.LogInfo((object)"Creating UI panel");
					CreateAngryUI();
				}
			}
		}

		[CompilerGenerated]
		private sealed class <CreateAngryUIAsync>d__3 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

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

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

			[DebuggerHidden]
			public <CreateAngryUIAsync>d__3(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

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

			private bool MoveNext()
			{
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_009b: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = null;
					<>1__state = 1;
					return true;
				case 1:
				{
					<>1__state = -1;
					if ((Object)(object)currentPanel != (Object)null)
					{
						return false;
					}
					Scene activeScene = SceneManager.GetActiveScene();
					GameObject val = (from obj in ((Scene)(ref activeScene)).GetRootGameObjects()
						where ((Object)obj).name == "Canvas"
						select obj).FirstOrDefault();
					if ((Object)(object)val == (Object)null)
					{
						Plugin.logger.LogWarning((object)"Angry tried to create main menu buttons, but root canvas was not found!");
						return false;
					}
					currentPanel = Addressables.InstantiateAsync((object)"AngryLevelLoader/UI/AngryUIPanel.prefab", val.transform, false, true).WaitForCompletion().GetComponent<AngryUIPanelComponent>();
					currentPanel.reloadBundlePrompt.MakeTransparent(true);
					currentPanel.reloadScriptPrompt.MakeTransparent(true);
					if (AngrySceneManager.currentBundleContainer.FileChangeDetected && !AngrySceneManager.currentBundleContainer.IgnoreFileChange)
					{
						ShowReloadBundlePrompt();
						return false;
					}
					if (!string.IsNullOrEmpty(UpdatedScript))
					{
						ShowReloadScriptPrompt();
						return false;
					}
					return false;
				}
				}
			}

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

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

		private const string ANGRY_UI_PANEL_ASSET_PATH = "AngryLevelLoader/UI/AngryUIPanel.prefab";

		private static AngryUIPanelComponent currentPanel;

		private static string _updatedScript = string.Empty;

		internal static string UpdatedScript
		{
			get
			{
				return _updatedScript;
			}
			set
			{
				_updatedScript = value;
				if ((Object)(object)currentPanel != (Object)null && !string.IsNullOrEmpty(_updatedScript))
				{
					ShowReloadScriptPrompt();
				}
			}
		}

		private static void CreateAngryUI()
		{
			((MonoBehaviour)Plugin.instance).StartCoroutine(CreateAngryUIAsync());
		}

		[IteratorStateMachine(typeof(<CreateAngryUIAsync>d__3))]
		private static IEnumerator CreateAngryUIAsync()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <CreateAngryUIAsync>d__3(0);
		}

		internal static void ReloadScript()
		{
			if (string.IsNullOrEmpty(UpdatedScript))
			{
				return;
			}
			if (AngrySceneManager.isInCustomLevel)
			{
				InternalConfigManager.instantLoadLevel.value = true;
				InternalConfigManager.instantLoadLevelGuid.value = AngrySceneManager.currentBundleContainer.bundleGuid;
				InternalConfigManager.instantLoadLevelId.value = AngrySceneManager.currentLevelContainer.levelId;
			}
			PluginConfiguratorController.FlushAllConfigs();
			ProcessStartInfo processStartInfo = new ProcessStartInfo
			{
				FileName = Path.Combine(Directory.GetParent(Application.dataPath).FullName, "ULTRAKILL.exe"),
				WorkingDirectory = Directory.GetParent(Application.dataPath).FullName,
				UseShellExecute = false,
				RedirectStandardError = true,
				RedirectStandardOutput = true
			};
			string[] array = new string[7] { "DOORSTOP_DISABLE", "DOORSTOP_DLL_SEARCH_DIRS", "DOORSTOP_INITIALIZED", "DOORSTOP_INVOKE_DLL_PATH", "DOORSTOP_MANAGED_FOLDER_DIR", "DOORSTOP_MONO_LIB_PATH", "DOORSTOP_PROCESS_PATH" };
			foreach (string key in array)
			{
				if (processStartInfo.EnvironmentVariables.ContainsKey(key))
				{
					processStartInfo.EnvironmentVariables.Remove(key);
				}
				if (processStartInfo.Environment.ContainsKey(key))
				{
					processStartInfo.Environment.Remove(key);
				}
			}
			Process.Start(processStartInfo);
			Application.Quit();
		}

		private static void ShowReloadScriptPrompt()
		{
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Expected O, but got Unknown
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Expected O, but got Unknown
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Expected O, but got Unknown
			if ((Object)(object)currentPanel == (Object)null || !AngrySceneManager.isInCustomLevel || string.IsNullOrEmpty(UpdatedScript) || ((Component)currentPanel.reloadScriptPrompt).gameObject.activeSe

plugins/AngryLevelLoader/AngryUiComponents.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("AngryUiComponents")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+9434d305d6d7e2d913c69afe409f247076c1fe94")]
[assembly: AssemblyProduct("AngryUiComponents")]
[assembly: AssemblyTitle("AngryUiComponents")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace AngryUiComponents;

public class AngryBundleSortFieldComponent : MonoBehaviour
{
	private class GraphicCopier : MonoBehaviour
	{
		public Graphic thisGraphic;

		public CanvasRenderer thisRenderer;

		public Graphic targetGraphic;

		public CanvasRenderer targetRenderer;

		private void Start()
		{
			if ((Object)(object)thisGraphic == (Object)null)
			{
				thisGraphic = ((Component)this).GetComponent<Graphic>();
			}
			if ((Object)(object)thisRenderer == (Object)null)
			{
				thisRenderer = ((Component)this).GetComponent<CanvasRenderer>();
			}
		}

		private void Update()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)targetGraphic != (Object)null && (Object)(object)thisGraphic != (Object)null && (Object)(object)thisRenderer != (Object)null && (Object)(object)targetRenderer != (Object)null)
			{
				targetGraphic.color = thisGraphic.color;
				targetRenderer.SetColor(thisRenderer.GetColor());
			}
		}
	}

	private struct ButtonInfo
	{
		public Button button;

		public Image bg;

		public TextMeshProUGUI text;

		public GraphicCopier copier;

		public ButtonInfo(Button button, Image bg, TextMeshProUGUI frame, GraphicCopier copier)
		{
			this.button = button;
			this.bg = bg;
			text = frame;
			this.copier = copier;
		}
	}

	public Button favSortButton;

	public Image favSortIcon;

	[Space(5f)]
	public Button nameButton;

	public Image nameBg;

	public Image nameFrame;

	public TextMeshProUGUI nameText;

	private GraphicCopier nameCopier;

	[Space(5f)]
	public Button authorButton;

	public Image authorBg;

	public Image authorFrame;

	public TextMeshProUGUI authorText;

	private GraphicCopier authorCopier;

	[Space(5f)]
	public Button lastUpdateButton;

	public Image lastUpdateBg;

	public Image lastUpdateFrame;

	public TextMeshProUGUI lastUpdateText;

	private GraphicCopier lastUpdateCopier;

	[Space(5f)]
	public Button lastPlayedButton;

	public Image lastPlayedBg;

	public Image lastPlayedFrame;

	public TextMeshProUGUI lastPlayedText;

	private GraphicCopier lastPlayedCopier;

	private bool _inited;

	private void Init()
	{
		if (!_inited)
		{
			_inited = true;
			nameCopier = ((Component)nameFrame).gameObject.AddComponent<GraphicCopier>();
			authorCopier = ((Component)authorFrame).gameObject.AddComponent<GraphicCopier>();
			lastUpdateCopier = ((Component)lastUpdateFrame).gameObject.AddComponent<GraphicCopier>();
			lastPlayedCopier = ((Component)lastPlayedFrame).gameObject.AddComponent<GraphicCopier>();
			nameCopier.targetGraphic = (Graphic)(object)nameText;
			authorCopier.targetGraphic = (Graphic)(object)authorText;
			lastUpdateCopier.targetGraphic = (Graphic)(object)lastUpdateText;
			lastPlayedCopier.targetGraphic = (Graphic)(object)lastPlayedText;
		}
	}

	private void Awake()
	{
		Init();
	}

	public void SetButtonSelected(Button button)
	{
		//IL_0130: Unknown result type (might be due to invalid IL or missing references)
		//IL_0140: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		Init();
		ButtonInfo[] array = new ButtonInfo[4]
		{
			new ButtonInfo(nameButton, nameBg, nameText, nameCopier),
			new ButtonInfo(authorButton, authorBg, authorText, authorCopier),
			new ButtonInfo(lastUpdateButton, lastUpdateBg, lastUpdateText, lastUpdateCopier),
			new ButtonInfo(lastPlayedButton, lastPlayedBg, lastPlayedText, lastPlayedCopier)
		};
		for (int i = 0; i < array.Length; i++)
		{
			ButtonInfo buttonInfo = array[i];
			if ((Object)(object)buttonInfo.button == (Object)(object)button)
			{
				buttonInfo.copier.targetGraphic = (Graphic)(object)buttonInfo.bg;
				buttonInfo.copier.targetRenderer = ((Component)buttonInfo.bg).GetComponent<CanvasRenderer>();
				((Graphic)buttonInfo.bg).color = Color.white;
				((Graphic)buttonInfo.text).color = Color.black;
			}
			else
			{
				buttonInfo.copier.targetGraphic = (Graphic)(object)buttonInfo.text;
				buttonInfo.copier.targetRenderer = ((Component)buttonInfo.text).GetComponent<CanvasRenderer>();
				((Graphic)buttonInfo.bg).color = Color.black;
				((Graphic)buttonInfo.text).color = Color.white;
			}
		}
	}
}
public class AngryCustomLevelButtonComponent : MonoBehaviour
{
	public RectTransform rect;

	public Button button;

	public Image background;

	public TextMeshProUGUI text;
}
public class AngryDeleteBundleNotificationComponent : MonoBehaviour
{
	public Text body;

	public Text bundleName;

	public Image bundleIcon;

	public Button cancelButton;

	public Button deleteButton;

	public Text deleteText;
}
public class AngryDeleteOldBundlesNotificationComponent : MonoBehaviour
{
	public Text body;

	public Button cancelButton;

	public Text cancelButtonText;

	public Button deleteButton;

	public Text deleteButtonText;

	public GameObject loadingCircle;

	public Text deletionProgress;

	public Text deletionLog;
}
public class AngryDifficultyFieldComponent : MonoBehaviour
{
	public CanvasGroup group;

	public Dropdown difficultyList;

	public Dropdown gamemodeList;
}
public class AngryEpilepsyWarningNotificationComponent : MonoBehaviour
{
	public Button cancelButton;

	public Button continueButton;

	public Text continueButtonText;

	public Button continueAndIgnoreButton;

	public Text continueAndIgnoreButtonText;
}
public class AngryFolderButtonComponent : MonoBehaviour
{
	public TextMeshProUGUI folderName;

	public Button folderButton;

	public RawImage folderIcon;
}
public class AngryLeaderboardNotificationComponent : MonoBehaviour
{
	public Text header;

	public Dropdown category;

	public Dropdown difficulty;

	public Dropdown group;

	public GameObject localUserRecordContainer;

	public RawImage localUserPfp;

	public Text localUserRank;

	public Text localUserName;

	public Text localUserTime;

	public GameObject recordEnabler;

	public Transform recordContainer;

	public AngryLeaderboardRecordEntryComponent recordTemplate;

	public GameObject pageText;

	public Button nextPage;

	public Button prevPage;

	public InputField pageInput;

	public Button closeButton;

	public GameObject refreshCircle;

	public Text failMessage;

	public Button refreshButton;

	public GameObject reportToggle;

	public GameObject reportFormToggle;

	public GameObject reportResultToggle;

	public Text reportBody;

	public GameObject reportLoadCircle;

	public Toggle inappropriateName;

	public Toggle inappropriatePicture;

	public Toggle cheatedScore;

	public Toggle reportValidation;

	public Button reportCancel;

	public Button reportSend;

	public Button reportReturn;

	public AngryManageUserComponent manageUserPanel;

	public AngryUserHistoryPanelComponent historyPanel;
}
public class AngryLeaderboardPermissionNotificationComponent : MonoBehaviour
{
	public Button cancelButton;

	public Button okButton;
}
public class AngryLeaderboardRecordEntryComponent : MonoBehaviour
{
	public Text rank;

	public Text username;

	public Text time;

	public RawImage profile;

	public Button reportButton;
}
public class AngryLevelFieldComponent : MonoBehaviour
{
	private class OnDisableCallback : MonoBehaviour
	{
		public Action callback;

		private void OnDisable()
		{
			if (callback != null)
			{
				callback();
			}
		}
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass41_0
	{
		public Action cb;

		internal void <ResetButtonCoroutine>b__0()
		{
			if (cb != null)
			{
				cb();
			}
		}
	}

	[CompilerGenerated]
	private sealed class <ResetButtonCoroutine>d__41 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public Action cb;

		public Button btn;

		public TextMeshProUGUI txt;

		private <>c__DisplayClass41_0 <>8__1;

		private int <i>5__2;

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

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

		[DebuggerHidden]
		public <ResetButtonCoroutine>d__41(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

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

		private bool MoveNext()
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Expected O, but got Unknown
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Expected O, but got Unknown
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>8__1 = new <>c__DisplayClass41_0();
				<>8__1.cb = cb;
				((Selectable)btn).interactable = false;
				<i>5__2 = 3;
				break;
			case 1:
				<>1__state = -1;
				<i>5__2--;
				break;
			}
			if (<i>5__2 >= 1)
			{
				((TMP_Text)txt).text = $"Are you sure? ({<i>5__2})";
				<>2__current = (object)new WaitForSecondsRealtime(1f);
				<>1__state = 1;
				return true;
			}
			((TMP_Text)txt).text = "<color=red>Are you sure?</color>";
			((Selectable)btn).interactable = true;
			btn.onClick = new ButtonClickedEvent();
			((UnityEvent)btn.onClick).AddListener((UnityAction)delegate
			{
				if (<>8__1.cb != null)
				{
					<>8__1.cb();
				}
			});
			return false;
		}

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

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

	public Text levelHeader;

	public Image fieldImage;

	public RectTransform statContainer;

	public Image statContainerImage;

	public Text[] headers;

	public Text timeText;

	public Text killText;

	public Text styleText;

	public Text secretsText;

	public Text secretsHeader;

	public GameObject secretsIconContainer;

	public Image[] secretsIcons;

	public GameObject settingsPanel;

	public Button openSettingsButton;

	public Button closeSettingsButton;

	public Button resetStatsButton;

	public TextMeshProUGUI resetStatsText;

	public Button resetSecretsButton;

	public TextMeshProUGUI resetSecretsText;

	public Button resetChallengeButton;

	public TextMeshProUGUI resetChallengeText;

	public Button resetLevelVarsButton;

	public TextMeshProUGUI resetLevelVarsText;

	public Button resetBundleVarsButton;

	public TextMeshProUGUI resetBundleVarsText;

	public Button resetUserVarsButton;

	public TextMeshProUGUI resetUserVarsText;

	public Action onResetStats;

	public Action onResetSecrets;

	public Action onResetChallenge;

	public Action onResetLevelVars;

	public Action onResetBundleVars;

	public Action onResetUserVars;

	public Image finalRankContainerImage;

	public Text finalRankText;

	public RectTransform challengeContainer;

	public Image challengeContainerImage;

	public Text challengeText;

	public Image levelThumbnail;

	public Button levelButton;

	public Button leaderboardsButton;

	private void Awake()
	{
		settingsPanel.AddComponent<OnDisableCallback>().callback = delegate
		{
			((MonoBehaviour)this).StopAllCoroutines();
		};
		ResetSettingsButtons();
	}

	public void ResetSettingsButtons()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Expected O, but got Unknown
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Expected O, but got Unknown
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Expected O, but got Unknown
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Expected O, but got Unknown
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Expected O, but got Unknown
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Expected O, but got Unknown
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Expected O, but got Unknown
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Expected O, but got Unknown
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ec: Expected O, but got Unknown
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_010d: Expected O, but got Unknown
		resetStatsButton.onClick = new ButtonClickedEvent();
		((UnityEvent)resetStatsButton.onClick).AddListener(new UnityAction(OnResetStats));
		resetSecretsButton.onClick = new ButtonClickedEvent();
		((UnityEvent)resetSecretsButton.onClick).AddListener(new UnityAction(OnResetSecrets));
		resetChallengeButton.onClick = new ButtonClickedEvent();
		((UnityEvent)resetChallengeButton.onClick).AddListener(new UnityAction(OnResetChallenge));
		resetLevelVarsButton.onClick = new ButtonClickedEvent();
		((UnityEvent)resetLevelVarsButton.onClick).AddListener(new UnityAction(OnResetLevelVars));
		resetBundleVarsButton.onClick = new ButtonClickedEvent();
		((UnityEvent)resetBundleVarsButton.onClick).AddListener(new UnityAction(OnResetBundleVars));
		resetUserVarsButton.onClick = new ButtonClickedEvent();
		((UnityEvent)resetUserVarsButton.onClick).AddListener(new UnityAction(onResetUserVars.Invoke));
	}

	public void OnResetStats()
	{
		((Selectable)resetStatsButton).interactable = false;
		((MonoBehaviour)this).StartCoroutine(ResetButtonCoroutine(resetStatsButton, resetStatsText, onResetStats));
	}

	public void OnResetSecrets()
	{
		((Selectable)resetSecretsButton).interactable = false;
		((MonoBehaviour)this).StartCoroutine(ResetButtonCoroutine(resetSecretsButton, resetSecretsText, onResetSecrets));
	}

	public void OnResetChallenge()
	{
		((Selectable)resetChallengeButton).interactable = false;
		((MonoBehaviour)this).StartCoroutine(ResetButtonCoroutine(resetChallengeButton, resetChallengeText, onResetChallenge));
	}

	public void OnResetLevelVars()
	{
		((Selectable)resetLevelVarsButton).interactable = false;
		((MonoBehaviour)this).StartCoroutine(ResetButtonCoroutine(resetLevelVarsButton, resetLevelVarsText, onResetLevelVars));
	}

	public void OnResetBundleVars()
	{
		((Selectable)resetBundleVarsButton).interactable = false;
		((MonoBehaviour)this).StartCoroutine(ResetButtonCoroutine(resetBundleVarsButton, resetBundleVarsText, onResetBundleVars));
	}

	[IteratorStateMachine(typeof(<ResetButtonCoroutine>d__41))]
	private IEnumerator ResetButtonCoroutine(Button btn, TextMeshProUGUI txt, Action cb)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <ResetButtonCoroutine>d__41(0)
		{
			btn = btn,
			txt = txt,
			cb = cb
		};
	}
}
public class AngryLevelUpdateNotificationComponent : MonoBehaviour
{
	public Text body;

	public Button cancel;

	public Button update;
}
public class AngryManageUserComponent : MonoBehaviour
{
	public GameObject managePanel;

	public RawImage userIcon;

	public Text userInfo;

	public Toggle cencorProfilePicture;

	public Toggle cencorProfileName;

	public Toggle banUser;

	public Toggle removeRecord;

	public Toggle removeAll;

	public Button cancelManage;

	public Button applyManage;

	public GameObject warningPanel;

	public RawImage warningUserIcon;

	public Text warningUserInfo;

	public Button warningCancelButton;

	public Button warningSubmitButton;

	public Text warningSubmitButtonText;

	public GameObject resultPanel;

	public GameObject loadingCircle;

	public Text resultText;

	public Button returnButton;

	public Button historyButton;
}
public class AngryNoMoNotSupportedNotificationComponent : MonoBehaviour
{
	public Button cancelButton;

	public Button continueButton;

	public Text continueButtonText;

	public Button continueAndIgnoreButton;

	public Text continueAndIgnoreButtonText;
}
public class AngryOnlineLevelFieldComponent : MonoBehaviour
{
	public RawImage thumbnail;

	public Text infoText;

	public Button changelog;

	public Button install;

	public Button update;

	public Button cancel;

	public Button upvoteButton;

	public Image upvoteImage;

	public Button downvoteButton;

	public Image downvoteImage;

	public Text votes;

	public RectTransform downloadContainer;

	public Text progressText;

	public RectTransform progressBar;
}
public class AngryOnlineSortFieldComponent : MonoBehaviour
{
	private class GraphicCopier : MonoBehaviour
	{
		public Graphic thisGraphic;

		public CanvasRenderer thisRenderer;

		public Graphic targetGraphic;

		public CanvasRenderer targetRenderer;

		private void Start()
		{
			if ((Object)(object)thisGraphic == (Object)null)
			{
				thisGraphic = ((Component)this).GetComponent<Graphic>();
			}
			if ((Object)(object)thisRenderer == (Object)null)
			{
				thisRenderer = ((Component)this).GetComponent<CanvasRenderer>();
			}
		}

		private void Update()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)targetGraphic != (Object)null && (Object)(object)thisGraphic != (Object)null && (Object)(object)thisRenderer != (Object)null && (Object)(object)targetRenderer != (Object)null)
			{
				targetGraphic.color = thisGraphic.color;
				targetRenderer.SetColor(thisRenderer.GetColor());
			}
		}
	}

	private struct ButtonInfo
	{
		public Button button;

		public Image bg;

		public TextMeshProUGUI text;

		public GraphicCopier copier;

		public ButtonInfo(Button button, Image bg, TextMeshProUGUI frame, GraphicCopier copier)
		{
			this.button = button;
			this.bg = bg;
			text = frame;
			this.copier = copier;
		}
	}

	public Button refreshButton;

	[Space(5f)]
	public Button nameButton;

	public Image nameBg;

	public Image nameFrame;

	public TextMeshProUGUI nameText;

	private GraphicCopier nameCopier;

	[Space(5f)]
	public Button authorButton;

	public Image authorBg;

	public Image authorFrame;

	public TextMeshProUGUI authorText;

	private GraphicCopier authorCopier;

	[Space(5f)]
	public Button lastUpdateButton;

	public Image lastUpdateBg;

	public Image lastUpdateFrame;

	public TextMeshProUGUI lastUpdateText;

	private GraphicCopier lastUpdateCopier;

	[Space(5f)]
	public Button votesButton;

	public Image votesBg;

	public Image votesFrame;

	public TextMeshProUGUI votesText;

	private GraphicCopier votesCopier;

	private bool _inited;

	private void Init()
	{
		if (!_inited)
		{
			_inited = true;
			nameCopier = ((Component)nameFrame).gameObject.AddComponent<GraphicCopier>();
			authorCopier = ((Component)authorFrame).gameObject.AddComponent<GraphicCopier>();
			lastUpdateCopier = ((Component)lastUpdateFrame).gameObject.AddComponent<GraphicCopier>();
			votesCopier = ((Component)votesFrame).gameObject.AddComponent<GraphicCopier>();
			nameCopier.targetGraphic = (Graphic)(object)nameText;
			authorCopier.targetGraphic = (Graphic)(object)authorText;
			lastUpdateCopier.targetGraphic = (Graphic)(object)lastUpdateText;
			votesCopier.targetGraphic = (Graphic)(object)votesText;
		}
	}

	private void Awake()
	{
		Init();
	}

	public void SetButtonSelected(Button button)
	{
		//IL_0130: Unknown result type (might be due to invalid IL or missing references)
		//IL_0140: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		Init();
		ButtonInfo[] array = new ButtonInfo[4]
		{
			new ButtonInfo(nameButton, nameBg, nameText, nameCopier),
			new ButtonInfo(authorButton, authorBg, authorText, authorCopier),
			new ButtonInfo(lastUpdateButton, lastUpdateBg, lastUpdateText, lastUpdateCopier),
			new ButtonInfo(votesButton, votesBg, votesText, votesCopier)
		};
		for (int i = 0; i < array.Length; i++)
		{
			ButtonInfo buttonInfo = array[i];
			if ((Object)(object)buttonInfo.button == (Object)(object)button)
			{
				buttonInfo.copier.targetGraphic = (Graphic)(object)buttonInfo.bg;
				buttonInfo.copier.targetRenderer = ((Component)buttonInfo.bg).GetComponent<CanvasRenderer>();
				((Graphic)buttonInfo.bg).color = Color.white;
				((Graphic)buttonInfo.text).color = Color.black;
			}
			else
			{
				buttonInfo.copier.targetGraphic = (Graphic)(object)buttonInfo.text;
				buttonInfo.copier.targetRenderer = ((Component)buttonInfo.text).GetComponent<CanvasRenderer>();
				((Graphic)buttonInfo.bg).color = Color.black;
				((Graphic)buttonInfo.text).color = Color.white;
			}
		}
	}
}
public class AngryOnlineStatusFilterComponent : MonoBehaviour
{
	public Toggle installed;

	public Toggle notInstalled;

	public Toggle updateAvailable;
}
public class AngryPluginChangelogNotificationComponent : MonoBehaviour
{
	public Text header;

	public Text text;

	public Button cancel;

	public Button ignoreUpdate;
}
public class AngryReloadBundlePromptComponent : MonoBehaviour
{
	public CanvasGroup division;

	public AudioSource audio;

	public Text text;

	public Button ignoreButton;

	public Button reloadButton;

	private bool transparent;

	private const float TARGET_ALPHA = 0.6f;

	public void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Expected O, but got Unknown
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Expected O, but got Unknown
		ignoreButton.onClick = new ButtonClickedEvent();
		((UnityEvent)ignoreButton.onClick).AddListener((UnityAction)delegate
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			reloadButton.onClick = new ButtonClickedEvent();
			((Component)this).gameObject.SetActive(false);
		});
	}

	public void MakeTransparent(bool instant)
	{
		transparent = true;
		if (instant)
		{
			division.alpha = 0.6f;
		}
	}

	public void MakeOpaque(bool instant)
	{
		transparent = false;
		if (instant)
		{
			division.alpha = 1f;
		}
	}

	public void Update()
	{
		if (transparent && division.alpha != 0.6f)
		{
			division.alpha = Mathf.MoveTowards(division.alpha, 0.6f, Time.unscaledDeltaTime * 2f);
		}
		else if (!transparent && division.alpha != 1f)
		{
			division.alpha = Mathf.MoveTowards(division.alpha, 1f, Time.unscaledDeltaTime * 2f);
		}
	}
}
public class AngryReloadScriptPromptComponent : MonoBehaviour
{
	public CanvasGroup division;

	public AudioSource audio;

	public Text text;

	public Button ignoreButton;

	public Button reloadButton;

	private bool transparent;

	private const float TARGET_ALPHA = 0.6f;

	public void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Expected O, but got Unknown
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Expected O, but got Unknown
		ignoreButton.onClick = new ButtonClickedEvent();
		((UnityEvent)ignoreButton.onClick).AddListener((UnityAction)delegate
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			reloadButton.onClick = new ButtonClickedEvent();
			((Component)this).gameObject.SetActive(false);
		});
	}

	public void MakeTransparent(bool instant)
	{
		transparent = true;
		if (instant)
		{
			division.alpha = 0.6f;
		}
	}

	public void MakeOpaque(bool instant)
	{
		transparent = false;
		if (instant)
		{
			division.alpha = 1f;
		}
	}

	public void Update()
	{
		if (transparent && division.alpha != 0.6f)
		{
			division.alpha = Mathf.MoveTowards(division.alpha, 0.6f, Time.unscaledDeltaTime * 2f);
		}
		else if (!transparent && division.alpha != 1f)
		{
			division.alpha = Mathf.MoveTowards(division.alpha, 1f, Time.unscaledDeltaTime * 2f);
		}
	}
}
public class AngryResetUserMapVarNotificationComponent : MonoBehaviour
{
	public GameObject notFoundText;

	public AngryResetUserMapVarNotificationElementComponent template;

	public Button exitButton;

	public AngryResetUserMapVarNotificationElementComponent CreateTemplate()
	{
		GameObject obj = Object.Instantiate<GameObject>(((Component)template).gameObject, ((Component)template).transform.parent);
		obj.SetActive(true);
		return obj.GetComponent<AngryResetUserMapVarNotificationElementComponent>();
	}
}
public class AngryResetUserMapVarNotificationElementComponent : MonoBehaviour
{
	[CompilerGenerated]
	private sealed class <>c__DisplayClass5_0
	{
		public Action cb;

		internal void <ResetButtonCoroutine>b__0()
		{
			if (cb != null)
			{
				cb();
			}
		}
	}

	[CompilerGenerated]
	private sealed class <ResetButtonCoroutine>d__5 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public Action cb;

		public Button btn;

		public TextMeshProUGUI txt;

		private <>c__DisplayClass5_0 <>8__1;

		private int <i>5__2;

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

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

		[DebuggerHidden]
		public <ResetButtonCoroutine>d__5(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

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

		private bool MoveNext()
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Expected O, but got Unknown
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Expected O, but got Unknown
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>8__1 = new <>c__DisplayClass5_0();
				<>8__1.cb = cb;
				((Selectable)btn).interactable = false;
				<i>5__2 = 3;
				break;
			case 1:
				<>1__state = -1;
				<i>5__2--;
				break;
			}
			if (<i>5__2 >= 1)
			{
				((TMP_Text)txt).text = $"Are you sure? ({<i>5__2})";
				<>2__current = (object)new WaitForSecondsRealtime(1f);
				<>1__state = 1;
				return true;
			}
			((TMP_Text)txt).text = "<color=red>Are you sure?</color>";
			((Selectable)btn).interactable = true;
			btn.onClick = new ButtonClickedEvent();
			((UnityEvent)btn.onClick).AddListener((UnityAction)delegate
			{
				if (<>8__1.cb != null)
				{
					<>8__1.cb();
				}
			});
			return false;
		}

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

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

	public TextMeshProUGUI id;

	public Button resetButton;

	public TextMeshProUGUI resetButtonText;

	public Action onReset;

	public void SetButton()
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Expected O, but got Unknown
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Expected O, but got Unknown
		((TMP_Text)resetButtonText).text = "Reset";
		resetButton.onClick = new ButtonClickedEvent();
		((UnityEvent)resetButton.onClick).AddListener((UnityAction)delegate
		{
			((MonoBehaviour)this).StartCoroutine(ResetButtonCoroutine(resetButton, resetButtonText, onReset));
		});
	}

	[IteratorStateMachine(typeof(<ResetButtonCoroutine>d__5))]
	private IEnumerator ResetButtonCoroutine(Button btn, TextMeshProUGUI txt, Action cb)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <ResetButtonCoroutine>d__5(0)
		{
			btn = btn,
			txt = txt,
			cb = cb
		};
	}
}
public class AngryScriptUpdateNotificationComponent : MonoBehaviour
{
	public Transform content;

	public Button cancel;

	public Button update;

	public Button continueButton;
}
public class AngryScriptWarningNotificationComponent : MonoBehaviour
{
	public Text header;

	public Text body;

	public Button topButton;

	public Text topButtonText;

	public Button leftButton;

	public Text leftButtonText;

	public Button rightButton;

	public Text rightButtonText;
}
public class AngryUIPanelComponent : MonoBehaviour
{
	public AngryReloadBundlePromptComponent reloadBundlePrompt;

	public AngryReloadScriptPromptComponent reloadScriptPrompt;
}
public class AngryUserHistoryPanelComponent : MonoBehaviour
{
	public RawImage userIcon;

	public Text userInfo;

	public Button backButton;

	public Button nextPageButton;

	public Button prevPageButton;

	public InputField pageNumber;

	public Dropdown categoryFilter;

	public Dropdown difficultyFilter;

	public Dropdown sortOrder;

	public Toggle reverseOrder;

	public InputField bundleName;

	public InputField levelName;

	public CanvasGroup inputGroup;

	public AngryUserRecordEntryComponent template;

	public GameObject loadingCircle;
}
public class AngryUserRecordEntryComponent : MonoBehaviour
{
	public RawImage bundleIcon;

	public RawImage levelIcon;

	public TextMeshProUGUI bundleInfo;

	public TextMeshProUGUI recordInfo;

	public TextMeshProUGUI time;
}

plugins/AngryLevelLoader/RudeLevelScripts.Essentials.dll

Decompiled 2 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using UnityEngine;
using UnityEngine.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("RudeLevelScripts.Essentials")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+9434d305d6d7e2d913c69afe409f247076c1fe94")]
[assembly: AssemblyProduct("RudeLevelScripts.Essentials")]
[assembly: AssemblyTitle("RudeLevelScripts.Essentials")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace RudeLevelScript
{
	public class FinalRoomTarget : MonoBehaviour
	{
		[Tooltip("If a valid Unique ID of a Rude Level Data is written, the level will be loaded. This ID can be in other bundles. If the id is invalid or the level is not available, returns to the main menu")]
		public string targetLevelUniqueId = "";
	}
	[CreateAssetMenu]
	public class RudeLevelData : ScriptableObject
	{
		[SerializeField]
		[Tooltip("Scene which belongs to the data")]
		public Object targetScene;

		[SerializeField]
		[HideInInspector]
		public string[] requiredDllNames;

		[HideInInspector]
		public string scenePath = "";

		[Header("Level Locator")]
		[Tooltip("This ID is used to reference the level externally, such as final pit targets or activasion scripts. This field must not match any other data's id even accross bundles. Strong naming suggested, such as including author name in the id")]
		public string uniqueIdentifier = "";

		[Space(10f)]
		[Header("Level Info")]
		[Tooltip("Name which will be displayed on angry")]
		public string levelName = "";

		[Tooltip("If the level is secret and uses FirstRoomSecret variant, set to true. Enabling this field will disable rank and challenge panel on angry side")]
		public bool isSecretLevel;

		[Tooltip("Order of the level in angry. Lower valued levels are at the top")]
		public int prefferedLevelOrder;

		[Tooltip("Sprite containing the level thumbnail. Label the sprite as well")]
		public Sprite levelPreviewImage;

		[Space(10f)]
		[Tooltip("Enablind this field will hide the level from angry until accessed by a final pit. Implemented for secret levels")]
		public bool hideIfNotPlayed;

		[Tooltip("The level IDs required to be completed before the level can be played. If one of the level ID's are not completed, level will be locked")]
		public string[] requiredCompletedLevelIdsForUnlock;

		[Space(10f)]
		public bool levelChallengeEnabled;

		public string levelChallengeText = "";

		[Tooltip("Set exactly to the number of secret bonuses in the level")]
		public int secretCount;

		public bool doNotHideLevelPreviewWhenNotCompleted;

		public bool doNotExport;

		public bool doesNotSupportNoMo;
	}
}
namespace RudeLevelScripts
{
	public class RudeMapVarHandler : MonoBehaviour
	{
		[Header("This is the id of the file to register the list of MapVars below with. Keep in mind, fileID's are not bundle or level specific.", order = 0)]
		[Header("With this in mind, please use an id that is unique to you.", order = 1)]
		public string fileID;

		[Space(10f)]
		[Header("Every MapVar key you list here will be registered to be set/read from the provided fileID. ", order = 2)]
		[Header("For any MapVarSetter components that use keys in this list,", order = 3)]
		[Header("their persistence setting will be ignored and it will only read/write to the provided fileID.", order = 4)]
		public List<string> varList;

		private const int MAX_FILE_NAME_LENGTH = 48;

		public bool IsValid()
		{
			if (string.IsNullOrEmpty(fileID) || string.IsNullOrWhiteSpace(fileID))
			{
				Debug.LogError((object)("(" + ((Object)this).name + ") RudeMapVarHandler.fileID is empty, null, or whitespace."));
				return false;
			}
			if (fileID.IndexOfAny(Path.GetInvalidFileNameChars()) != -1)
			{
				Debug.LogError((object)("(" + ((Object)this).name + ") RudeMapVarHandler.fileID contains invalid characters."));
				return false;
			}
			if (fileID.Length > 48)
			{
				Debug.LogError((object)string.Format("({0}) {1}.{2} is too long. Max length is {3} characters.", ((Object)this).name, "RudeMapVarHandler", "fileID", 48));
				return false;
			}
			return true;
		}

		private void OnValidate()
		{
			if (fileID == null)
			{
				fileID = Guid.NewGuid().ToString();
			}
			char[] invalidFileNameChars = Path.GetInvalidFileNameChars();
			if (fileID.IndexOfAny(invalidFileNameChars) != -1)
			{
				Debug.LogError((object)"RudeMapVarHandler: fileID of RudeMapVarHandler contains invalid characters.");
				for (int i = 0; i < invalidFileNameChars.Length; i++)
				{
					fileID = fileID.Replace(invalidFileNameChars[i], '_');
				}
			}
			if (fileID.Length > 48)
			{
				fileID = fileID.Substring(0, Mathf.Min(fileID.Length, 48));
			}
		}
	}
}
namespace RudeLevelScripts.Essentials
{
	public class ExecuteOnSceneLoad : MonoBehaviour
	{
		[Tooltip("Lower value ExecuteOnSceneLoad are executed first")]
		public int relativeExecutionOrder;

		public UnityEvent onSceneLoad;

		public void Execute()
		{
			if (onSceneLoad != null)
			{
				onSceneLoad.Invoke();
			}
		}
	}
	public class IgnoreSecret : MonoBehaviour
	{
	}
	[CreateAssetMenu]
	public class RudeBundleData : ScriptableObject
	{
		[Tooltip("Will be shown on the angry bundle list")]
		public string bundleName;

		[Tooltip("Will be shown below the bundle name")]
		public string author;

		[Tooltip("Icon shown right next to the level name. Must be in png format. If not square, gets cropped")]
		public Sprite levelIcon;

		[Tooltip("Flag this field if the bundle contains levels that contains seizure inducing elements")]
		public bool epilepsyWarning;
	}
}

plugins/AngryLevelLoader/Scripts/AngryLoaderAPI.dll

Decompiled 2 days ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using AngryLevelLoader;
using AngryLevelLoader.Managers;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("AngryLoaderAPI")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+9434d305d6d7e2d913c69afe409f247076c1fe94")]
[assembly: AssemblyProduct("AngryLoaderAPI")]
[assembly: AssemblyTitle("AngryLoaderAPI")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace AngryLoaderAPI;

public static class BundleInterface
{
	public static bool BundleExists(string bundleGuid)
	{
		return RudeBundleInterface.BundleExists(bundleGuid);
	}

	public static string GetBundleBuildHash(string bundleGuid)
	{
		return RudeBundleInterface.GetBundleBuildHash(bundleGuid);
	}
}
public static class GamemodeInterface
{
	public enum Gamemode
	{
		None,
		NoMonsters,
		NoMonstersAndWeapons
	}

	public static Gamemode GetCurrentGamemode()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Expected I4, but got Unknown
		Gamemode currentGamemode = RudeGamemodeInterface.GetCurrentGamemode();
		return (int)currentGamemode switch
		{
			1 => Gamemode.NoMonsters, 
			2 => Gamemode.NoMonstersAndWeapons, 
			_ => Gamemode.None, 
		};
	}
}
public static class LevelInterface
{
	public static char INCOMPLETE_LEVEL_CHAR = RudeLevelInterface.INCOMPLETE_LEVEL_CHAR;

	public static char GetLevelRank(string levelId)
	{
		return RudeLevelInterface.GetLevelRank(levelId);
	}

	public static bool GetLevelChallenge(string levelId)
	{
		return RudeLevelInterface.GetLevelChallenge(levelId);
	}

	public static bool GetLevelSecret(string levelId, int secretIndex)
	{
		return RudeLevelInterface.GetLevelSecret(levelId, secretIndex);
	}

	public static string GetCurrentLevelId()
	{
		return RudeLevelInterface.GetCurrentLevelId();
	}
}

plugins/AngryLevelLoader/Scripts/RudeLevelScripts.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AngryLoaderAPI;
using RudeLevelScript;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("RudeLevelScripts")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+9434d305d6d7e2d913c69afe409f247076c1fe94")]
[assembly: AssemblyProduct("RudeLevelScripts")]
[assembly: AssemblyTitle("RudeLevelScripts")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace RudeLevelScript
{
	[Serializable]
	public class LayerInfo
	{
		public string layerName = "";

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

			private Rigidbody rb;

			public static float defaultMoveForce = 67f;

			public float force = defaultMoveForce;

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

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

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

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

			public bool active;

			public float speed = 10f;

			public void Update()
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_003c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				if (active)
				{
					((Component)this).transform.localPosition = Vector3.MoveTowards(((Component)this).transform.localPosition, targetLocalPosition, Time.deltaTime * speed);
					if (((Component)this).transform.localPosition == targetLocalPosition)
					{
						Object.Destroy((Object)(object)this);
					}
				}
			}

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

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

			public Image targetImage;

			public AudioSource aud;

			private bool white = true;

			private RectTransform rect;

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

			private void Update()
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				//IL_0043: Unknown result type (might be due to invalid IL or missing references)
				rect.anchoredPosition = Vector2.MoveTowards(rect.anchoredPosition, targetPosition, Time.deltaTime * 4f * Vector3.Distance(Vector2.op_Implicit(rect.anchoredPosition), Vector2.op_Implicit(targetPosition)));
			}

			private void FlashImage()
			{
				//IL_005b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				if (white)
				{
					white = false;
					((Graphic)targetImage).color = new Color(0f, 0f, 0f, 0f);
					if (!((Component)this).gameObject.activeSelf)
					{
						return;
					}
					aud.Play();
				}
				else
				{
					white = true;
					((Graphic)targetImage).color = Color.white;
				}
				if (((Component)this).gameObject.activeInHierarchy)
				{
					((MonoBehaviour)this).Invoke("FlashImage", 0.075f);
				}
			}
		}

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

			public static UnityAction <>9__36_5;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

		public Color backgroundColor = Color.black;

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

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

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

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

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

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

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

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

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

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

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

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

		private bool spawned;

		public static float upDisablePos = 60f;

		public static float doorClosePos = 10f;

		public static float doorCloseSpeed = 10f;

		public static float actDelay = 0.5f;

		public static float ascendingPlayerSpawnPos = -55f;

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

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

		public void OnAfterDeserialize()
		{
		}

		private static Text MakeText(Transform parent)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject();
			((Transform)val.AddComponent<RectTransform>()).SetParent(parent);
			val.transform.localScale = Vector3.one;
			return val.AddComponent<Text>();
		}

		private static RectTransform MakeRect(Transform parent)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			RectTransform obj = new GameObject().AddComponent<RectTransform>();
			((Transform)obj).SetParent(parent);
			return obj;
		}

		public static void ConvertToAscendingFirstRoom(GameObject firstRoom, AudioClip doorCloseAud, List<GameObject> toEnable, List<GameObject> toDisable, bool doNotReplace)
		{
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0344: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0369: Unknown result type (might be due to invalid IL or missing references)
			//IL_036e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0389: Unknown result type (might be due to invalid IL or missing references)
			//IL_039e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_040d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0417: Expected O, but got Unknown
			//IL_041d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0427: Expected O, but got Unknown
			//IL_0438: Unknown result type (might be due to invalid IL or missing references)
			//IL_0442: Expected O, but got Unknown
			//IL_0442: Unknown result type (might be due to invalid IL or missing references)
			//IL_0447: Unknown result type (might be due to invalid IL or missing references)
			//IL_0462: Unknown result type (might be due to invalid IL or missing references)
			//IL_0477: Unknown result type (might be due to invalid IL or missing references)
			//IL_0481: Unknown result type (might be due to invalid IL or missing references)
			//IL_0487: Unknown result type (might be due to invalid IL or missing references)
			//IL_0491: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f1: Expected O, but got Unknown
			//IL_04f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0501: Expected O, but got Unknown
			//IL_0513: Unknown result type (might be due to invalid IL or missing references)
			//IL_051d: Expected O, but got Unknown
			//IL_052f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0539: Expected O, but got Unknown
			//IL_054a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0554: Expected O, but got Unknown
			//IL_0568: Unknown result type (might be due to invalid IL or missing references)
			//IL_0572: Expected O, but got Unknown
			//IL_0578: Unknown result type (might be due to invalid IL or missing references)
			//IL_0582: Expected O, but got Unknown
			//IL_0594: Unknown result type (might be due to invalid IL or missing references)
			//IL_059e: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: 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_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c8: Expected O, but got Unknown
			Transform val = firstRoom.transform.Find("Room");
			if (!doNotReplace)
			{
				Transform obj = val.Find("Pit (3)");
				((Component)obj).transform.localPosition = new Vector3(0f, 2f, 41.72f);
				((Component)obj).transform.localRotation = Quaternion.Euler(0f, 0f, 180f);
				Object.Destroy((Object)(object)((Component)((Component)val).transform.Find("Room/Ceiling")).gameObject);
				Transform val2 = ((Component)val).transform.Find("Room/Floor");
				GameObject gameObject = ((Component)val2.GetChild(0)).gameObject;
				GameObject obj2 = Object.Instantiate<GameObject>(gameObject, val2);
				obj2.transform.localPosition = new Vector3(-15f, 9.7f, 20.28f);
				obj2.transform.localRotation = Quaternion.identity;
				GameObject obj3 = Object.Instantiate<GameObject>(gameObject, val2);
				obj3.transform.localPosition = new Vector3(5f, 9.7f, 20.28f);
				obj3.transform.localRotation = Quaternion.identity;
				GameObject obj4 = Object.Instantiate<GameObject>(gameObject, val2);
				obj4.transform.localPosition = new Vector3(-5f, 9.7f, 0.2f);
				obj4.transform.localRotation = Quaternion.Euler(0f, -90f, 0f);
				GameObject obj5 = Object.Instantiate<GameObject>(gameObject, val2);
				obj5.transform.localPosition = new Vector3(5f, 9.7f, 10.28f);
				obj5.transform.localRotation = Quaternion.identity;
				((Renderer)obj5.GetComponent<MeshRenderer>()).materials = (Material[])(object)new Material[2]
				{
					Utils.metalDec20,
					Utils.metalDec20
				};
				GameObject obj6 = Object.Instantiate<GameObject>(gameObject, val2);
				obj6.transform.localPosition = new Vector3(-15f, 9.7f, 10.28f);
				obj6.transform.localRotation = Quaternion.identity;
				((Renderer)obj6.GetComponent<MeshRenderer>()).materials = (Material[])(object)new Material[2]
				{
					Utils.metalDec20,
					Utils.metalDec20
				};
				GameObject obj7 = Object.Instantiate<GameObject>(gameObject, val2);
				obj7.transform.localPosition = new Vector3(-5f, -0.3f, 20.28f);
				obj7.transform.localRotation = Quaternion.Euler(0f, -90f, -180f);
			}
			Transform child = val.Find("Decorations").GetChild(12);
			child.localPosition = new Vector3(-5f, 2f, 52f);
			LocalMoveTowards floorMover = ((Component)child).gameObject.AddComponent<LocalMoveTowards>();
			floorMover.targetLocalPosition = new Vector3(-5f, 2f, 42f);
			floorMover.speed = doorCloseSpeed;
			AudioSource floorTileAud = ((Component)child).gameObject.AddComponent<AudioSource>();
			floorTileAud.playOnAwake = false;
			floorTileAud.loop = false;
			floorTileAud.clip = doorCloseAud;
			PlayerActivator act = firstRoom.GetComponentsInChildren<PlayerActivator>().First();
			((Component)act).gameObject.SetActive(false);
			NewMovement instance = MonoSingleton<NewMovement>.Instance;
			((Component)instance).transform.localPosition = new Vector3(((Component)instance).transform.localPosition.x, ascendingPlayerSpawnPos, ((Component)instance).transform.localPosition.z);
			PlayerForcedMovement focedMov = ((Component)instance).gameObject.AddComponent<PlayerForcedMovement>();
			GameObject val3 = new GameObject();
			val3.transform.SetParent(((Component)act).transform.parent);
			val3.transform.localPosition = new Vector3(0f, upDisablePos, 0f);
			val3.transform.localRotation = Quaternion.identity;
			val3.transform.localScale = new Vector3(80f, 0.2f, 80f);
			val3.layer = ((Component)act).gameObject.layer;
			((Collider)val3.AddComponent<BoxCollider>()).isTrigger = true;
			ObjectActivator obj8 = val3.AddComponent<ObjectActivator>();
			obj8.dontActivateOnEnable = true;
			obj8.oneTime = true;
			obj8.events = new UltrakillEvent();
			obj8.events.onActivate = new UnityEvent();
			obj8.events.onActivate.AddListener((UnityAction)delegate
			{
				focedMov.DestroyComp();
			});
			GameObject val4 = new GameObject();
			val4.transform.SetParent(((Component)act).transform.parent);
			val4.transform.localPosition = new Vector3(0f, doorClosePos, 0f);
			val4.transform.localRotation = Quaternion.identity;
			val4.transform.localScale = new Vector3(80f, 0.2f, 80f);
			val4.layer = ((Component)act).gameObject.layer;
			((Collider)val4.AddComponent<BoxCollider>()).isTrigger = true;
			ObjectActivator obj9 = val4.AddComponent<ObjectActivator>();
			obj9.dontActivateOnEnable = true;
			obj9.oneTime = true;
			obj9.events = new UltrakillEvent();
			obj9.events.onActivate = new UnityEvent();
			obj9.events.onActivate.AddListener((UnityAction)delegate
			{
				floorMover.Activate();
			});
			obj9.events.onActivate.AddListener((UnityAction)delegate
			{
				floorTileAud.Play();
			});
			obj9.events.onActivate.AddListener((UnityAction)delegate
			{
				foreach (GameObject item in toEnable)
				{
					item.SetActive(true);
				}
				foreach (GameObject item2 in toDisable)
				{
					item2.SetActive(false);
				}
			});
			ObjectActivator obj10 = val4.AddComponent<ObjectActivator>();
			obj10.dontActivateOnEnable = true;
			obj10.oneTime = true;
			obj10.events = new UltrakillEvent();
			obj10.events.onActivate = new UnityEvent();
			obj10.events.onActivate.AddListener((UnityAction)delegate
			{
				((Component)act).gameObject.SetActive(true);
			});
			UnityEvent onActivate = obj10.events.onActivate;
			object obj11 = <>c.<>9__36_5;
			if (obj11 == null)
			{
				UnityAction val5 = delegate
				{
					//IL_000f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0014: Unknown result type (might be due to invalid IL or missing references)
					MonoSingleton<StatsManager>.Instance.spawnPos = ((Component)MonoSingleton<NewMovement>.Instance).transform.position;
				};
				<>c.<>9__36_5 = val5;
				obj11 = (object)val5;
			}
			onActivate.AddListener((UnityAction)obj11);
			obj10.delay = actDelay;
		}

		public void Spawn()
		{
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: 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_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Unknown result type (might be due to invalid IL or missing references)
			//IL_0388: 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_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_0365: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0412: Unknown result type (might be due to invalid IL or missing references)
			//IL_0417: Unknown result type (might be due to invalid IL or missing references)
			//IL_0490: Unknown result type (might be due to invalid IL or missing references)
			//IL_0495: Unknown result type (might be due to invalid IL or missing references)
			//IL_0496: Unknown result type (might be due to invalid IL or missing references)
			//IL_049d: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d2: 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_04e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0515: Unknown result type (might be due to invalid IL or missing references)
			//IL_0521: Unknown result type (might be due to invalid IL or missing references)
			//IL_0537: Unknown result type (might be due to invalid IL or missing references)
			//IL_0543: Unknown result type (might be due to invalid IL or missing references)
			//IL_054f: Unknown result type (might be due to invalid IL or missing references)
			//IL_055b: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c6e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c73: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c89: Unknown result type (might be due to invalid IL or missing references)
			//IL_0602: Unknown result type (might be due to invalid IL or missing references)
			//IL_0643: Unknown result type (might be due to invalid IL or missing references)
			//IL_0653: Unknown result type (might be due to invalid IL or missing references)
			//IL_065e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0669: Unknown result type (might be due to invalid IL or missing references)
			//IL_067e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0689: Unknown result type (might be due to invalid IL or missing references)
			//IL_0693: Unknown result type (might be due to invalid IL or missing references)
			//IL_09fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a01: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a0a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a3a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a3f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a48: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a6d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a72: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a73: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a7a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a8c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aa1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0abb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ac6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ad1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b32: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b34: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b6c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b76: Expected O, but got Unknown
			//IL_06c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0704: Unknown result type (might be due to invalid IL or missing references)
			//IL_0719: Unknown result type (might be due to invalid IL or missing references)
			//IL_0744: Unknown result type (might be due to invalid IL or missing references)
			//IL_0749: Unknown result type (might be due to invalid IL or missing references)
			//IL_074a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0751: Unknown result type (might be due to invalid IL or missing references)
			//IL_0763: Unknown result type (might be due to invalid IL or missing references)
			//IL_076e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0788: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_07fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0805: Unknown result type (might be due to invalid IL or missing references)
			//IL_081a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0825: Unknown result type (might be due to invalid IL or missing references)
			//IL_083a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0844: Unknown result type (might be due to invalid IL or missing references)
			//IL_0883: Unknown result type (might be due to invalid IL or missing references)
			//IL_0888: Unknown result type (might be due to invalid IL or missing references)
			//IL_0889: Unknown result type (might be due to invalid IL or missing references)
			//IL_0890: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_08bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0921: Unknown result type (might be due to invalid IL or missing references)
			//IL_0926: Unknown result type (might be due to invalid IL or missing references)
			//IL_0927: Unknown result type (might be due to invalid IL or missing references)
			//IL_092e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0940: Unknown result type (might be due to invalid IL or missing references)
			//IL_0955: Unknown result type (might be due to invalid IL or missing references)
			//IL_096e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0979: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e58: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f46: Unknown result type (might be due to invalid IL or missing references)
			if (spawned)
			{
				return;
			}
			GameObject onLevelStartObj = null;
			bool flag = (Object)(object)MonoSingleton<OnLevelStart>.Instance != (Object)null;
			if (!flag)
			{
				Transform val = ((Component)this).gameObject.transform.Find("OnLevelStart");
				if ((Object)(object)val != (Object)null)
				{
					flag = (Object)(object)((Component)val).GetComponent<OnLevelStart>() != (Object)null;
					onLevelStartObj = ((Component)val).gameObject;
				}
			}
			else
			{
				onLevelStartObj = ((Component)MonoSingleton<OnLevelStart>.Instance).gameObject;
			}
			GameObject val2 = ((Component)this).gameObject;
			GameObject val3 = Addressables.LoadAssetAsync<GameObject>((object)(secretRoom ? "FirstRoom Secret" : (primeRoom ? "FirstRoom Prime" : (encoreRoom ? "Assets/Prefabs/Levels/Special Rooms/FirstRoom Encore.prefab" : "FirstRoom")))).WaitForCompletion();
			Scene activeScene;
			if (!doNotReplace)
			{
				val2 = Object.Instantiate<GameObject>(val3, ((Component)this).transform.parent);
				if (flag)
				{
					Transform? obj = val2.transform.Find("OnLevelStart");
					if (obj == null)
					{
						activeScene = SceneManager.GetActiveScene();
						obj = (from go in ((Scene)(ref activeScene)).GetRootGameObjects()
							where ((Object)go).name == "OnLevelStart" && (Object)(object)go.transform != (Object)(object)onLevelStartObj
							select go.transform).FirstOrDefault();
					}
					Transform val4 = obj;
					if ((Object)(object)val4 != (Object)null)
					{
						Object.Destroy((Object)(object)((Component)val4).gameObject);
					}
					if ((Object)(object)onLevelStartObj != (Object)null)
					{
						onLevelStartObj.transform.SetParent(val2.transform);
					}
				}
			}
			else
			{
				GameObject val5 = Object.Instantiate<GameObject>(val3, ((Component)this).transform.position, ((Component)this).transform.rotation, ((Component)this).transform.parent);
				Object.Destroy((Object)(object)((Component)val5.transform.Find("Room")).gameObject);
				if (flag)
				{
					Transform val6 = val5.transform.Find("OnLevelStart");
					if ((Object)(object)val6 != (Object)null)
					{
						Object.Destroy((Object)(object)((Component)val6).gameObject);
					}
					else
					{
						activeScene = SceneManager.GetActiveScene();
						OnLevelStart val7 = (from go in ((Scene)(ref activeScene)).GetRootGameObjects()
							select go.GetComponent<OnLevelStart>() into ls
							where (Object)(object)ls != (Object)null && (Object)(object)((Component)ls).gameObject != (Object)(object)onLevelStartObj
							select ls).FirstOrDefault();
						if ((Object)(object)val7 != (Object)null)
						{
							Object.Destroy((Object)(object)((Component)val7).gameObject);
						}
					}
				}
			}
			MeshCollider[] componentsInChildren = val2.GetComponentsInChildren<MeshCollider>();
			MeshFilter val9 = default(MeshFilter);
			foreach (MeshCollider val8 in componentsInChildren)
			{
				if (((Component)val8).gameObject.TryGetComponent<MeshFilter>(ref val9))
				{
					val9.mesh = val8.sharedMesh;
				}
			}
			Transform transform = ((Component)MonoSingleton<NewMovement>.Instance).transform;
			((Component)transform).transform.parent = val2.transform;
			val2.transform.position = ((Component)this).transform.position;
			val2.transform.rotation = ((Component)this).transform.rotation;
			((Component)transform).transform.parent = null;
			Quaternion rotation = ((Component)this).transform.rotation;
			Utils.SetPlayerWorldRotation(Quaternion.Euler(0f, ((Quaternion)(ref rotation)).eulerAngles.y, 0f));
			if ((Object)(object)playerSpawnPos != (Object)null)
			{
				((Component)transform).transform.parent = ((Component)playerSpawnPos).transform.parent;
				((Component)transform).transform.localPosition = playerSpawnPos.localPosition;
				Utils.SetPlayerWorldRotation(playerSpawnPos.rotation);
				((Component)transform).transform.SetParent((Transform)null);
			}
			MonoSingleton<StatsManager>.Instance.spawnPos = ((Component)transform).transform.position;
			try
			{
				((Component)val2.transform.Find("Room/FinalDoor")).GetComponent<FinalDoor>();
				Camera main = Camera.main;
				main.backgroundColor = backgroundColor;
				main.clearFlags = cameraFillMode;
				((Component)val2.transform.Find("Room/FinalDoor/FinalDoorOpener")).GetComponent<FinalDoorOpener>().startMusic = startMusic;
				((Component)val2.transform.Find("Room/FinalDoor")).GetComponent<FinalDoor>();
				Transform obj2 = ((Component)MonoSingleton<NewMovement>.Instance).transform.Find("Canvas");
				if (obj2 == null)
				{
					activeScene = SceneManager.GetActiveScene();
					obj2 = (from o in ((Scene)(ref activeScene)).GetRootGameObjects()
						where ((Object)o).name == "Canvas"
						select o).First().transform;
				}
				Transform val10 = obj2;
				GameObject val11 = null;
				if (enableHellMap)
				{
					Deserialize();
					RectTransform val12 = MakeRect(val10);
					((Object)val12).name = "Hellmap";
					val11 = ((Component)val12).gameObject;
					Vector2 anchorMin = (val12.anchorMax = new Vector2(0.5f, 0.5f));
					val12.anchorMin = anchorMin;
					val12.pivot = new Vector2(0.5f, 0.5f);
					val12.sizeDelta = new Vector2(250f, 650f);
					val12.anchoredPosition = Vector2.zero;
					((Transform)val12).localScale = Vector3.one * 0.82244f;
					((Transform)val12).SetAsFirstSibling();
					RectTransform val14 = MakeRect(((Component)val12).transform);
					((Object)val14).name = "Hellmap Container";
					val14.anchorMin = Vector2.zero;
					val14.anchorMax = Vector2.one;
					val14.pivot = new Vector2(0.5f, 0.5f);
					val14.sizeDelta = Vector2.zero;
					val14.anchoredPosition = Vector2.zero;
					((Transform)val14).localScale = Vector3.one;
					float num = 0f;
					Stack<RectTransform> stack = new Stack<RectTransform>();
					foreach (LayerInfo layersAndLevel in layersAndLevels)
					{
						RectTransform obj3 = MakeRect((Transform)(object)val14);
						anchorMin = (obj3.anchorMax = new Vector2(0f, 1f));
						obj3.anchorMin = anchorMin;
						obj3.sizeDelta = new Vector2(250f, 50f);
						obj3.pivot = new Vector2(0f, 1f);
						((Transform)obj3).localScale = Vector3.one;
						obj3.anchoredPosition = new Vector2(0f, (num == 0f) ? (-3.051758E-05f) : num);
						num -= 50f;
						Text obj4 = MakeText((Transform)(object)obj3);
						obj4.text = layersAndLevel.layerName;
						obj4.fontSize = 36;
						obj4.font = Utils.gameFont;
						obj4.alignment = (TextAnchor)3;
						((Graphic)obj4).color = Color.white;
						RectTransform component = ((Component)obj4).GetComponent<RectTransform>();
						component.anchorMin = Vector2.zero;
						component.anchorMax = Vector2.one;
						component.sizeDelta = Vector2.zero;
						component.pivot = new Vector2(0.5f, 0.5f);
						((Transform)component).localScale = Vector3.one;
						component.anchoredPosition = Vector2.zero;
						string[] layerLevels = layersAndLevel.layerLevels;
						foreach (string text in layerLevels)
						{
							RectTransform obj5 = MakeRect((Transform)(object)val14);
							anchorMin = (obj5.anchorMax = new Vector2(0f, 1f));
							obj5.anchorMin = anchorMin;
							obj5.pivot = new Vector2(0f, 1f);
							((Transform)obj5).localScale = Vector3.one;
							obj5.anchoredPosition = new Vector2(60f, num);
							obj5.sizeDelta = new Vector2(125f, 45f);
							num -= 50f;
							RectTransform obj6 = MakeRect(((Component)obj5).transform);
							anchorMin = (obj6.anchorMax = new Vector2(0.5f, 0.5f));
							obj6.anchorMin = anchorMin;
							obj6.sizeDelta = new Vector2(25f, 9f);
							obj6.anchoredPosition = Vector2.zero;
							((Transform)obj6).localScale = new Vector3(5f, 5f, 5f);
							Image obj7 = ((Component)obj6).gameObject.AddComponent<Image>();
							obj7.type = (Type)1;
							obj7.sprite = Utils.levelPanel;
							obj7.pixelsPerUnitMultiplier = 1f;
							Text obj8 = MakeText(((Component)obj5).transform);
							obj8.text = text;
							obj8.font = Utils.gameFont;
							obj8.fontSize = 32;
							obj8.alignment = (TextAnchor)4;
							((Graphic)obj8).color = Color.black;
							RectTransform component2 = ((Component)obj8).gameObject.GetComponent<RectTransform>();
							component2.anchorMin = Vector2.zero;
							component2.anchorMax = Vector2.one;
							component2.pivot = new Vector2(0.5f, 0.5f);
							component2.sizeDelta = Vector2.zero;
							component2.anchoredPosition = new Vector2(0f, 0f);
							((Transform)component2).localScale = Vector3.one;
						}
						if (layersAndLevel.layerLevels.Length != 0)
						{
							RectTransform val18 = MakeRect((Transform)(object)val14);
							anchorMin = (val18.anchorMax = new Vector2(0.5f, 1f));
							val18.anchorMin = anchorMin;
							val18.pivot = new Vector2(0.5f, 0f);
							val18.anchoredPosition = new Vector2(-95f, num + 25f);
							val18.sizeDelta = new Vector2(3f, (float)layersAndLevel.layerLevels.Length * 50f - 27.5f);
							((Transform)val18).localScale = Vector3.one;
							((Component)val18).gameObject.AddComponent<Image>();
							for (int j = 0; j < layersAndLevel.layerLevels.Length; j++)
							{
								RectTransform obj9 = MakeRect((Transform)(object)val18);
								anchorMin = (obj9.anchorMax = new Vector2(0.5f, 0f));
								obj9.anchorMin = anchorMin;
								obj9.pivot = new Vector2(0f, 0.5f);
								obj9.sizeDelta = new Vector2(20f, 3f);
								obj9.anchoredPosition = new Vector2(-1.5f, (float)j * 50f);
								((Transform)obj9).localScale = Vector3.one;
								((Component)obj9).gameObject.AddComponent<Image>();
							}
							stack.Push(val18);
						}
					}
					while (stack.Count != 0)
					{
						((Transform)stack.Pop()).SetAsLastSibling();
					}
					Vector2 anchoredPosition = ((Component)((Transform)val14).GetChild(GetChildIndexFromLayerAndLevel(layerIndexToStartFrom, levelIndexToStartFrom))).GetComponent<RectTransform>().anchoredPosition;
					((Vector2)(ref anchoredPosition))..ctor(210f, anchoredPosition.y - 22.5f);
					Vector2 anchoredPosition2 = ((Component)((Transform)val14).GetChild(GetChildIndexFromLayerAndLevel(layerIndexToEndAt, levelIndexToEndAt))).GetComponent<RectTransform>().anchoredPosition;
					((Vector2)(ref anchoredPosition2))..ctor(210f, anchoredPosition2.y - 22.5f);
					RectTransform obj10 = MakeRect((Transform)(object)val12);
					anchorMin = (obj10.anchorMax = new Vector2(0f, 1f));
					obj10.anchorMin = anchorMin;
					obj10.pivot = new Vector2(0.5f, 0.5f);
					obj10.sizeDelta = new Vector2(35f, 35f);
					((Transform)obj10).rotation = Quaternion.Euler(0f, 0f, 90f);
					((Transform)obj10).localScale = Vector3.one;
					obj10.anchoredPosition = anchoredPosition;
					AudioSource val22 = ((Component)obj10).gameObject.AddComponent<AudioSource>();
					val22.playOnAwake = false;
					val22.loop = false;
					val22.clip = hellmapBeepClip;
					val22.volume = 0.1f;
					Image val23 = ((Component)obj10).gameObject.AddComponent<Image>();
					val23.sprite = Utils.hellmapArrow;
					CustomHellmapCursor customHellmapCursor = ((Component)obj10).gameObject.AddComponent<CustomHellmapCursor>();
					customHellmapCursor.targetPosition = anchoredPosition2;
					customHellmapCursor.aud = val22;
					customHellmapCursor.targetImage = val23;
					ObjectActivator obj11 = ((Component)UnityUtils.GetComponentInChildrenRecursive<PlayerActivator>(val2.transform)).gameObject.AddComponent<ObjectActivator>();
					obj11.dontActivateOnEnable = true;
					obj11.oneTime = true;
					obj11.events = new UltrakillEvent();
					obj11.events.toDisActivateObjects = (GameObject[])(object)new GameObject[1] { ((Component)val12).gameObject };
				}
				if (convertToUpwardRoom)
				{
					foreach (GameObject item in upwardRoomOutOfBoundsToDisable)
					{
						item.SetActive(false);
					}
					List<GameObject> list = new List<GameObject>();
					if ((Object)(object)val11 != (Object)null)
					{
						list.Add(val11);
					}
					List<GameObject> list2 = new List<GameObject>();
					list2.AddRange(upwardRoomOutOfBoundsToDisable);
					ConvertToAscendingFirstRoom(val2, upwardRoomDoorCloseClip, list2, list, doNotReplace);
				}
				if (!encoreRoom)
				{
					return;
				}
				FinalRank instance = MonoSingleton<FinalRank>.Instance;
				if (!((Object)(object)instance != (Object)null))
				{
					return;
				}
				Transform val24 = ((Component)instance).transform.Find("Extra Info");
				RectTransform val25 = default(RectTransform);
				if ((Object)(object)val24 != (Object)null && ((Component)val24).gameObject.TryGetComponent<RectTransform>(ref val25))
				{
					val25.anchoredPosition = Vector2.op_Implicit(new Vector3(0f, 200f, 0f));
					val25.sizeDelta = new Vector2(480f, 180f);
				}
				Transform val26 = ((Component)instance).transform.Find("Secrets -  Title");
				Transform val27 = ((Component)instance).transform.Find("Secrets - Info");
				Transform val28 = (((Object)(object)val27 == (Object)null) ? null : ((Component)val27).transform.Find("Text (1)"));
				Transform val29 = ((Component)instance).transform.Find("Challenge - Title");
				Transform val30 = ((Component)instance).transform.Find("Challenge");
				List<GameObject> list3 = instance.toAppear.ToList();
				if ((Object)(object)val26 != (Object)null && !list3.Contains(((Component)val26).gameObject))
				{
					list3.Insert(list3.Count - 1, ((Component)val26).gameObject);
				}
				if ((Object)(object)val27 != (Object)null && !list3.Contains(((Component)val27).gameObject))
				{
					list3.Insert(list3.Count - 1, ((Component)val27).gameObject);
				}
				if ((Object)(object)val28 != (Object)null && !list3.Contains(((Component)val28).gameObject))
				{
					list3.Insert(list3.Count - 1, ((Component)val28).gameObject);
				}
				if ((Object)(object)val29 != (Object)null && !list3.Contains(((Component)val29).gameObject))
				{
					((Component)val29).gameObject.SetActive(true);
					list3.Insert(list3.Count - 1, ((Component)val29).gameObject);
				}
				if ((Object)(object)val30 != (Object)null && !list3.Contains(((Component)val30).gameObject))
				{
					list3.Insert(list3.Count - 1, ((Component)val30).gameObject);
				}
				instance.toAppear = list3.ToArray();
				Transform val31 = ((Component)val10).transform.Find("Level Stats Controller");
				if (!((Object)(object)val31 != (Object)null))
				{
					return;
				}
				LevelStats componentInChildren = ((Component)val31).GetComponentInChildren<LevelStats>(true);
				((Component)componentInChildren).GetComponent<RectTransform>().sizeDelta = new Vector2(285f, 315f);
				Transform obj12 = ((Component)componentInChildren).transform.Find("Challenge Title/Challenge");
				componentInChildren.challenge = ((obj12 != null) ? ((Component)obj12).GetComponent<TMP_Text>() : null);
				Transform obj13 = ((Component)componentInChildren).transform.Find("Challenge Title");
				if (obj13 != null)
				{
					((Component)obj13).gameObject.SetActive(true);
				}
				Transform obj14 = ((Component)componentInChildren).transform.Find("Secrets Title");
				if (obj14 != null)
				{
					((Component)obj14).gameObject.SetActive(true);
				}
				List<Image> list4 = new List<Image>();
				for (int num2 = 5; num2 >= 1; num2--)
				{
					Transform val32 = ((Component)componentInChildren).transform.Find($"Secrets Title/Secret {num2}");
					if ((Object)(object)val32 != (Object)null)
					{
						list4.Add(((Component)val32).GetComponent<Image>());
					}
				}
				componentInChildren.secrets = list4.ToArray();
				((Component)((Component)componentInChildren).transform.Find("Assists Title")).GetComponent<RectTransform>().anchoredPosition = new Vector2(10f, -275f);
			}
			catch (Exception ex)
			{
				throw ex;
			}
			finally
			{
				spawned = true;
			}
			int GetChildIndexFromLayerAndLevel(int layer, int level)
			{
				int num3 = 0;
				for (int k = 0; k < layer; k++)
				{
					num3 += 1 + levelSizes[k];
				}
				return num3 + 1 + level;
			}
		}

		public void Awake()
		{
			Spawn();
		}

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

		public UltrakillEvent onSuccess;

		public UltrakillEvent onFailure;

		public bool activateOnEnable = true;

		public void OnEnable()
		{
			if (activateOnEnable)
			{
				Activate();
			}
		}

		public void Activate()
		{
			if (LevelInterface.GetLevelChallenge(targetLevelId))
			{
				if (onSuccess != null)
				{
					onSuccess.Invoke("");
				}
			}
			else if (onFailure != null)
			{
				onFailure.Invoke("");
			}
		}
	}
	public enum LevelRanks
	{
		NotCompleted,
		Completed,
		CompletedWithCheats,
		CompletedWithoutCheats,
		D,
		AtLeastD,
		AtMostD,
		C,
		AtLeastC,
		AtMostC,
		B,
		AtLeastB,
		AtMostB,
		A,
		AtLeastA,
		AtMostA,
		S,
		AtLeastS,
		AtMostS,
		P
	}
	public class RudeLevelRankChecker : MonoBehaviour
	{
		public string targetLevelUniqueId = "";

		public LevelRanks requiredFinalRank = LevelRanks.Completed;

		public UltrakillEvent OnSuccess;

		public UltrakillEvent OnFail;

		public bool activateOnEnable = true;

		public void OnEnable()
		{
			if (activateOnEnable)
			{
				Activate();
			}
		}

		public static int GetRankScore(char rank)
		{
			return rank switch
			{
				'D' => 1, 
				'C' => 2, 
				'B' => 3, 
				'A' => 4, 
				'S' => 5, 
				'P' => 6, 
				_ => -1, 
			};
		}

		public void Activate()
		{
			char levelRank = LevelInterface.GetLevelRank(targetLevelUniqueId);
			int rankScore = GetRankScore(levelRank);
			bool flag = false;
			switch (requiredFinalRank)
			{
			case LevelRanks.NotCompleted:
				flag = levelRank == '-';
				break;
			case LevelRanks.Completed:
				flag = levelRank != '-';
				break;
			case LevelRanks.CompletedWithCheats:
				flag = levelRank == ' ';
				break;
			case LevelRanks.CompletedWithoutCheats:
				flag = levelRank != ' ' && levelRank != '-';
				break;
			case LevelRanks.D:
				flag = levelRank == 'D';
				break;
			case LevelRanks.C:
				flag = levelRank == 'C';
				break;
			case LevelRanks.B:
				flag = levelRank == 'B';
				break;
			case LevelRanks.A:
				flag = levelRank == 'A';
				break;
			case LevelRanks.S:
				flag = levelRank == 'S';
				break;
			case LevelRanks.P:
				flag = levelRank == 'P';
				break;
			case LevelRanks.AtLeastD:
				flag = rankScore >= GetRankScore('D');
				break;
			case LevelRanks.AtMostD:
				flag = rankScore <= GetRankScore('D');
				break;
			case LevelRanks.AtLeastC:
				flag = rankScore >= GetRankScore('C');
				break;
			case LevelRanks.AtMostC:
				flag = rankScore <= GetRankScore('C');
				break;
			case LevelRanks.AtLeastB:
				flag = rankScore >= GetRankScore('B');
				break;
			case LevelRanks.AtMostB:
				flag = rankScore <= GetRankScore('B');
				break;
			case LevelRanks.AtLeastA:
				flag = rankScore >= GetRankScore('A');
				break;
			case LevelRanks.AtMostA:
				flag = rankScore <= GetRankScore('A');
				break;
			case LevelRanks.AtLeastS:
				flag = rankScore >= GetRankScore('S');
				break;
			case LevelRanks.AtMostS:
				flag = rankScore <= GetRankScore('S');
				break;
			}
			if (flag)
			{
				if (OnSuccess != null)
				{
					OnSuccess.Invoke("");
				}
			}
			else if (OnFail != null)
			{
				OnFail.Invoke("");
			}
		}
	}
	public class RudeLevelSecretChecker : MonoBehaviour
	{
		public string targetLevelId = "";

		public int targetSecretIndex;

		public UltrakillEvent onSuccess;

		public UltrakillEvent onFailure;

		public bool activateOnEnable = true;

		public void OnEnable()
		{
			if (activateOnEnable)
			{
				Activate();
			}
		}

		public void Activate()
		{
			if (LevelInterface.GetLevelSecret(targetLevelId, targetSecretIndex))
			{
				if (onSuccess != null)
				{
					onSuccess.Invoke("");
				}
			}
			else if (onFailure != null)
			{
				onFailure.Invoke("");
			}
		}
	}
	public static class Utils
	{
		private static Font _gameFont;

		private static Sprite _levelPanel;

		private static Sprite _hellmapArrow;

		private static Material _metalDec20;

		public static Font gameFont
		{
			get
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)_gameFont == (Object)null)
				{
					_gameFont = Addressables.LoadAssetAsync<Font>((object)"Assets/Fonts/VCR_OSD_MONO_1.001.ttf").WaitForCompletion();
				}
				return _gameFont;
			}
		}

		public static Sprite levelPanel
		{
			get
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)_levelPanel == (Object)null)
				{
					_levelPanel = Addressables.LoadAssetAsync<Sprite>((object)"Assets/Textures/UI/meter.png").WaitForCompletion();
				}
				return _levelPanel;
			}
		}

		public static Sprite hellmapArrow
		{
			get
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)_hellmapArrow == (Object)null)
				{
					_hellmapArrow = Addressables.LoadAssetAsync<Sprite>((object)"Assets/Textures/UI/arrow.png").WaitForCompletion();
				}
				return _hellmapArrow;
			}
		}

		public static Material metalDec20
		{
			get
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)_metalDec20 == (Object)null)
				{
					_metalDec20 = Addressables.LoadAssetAsync<Material>((object)"Assets/Materials/Environment/Metal/Metal Decoration 20.mat").WaitForCompletion();
				}
				return _metalDec20;
			}
		}

		public static void SetPlayerWorldRotation(Quaternion newRotation)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_007e: Unknown result type (might be due to invalid IL or missing references)
			((Component)MonoSingleton<CameraController>.Instance).transform.rotation = newRotation;
			float x = ((Component)MonoSingleton<CameraController>.Instance).transform.localEulerAngles.x;
			float rotationX = x;
			if (x <= 90f && x >= 0f)
			{
				rotationX = 0f - x;
			}
			else if (x >= 270f && x <= 360f)
			{
				rotationX = Mathf.Lerp(0f, 90f, Mathf.InverseLerp(360f, 270f, x));
			}
			Quaternion rotation = ((Component)MonoSingleton<CameraController>.Instance).transform.rotation;
			float y = ((Quaternion)(ref rotation)).eulerAngles.y;
			MonoSingleton<CameraController>.Instance.rotationX = rotationX;
			MonoSingleton<CameraController>.Instance.rotationY = y;
		}
	}
	public static class UnityUtils
	{
		[CompilerGenerated]
		private sealed class <GetComponentsInChildrenRecursive>d__0<T> : IEnumerable<object>, IEnumerable, IEnumerator<object>, IEnumerator, IDisposable where T : Component
		{
			private int <>1__state;

			private object <>2__current;

			private int <>l__initialThreadId;

			private Transform parent;

			public Transform <>3__parent;

			private IEnumerator <>7__wrap1;

			private Transform <child>5__3;

			private IEnumerator <>7__wrap3;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if ((uint)(num - -4) <= 1u || (uint)(num - 1) <= 1u)
				{
					try
					{
						if (num == -4 || num == 2)
						{
							try
							{
							}
							finally
							{
								<>m__Finally2();
							}
						}
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<>7__wrap1 = null;
				<child>5__3 = null;
				<>7__wrap3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0051: Unknown result type (might be due to invalid IL or missing references)
				//IL_005b: Expected O, but got Unknown
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<>7__wrap1 = parent.GetEnumerator();
						<>1__state = -3;
						goto IL_00fd;
					case 1:
						<>1__state = -3;
						goto IL_008c;
					case 2:
						{
							<>1__state = -4;
							goto IL_00dc;
						}
						IL_00fd:
						if (<>7__wrap1.MoveNext())
						{
							<child>5__3 = (Transform)<>7__wrap1.Current;
							T val = default(T);
							if (((Component)<child>5__3).TryGetComponent<T>(ref val))
							{
								<>2__current = val;
								<>1__state = 1;
								return true;
							}
							goto IL_008c;
						}
						<>m__Finally1();
						<>7__wrap1 = null;
						return false;
						IL_008c:
						<>7__wrap3 = GetComponentsInChildrenRecursive<T>(<child>5__3).GetEnumerator();
						<>1__state = -4;
						goto IL_00dc;
						IL_00dc:
						if (<>7__wrap3.MoveNext())
						{
							T val2 = (T)<>7__wrap3.Current;
							<>2__current = val2;
							<>1__state = 2;
							return true;
						}
						<>m__Finally2();
						<>7__wrap3 = null;
						<child>5__3 = null;
						goto IL_00fd;
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

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

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<>7__wrap1 is IDisposable disposable)
				{
					disposable.Dispose();
				}
			}

			private void <>m__Finally2()
			{
				<>1__state = -3;
				if (<>7__wrap3 is IDisposable disposable)
				{
					disposable.Dispose();
				}
			}

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

			[DebuggerHidden]
			IEnumerator<object> IEnumerable<object>.GetEnumerator()
			{
				<GetComponentsInChildrenRecursive>d__0<T> <GetComponentsInChildrenRecursive>d__;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					<GetComponentsInChildrenRecursive>d__ = this;
				}
				else
				{
					<GetComponentsInChildrenRecursive>d__ = new <GetComponentsInChildrenRecursive>d__0<T>(0);
				}
				<GetComponentsInChildrenRecursive>d__.parent = <>3__parent;
				return <GetComponentsInChildrenRecursive>d__;
			}

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

		[IteratorStateMachine(typeof(<GetComponentsInChildrenRecursive>d__0<>))]
		public static IEnumerable GetComponentsInChildrenRecursive<T>(Transform parent) where T : Component
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <GetComponentsInChildrenRecursive>d__0<T>(-2)
			{
				<>3__parent = parent
			};
		}

		public static T GetComponentInChildrenRecursive<T>(Transform parent) where T : Component
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			T result = default(T);
			foreach (Transform item in parent)
			{
				Transform val = item;
				if (((Component)val).TryGetComponent<T>(ref result))
				{
					return result;
				}
				T componentInChildrenRecursive = GetComponentInChildrenRecursive<T>(val);
				if ((Object)(object)componentInChildrenRecursive != (Object)null)
				{
					return componentInChildrenRecursive;
				}
			}
			return default(T);
		}
	}
}
namespace RudeLevelScripts
{
	public class AscendingFinalRoom : MonoBehaviour
	{
		private void OnTriggerEnter(Collider other)
		{
			GameObject gameObject = ((Component)MonoSingleton<NewMovement>.Instance).gameObject;
			if ((Object)(object)((Component)other).gameObject == (Object)(object)gameObject && Object.op_Implicit((Object)(object)MonoSingleton<NewMovement>.Instance) && MonoSingleton<NewMovement>.Instance.hp > 0)
			{
				gameObject.AddComponent<FirstRoomSpawner.PlayerForcedMovement>().force = 100f;
			}
		}
	}
	public class EnemyInfoPageDataLoader : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <LoadDataAndDestroyAsync>d__6 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public EnemyInfoPageDataLoader <>4__this;

			private AsyncOperationHandle<SpawnableObjectsDatabase> <handle>5__2;

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

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

			[DebuggerHidden]
			public <LoadDataAndDestroyAsync>d__6(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				<handle>5__2 = default(AsyncOperationHandle<SpawnableObjectsDatabase>);
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0083: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_004e: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				EnemyInfoPageDataLoader enemyInfoPageDataLoader = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (enemyInfoPageDataLoader._taskStarted)
					{
						return false;
					}
					enemyInfoPageDataLoader._taskStarted = true;
					if ((Object)(object)database == (Object)null)
					{
						<handle>5__2 = Addressables.LoadAssetAsync<SpawnableObjectsDatabase>((object)"Assets/Data/Bestiary Database.asset");
						<>2__current = <handle>5__2;
						<>1__state = 1;
						return true;
					}
					break;
				case 1:
					<>1__state = -1;
					database = <handle>5__2.Result;
					<handle>5__2 = default(AsyncOperationHandle<SpawnableObjectsDatabase>);
					break;
				}
				if ((Object)(object)enemyInfoPageDataLoader.target == (Object)null)
				{
					enemyInfoPageDataLoader.target = ((Component)enemyInfoPageDataLoader).GetComponent<EnemyInfoPage>();
				}
				enemyInfoPageDataLoader.target.objects = Object.Instantiate<SpawnableObjectsDatabase>(database);
				if (enemyInfoPageDataLoader.additionalEnemies != null && enemyInfoPageDataLoader.additionalEnemies.Count != 0)
				{
					List<SpawnableObject> list = enemyInfoPageDataLoader.target.objects.enemies.ToList();
					list.AddRange(enemyInfoPageDataLoader.additionalEnemies);
					enemyInfoPageDataLoader.target.objects.enemies = list.ToArray();
				}
				Object.Destroy((Object)(object)enemyInfoPageDataLoader);
				return false;
			}

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

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

		public EnemyInfoPage target;

		public List<SpawnableObject> additionalEnemies;

		private static SpawnableObjectsDatabase database;

		private bool _taskStarted;

		public void Awake()
		{
			LoadDataAndDestroy();
		}

		public void LoadDataAndDestroy()
		{
			((MonoBehaviour)this).StartCoroutine(LoadDataAndDestroyAsync());
		}

		[IteratorStateMachine(typeof(<LoadDataAndDestroyAsync>d__6))]
		private IEnumerator LoadDataAndDestroyAsync()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <LoadDataAndDestroyAsync>d__6(0)
			{
				<>4__this = this
			};
		}
	}
	internal static class GameObjectExtensions
	{
		public static bool TryGetComponentInChildren<T>(this GameObject obj, out T result) where T : Component
		{
			result = obj.GetComponentInChildren<T>();
			return (Object)(object)result != (Object)null;
		}
	}
	public class FirstRoomGameControllerLoader : MonoBehaviour
	{
		public void RunAndDestroy()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			if (((Component)this).gameObject.TryGetComponentInChildren<PlayerTracker>(out PlayerTracker result) && (Object)(object)result.platformerPlayerPrefab == (Object)null)
			{
				result.platformerPlayerPrefab = Addressables.LoadAssetAsync<GameObject>((object)"Assets/Prefabs/Player/PlatformerController.prefab").WaitForCompletion();
			}
			if (((Component)this).gameObject.TryGetComponentInChildren<SandboxSaver>(out SandboxSaver result2) && (Object)(object)result2.objects == (Object)null)
			{
				result2.objects = Addressables.LoadAssetAsync<SpawnableObjectsDatabase>((object)"Assets/Data/Sandbox/Spawnable Objects Database.asset").WaitForCompletion();
			}
			if (((Component)this).gameObject.TryGetComponentInChildren<TimeController>(out TimeController result3) && (Object)(object)result3.parryLight == (Object)null)
			{
				result3.parryLight = Addressables.LoadAssetAsync<GameObject>((object)"Assets/Particles/ParryLight.prefab").WaitForCompletion();
			}
		}
	}
	[Flags]
	public enum Gamemode
	{
		NoGamemode = 1,
		NoMonsters = 2,
		NoMonstersAndWeapons = 4
	}
	public class RudeGamemodeChecker : MonoBehaviour
	{
		public Gamemode gamemode = Gamemode.NoMonsters | Gamemode.NoMonstersAndWeapons;

		public UltrakillEvent OnSuccess;

		public UltrakillEvent OnFail;

		public bool activateOnEnable = true;

		public void OnEnable()
		{
			if (activateOnEnable)
			{
				Activate();
			}
		}

		public void Activate()
		{
			//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_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected I4, but got Unknown
			bool flag = false;
			Gamemode currentGamemode = GamemodeInterface.GetCurrentGamemode();
			switch ((int)currentGamemode)
			{
			case 0:
				flag = gamemode.HasFlag(Gamemode.NoGamemode);
				break;
			case 1:
				flag = gamemode.HasFlag(Gamemode.NoMonsters);
				break;
			case 2:
				flag = gamemode.HasFlag(Gamemode.NoMonstersAndWeapons);
				break;
			}
			if (flag)
			{
				if (OnSuccess != null)
				{
					OnSuccess.Invoke("");
				}
			}
			else if (OnFail != null)
			{
				OnFail.Invoke("");
			}
		}
	}
}