Decompiled source of AngryLevelLoader v2.9.0

plugins/AngryLevelLoader/AngryLevelLoader.dll

Decompiled 3 weeks 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.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 AngryUiComponents;
using Atlas.Modules.Guns;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using FasterPunch;
using HarmonyLib;
using Logic;
using LucasMeshCombine;
using Microsoft.CodeAnalysis;
using MyCoolMod;
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 UltraFunGuns;
using UltraTweaker;
using UltraTweaker.Tweaks;
using UltraTweaker.Tweaks.Impl;
using Ultrapain;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.AddressableAssets.ResourceLocators;
using UnityEngine.Audio;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.ResourceManagement.ResourceProviders;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public 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 GameObject backgroundUpdater;

	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()
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Expected O, but got Unknown
		if (instance == null)
		{
			mainThread = Thread.CurrentThread;
			instance = new CrossThreadInvoker();
			backgroundUpdater = new GameObject();
			Object.DontDestroyOnLoad((Object)(object)backgroundUpdater);
			backgroundUpdater.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
	{
		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 (!Plugin.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, "LevelCatalog.json");

		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");

		public static void TryCreateAllPaths()
		{
			IOUtils.TryCreateDirectory(ConfigFolderPath);
			IOUtils.TryCreateDirectory(OnlineCacheFolderPath);
			IOUtils.TryCreateDirectory(ThumbnailCacheFolderPath);
		}
	}
	public class ManifestReader
	{
		public static byte[] GetBytes(string resourceName)
		{
			using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("AngryLevelLoader.Resources." + resourceName);
			byte[] array = new byte[stream.Length];
			stream.Read(array, 0, array.Length);
			return array;
		}
	}
	public class SpaceField : CustomConfigField
	{
		public SpaceField(ConfigPanel parentPanel, float space)
			: base(parentPanel, 60f, space)
		{
		}
	}
	[BepInPlugin("com.eternalUnion.angryLevelLoader", "AngryLevelLoader", "2.9.0")]
	[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.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public enum CustomLevelButtonPosition
		{
			Top,
			Bottom,
			Disabled
		}

		public enum BundleSorting
		{
			Alphabetically,
			Author,
			LastPlayed,
			LastUpdate
		}

		public enum DefaultLeaderboardCategory
		{
			All,
			PRank,
			Challenge,
			Nomo,
			Nomow
		}

		public enum DefaultLeaderboardDifficulty
		{
			Any,
			Harmless,
			Lenient,
			Standard,
			Violent,
			Brutal
		}

		public enum DefaultLeaderboardFilter
		{
			Global,
			Friends
		}

		private class RecordInfoJsonWrapper
		{
			public string category { get; set; }

			public string difficulty { get; set; }

			public string bundleGuid { get; set; }

			public string hash { get; set; }

			public string levelId { get; set; }

			public int time { get; set; }

			public RecordInfoJsonWrapper()
			{
			}

			public RecordInfoJsonWrapper(AngryLeaderboards.PostRecordInfo record)
			{
				category = AngryLeaderboards.RECORD_CATEGORY_DICT[record.category];
				difficulty = AngryLeaderboards.RECORD_DIFFICULTY_DICT[record.difficulty];
				bundleGuid = record.bundleGuid;
				hash = record.hash;
				levelId = record.levelId;
				time = record.time;
			}

			public bool TryParseRecordInfo(out AngryLeaderboards.PostRecordInfo record)
			{
				record = default(AngryLeaderboards.PostRecordInfo);
				record.category = AngryLeaderboards.RECORD_CATEGORY_DICT.FirstOrDefault((KeyValuePair<AngryLeaderboards.RecordCategory, string> i) => i.Value == category).Key;
				if (AngryLeaderboards.RECORD_CATEGORY_DICT[record.category] != category)
				{
					return false;
				}
				record.difficulty = AngryLeaderboards.RECORD_DIFFICULTY_DICT.FirstOrDefault((KeyValuePair<AngryLeaderboards.RecordDifficulty, string> i) => i.Value == difficulty).Key;
				if (AngryLeaderboards.RECORD_DIFFICULTY_DICT[record.difficulty] != difficulty)
				{
					return false;
				}
				record.bundleGuid = bundleGuid;
				record.hash = hash;
				record.levelId = levelId;
				record.time = time;
				return true;
			}
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static UnityAction<Scene, LoadSceneMode> <0>__RefreshCatalogOnMainMenu;

			public static OnClick <1>__ProcessPendingRecords;
		}

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

			public static Func<AngryBundleContainer, string> <>9__37_0;

			public static Func<AngryBundleContainer, string> <>9__37_1;

			public static Func<AngryBundleContainer, long> <>9__37_2;

			public static Func<AngryBundleContainer, long> <>9__37_3;

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

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

			public static FileSystemEventHandler <>9__101_0;

			public static RenamedEventHandler <>9__101_1;

			public static FileSystemEventHandler <>9__101_2;

			public static FileSystemEventHandler <>9__101_3;

			public static PostPresetChangeEvent <>9__102_0;

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

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

			public static OpenPanelEventDelegate <>9__102_1;

			public static OpenPanelEventDelegate <>9__102_2;

			public static EnumValueChangeEventDelegate<BundleSorting> <>9__102_3;

			public static PostStringListValueChangeEvent <>9__102_22;

			public static OpenPanelEventDelegate <>9__102_4;

			public static OnClick <>9__102_5;

			public static OnClick <>9__102_6;

			public static KeyCodeValueChangeEventDelegate <>9__102_7;

			public static PostEnumValueChangeEvent<CustomLevelButtonPosition> <>9__102_8;

			public static PostColorValueChangeEvent <>9__102_9;

			public static PostColorValueChangeEvent <>9__102_10;

			public static PostColorValueChangeEvent <>9__102_11;

			public static BoolValueChangeEventDelegate <>9__102_12;

			public static BoolValueChangeEventDelegate <>9__102_13;

			public static BoolValueChangeEventDelegate <>9__102_14;

			public static OnClick <>9__102_17;

			public static Func<RudeLevelData, string> <>9__102_24;

			public static Func<Task, bool> <>9__109_0;

			public static BoolValueChangeEventDelegate <>9__112_0;

			public static PostBoolValueChangeEvent <>9__112_1;

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

			public static OpenPanelEventDelegate <>9__112_4;

			internal string <SortBundles>b__37_0(AngryBundleContainer b)
			{
				return b.bundleData.bundleName;
			}

			internal string <SortBundles>b__37_1(AngryBundleContainer b)
			{
				return b.bundleData.bundleAuthor;
			}

			internal long <SortBundles>b__37_2(AngryBundleContainer b)
			{
				if (lastPlayed.TryGetValue(b.bundleData.bundleGuid, out var value))
				{
					return value;
				}
				return 0L;
			}

			internal long <SortBundles>b__37_3(AngryBundleContainer b)
			{
				if (lastUpdate.TryGetValue(b.bundleData.bundleGuid, out var value))
				{
					return value;
				}
				return 0L;
			}

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

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

			internal void <InitializeFileWatcher>b__101_0(object sender, FileSystemEventArgs e)
			{
				string fullPath = e.FullPath;
				foreach (AngryBundleContainer value in angryBundles.Values)
				{
					if (IOUtils.PathEquals(fullPath, value.pathToAngryBundle))
					{
						logger.LogWarning((object)("Bundle " + fullPath + " was updated, container notified"));
						value.FileChanged();
						break;
					}
				}
			}

			internal void <InitializeFileWatcher>b__101_1(object sender, RenamedEventArgs e)
			{
				string fullPath = e.FullPath;
				foreach (AngryBundleContainer value in angryBundles.Values)
				{
					if (IOUtils.PathEquals(fullPath, value.pathToAngryBundle))
					{
						logger.LogWarning((object)("Bundle " + fullPath + " was renamed, path updated"));
						value.pathToAngryBundle = fullPath;
						break;
					}
				}
			}

			internal void <InitializeFileWatcher>b__101_2(object sender, FileSystemEventArgs e)
			{
				string fullPath = e.FullPath;
				foreach (AngryBundleContainer value in angryBundles.Values)
				{
					if (IOUtils.PathEquals(fullPath, value.pathToAngryBundle))
					{
						logger.LogWarning((object)("Bundle " + fullPath + " was deleted, unlinked"));
						value.pathToAngryBundle = "";
						break;
					}
				}
			}

			internal void <InitializeFileWatcher>b__101_3(object sender, FileSystemEventArgs e)
			{
				string fullPath = e.FullPath;
				if (AngryFileUtils.TryGetAngryBundleData(fullPath, out var data, out var _) && angryBundles.TryGetValue(data.bundleGuid, out var value) && value.bundleData.bundleGuid == data.bundleGuid && !File.Exists(value.pathToAngryBundle))
				{
					logger.LogWarning((object)("Bundle " + fullPath + " was just added, and a container with the same guid had no file linked. Linked, container notified"));
					value.pathToAngryBundle = fullPath;
					value.FileChanged();
				}
			}

			internal void <InitializeConfig>b__102_0(string b, string a)
			{
				UpdateAllUI();
			}

			internal void <InitializeConfig>b__102_1(bool external)
			{
				if (newLevelToggle.value)
				{
					newLevelNotifier.text = string.Join("\n", from level in newLevelNotifierLevels.value.Split(new char[1] { '`' })
						where !string.IsNullOrEmpty(level)
						select level into name
						select "<color=lime>New level: " + name + "</color>");
					((ConfigField)newLevelNotifier).hidden = false;
					newLevelNotifierLevels.value = "";
				}
				newLevelToggle.value = false;
			}

			internal bool <InitializeConfig>b__102_19(string level)
			{
				return !string.IsNullOrEmpty(level);
			}

			internal string <InitializeConfig>b__102_20(string name)
			{
				return "<color=lime>New level: " + name + "</color>";
			}

			internal void <InitializeConfig>b__102_2(bool e)
			{
				((ConfigField)newLevelNotifier).hidden = true;
			}

			internal void <InitializeConfig>b__102_3(EnumValueChangeEvent<BundleSorting> e)
			{
				bundleSortingMode.value = e.value;
				SortBundles();
			}

			internal void <InitializeConfig>b__102_22(string gamemodeName, int gamemodeIndex)
			{
				difficultyField.TriggerPostDifficultyChangeEvent();
			}

			internal void <InitializeConfig>b__102_4(bool externally)
			{
				difficultyField.TriggerPostDifficultyChangeEvent();
			}

			internal void <InitializeConfig>b__102_5()
			{
				Application.OpenURL(levelsPath);
			}

			internal void <InitializeConfig>b__102_6()
			{
				openButtons.SetButtonInteractable(1, false);
				PluginUpdateHandler.CheckPluginUpdate();
			}

			internal void <InitializeConfig>b__102_7(KeyCodeValueChangeEvent e)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: Invalid comparison between Unknown and I4
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Invalid comparison between Unknown and I4
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Invalid comparison between Unknown and I4
				if ((int)e.value == 323 || (int)e.value == 324 || (int)e.value == 325)
				{
					e.canceled = true;
				}
			}

			internal void <InitializeConfig>b__102_8(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 CustomLevelButtonPosition.Disabled:
					((Component)currentCustomLevelButton).gameObject.SetActive(false);
					break;
				case CustomLevelButtonPosition.Bottom:
					((Component)currentCustomLevelButton).transform.localPosition = new Vector3(((Component)currentCustomLevelButton).transform.localPosition.x, -303f, ((Component)currentCustomLevelButton).transform.localPosition.z);
					break;
				case 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 == 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 <InitializeConfig>b__102_9(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 <InitializeConfig>b__102_10(Color clr)
			{
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)currentCustomLevelButton == (Object)null))
				{
					((Graphic)currentCustomLevelButton.background).color = clr;
				}
			}

			internal void <InitializeConfig>b__102_11(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;
				}
			}

			internal void <InitializeConfig>b__102_12(BoolValueChangeEvent e)
			{
				levelUpdateNotifierToggle.value = e.value;
				OnlineLevelsManager.CheckLevelUpdateText();
			}

			internal void <InitializeConfig>b__102_13(BoolValueChangeEvent e)
			{
				levelUpdateIgnoreCustomBuilds.value = e.value;
				OnlineLevelsManager.CheckLevelUpdateText();
			}

			internal void <InitializeConfig>b__102_14(BoolValueChangeEvent e)
			{
				newLevelNotifierToggle.value = e.value;
				if (!e.value)
				{
					((ConfigField)newLevelNotifier).hidden = true;
				}
			}

			internal void <InitializeConfig>b__102_17()
			{
				ScanForLevels();
			}

			internal string <InitializeConfig>b__102_24(RudeLevelData data)
			{
				return data.uniqueIdentifier;
			}

			internal bool <ProcessPendingRecords>b__109_0(Task task)
			{
				return ((ConfigField)sendPendingRecords).interactable = true;
			}

			internal void <PostAwake>b__112_0(BoolValueChangeEvent e)
			{
				if (e.value)
				{
					e.canceled = true;
					NotificationPanel.Open((Notification)(object)new LeaderboardPermissionNotification());
				}
			}

			internal void <PostAwake>b__112_1(bool newVal)
			{
				((ConfigField)leaderboardsDivision).hidden = newVal;
			}

			internal void <PostAwake>b__112_2(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)
				{
					return;
				}
				if (AngrySceneManager.isInCustomLevel)
				{
					switch (AngrySceneManager.currentBundleContainer.bundleData.bundleVersion)
					{
					case 2:
						LegacyPatchManager.SetLegacyPatchState(LegacyPatchState.Ver2);
						break;
					case 3:
						LegacyPatchManager.SetLegacyPatchState(LegacyPatchState.Ver3);
						break;
					default:
						LegacyPatchManager.SetLegacyPatchState(LegacyPatchState.None);
						break;
					}
				}
				else
				{
					LegacyPatchManager.SetLegacyPatchState(LegacyPatchState.None);
				}
			}

			internal void <PostAwake>b__112_4(bool externally)
			{
				if (AngryLeaderboards.bannedModsListLoaded)
				{
					CheckForBannedMods();
				}
				else
				{
					AngryLeaderboards.LoadBannedModsList();
				}
			}
		}

		public const string PLUGIN_NAME = "AngryLevelLoader";

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

		public const string PLUGIN_VERSION = "2.9.0";

		public const string PLUGIN_CONFIG_MIN_VERSION = "1.8.0";

		public static readonly Vector3 defaultGravity = new Vector3(0f, -40f, 0f);

		public static string workingDir;

		public static string tempFolderPath;

		public static string dataPath;

		public static string levelsPath;

		public static string mapVarsFolderPath;

		public static string angryCatalogPath;

		public static Plugin instance;

		public static ManualLogSource logger;

		public static PluginConfigurator internalConfig;

		public static BoolField devMode;

		public static StringField lastVersion;

		public static StringField updateLastVersion;

		public static BoolField ignoreUpdates;

		public static StringField configDataPath;

		public static BoolField leaderboardToggle;

		public static BoolField askedPermissionForLeaderboards;

		public static BoolField showLeaderboardOnLevelEnd;

		public static BoolField showLeaderboardOnSecretLevelEnd;

		public static StringField pendingRecordsField;

		public static bool ultrapainLoaded = false;

		public static bool heavenOrHellLoaded = false;

		public static Dictionary<string, RudeLevelData> idDictionary = new Dictionary<string, RudeLevelData>();

		public static Dictionary<string, AngryBundleContainer> angryBundles = new Dictionary<string, AngryBundleContainer>();

		public static Dictionary<string, long> lastPlayed = new Dictionary<string, long>();

		public static Dictionary<string, long> lastUpdate = new Dictionary<string, long>();

		public static int selectedDifficulty = 3;

		public static DifficultyField difficultyField;

		internal static List<string> difficultyList = new List<string> { "HARMLESS", "LENIENT", "STANDARD", "VIOLENT", "BRUTAL" };

		internal static List<string> gamemodeList = new List<string> { "None", "No Monsters", "No Monsters/Weapons" };

		public static Harmony harmony;

		public static PluginConfigurator config;

		public static ConfigHeader levelUpdateNotifier;

		public static ConfigHeader newLevelNotifier;

		public static StringField newLevelNotifierLevels;

		public static BoolField newLevelToggle;

		public static ConfigHeader errorText;

		public static ConfigDivision bundleDivision;

		public static ConfigDivision leaderboardsDivision;

		public static ConfigPanel bannedModsPanel;

		public static ConfigHeader bannedModsText;

		public static ConfigPanel pendingRecords;

		public static ButtonField sendPendingRecords;

		public static ConfigHeader pendingRecordsStatus;

		public static ConfigHeader pendingRecordsInfo;

		public static ButtonArrayField openButtons;

		public static KeyCodeField reloadFileKeybind;

		public static EnumField<CustomLevelButtonPosition> customLevelButtonPosition;

		public static ColorField customLevelButtonFrameColor;

		public static ColorField customLevelButtonBackgroundColor;

		public static ColorField customLevelButtonTextColor;

		public static BoolField refreshCatalogOnBoot;

		public static BoolField checkForUpdates;

		public static BoolField levelUpdateNotifierToggle;

		public static BoolField levelUpdateIgnoreCustomBuilds;

		public static BoolField newLevelNotifierToggle;

		public static BoolField scriptAutoUpdate;

		public static List<string> scriptCertificateIgnore = new List<string>();

		public static StringMultilineField scriptCertificateIgnoreField;

		public static BoolField useDevelopmentBranch;

		public static BoolField useLocalServer;

		public static BoolField scriptUpdateIgnoreCustom;

		public static EnumField<BundleSorting> bundleSortingMode;

		public static EnumField<DefaultLeaderboardCategory> defaultLeaderboardCategory;

		public static EnumField<DefaultLeaderboardDifficulty> defaultLeaderboardDifficulty;

		public static EnumField<DefaultLeaderboardFilter> defaultLeaderboardFilter;

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

		private static AngryCustomLevelButtonComponent currentCustomLevelButton;

		private static RectTransform bossRushButton;

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

		public static AngryUIPanelComponent currentPanel;

		internal static FileSystemWatcher watcher;

		private static Task pendingRecordsTask = null;

		private float lastPress;

		public static bool NoMonsters
		{
			get
			{
				if (difficultyField.gamemodeListValueIndex != 1)
				{
					return difficultyField.gamemodeListValueIndex == 2;
				}
				return true;
			}
		}

		public static bool NoWeapons => difficultyField.gamemodeListValueIndex == 2;

		public static void LoadLastPlayedMap()
		{
			lastPlayed.Clear();
			string lastPlayedMapPath = AngryPaths.LastPlayedMapPath;
			if (!File.Exists(lastPlayedMapPath))
			{
				return;
			}
			using StreamReader streamReader = new StreamReader(File.Open(lastPlayedMapPath, FileMode.Open, FileAccess.Read));
			while (!streamReader.EndOfStream)
			{
				string key = streamReader.ReadLine();
				if (streamReader.EndOfStream)
				{
					logger.LogWarning((object)"Invalid end of last played map file");
					break;
				}
				string text = streamReader.ReadLine();
				if (long.TryParse(text, out var result))
				{
					lastPlayed[key] = result;
				}
				else
				{
					logger.LogInfo((object)("Invalid last played time '" + text + "'"));
				}
			}
		}

		public static void UpdateLastPlayed(AngryBundleContainer bundle)
		{
			string bundleGuid = bundle.bundleData.bundleGuid;
			if (bundleGuid.Length != 32)
			{
				return;
			}
			if (bundleSortingMode.value == BundleSorting.LastPlayed)
			{
				((ConfigField)bundle.rootPanel).siblingIndex = 0;
			}
			long value = ((DateTimeOffset)DateTime.UtcNow).ToUnixTimeSeconds();
			lastPlayed[bundleGuid] = value;
			string lastPlayedMapPath = AngryPaths.LastPlayedMapPath;
			IOUtils.TryCreateDirectoryForFile(lastPlayedMapPath);
			using StreamWriter streamWriter = new StreamWriter(File.Open(lastPlayedMapPath, FileMode.OpenOrCreate, FileAccess.Write));
			streamWriter.BaseStream.Seek(0L, SeekOrigin.Begin);
			streamWriter.BaseStream.SetLength(0L);
			foreach (KeyValuePair<string, long> item in lastPlayed)
			{
				streamWriter.WriteLine(item.Key);
				streamWriter.WriteLine(item.Value.ToString());
			}
		}

		public static void LoadLastUpdateMap()
		{
			lastUpdate.Clear();
			string lastUpdateMapPath = AngryPaths.LastUpdateMapPath;
			if (!File.Exists(lastUpdateMapPath))
			{
				return;
			}
			using StreamReader streamReader = new StreamReader(File.Open(lastUpdateMapPath, FileMode.Open, FileAccess.Read));
			while (!streamReader.EndOfStream)
			{
				string key = streamReader.ReadLine();
				if (streamReader.EndOfStream)
				{
					logger.LogWarning((object)"Invalid end of last played map file");
					break;
				}
				string text = streamReader.ReadLine();
				if (long.TryParse(text, out var result))
				{
					lastUpdate[key] = result;
				}
				else
				{
					logger.LogInfo((object)("Invalid last played time '" + text + "'"));
				}
			}
		}

		public static void UpdateLastUpdate(AngryBundleContainer bundle)
		{
			string bundleGuid = bundle.bundleData.bundleGuid;
			if (bundleGuid.Length != 32)
			{
				return;
			}
			if (bundleSortingMode.value == BundleSorting.LastUpdate)
			{
				((ConfigField)bundle.rootPanel).siblingIndex = 0;
			}
			long value = ((DateTimeOffset)DateTime.UtcNow).ToUnixTimeSeconds();
			lastUpdate[bundleGuid] = value;
			string lastUpdateMapPath = AngryPaths.LastUpdateMapPath;
			IOUtils.TryCreateDirectoryForFile(lastUpdateMapPath);
			using StreamWriter streamWriter = new StreamWriter(File.Open(lastUpdateMapPath, FileMode.OpenOrCreate, FileAccess.Write));
			streamWriter.BaseStream.Seek(0L, SeekOrigin.Begin);
			streamWriter.BaseStream.SetLength(0L);
			foreach (KeyValuePair<string, long> item in lastUpdate)
			{
				streamWriter.WriteLine(item.Key);
				streamWriter.WriteLine(item.Value.ToString());
			}
		}

		public static AngryBundleContainer GetAngryBundleByGuid(string guid)
		{
			return angryBundles.Values.Where((AngryBundleContainer bundle) => bundle.bundleData.bundleGuid == guid).FirstOrDefault();
		}

		public static void ProcessPath(string path)
		{
			if (AngryFileUtils.TryGetAngryBundleData(path, out var data, out var error))
			{
				if (!angryBundles.TryGetValue(data.bundleGuid, out var value))
				{
					AngryBundleContainer angryBundleContainer = new AngryBundleContainer(path, data);
					angryBundles[data.bundleGuid] = angryBundleContainer;
					angryBundleContainer.UpdateOrder();
					try
					{
						if (angryBundleContainer.finalRankScore.value < 0)
						{
							logger.LogWarning((object)"Final rank score for the bundle not cached, skipping lazy reload");
							angryBundleContainer.UpdateScenes(forceReload: false, lazyLoad: false);
						}
						else
						{
							angryBundleContainer.UpdateScenes(forceReload: false, lazyLoad: true);
						}
						return;
					}
					catch (Exception arg)
					{
						logger.LogWarning((object)$"Exception thrown while loading level bundle: {arg}");
						if (!string.IsNullOrEmpty(errorText.text))
						{
							ConfigHeader obj = errorText;
							obj.text += "\n";
						}
						ConfigHeader obj2 = errorText;
						obj2.text = obj2.text + "<color=red>Error loading " + Path.GetFileNameWithoutExtension(path) + "</color>. Check the logs for more information";
						return;
					}
				}
				if (File.Exists(value.pathToAngryBundle) && !IOUtils.PathEquals(path, value.pathToAngryBundle))
				{
					logger.LogError((object)("Duplicate angry files. Original: " + Path.GetFileName(value.pathToAngryBundle) + ". Duplicate: " + Path.GetFileName(path)));
					if (!string.IsNullOrEmpty(errorText.text))
					{
						ConfigHeader obj3 = errorText;
						obj3.text += "\n";
					}
					ConfigHeader val = errorText;
					val.text = val.text + "<color=red>Error loading " + Path.GetFileName(path) + "</color> Duplicate file, original is " + Path.GetFileName(value.pathToAngryBundle);
				}
				else
				{
					bool num = !IOUtils.PathEquals(value.pathToAngryBundle, path);
					value.pathToAngryBundle = path;
					((ConfigField)value.rootPanel).interactable = true;
					((ConfigField)value.rootPanel).hidden = false;
					if (num)
					{
						value.UpdateScenes(forceReload: false, lazyLoad: false);
					}
				}
			}
			else if (AngryFileUtils.IsV1LegacyFile(path))
			{
				if (!string.IsNullOrEmpty(errorText.text))
				{
					ConfigHeader obj4 = errorText;
					obj4.text += "\n";
				}
				ConfigHeader obj5 = errorText;
				obj5.text = obj5.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(errorText.text))
				{
					ConfigHeader obj6 = errorText;
					obj6.text += "\n";
				}
				ConfigHeader obj7 = errorText;
				obj7.text = obj7.text + "<color=yellow>Failed to load " + Path.GetFileNameWithoutExtension(path) + "</color>";
			}
		}

		public static void ScanForLevels()
		{
			errorText.text = "";
			if (!Directory.Exists(levelsPath))
			{
				logger.LogWarning((object)("Could not find the Levels folder at " + levelsPath));
				errorText.text = "<color=red>Error: </color>Levels folder not found";
				return;
			}
			string[] files = Directory.GetFiles(levelsPath);
			for (int i = 0; i < files.Length; i++)
			{
				ProcessPath(files[i]);
			}
			OnlineLevelsManager.UpdateUI();
		}

		public static void SortBundles()
		{
			int num = 0;
			if (bundleSortingMode.value == BundleSorting.Alphabetically)
			{
				foreach (AngryBundleContainer item in angryBundles.Values.OrderBy((AngryBundleContainer b) => b.bundleData.bundleName))
				{
					((ConfigField)item.rootPanel).siblingIndex = num++;
				}
				return;
			}
			if (bundleSortingMode.value == BundleSorting.Author)
			{
				foreach (AngryBundleContainer item2 in angryBundles.Values.OrderBy((AngryBundleContainer b) => b.bundleData.bundleAuthor))
				{
					((ConfigField)item2.rootPanel).siblingIndex = num++;
				}
				return;
			}
			if (bundleSortingMode.value == BundleSorting.LastPlayed)
			{
				long value2;
				foreach (AngryBundleContainer item3 in angryBundles.Values.OrderByDescending((AngryBundleContainer b) => lastPlayed.TryGetValue(b.bundleData.bundleGuid, out value2) ? value2 : 0))
				{
					((ConfigField)item3.rootPanel).siblingIndex = num++;
				}
				return;
			}
			if (bundleSortingMode.value != BundleSorting.LastUpdate)
			{
				return;
			}
			long value;
			foreach (AngryBundleContainer item4 in angryBundles.Values.OrderByDescending((AngryBundleContainer b) => lastUpdate.TryGetValue(b.bundleData.bundleGuid, out value) ? value : 0))
			{
				((ConfigField)item4.rootPanel).siblingIndex = num++;
			}
		}

		public static void UpdateAllUI()
		{
			foreach (AngryBundleContainer value in angryBundles.Values)
			{
				if (value.finalRankScore.value < 0)
				{
					value.UpdateScenes(forceReload: false, lazyLoad: false);
				}
				else
				{
					value.UpdateFinalRankUI();
				}
				foreach (LevelContainer value2 in value.levels.Values)
				{
					value2.UpdateUI();
				}
			}
		}

		public static bool LoadEssentialScripts()
		{
			bool result = true;
			if (ScriptManager.AttemptLoadScriptWithCertificate("AngryLoaderAPI.dll") == ScriptManager.LoadScriptResult.NotFound)
			{
				logger.LogError((object)"Required script AngryLoaderAPI.dll not found");
				result = false;
			}
			else
			{
				ScriptManager.ForceLoadScript("AngryLoaderAPI.dll");
			}
			if (ScriptManager.AttemptLoadScriptWithCertificate("RudeLevelScripts.dll") == ScriptManager.LoadScriptResult.NotFound)
			{
				logger.LogError((object)"Required script RudeLevelScripts.dll not found");
				result = false;
			}
			else
			{
				ScriptManager.ForceLoadScript("RudeLevelScripts.dll");
			}
			return result;
		}

		private static void DisableAllConfig()
		{
			Stack<ConfigField> stack = new Stack<ConfigField>(config.rootPanel.GetAllFields());
			while (stack.Count != 0)
			{
				ConfigField val = stack.Pop();
				ConfigPanel val2 = (ConfigPanel)(object)((val is ConfigPanel) ? val : null);
				if (val2 != null)
				{
					ConfigField[] allFields = val2.GetAllFields();
					foreach (ConfigField item in allFields)
					{
						stack.Push(item);
					}
				}
				val.interactable = false;
			}
		}

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

		private static bool GetUltrapainDifficultySet()
		{
			return Plugin.ultrapainDifficulty;
		}

		private static bool GetHeavenOrHellDifficultySet()
		{
			return Plugin.isHeavenOrHell;
		}

		private static void CreateCustomLevelButtonOnMainMenu()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Expected O, but got Unknown
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Expected O, but got Unknown
			Scene activeScene = SceneManager.GetActiveScene();
			GameObject canvasObj = (from obj in ((Scene)(ref activeScene)).GetRootGameObjects()
				where ((Object)obj).name == "Canvas"
				select obj).FirstOrDefault();
			if ((Object)(object)canvasObj == (Object)null)
			{
				logger.LogWarning((object)"Angry tried to create main menu buttons, but root canvas was not found!");
				return;
			}
			Transform chapterSelect = canvasObj.transform.Find("Chapter Select");
			if ((Object)(object)chapterSelect != (Object)null)
			{
				GameObject obj2 = Addressables.InstantiateAsync((object)"AngryLevelLoader/UI/CustomLevels.prefab", chapterSelect, false, true).WaitForCompletion();
				Transform val = chapterSelect.Find("Boss Rush Button");
				if ((Object)(object)val != (Object)null)
				{
					bossRushButton = ((Component)val).gameObject.GetComponent<RectTransform>();
				}
				currentCustomLevelButton = obj2.GetComponent<AngryCustomLevelButtonComponent>();
				currentCustomLevelButton.button.onClick = new ButtonClickedEvent();
				((UnityEvent)currentCustomLevelButton.button.onClick).AddListener((UnityAction)delegate
				{
					//IL_0147: Unknown result type (might be due to invalid IL or missing references)
					((Component)chapterSelect).gameObject.SetActive(false);
					Transform val2 = canvasObj.transform.Find("OptionsMenu");
					if ((Object)(object)val2 == (Object)null)
					{
						logger.LogError((object)"Angry tried to find the options menu but failed!");
						((Component)chapterSelect).gameObject.SetActive(true);
					}
					else
					{
						((Component)val2).gameObject.SetActive(true);
						Transform val3 = ((Component)val2).transform.Find("Panel/PluginConfiguratorButton(Clone)");
						if ((Object)(object)val3 == (Object)null)
						{
							val3 = ((Component)val2).transform.Find("Panel/PluginConfiguratorButton");
						}
						if ((Object)(object)val3 == (Object)null)
						{
							logger.LogError((object)"Angry tried to find the plugin configurator button but failed!");
						}
						else
						{
							Transform val4 = val2.Find("Panel");
							ButtonHighlightParent val5 = default(ButtonHighlightParent);
							if ((Object)(object)val4 != (Object)null && ((Component)val4).gameObject.TryGetComponent<ButtonHighlightParent>(ref val5) && (val5.buttons == null || val5.buttons.Length == 0))
							{
								val5.Start();
							}
							((UnityEvent)((Component)val3).gameObject.GetComponent<Button>().onClick).Invoke();
							if ((Object)(object)PluginConfiguratorController.activePanel != (Object)null)
							{
								PluginConfiguratorController.activePanel.SetActive(false);
							}
							((Component)PluginConfiguratorController.mainPanel).gameObject.SetActive(false);
							config.rootPanel.OpenPanelInternally(false);
							config.rootPanel.currentPanel.rect.normalizedPosition = new Vector2(0f, 1f);
							int @int = MonoSingleton<PrefsManager>.Instance.GetInt("difficulty", 3);
							switch (@int)
							{
							case 0:
							case 1:
							case 2:
							case 3:
							case 4:
								logger.LogInfo((object)("Angry setting difficulty to " + difficultyList[@int]));
								difficultyField.difficultyListValueIndex = @int;
								break;
							case 5:
								if (ultrapainLoaded)
								{
									if (GetUltrapainDifficultySet())
									{
										difficultyField.difficultyListValueIndex = difficultyList.IndexOf("ULTRAPAIN");
									}
									else
									{
										logger.LogWarning((object)"Difficulty was set to UKMD, but angry does not support it. Setting to violent");
										difficultyField.difficultyListValueIndex = 3;
									}
								}
								break;
							default:
								if (heavenOrHellLoaded)
								{
									if (GetHeavenOrHellDifficultySet())
									{
										difficultyField.difficultyListValueIndex = difficultyList.IndexOf("HEAVEN OR HELL");
									}
									else
									{
										logger.LogWarning((object)"Unknown difficulty, defaulting to violent");
										difficultyField.difficultyListValueIndex = 3;
									}
								}
								break;
							}
							difficultyField.TriggerPostDifficultyChangeEvent();
						}
					}
				});
				customLevelButtonPosition.TriggerPostValueChangeEvent();
				customLevelButtonFrameColor.TriggerPostValueChangeEvent();
				customLevelButtonBackgroundColor.TriggerPostValueChangeEvent();
				customLevelButtonTextColor.TriggerPostValueChangeEvent();
			}
			else
			{
				logger.LogWarning((object)"Angry tried to find chapter select menu, but root canvas was not found!");
			}
		}

		private static void CreateAngryUI()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			if (!((Object)(object)currentPanel != (Object)null))
			{
				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;
				}
				currentPanel = Addressables.InstantiateAsync((object)"AngryLevelLoader/UI/AngryUIPanel.prefab", val.transform, false, true).WaitForCompletion().GetComponent<AngryUIPanelComponent>();
				currentPanel.reloadBundlePrompt.MakeTransparent(true);
			}
		}

		private static void InitializeFileWatcher()
		{
			if (watcher != null)
			{
				return;
			}
			watcher = new FileSystemWatcher(levelsPath);
			watcher.SynchronizingObject = CrossThreadInvoker.Instance;
			watcher.Changed += delegate(object sender, FileSystemEventArgs e)
			{
				string fullPath4 = e.FullPath;
				foreach (AngryBundleContainer value2 in angryBundles.Values)
				{
					if (IOUtils.PathEquals(fullPath4, value2.pathToAngryBundle))
					{
						logger.LogWarning((object)("Bundle " + fullPath4 + " was updated, container notified"));
						value2.FileChanged();
						break;
					}
				}
			};
			watcher.Renamed += delegate(object sender, RenamedEventArgs e)
			{
				string fullPath3 = e.FullPath;
				foreach (AngryBundleContainer value3 in angryBundles.Values)
				{
					if (IOUtils.PathEquals(fullPath3, value3.pathToAngryBundle))
					{
						logger.LogWarning((object)("Bundle " + fullPath3 + " was renamed, path updated"));
						value3.pathToAngryBundle = fullPath3;
						break;
					}
				}
			};
			watcher.Deleted += delegate(object sender, FileSystemEventArgs e)
			{
				string fullPath2 = e.FullPath;
				foreach (AngryBundleContainer value4 in angryBundles.Values)
				{
					if (IOUtils.PathEquals(fullPath2, value4.pathToAngryBundle))
					{
						logger.LogWarning((object)("Bundle " + fullPath2 + " was deleted, unlinked"));
						value4.pathToAngryBundle = "";
						break;
					}
				}
			};
			watcher.Created += delegate(object sender, FileSystemEventArgs e)
			{
				string fullPath = e.FullPath;
				if (AngryFileUtils.TryGetAngryBundleData(fullPath, out var data, out var _) && angryBundles.TryGetValue(data.bundleGuid, out var value) && value.bundleData.bundleGuid == data.bundleGuid && !File.Exists(value.pathToAngryBundle))
				{
					logger.LogWarning((object)("Bundle " + fullPath + " was just added, and a container with the same guid had no file linked. Linked, container notified"));
					value.pathToAngryBundle = fullPath;
					value.FileChanged();
				}
			};
			watcher.Filter = "*";
			watcher.IncludeSubdirectories = false;
			watcher.EnableRaisingEvents = true;
		}

		private static void InitializeConfig()
		{
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Expected O, but got Unknown
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Expected O, but got Unknown
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Expected O, but got Unknown
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Expected O, but got Unknown
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Expected O, but got Unknown
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Expected O, but got Unknown
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Expected O, but got Unknown
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Expected O, but got Unknown
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Expected O, but got Unknown
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Expected O, but got Unknown
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Expected O, but got Unknown
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Expected O, but got Unknown
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Expected O, but got Unknown
			//IL_036f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0387: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Expected O, but got Unknown
			//IL_0397: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c9: Expected O, but got Unknown
			//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d3: Expected O, but got Unknown
			//IL_0402: Unknown result type (might be due to invalid IL or missing references)
			//IL_040c: Expected O, but got Unknown
			//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fd: Expected O, but got Unknown
			//IL_045a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0464: Expected O, but got Unknown
			//IL_0474: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cd: Expected O, but got Unknown
			//IL_042a: Unknown result type (might be due to invalid IL or missing references)
			//IL_042f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0435: Expected O, but got Unknown
			//IL_04ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f7: Expected O, but got Unknown
			//IL_053c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0546: Expected O, but got Unknown
			//IL_051b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0520: Unknown result type (might be due to invalid IL or missing references)
			//IL_0526: Expected O, but got Unknown
			//IL_057c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0590: Unknown result type (might be due to invalid IL or missing references)
			//IL_055f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0564: Unknown result type (might be due to invalid IL or missing references)
			//IL_056a: Expected O, but got Unknown
			//IL_05ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0608: Expected O, but got Unknown
			//IL_0603: Unknown result type (might be due to invalid IL or missing references)
			//IL_060d: Expected O, but got Unknown
			//IL_0636: Unknown result type (might be due to invalid IL or missing references)
			//IL_0641: Unknown result type (might be due to invalid IL or missing references)
			//IL_064b: Expected O, but got Unknown
			//IL_0646: Unknown result type (might be due to invalid IL or missing references)
			//IL_0650: Expected O, but got Unknown
			//IL_0626: Unknown result type (might be due to invalid IL or missing references)
			//IL_062b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0631: Expected O, but got Unknown
			//IL_0683: Unknown result type (might be due to invalid IL or missing references)
			//IL_068d: Expected O, but got Unknown
			//IL_0688: Unknown result type (might be due to invalid IL or missing references)
			//IL_0692: Expected O, but got Unknown
			//IL_0669: Unknown result type (might be due to invalid IL or missing references)
			//IL_066e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0674: Expected O, but got Unknown
			//IL_06c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0708: Unknown result type (might be due to invalid IL or missing references)
			//IL_0712: Expected O, but got Unknown
			//IL_0723: Unknown result type (might be due to invalid IL or missing references)
			//IL_072d: Expected O, but got Unknown
			//IL_07cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_07fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0805: Expected O, but got Unknown
			//IL_0816: Unknown result type (might be due to invalid IL or missing references)
			//IL_0820: Expected O, but got Unknown
			//IL_0831: Unknown result type (might be due to invalid IL or missing references)
			//IL_083b: Expected O, but got Unknown
			//IL_084c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0856: Expected O, but got Unknown
			//IL_06ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b6: Expected O, but got Unknown
			//IL_089f: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a9: Expected O, but got Unknown
			//IL_08e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ed: Expected O, but got Unknown
			//IL_08c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_08cd: Expected O, but got Unknown
			//IL_092c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0936: Expected O, but got Unknown
			//IL_0952: Unknown result type (might be due to invalid IL or missing references)
			//IL_095c: Expected O, but got Unknown
			//IL_0906: Unknown result type (might be due to invalid IL or missing references)
			//IL_090b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0911: Expected O, but got Unknown
			//IL_0992: Unknown result type (might be due to invalid IL or missing references)
			//IL_09a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_09cb: Expected O, but got Unknown
			//IL_09dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e6: Expected O, but got Unknown
			//IL_09fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a06: Expected O, but got Unknown
			//IL_0a48: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a4d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a6f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a79: Expected O, but got Unknown
			//IL_0a89: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a9c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aa6: Expected O, but got Unknown
			//IL_0ab9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ac3: Expected O, but got Unknown
			//IL_0b04: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b09: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b17: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b21: Expected O, but got Unknown
			//IL_0975: Unknown result type (might be due to invalid IL or missing references)
			//IL_097a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0980: Expected O, but got Unknown
			//IL_0b60: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b66: Expected O, but got Unknown
			//IL_0b3b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b40: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b46: Expected O, but got Unknown
			//IL_0b81: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b8e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b98: Expected O, but got Unknown
			//IL_0ba8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bb6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bc6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bd0: Expected O, but got Unknown
			//IL_0bda: Unknown result type (might be due to invalid IL or missing references)
			//IL_0be4: Expected O, but got Unknown
			//IL_0beb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bf5: Expected O, but got Unknown
			//IL_0c07: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c11: Expected O, but got Unknown
			//IL_0c22: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c37: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c41: Expected O, but got Unknown
			if (config != null)
			{
				return;
			}
			config = PluginConfigurator.Create("Angry Level Loader", "com.eternalUnion.angryLevelLoader");
			PluginConfigurator obj = config;
			object obj2 = <>c.<>9__102_0;
			if (obj2 == null)
			{
				PostPresetChangeEvent val = delegate
				{
					UpdateAllUI();
				};
				<>c.<>9__102_0 = val;
				obj2 = (object)val;
			}
			obj.postPresetChangeEvent += (PostPresetChangeEvent)obj2;
			config.SetIconWithURL("file://" + Path.Combine(workingDir, "plugin-icon.png"));
			newLevelToggle = new BoolField(config.rootPanel, "", "v_newLevelToggle", false);
			((ConfigField)newLevelToggle).hidden = true;
			ConfigPanel rootPanel = config.rootPanel;
			object obj3 = <>c.<>9__102_1;
			if (obj3 == null)
			{
				OpenPanelEventDelegate val2 = delegate
				{
					if (newLevelToggle.value)
					{
						newLevelNotifier.text = string.Join("\n", from level in newLevelNotifierLevels.value.Split(new char[1] { '`' })
							where !string.IsNullOrEmpty(level)
							select level into name
							select "<color=lime>New level: " + name + "</color>");
						((ConfigField)newLevelNotifier).hidden = false;
						newLevelNotifierLevels.value = "";
					}
					newLevelToggle.value = false;
				};
				<>c.<>9__102_1 = val2;
				obj3 = (object)val2;
			}
			rootPanel.onPannelOpenEvent += (OpenPanelEventDelegate)obj3;
			newLevelNotifier = new ConfigHeader(config.rootPanel, "<color=lime>New levels are available!</color>", 16);
			((ConfigField)newLevelNotifier).hidden = true;
			levelUpdateNotifier = new ConfigHeader(config.rootPanel, "<color=lime>Level updates available!</color>", 16);
			((ConfigField)levelUpdateNotifier).hidden = true;
			OnlineLevelsManager.onlineLevelsPanel = new ConfigPanel(internalConfig.rootPanel, "Online Levels", "b_onlineLevels", (PanelFieldType)1);
			new ConfigBridge((ConfigField)(object)OnlineLevelsManager.onlineLevelsPanel, config.rootPanel);
			OnlineLevelsManager.onlineLevelsPanel.SetIconWithURL("file://" + Path.Combine(workingDir, "online-icon.png"));
			ConfigPanel onlineLevelsPanel = OnlineLevelsManager.onlineLevelsPanel;
			object obj4 = <>c.<>9__102_2;
			if (obj4 == null)
			{
				OpenPanelEventDelegate val3 = delegate
				{
					((ConfigField)newLevelNotifier).hidden = true;
				};
				<>c.<>9__102_2 = val3;
				obj4 = (object)val3;
			}
			onlineLevelsPanel.onPannelOpenEvent += (OpenPanelEventDelegate)obj4;
			OnlineLevelsManager.Init();
			leaderboardsDivision = new ConfigDivision(config.rootPanel, "leaderboardsDivision");
			((ConfigField)leaderboardsDivision).hidden = !leaderboardToggle.value;
			bannedModsPanel = new ConfigPanel((ConfigPanel)(object)leaderboardsDivision, "Leaderboard banned mods", "bannedModsPanel", (PanelFieldType)1);
			bannedModsPanel.SetIconWithURL("file://" + Path.Combine(workingDir, "banned-mods-icon.png"));
			((ConfigField)bannedModsPanel).hidden = true;
			bannedModsText = new ConfigHeader(bannedModsPanel, "", 24, (TextAnchor)3);
			pendingRecords = new ConfigPanel((ConfigPanel)(object)leaderboardsDivision, "Pending records", "pendingRecords", (PanelFieldType)1);
			pendingRecords.SetIconWithURL("file://" + Path.Combine(workingDir, "pending.png"));
			sendPendingRecords = new ButtonField(pendingRecords, "Send Pending Records", "sendPendingRecordsButton");
			ButtonField obj5 = sendPendingRecords;
			object obj6 = <>O.<1>__ProcessPendingRecords;
			if (obj6 == null)
			{
				OnClick val4 = ProcessPendingRecords;
				<>O.<1>__ProcessPendingRecords = val4;
				obj6 = (object)val4;
			}
			obj5.onClick += (OnClick)obj6;
			pendingRecordsStatus = new ConfigHeader(pendingRecords, "", 20, (TextAnchor)3);
			new ConfigSpace(pendingRecords, 5f);
			pendingRecordsInfo = new ConfigHeader(pendingRecords, "", 18, (TextAnchor)3);
			UpdatePendingRecordsUI();
			difficultyField = new DifficultyField(config.rootPanel);
			bundleSortingMode = new EnumField<BundleSorting>(internalConfig.rootPanel, "Bundle sorting", "s_bundleSortingMode", BundleSorting.LastPlayed);
			bundleSortingMode.onValueChange += delegate(EnumValueChangeEvent<BundleSorting> e)
			{
				bundleSortingMode.value = e.value;
				SortBundles();
			};
			bundleSortingMode.SetEnumDisplayName(BundleSorting.LastPlayed, "Last Played");
			bundleSortingMode.SetEnumDisplayName(BundleSorting.LastUpdate, "Last Update");
			new ConfigBridge((ConfigField)(object)bundleSortingMode, config.rootPanel);
			ConfigHeader difficultyOverrideWarning = new ConfigHeader(config.rootPanel, "Difficulty is overridden by gamemode\nWarning: Some levels may not be compatible with gamemodes", 18);
			difficultyOverrideWarning.textColor = Color.yellow;
			((ConfigField)difficultyOverrideWarning).hidden = true;
			DifficultyField obj7 = difficultyField;
			obj7.postDifficultyChange = (PostStringListValueChangeEvent)Delegate.Combine((Delegate?)(object)obj7.postDifficultyChange, (Delegate?)(PostStringListValueChangeEvent)delegate(string difficultyName, int difficultyIndex)
			{
				selectedDifficulty = Array.IndexOf(difficultyList.ToArray(), difficultyName);
				if (selectedDifficulty == -1)
				{
					logger.LogWarning((object)"Invalid difficulty, setting to violent");
					selectedDifficulty = 3;
					difficultyField.difficultyListValue = "VIOLENT";
				}
				else if (difficultyName == "ULTRAPAIN")
				{
					selectedDifficulty = 100;
				}
				else if (difficultyName == "HEAVEN OR HELL")
				{
					selectedDifficulty = 101;
				}
				if (difficultyField.gamemodeListValueIndex == 1 || difficultyField.gamemodeListValueIndex == 2)
				{
					((ConfigField)difficultyOverrideWarning).hidden = false;
					difficultyField.difficultyInteractable = false;
					difficultyField.ForceSetDifficultyUI(0);
					selectedDifficulty = 0;
				}
				else
				{
					((ConfigField)difficultyOverrideWarning).hidden = true;
					difficultyField.difficultyInteractable = true;
					difficultyField.ForceSetDifficultyUI(selectedDifficulty);
				}
			});
			DifficultyField obj8 = difficultyField;
			PostStringListValueChangeEvent postGamemodeChange = obj8.postGamemodeChange;
			object obj9 = <>c.<>9__102_22;
			if (obj9 == null)
			{
				PostStringListValueChangeEvent val5 = delegate
				{
					difficultyField.TriggerPostDifficultyChangeEvent();
				};
				<>c.<>9__102_22 = val5;
				obj9 = (object)val5;
			}
			obj8.postGamemodeChange = (PostStringListValueChangeEvent)Delegate.Combine((Delegate?)(object)postGamemodeChange, (Delegate?)obj9);
			ConfigPanel rootPanel2 = config.rootPanel;
			object obj10 = <>c.<>9__102_4;
			if (obj10 == null)
			{
				OpenPanelEventDelegate val6 = delegate
				{
					difficultyField.TriggerPostDifficultyChangeEvent();
				};
				<>c.<>9__102_4 = val6;
				obj10 = (object)val6;
			}
			rootPanel2.onPannelOpenEvent += (OpenPanelEventDelegate)obj10;
			difficultyField.TriggerPostDifficultyChangeEvent();
			ConfigPanel settingsPanel = new ConfigPanel(internalConfig.rootPanel, "Settings", "p_settings", (PanelFieldType)0);
			new ConfigBridge((ConfigField)(object)settingsPanel, config.rootPanel);
			((ConfigField)settingsPanel).hidden = true;
			openButtons = new ButtonArrayField(settingsPanel, "settingButtons", 2, new float[2] { 0.5f, 0.5f }, new string[2] { "Open Levels Folder", "Changelog" }, 5f);
			ButtonClickEvent obj11 = openButtons.OnClickEventHandler(0);
			object obj12 = <>c.<>9__102_5;
			if (obj12 == null)
			{
				OnClick val7 = delegate
				{
					Application.OpenURL(levelsPath);
				};
				<>c.<>9__102_5 = val7;
				obj12 = (object)val7;
			}
			obj11.onClick += (OnClick)obj12;
			ButtonClickEvent obj13 = openButtons.OnClickEventHandler(1);
			object obj14 = <>c.<>9__102_6;
			if (obj14 == null)
			{
				OnClick val8 = delegate
				{
					openButtons.SetButtonInteractable(1, false);
					PluginUpdateHandler.CheckPluginUpdate();
				};
				<>c.<>9__102_6 = val8;
				obj14 = (object)val8;
			}
			obj13.onClick += (OnClick)obj14;
			reloadFileKeybind = new KeyCodeField(settingsPanel, "Reload File", "f_reloadFile", (KeyCode)0);
			KeyCodeField obj15 = reloadFileKeybind;
			object obj16 = <>c.<>9__102_7;
			if (obj16 == null)
			{
				KeyCodeValueChangeEventDelegate val9 = delegate(KeyCodeValueChangeEvent e)
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					//IL_000b: Invalid comparison between Unknown and I4
					//IL_000e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0018: Invalid comparison between Unknown and I4
					//IL_001b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0025: Invalid comparison between Unknown and I4
					if ((int)e.value == 323 || (int)e.value == 324 || (int)e.value == 325)
					{
						e.canceled = true;
					}
				};
				<>c.<>9__102_7 = val9;
				obj16 = (object)val9;
			}
			obj15.onValueChange += (KeyCodeValueChangeEventDelegate)obj16;
			new ConfigHeader(settingsPanel, "User Interface", 24).textColor = new Color(1f, 0.504717f, 0.9454f);
			customLevelButtonPosition = new EnumField<CustomLevelButtonPosition>(settingsPanel, "Custom level button position", "s_customLevelButtonPosition", CustomLevelButtonPosition.Bottom);
			customLevelButtonPosition.postValueChangeEvent += delegate(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 CustomLevelButtonPosition.Disabled:
						((Component)currentCustomLevelButton).gameObject.SetActive(false);
						break;
					case CustomLevelButtonPosition.Bottom:
						((Component)currentCustomLevelButton).transform.localPosition = new Vector3(((Component)currentCustomLevelButton).transform.localPosition.x, -303f, ((Component)currentCustomLevelButton).transform.localPosition.z);
						break;
					case 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 == 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);
						}
					}
				}
			};
			ConfigPanel val10 = new ConfigPanel(settingsPanel, "Custom level button colors", "customLevelButtonPanel");
			customLevelButtonFrameColor = new ColorField(val10, "Custom level button frame color", "s_customLevelButtonFrameColor", Color.white);
			ColorField obj17 = customLevelButtonFrameColor;
			object obj18 = <>c.<>9__102_9;
			if (obj18 == null)
			{
				PostColorValueChangeEvent val11 = 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__102_9 = val11;
				obj18 = (object)val11;
			}
			obj17.postValueChangeEvent += (PostColorValueChangeEvent)obj18;
			customLevelButtonBackgroundColor = new ColorField(val10, "Custom level button background color", "s_customLevelButtonBgColor", Color.black);
			ColorField obj19 = customLevelButtonBackgroundColor;
			object obj20 = <>c.<>9__102_10;
			if (obj20 == null)
			{
				PostColorValueChangeEvent val12 = 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.background).color = clr;
					}
				};
				<>c.<>9__102_10 = val12;
				obj20 = (object)val12;
			}
			obj19.postValueChangeEvent += (PostColorValueChangeEvent)obj20;
			customLevelButtonTextColor = new ColorField(val10, "Custom level button text color", "s_customLevelButtonTextColor", Color.white);
			ColorField obj21 = customLevelButtonTextColor;
			object obj22 = <>c.<>9__102_11;
			if (obj22 == null)
			{
				PostColorValueChangeEvent val13 = 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__102_11 = val13;
				obj22 = (object)val13;
			}
			obj21.postValueChangeEvent += (PostColorValueChangeEvent)obj22;
			new ConfigHeader(settingsPanel, "Leaderboards", 24).textColor = new Color(1f, 0.692924f, 0.291f);
			new ConfigBridge((ConfigField)(object)leaderboardToggle, settingsPanel);
			showLeaderboardOnLevelEnd = new BoolField(settingsPanel, "Show leaderboard on level end", "showLeaderboardOnLevelEnd", true);
			showLeaderboardOnSecretLevelEnd = new BoolField(settingsPanel, "Show leaderboard on secret level end", "showLeaderboardOnSecretLevelEnd", true);
			new SpaceField(settingsPanel, 5f);
			defaultLeaderboardCategory = new EnumField<DefaultLeaderboardCategory>(settingsPanel, "Default leaderboard category", "defaultLeaderboardCategory", DefaultLeaderboardCategory.All);
			defaultLeaderboardCategory.SetEnumDisplayName(DefaultLeaderboardCategory.PRank, "P Rank");
			defaultLeaderboardCategory.SetEnumDisplayName(DefaultLeaderboardCategory.Nomo, "No Monsters");
			defaultLeaderboardCategory.SetEnumDisplayName(DefaultLeaderboardCategory.Nomow, "No Monsters/Weapons");
			defaultLeaderboardDifficulty = new EnumField<DefaultLeaderboardDifficulty>(settingsPanel, "Default leaderboard difficulty", "defaultLeaderboardDifficulty", DefaultLeaderboardDifficulty.Any);
			defaultLeaderboardFilter = new EnumField<DefaultLeaderboardFilter>(settingsPanel, "Default leaderboard filter", "defaultLeaderboardFilter", DefaultLeaderboardFilter.Global);
			new ConfigHeader(settingsPanel, "Online", 24).textColor = new Color(0.532f, 0.8284001f, 1f);
			refreshCatalogOnBoot = new BoolField(settingsPanel, "Refresh online catalog on boot", "s_refreshCatalogBoot", true);
			checkForUpdates = new BoolField(settingsPanel, "Check for updates on boot", "s_checkForUpdates", true);
			useDevelopmentBranch = new BoolField(settingsPanel, "Use development chanel", "s_useDevChannel", false);
			useLocalServer = new BoolField(settingsPanel, "Use local server", "s_useLocalServer", false);
			if (!devMode.value)
			{
				((ConfigField)useDevelopmentBranch).hidden = true;
				useDevelopmentBranch.value = false;
				((ConfigField)useLocalServer).hidden = true;
				useLocalServer.value = false;
			}
			levelUpdateNotifierToggle = new BoolField(settingsPanel, "Notify on level updates", "s_levelUpdateNofify", true);
			BoolField obj23 = levelUpdateNotifierToggle;
			object obj24 = <>c.<>9__102_12;
			if (obj24 == null)
			{
				BoolValueChangeEventDelegate val14 = delegate(BoolValueChangeEvent e)
				{
					levelUpdateNotifierToggle.value = e.value;
					OnlineLevelsManager.CheckLevelUpdateText();
				};
				<>c.<>9__102_12 = val14;
				obj24 = (object)val14;
			}
			obj23.onValueChange += (BoolValueChangeEventDelegate)obj24;
			levelUpdateIgnoreCustomBuilds = new BoolField(settingsPanel, "Ignore updates for custom build", "s_levelUpdateIgnoreCustomBuilds", false);
			BoolField obj25 = levelUpdateIgnoreCustomBuilds;
			object obj26 = <>c.<>9__102_13;
			if (obj26 == null)
			{
				BoolValueChangeEventDelegate val15 = delegate(BoolValueChangeEvent e)
				{
					levelUpdateIgnoreCustomBuilds.value = e.value;
					OnlineLevelsManager.CheckLevelUpdateText();
				};
				<>c.<>9__102_13 = val15;
				obj26 = (object)val15;
			}
			obj25.onValueChange += (BoolValueChangeEventDelegate)obj26;
			newLevelNotifierLevels = new StringField(settingsPanel, "h_New levels", "s_newLevelNotifierLevels", "", true);
			((ConfigField)newLevelNotifierLevels).hidden = true;
			newLevelNotifierToggle = new BoolField(settingsPanel, "Notify on new level release", "s_newLevelNotiftToggle", true);
			BoolField obj27 = newLevelNotifierToggle;
			object obj28 = <>c.<>9__102_14;
			if (obj28 == null)
			{
				BoolValueChangeEventDelegate val16 = delegate(BoolValueChangeEvent e)
				{
					newLevelNotifierToggle.value = e.value;
					if (!e.value)
					{
						((ConfigField)newLevelNotifier).hidden = true;
					}
				};
				<>c.<>9__102_14 = val16;
				obj28 = (object)val16;
			}
			obj27.onValueChange += (BoolValueChangeEventDelegate)obj28;
			new ConfigHeader(settingsPanel, "Scripts", 24).textColor = new Color(0.6248745f, 1f, 0.617f);
			scriptUpdateIgnoreCustom = new BoolField(settingsPanel, "Ignore updates for custom builds", "s_scriptUpdateIgnoreCustom", false);
			scriptAutoUpdate = new BoolField(settingsPanel, "Auto update scripts", "s_scriptAutoUpdate", true);
			scriptCertificateIgnoreField = new StringMultilineField(settingsPanel, "Certificate ignore", "s_scriptCertificateIgnore", "", true);
			scriptCertificateIgnore = scriptCertificateIgnoreField.value.Split(new char[1] { '\n' }).ToList();
			new SpaceField(settingsPanel, 5f);
			new ConfigHeader(settingsPanel, "Danger Zone", 24).textColor = Color.red;
			StringField dataPathInput = new StringField(settingsPanel, "Data Path", "s_dataPathInput", dataPath, false, false);
			ButtonField val17 = new ButtonField(settingsPanel, "Move Data", "s_changeDataPath");
			ConfigHeader dataInfo = new ConfigHeader(settingsPanel, "<color=red>RESTART REQUIRED</color>", 18);
			((ConfigField)dataInfo).hidden = true;
			val17.onClick += (OnClick)delegate
			{
				string value = dataPathInput.value;
				if (!(value == configDataPath.value))
				{
					if (!Directory.Exists(value))
					{
						dataInfo.text = "<color=red>Could not find the directory</color>";
						((ConfigField)dataInfo).hidden = false;
					}
					else
					{
						string text3 = Path.Combine(value, "Levels");
						IOUtils.TryCreateDirectory(text3);
						string[] files = Directory.GetFiles(levelsPath);
						foreach (string text4 in files)
						{
							string text5 = Path.Combine(text3, Path.GetFileName(text4));
							if (File.Exists(text5))
							{
								File.Copy(text4, text5, overwrite: true);
								File.Delete(text4);
							}
							else
							{
								File.Move(text4, text5);
							}
						}
						Directory.Delete(levelsPath, recursive: true);
						levelsPath = text3;
						string text6 = Path.Combine(value, "LevelsUnpacked");
						IOUtils.TryCreateDirectory(text6);
						files = Directory.GetDirectories(tempFolderPath);
						foreach (string text7 in files)
						{
							string text8 = Path.Combine(text6, Path.GetFileName(text7));
							if (Directory.Exists(text8))
							{
								Directory.Delete(text8, recursive: true);
							}
							IOUtils.DirectoryCopy(text7, text8, copySubDirs: true, deleteSource: true);
						}
						Directory.Delete(tempFolderPath, recursive: true);
						tempFolderPath = text6;
						string text9 = Path.Combine(value, "MapVars");
						IOUtils.TryCreateDirectory(text9);
						files = Directory.GetDirectories(Path.Combine(dataPath, "MapVars"));
						foreach (string text10 in files)
						{
							string text11 = Path.Combine(text9, Path.GetFileName(text10));
							if (Directory.Exists(text11))
							{
								Directory.Delete(text11, recursive: true);
							}
							IOUtils.DirectoryCopy(text10, text11, copySubDirs: true, deleteSource: true);
						}
						if (Directory.Exists(Path.Combine(dataPath, "MapVars")))
						{
							Directory.Delete(Path.Combine(dataPath, "MapVars"), recursive: true);
						}
						dataInfo.text = "<color=red>RESTART REQUIRED</color>";
						((ConfigField)dataInfo).hidden = false;
						configDataPath.value = value;
						DisableAllConfig();
					}
				}
			};
			ButtonArrayField val18 = new ButtonArrayField(config.rootPanel, "settingsAndReload", 2, new float[2] { 0.5f, 0.5f }, new string[2] { "Settings", "Scan For Levels" }, 5f);
			val18.OnClickEventHandler(0).onClick += (OnClick)delegate
			{
				settingsPanel.OpenPanel();
			};
			ButtonClickEvent obj29 = val18.OnClickEventHandler(1);
			object obj30 = <>c.<>9__102_17;
			if (obj30 == null)
			{
				OnClick val19 = delegate
				{
					ScanForLevels();
				};
				<>c.<>9__102_17 = val19;
				obj30 = (object)val19;
			}
			obj29.onClick += (OnClick)obj30;
			ConfigPanel val20 = new ConfigPanel(config.rootPanel, "Developer Panel", "devPanel", (PanelFieldType)3);
			if (!devMode.value)
			{
				((ConfigField)val20).hidden = true;
			}
			new ConfigHeader(val20, "Angry Server Interface", 24);
			ConfigDivision devDiv = new ConfigDivision(val20, "devDiv");
			ButtonField val21 = new ButtonField((ConfigPanel)(object)devDiv, "Update All Bundles", "updateAllBundles");
			new ConfigHeader(val20, "Output", 18, (TextAnchor)3);
			ConfigHeader processInfo = new ConfigHeader(val20, "", 18, (TextAnchor)3);
			ConfigHeader debugInfo = new ConfigHeader(val20, "", 18, (TextAnchor)3);
			val21.onClick += (OnClick)async delegate
			{
				((ConfigField)devDiv).interactable = false;
				processInfo.text = "";
				debugInfo.text = "";
				try
				{
					if (OnlineLevelsManager.catalog == null)
					{
						processInfo.text = "<color=red>Catalog is not loaded</color>";
					}
					else
					{
						debugInfo.text = "<color=grey>Fetching existing bundles...</color>";
						AngryAdmin.GetAllLevelInfoResult existingBundles = await AngryAdmin.GetAllLevelInfoTask();
						if (existingBundles.networkError)
						{
							processInfo.text = "Network error, check connection";
						}
						else if (existingBundles.httpError)
						{
							processInfo.text = "Http error, check server";
						}
						else if (existingBundles.status != 0)
						{
							processInfo.text = $"Status error: {existingBundles.message}:{existingBundles.status}";
						}
						else
						{
							foreach (LevelInfo bundle in OnlineLevelsManager.catalog.Levels)
							{
								processInfo.text = "\nChecking " + bundle.Name + "...";
								AngryAdmin.BundleLevelInfo existingBundle = existingBundles.response.result.Where((AngryAdmin.BundleLevelInfo b) => b.bundleGuid == bundle.Guid).FirstOrDefault();
								if (existingBundle == null)
								{
									ConfigHeader obj31 = debugInfo;
									obj31.text += "\nMissing, adding to the server";
									ConfigHeader obj32 = debugInfo;
									obj32.text = obj32.text + "\n<color=grey>command: add_bundle " + bundle.Guid + "</color>";
									AngryAdmin.CommandResult commandResult = await AngryAdmin.SendCommand("add_bundle " + bundle.Guid);
									if (commandResult.completedSuccessfully && commandResult.status == AngryAdmin.CommandStatus.OK)
									{
										ConfigHeader obj33 = debugInfo;
										obj33.text = obj33.text + "\n" + commandResult.response.result;
									}
									else if (commandResult.networkError)
									{
										ConfigHeader obj34 = debugInfo;
										obj34.text += "\n<color=red>NETWORK ERROR</color> Check conntection";
									}
									else if (commandResult.httpError)
									{
										ConfigHeader obj35 = debugInfo;
										obj35.text += "\n<color=red>HTTP ERROR</color> Check server";
									}
									else if (commandResult.response != null)
									{
										ConfigHeader obj36 = debugInfo;
										obj36.text += $"\n<color=red>ERROR: </color>{commandResult.message}:{commandResult.status}";
									}
									else
									{
										ConfigHeader obj37 = debugInfo;
										obj37.text = obj37.text + "\n<color=red>ERROR: </color>Encountered unknown error. Status: " + commandResult.status;
									}
								}
								if (existingBundle == null || existingBundle.hash != bundle.Hash)
								{
									ConfigHeader obj38 = debugInfo;
									obj38.text += "\nOut of date hash, updating";
									ConfigHeader val22 = debugInfo;
									val22.text = val22.text + "\n<color=grey>command: update_leaderboard_hash " + bundle.Guid + " " + bundle.Hash + "</color>";
									AngryAdmin.CommandResult commandResult2 = await AngryAdmin.SendCommand("update_leaderboard_hash " + bundle.Guid + " " + bundle.Hash);
									if (commandResult2.completedSuccessfully && commandResult2.status == AngryAdmin.CommandStatus.OK)
									{
										ConfigHeader obj39 = debugInfo;
										obj39.text = obj39.text + "\n" + commandResult2.response.result;
									}
									else if (commandResult2.networkError)
									{
										ConfigHeader obj40 = debugInfo;
										obj40.text += "\n<color=red>NETWORK ERROR</color> Check conntection";
									}
									else if (commandResult2.httpError)
									{
										ConfigHeader obj41 = debugInfo;
										obj41.text += "\n<color=red>HTTP ERROR</color> Check server";
									}
									else if (commandResult2.response != null)
									{
										ConfigHeader obj42 = debugInfo;
										obj42.text += $"\n<color=red>ERROR: </color>{commandResult2.message}:{commandResult2.status}";
									}
									else
									{
										ConfigHeader obj43 = debugInfo;
										obj43.text = obj43.text + "\n<color=red>ERROR: </color>Encountered unknown error. Status: " + commandResult2.status;
									}
								}
								AngryBundleContainer container = GetAngryBundleByGuid(bundle.Guid);
								if (container == null)
								{
									ConfigHeader obj44 = debugInfo;
									obj44.text += "\n<color=red>Bundle not installed locally to check levels</color>";
								}
								else if (container.bundleData.buildHash != bundle.Hash)
								{
									ConfigHeader obj45 = debugInfo;
									obj45.text += "\n<color=red>Local level out of date</color>";
								}
								else
								{
									if (container.locator == null)
									{
										if (container.updating)
										{
											await container.UpdateScenes(forceReload: false, lazyLoad: false);
										}
										await container.UpdateScenes(forceReload: false, lazyLoad: false);
									}
									string[] array = (from data in container.GetAllLevelData()
										select data.uniqueIdentifier).ToArray();
									string[] existingLevels = ((existingBundle == null) ? new string[0] : existingBundle.levels);
									string[] array2 = array;
									foreach (string text in array2)
									{
										if (!existingLevels.Contains(text))
										{
											if (Enumerable.Contains(text, '~'))
											{
												ConfigHeader obj46 = debugInfo;
												obj46.text = obj46.text + "\n<color=red>Level ID '" + text + "' contains ~. Cannot process</color>";
											}
											else
											{
												string text2 = text.Replace(' ', '~');
												ConfigHeader val22 = debugInfo;
												val22.text = val22.text + "\n<color=grey>command: add_leaderboard " + bundle.Guid + " " + bundle.Hash + " " + text2 + "</color>";
												AngryAdmin.CommandResult commandResult3 = await AngryAdmin.SendCommand("add_leaderboard " + bundle.Guid + " " + bundle.Hash + " " + text2);
												if (commandResult3.completedSuccessfully && commandResult3.status == AngryAdmin.CommandStatus.OK)
												{
													ConfigHeader obj47 = debugInfo;
													obj47.text = obj47.text + "\n" + commandResult3.response.result;
												}
												else if (commandResult3.networkError)
												{
													ConfigHeader obj48 = debugInfo;
													obj48.text += "\n<color=red>NETWORK ERROR</color> Check conntection";
												}
												else if (commandResult3.httpError)
												{
													ConfigHeader obj49 = debugInfo;
													obj49.text += "\n<color=red>HTTP ERROR</color> Check server";
												}
												else if (commandResult3.response != null)
												{
													ConfigHeader obj50 = debugInfo;
													obj50.text += $"\n<color=red>ERROR: </color>{commandResult3.message}:{commandResult3.status}";
												}
												else
												{
													ConfigHeader obj51 = debugInfo;
													obj51.text = obj51.text + "\n<color=red>ERROR: </color>Encountered unknown error. Status: " + commandResult3.status;
												}
											}
										}
									}
								}
							}
							processInfo.text = "<color=lime>Done!</color>";
						}
					}
				}
				finally
				{
					((ConfigField)devDiv).interactable = true;
				}
			};
			errorText = new ConfigHeader(config.rootPanel, "", 16, (TextAnchor)0);
			new ConfigHeader(config.rootPanel, "Level Bundles", 24);
			bundleDivision = new ConfigDivision(config.rootPanel, "div_bundles");
		}

		public static void CheckForBannedMods()
		{
			if (!AngryLeaderboards.bannedModsListLoaded)
			{
				return;
			}
			bool flag = false;
			bannedModsText.text = "";
			string[] array = AngryLeaderboards.bannedMods;
			if (array == null)
			{
				logger.LogWarning((object)"Banned mods list cannot be fetched from angry servers, using the local list");
				array = BannedModsManager.LOCAL_BANNED_MODS_LIST;
			}
			foreach (string key in Chainloader.PluginInfos.Keys)
			{
				if (Array.IndexOf(array, key) == -1)
				{
					continue;
				}
				if (!BannedModsManager.guidToName.TryGetValue(key, out var value))
				{
					value = key;
				}
				if (BannedModsManager.checkers.TryGetValue(key, out var value2))
				{
					try
					{
						SoftBanCheckResult softBanCheckResult = value2();
						if (softBanCheckResult.banned)
						{
							if (!string.IsNullOrEmpty(bannedModsText.text))
							{
								ConfigHeader obj = bannedModsText;
								obj.text += "\n";
							}
							ConfigHeader val = bannedModsText;
							val.text = val.text + "<color=red>" + value + "</color>\n<size=18>" + softBanCheckResult.message + "</size>\n\n";
							flag = true;
						}
					}
					catch (Exception arg)
					{
						logger.LogError((object)$"Exception thrown while checking for soft ban for {value}\n{arg}");
						if (!string.IsNullOrEmpty(bannedModsText.text))
						{
							ConfigHeader obj2 = bannedModsText;
							obj2.text += "\n";
						}
						ConfigHeader obj3 = bannedModsText;
						obj3.text = obj3.text + "<color=red>" + value + "</color>\n<size=18>- Encountered an error while checking for the soft ban status, check console</size>\n\n";
						flag = true;
					}
				}
				else
				{
					if (!string.IsNullOrEmpty(bannedModsText.text))
					{
						ConfigHeader obj4 = bannedModsText;
						obj4.text += "\n";
					}
					ConfigHeader obj5 = bannedModsText;
					obj5.text = obj5.text + "<color=red>" + value + "</color>\n<size=18>- Could not find a soft ban check for this mod. Is angry up to date?</size>\n\n";
					flag = true;
				}
			}
			((ConfigField)bannedModsPanel).hidden = !flag;
		}

		internal static void AddPendingRecord(AngryLeaderboards.PostRecordInfo record, bool recursiveCall = false)
		{
			if (pendingRecordsTask != null && !pendingRecordsTask.IsCompleted && !recursiveCall)
			{
				pendingRecordsTask.ContinueWith(delegate
				{
					AddPendingRecord(record, recursiveCall: true);
				}, TaskScheduler.FromCurrentSynchronizationContext());
				return;
			}
			List<RecordInfoJsonWrapper> list;
			try
			{
				list = JsonConvert.DeserializeObject<List<RecordInfoJsonWrapper>>(pendingRecordsField.value);
				if (list == null)
				{
					list = new List<RecordInfoJsonWrapper>();
				}
			}
			catch (Exception arg)
			{
				logger.LogError((object)$"Caught exception while trying to deserialize pending records\n{arg}");
				pendingRecordsField.value = "[]";
				list = new List<RecordInfoJsonWrapper>();
			}
			list.Add(new RecordInfoJsonWrapper(record));
			pendingRecordsField.value = JsonConvert.SerializeObject((object)list);
			UpdatePendingRecordsUI();
		}

		internal static void UpdatePendingRecordsUI()
		{
			try
			{
				List<RecordInfoJsonWrapper> list = JsonConvert.DeserializeObject<List<RecordInfoJsonWrapper>>(pendingRecordsField.value);
				if (list == null)
				{
					list = new List<RecordInfoJsonWrapper>();
				}
				((ConfigField)pendingRecords).hidden = list.Count == 0;
				pendingRecordsInfo.text = "";
				foreach (RecordInfoJsonWrapper item in list)
				{
					string text = item.bundleGuid;
					string text2 = item.levelId;
					AngryBundleContainer angryBundleByGuid = GetAngryBundleByGuid(text);
					if (angryBundleByGuid != null)
					{
						text = angryBundleByGuid.bundleData.bundleName;
					}
					if (AngrySceneManager.TryFindLevel(text2, out var level))
					{
						text2 = level.data.levelName;
					}
					ConfigHeader obj = pendingRecordsInfo;
					obj.text += $"Bundle: <color=grey>{text}</color>\nLevel: <color=grey>{text2}</color>\nCategory: <color=grey>{item.category}</color>\nDifficulty: <color=grey>{item.difficulty}</color>\nTime: <color=grey>{item.time}</color>\n\n\n";
				}
			}
			catch (Exception arg)
			{
				logger.LogError((object)$"Caught exception while trying to deserialize pending records\n{arg}");
				pendingRecordsField.value = "[]";
				((ConfigField)pendingRecords).hidden = true;
			}
		}

		private static async Task ProcessPendingRecordsTask()
		{
			pendingRecordsStatus.text = "";
			List<RecordInfoJsonWrapper> list;
			try
			{
				list = JsonConvert.DeserializeObject<List<RecordInfoJsonWrapper>>(pendingRecordsField.value);
				if (list == null)
				{
					list = new List<RecordInfoJsonWrapper>();
				}
			}
			catch (Exception arg)
			{
				pendingRecordsStatus.text = $"<color=red>Exception thrown while deserializing pending records, discarding\n\n{arg}</color>";
				pendingRecordsField.value = "[]";
				UpdatePendingRecordsUI();
				return;
			}
			List<RecordInfoJsonWrapper> failedToSend = new List<RecordInfoJsonWrapper>();
			foreach (RecordInfoJsonWrapper record in list)
			{
				string text = record.bundleGuid;
				string text2 = record.levelId;
				AngryBundleContainer angryBundleByGuid = GetAngryBundleByGuid(text);
				if (angryBundleByGuid != null)
				{
					text = angryBundleByGuid.bundleData.bundleName;
				}
				if (AngrySceneManager.TryFindLevel(text2, out var level))
				{
					text2 = level.data.levelName;
				}
				ConfigHeader val;
				if (!record.TryParseRecordInfo(out var record2))
				{
					val = pendingRecordsStatus;
					val.text = val.text + "<color=red>Failed to parse record info for level " + text2 + " in bundle " + text + ". Discarded.</color>\n\n";
					continue;
				}
				val = pendingRecordsStatus;
				val.text = val.text + "Posting record for level <color=grey>" + text2 + "</color> in bundle <color=grey>" + text + "</color>...\n";
				AngryLeaderboards.PostRecordResult postRecordResult = await AngryLeaderboards.PostRecordTask(record2.category, record2.difficulty, record2.bundleGuid, record2.hash, record2.levelId, record2.time);
				if (postRecordResult.completedSuccessfully)
				{
					if (postRecordResult.status == AngryLeaderboards.PostRecordStatus.OK)
					{
						ConfigHeader obj = pendingRecordsStatus;
						obj.text += $"<color=lime>Record posted successfully!</color> Ranking: #{postRecordResult.response.ranking}, New Best: {postRecordResult.response.newBest}\n\n";
						continue;
					}
					switch (postRecordResult.status)
					{
					case AngryLeaderboards.PostRecordStatus.BANNED:
					{
						ConfigHeader obj7 = pendingRecordsStatus;
						obj7.text += "<color=red>User banned from the leaderboards. Discarded.</color>\n\n";
						break;
					}
					case AngryLeaderboards.PostRecordStatus.INVALID_BUNDLE:
					case AngryLeaderboards.PostRecordStatus.INVALID_ID:
					{
						ConfigHeader obj6 = pendingRecordsStatus;
						obj6.text += "<color=red>Level's leaderboards are not enabled. Discarded.</color>\n\n";
						break;
					}
					case AngryLeaderboards.PostRecordStatus.RATE_LIMITED:
					{
						ConfigHeader obj5 = pendingRecordsStatus;
						obj5.text += "<color=red>Too many requests sent. Returning record to the pending list</color>\n\n";
						failedToSend.Add(record);
						break;
					}
					case AngryLeaderboards.PostRecordStatus.INVALID_HASH:
					{
						ConfigHeader obj4 = pendingRecordsStatus;
						obj4.text += "<color=red>Record bundle version is not up to date with the leaderboard. Discarded.</color>\n\n";
						break;
					}
					case AngryLeaderboards.PostRecordStatus.INVALID_TIME:
					{
						ConfigHeader obj3 = pendingRecordsStatus;
						obj3.text += $"<color=red>Angry server rejected the sent time {record.time}. Discarded.</color>\n\n";
						break;
					}
					default:
					{
						ConfigHeader obj2 = pendingRecordsStatus;
						obj2.text += $"<color=red>Encountered an unknown error while posting record. Status: {postRecordResult.status}, Message: '{postRecordResult.message}'. Returning record to the pending list</color>\n\n";
						failedToSend.Add(record);
						break;
					}
					}
				}
				else
				{
					ConfigHeader obj8 = pendingRecordsStatus;
					obj8.text += "<color=red>Encountered a network error while posting record. Returning record to the pending list</color>\n\n";
					failedToSend.Add(record);
				}
			}
			ConfigHeader obj9 = pendingRecordsStatus;
			obj9.text += "<color=lime>Done!</color>";
			pendingRecordsField.value = JsonConvert.SerializeObject((object)failedToSend);
			UpdatePendingRecordsUI();
		}

		internal static void ProcessPendingRecords()
		{
			if (pendingRecordsTask == null || pendingRecordsTask.IsCompleted)
			{
				((ConfigField)sendPendingRecords).interactable = false;
				pendingRecordsTask = ProcessPendingRecordsTask().ContinueWith((Task task) => ((ConfigField)sendPendingRecords).interactable = true, TaskScheduler.FromCurrentSynchronizationContext());
			}
		}

		private void DisplayPluginConfigVersionError()
		{
			//IL_003a: Unknown result type

plugins/AngryLevelLoader/AngryUiComponents.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
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.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("AngryUiComponents")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+d8886733f3884556765f7ffd415dcda0fe2bbc24")]
[assembly: AssemblyProduct("AngryUiComponents")]
[assembly: AssemblyTitle("AngryUiComponents")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace AngryUiComponents;

public class AngryCustomLevelButtonComponent : MonoBehaviour
{
	public RectTransform rect;

	public Button button;

	public Image background;

	public Text 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 AngryDifficultyFieldComponent : MonoBehaviour
{
	public CanvasGroup group;

	public Dropdown difficultyList;

	public Dropdown gamemodeList;
}
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 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();
			}
		}
	}

	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));
	}

	private IEnumerator ResetButtonCoroutine(Button btn, TextMeshProUGUI txt, Action cb)
	{
		((Selectable)btn).interactable = false;
		for (int i = 3; i >= 1; i--)
		{
			((TMP_Text)txt).text = $"Are you sure? ({i})";
			yield return (object)new WaitForSecondsRealtime(1f);
		}
		((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 (cb != null)
			{
				cb();
			}
		});
	}
}
public class AngryLevelUpdateNotificationComponent : MonoBehaviour
{
	public Text body;

	public Button cancel;

	public Button update;
}
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 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 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
{
	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));
		});
	}

	private IEnumerator ResetButtonCoroutine(Button btn, TextMeshProUGUI txt, Action cb)
	{
		((Selectable)btn).interactable = false;
		for (int i = 3; i >= 1; i--)
		{
			((TMP_Text)txt).text = $"Are you sure? ({i})";
			yield return (object)new WaitForSecondsRealtime(1f);
		}
		((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 (cb != null)
			{
				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;
}

plugins/AngryLevelLoader/RudeLevelScripts.Essentials.dll

Decompiled 3 weeks 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.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("RudeLevelScripts.Essentials")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+e50ad21993c11464a82808094a3e31b9db5e29c8")]
[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;
	}
}
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();
			}
		}
	}
	[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;
	}
}

plugins/AngryLevelLoader/Scripts/AngryLoaderAPI.dll

Decompiled 3 weeks ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using AngryLevelLoader;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("AngryLoaderAPI")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+378c4d5812995604367aa9793cc1cbe74a762e71")]
[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 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 3 weeks 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 UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.AddressableAssets.ResourceLocators;
using UnityEngine.Events;
using UnityEngine.ResourceManagement.ResourceLocations;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("RudeLevelScripts")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+378c4d5812995604367aa9793cc1cbe74a762e71")]
[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__35_5;

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

			internal void <ConvertToAscendingFirstRoom>b__35_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 bool <Spawn>b__36_0(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 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;

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

		[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__35_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__35_5 = val5;
				obj11 = (object)val5;
			}
			onActivate.AddListener((UnityAction)obj11);
			obj10.delay = actDelay;
		}

		public void Spawn()
		{
			//IL_005c: 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_00fa: 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_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: 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_0353: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_035b: 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_0385: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_039d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_0407: Unknown result type (might be due to invalid IL or missing references)
			//IL_040c: Unknown result type (might be due to invalid IL or missing references)
			//IL_040d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0414: Unknown result type (might be due to invalid IL or missing references)
			//IL_0427: Unknown result type (might be due to invalid IL or missing references)
			//IL_043c: 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_047e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0499: Unknown result type (might be due to invalid IL or missing references)
			//IL_049e: Unknown result type (might be due to invalid IL or missing references)
			//IL_049f: 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_04be: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d3: 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_04f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0721: Unknown result type (might be due to invalid IL or missing references)
			//IL_0726: Unknown result type (might be due to invalid IL or missing references)
			//IL_072f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0754: Unknown result type (might be due to invalid IL or missing references)
			//IL_0759: Unknown result type (might be due to invalid IL or missing references)
			//IL_075a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0761: Unknown result type (might be due to invalid IL or missing references)
			//IL_0773: 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_07a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0819: Unknown result type (might be due to invalid IL or missing references)
			//IL_081b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0853: Unknown result type (might be due to invalid IL or missing references)
			//IL_085d: Expected O, but got Unknown
			//IL_0527: Unknown result type (might be due to invalid IL or missing references)
			//IL_052c: Unknown result type (might be due to invalid IL or missing references)
			//IL_052d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0534: Unknown result type (might be due to invalid IL or missing references)
			//IL_0546: Unknown result type (might be due to invalid IL or missing references)
			//IL_0551: Unknown result type (might be due to invalid IL or missing references)
			//IL_0572: Unknown result type (might be due to invalid IL or missing references)
			//IL_0577: Unknown result type (might be due to invalid IL or missing references)
			//IL_0578: Unknown result type (might be due to invalid IL or missing references)
			//IL_057f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0591: Unknown result type (might be due to invalid IL or missing references)
			//IL_059c: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0614: Unknown result type (might be due to invalid IL or missing references)
			//IL_0629: Unknown result type (might be due to invalid IL or missing references)
			//IL_0634: Unknown result type (might be due to invalid IL or missing references)
			//IL_0649: Unknown result type (might be due to invalid IL or missing references)
			//IL_0654: 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_0673: Unknown result type (might be due to invalid IL or missing references)
			//IL_0687: Unknown result type (might be due to invalid IL or missing references)
			if (spawned)
			{
				return;
			}
			GameObject val = ((Component)this).gameObject;
			GameObject val2 = Utils.LoadObject<GameObject>(secretRoom ? "FirstRoom Secret" : (primeRoom ? "FirstRoom Prime" : "FirstRoom"));
			if (!doNotReplace)
			{
				val = Object.Instantiate<GameObject>(val2, ((Component)this).transform.parent);
			}
			else
			{
				Object.Destroy((Object)(object)((Component)Object.Instantiate<GameObject>(val2, ((Component)this).transform.position, ((Component)this).transform.rotation, ((Component)this).transform.parent).transform.Find("Room")).gameObject);
			}
			MeshCollider[] componentsInChildren = val.GetComponentsInChildren<MeshCollider>();
			MeshFilter val4 = default(MeshFilter);
			foreach (MeshCollider val3 in componentsInChildren)
			{
				if (((Component)val3).gameObject.TryGetComponent<MeshFilter>(ref val4))
				{
					val4.mesh = val3.sharedMesh;
				}
			}
			Transform transform = ((Component)MonoSingleton<NewMovement>.instance).transform;
			((Component)transform).transform.parent = val.transform;
			val.transform.position = ((Component)this).transform.position;
			val.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)val.transform.Find("Room/FinalDoor")).GetComponent<FinalDoor>();
				Camera main = Camera.main;
				main.backgroundColor = backgroundColor;
				main.clearFlags = cameraFillMode;
				((Component)val.transform.Find("Room/FinalDoor/FinalDoorOpener")).GetComponent<FinalDoorOpener>().startMusic = startMusic;
				((Component)val.transform.Find("Room/FinalDoor")).GetComponent<FinalDoor>().levelNameOnOpen = displayLevelTitle;
				GameObject val5 = null;
				if (enableHellMap)
				{
					Deserialize();
					Transform obj = ((Component)MonoSingleton<NewMovement>.instance).transform.Find("Canvas");
					if (obj == null)
					{
						Scene activeScene = SceneManager.GetActiveScene();
						obj = (from o in ((Scene)(ref activeScene)).GetRootGameObjects()
							where ((Object)o).name == "Canvas"
							select o).First().transform;
					}
					RectTransform val6 = MakeRect(obj);
					((Object)val6).name = "Hellmap";
					val5 = ((Component)val6).gameObject;
					Vector2 anchorMin = (val6.anchorMax = new Vector2(0.5f, 0.5f));
					val6.anchorMin = anchorMin;
					val6.pivot = new Vector2(0.5f, 0.5f);
					val6.sizeDelta = new Vector2(250f, 650f);
					val6.anchoredPosition = Vector2.zero;
					((Transform)val6).localScale = Vector3.one;
					((Transform)val6).SetAsFirstSibling();
					RectTransform val8 = MakeRect(((Component)val6).transform);
					((Object)val8).name = "Hellmap Container";
					anchorMin = (val8.anchorMax = new Vector2(0.5f, 0.5f));
					val8.anchorMin = anchorMin;
					val8.pivot = new Vector2(0.5f, 0.5f);
					val8.sizeDelta = new Vector2((float)Screen.width, 650f);
					val8.anchoredPosition = Vector2.zero;
					((Transform)val8).localScale = Vector3.one;
					VerticalLayoutGroup obj2 = ((Component)val8).gameObject.AddComponent<VerticalLayoutGroup>();
					((LayoutGroup)obj2).childAlignment = (TextAnchor)1;
					((HorizontalOrVerticalLayoutGroup)obj2).spacing = 5f;
					((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = false;
					((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = false;
					((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = false;
					foreach (LayerInfo layersAndLevel in layersAndLevels)
					{
						RectTransform obj3 = MakeRect((Transform)(object)val8);
						anchorMin = (obj3.anchorMax = new Vector2(0f, 1f));
						obj3.anchorMin = anchorMin;
						obj3.sizeDelta = new Vector2((float)Screen.width, 50f);
						obj3.pivot = new Vector2(0f, 1f);
						((Transform)obj3).localScale = Vector3.one;
						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>();
						anchorMin = (component.anchorMax = new Vector2(0.5f, 0.5f));
						component.anchorMin = anchorMin;
						component.sizeDelta = new Vector2((float)(Screen.width / 2 + 125), 100f);
						component.pivot = new Vector2(0f, 0.5f);
						((Transform)component).localScale = Vector3.one;
						component.anchoredPosition = new Vector2(-125f, 0f);
						string[] layerLevels = layersAndLevel.layerLevels;
						foreach (string text in layerLevels)
						{
							RectTransform obj5 = MakeRect((Transform)(object)val8);
							anchorMin = (obj5.anchorMax = new Vector2(0f, 1f));
							obj5.anchorMin = anchorMin;
							obj5.pivot = new Vector2(0.5f, 1f);
							((Transform)obj5).localScale = Vector3.one;
							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, 1f);
							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;
							obj5.sizeDelta = new Vector2(125f, 45f);
						}
					}
					LayoutRebuilder.ForceRebuildLayoutImmediate(val8);
					Vector2 anchoredPosition = ((Component)((Transform)val8).GetChild(GetChildIndexFromLayerAndLevel(layerIndexToStartFrom, levelIndexToStartFrom))).GetComponent<RectTransform>().anchoredPosition;
					((Vector2)(ref anchoredPosition))..ctor(35f, anchoredPosition.y - 22.5f);
					Vector2 anchoredPosition2 = ((Component)((Transform)val8).GetChild(GetChildIndexFromLayerAndLevel(layerIndexToEndAt, levelIndexToEndAt))).GetComponent<RectTransform>().anchoredPosition;
					((Vector2)(ref anchoredPosition2))..ctor(35f, anchoredPosition2.y - 22.5f);
					RectTransform obj9 = MakeRect((Transform)(object)val6);
					anchorMin = (obj9.anchorMax = new Vector2(0f, 1f));
					obj9.anchorMin = anchorMin;
					obj9.pivot = new Vector2(0.5f, 0.5f);
					obj9.sizeDelta = new Vector2(35f, 35f);
					((Transform)obj9).rotation = Quaternion.Euler(0f, 0f, -90f);
					((Transform)obj9).localScale = Vector3.one;
					obj9.anchoredPosition = anchoredPosition;
					AudioSource val15 = ((Component)obj9).gameObject.AddComponent<AudioSource>();
					val15.playOnAwake = false;
					val15.loop = false;
					val15.clip = hellmapBeepClip;
					val15.volume = 0.1f;
					Image val16 = ((Component)obj9).gameObject.AddComponent<Image>();
					val16.sprite = Utils.hellmapArrow;
					CustomHellmapCursor customHellmapCursor = ((Component)obj9).gameObject.AddComponent<CustomHellmapCursor>();
					customHellmapCursor.targetPosition = anchoredPosition2;
					customHellmapCursor.aud = val15;
					customHellmapCursor.targetImage = val16;
					ObjectActivator obj10 = ((Component)UnityUtils.GetComponentInChildrenRecursive<PlayerActivator>(val.transform)).gameObject.AddComponent<ObjectActivator>();
					obj10.dontActivateOnEnable = true;
					obj10.oneTime = true;
					obj10.events = new UltrakillEvent();
					obj10.events.toDisActivateObjects = (GameObject[])(object)new GameObject[1] { ((Component)val6).gameObject };
				}
				if (!convertToUpwardRoom)
				{
					return;
				}
				foreach (GameObject item in upwardRoomOutOfBoundsToDisable)
				{
					item.SetActive(false);
				}
				List<GameObject> list = new List<GameObject>();
				if ((Object)(object)val5 != (Object)null)
				{
					list.Add(val5);
				}
				List<GameObject> list2 = new List<GameObject>();
				list2.AddRange(upwardRoomOutOfBoundsToDisable);
				ConvertToAscendingFirstRoom(val, upwardRoomDoorCloseClip, list2, list, doNotReplace);
			}
			catch (Exception ex)
			{
				throw ex;
			}
			finally
			{
				spawned = true;
				if (!doNotReplace)
				{
					Object.Destroy((Object)(object)((Component)this).gameObject);
				}
			}
			int GetChildIndexFromLayerAndLevel(int layer, int level)
			{
				int num = 0;
				for (int j = 0; j < layer; j++)
				{
					num += 1 + levelSizes[j];
				}
				return num + 1 + level;
			}
		}

		public void Awake()
		{
			Spawn();
		}
	}
	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 ResourceLocationMap resourceMap;

		public static Font gameFont
		{
			get
			{
				if ((Object)(object)_gameFont == (Object)null)
				{
					_gameFont = LoadObject<Font>("Assets/Fonts/VCR_OSD_MONO_1.001.ttf");
				}
				return _gameFont;
			}
		}

		public static Sprite levelPanel
		{
			get
			{
				if ((Object)(object)_levelPanel == (Object)null)
				{
					_levelPanel = LoadObject<Sprite>("Assets/Textures/UI/meter.png");
				}
				return _levelPanel;
			}
		}

		public static Sprite hellmapArrow
		{
			get
			{
				if ((Object)(object)_hellmapArrow == (Object)null)
				{
					_hellmapArrow = LoadObject<Sprite>("Assets/Textures/UI/arrow.png");
				}
				return _hellmapArrow;
			}
		}

		public static Material metalDec20
		{
			get
			{
				if ((Object)(object)_metalDec20 == (Object)null)
				{
					_metalDec20 = LoadObject<Material>("Assets/Materials/Environment/Metal/Metal Decoration 20.mat");
				}
				return _metalDec20;
			}
		}

		public static T LoadObject<T>(string path)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			if (resourceMap == null)
			{
				Addressables.InitializeAsync().WaitForCompletion();
				IResourceLocator obj = Addressables.ResourceLocators.First();
				resourceMap = (ResourceLocationMap)(object)((obj is ResourceLocationMap) ? obj : null);
			}
			Debug.Log((object)("Loading " + path));
			KeyValuePair<object, IList<IResourceLocation>> keyValuePair;
			try
			{
				keyValuePair = resourceMap.Locations.Where((KeyValuePair<object, IList<IResourceLocation>> pair) => pair.Key as string == path).First();
			}
			catch (Exception)
			{
				return default(T);
			}
			return Addressables.LoadAssetAsync<T>(keyValuePair.Value.First()).WaitForCompletion();
		}

		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
	{
		public static IEnumerable GetComponentsInChildrenRecursive<T>(Transform parent) where T : Component
		{
			T val = default(T);
			foreach (Transform item in parent)
			{
				Transform child = item;
				if (((Component)child).TryGetComponent<T>(ref val))
				{
					yield return val;
				}
				foreach (T item2 in GetComponentsInChildrenRecursive<T>(child))
				{
					yield return item2;
				}
			}
		}

		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;
			}
		}
	}
	[RequireComponent(typeof(EnemyInfoPage))]
	public class EnemyInfoPageDataLoader : MonoBehaviour
	{
		public List<SpawnableObject> additionalEnemies;

		public void LoadDataAndDestroy()
		{
			//IL_000d: 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)
			EnemyInfoPage component = ((Component)this).GetComponent<EnemyInfoPage>();
			component.objects = Object.Instantiate<SpawnableObjectsDatabase>(Addressables.LoadAssetAsync<SpawnableObjectsDatabase>((object)"Assets/Data/Bestiary Database.asset").WaitForCompletion());
			if (additionalEnemies != null && additionalEnemies.Count != 0)
			{
				List<SpawnableObject> list = component.objects.enemies.ToList();
				list.AddRange(additionalEnemies);
				component.objects.enemies = list.ToArray();
			}
			Object.Destroy((Object)(object)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();
			}
		}
	}
}