Decompiled source of UnboundLib v3.2.13

plugins\UnboundLib.dll

Decompiled 4 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using ExitGames.Client.Photon;
using HarmonyLib;
using Jotunn.Utils;
using On;
using Photon.Pun;
using Photon.Realtime;
using TMPro;
using UnboundLib.Cards;
using UnboundLib.Extensions;
using UnboundLib.GameModes;
using UnboundLib.Networking;
using UnboundLib.Utils;
using UnboundLib.Utils.UI;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using UnityEngine.UI.ProceduralImage;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyFileVersion("3.2.13")]
[assembly: AssemblyInformationalVersion("3.2.13")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.1", FrameworkDisplayName = ".NET Framework 4.6.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("3.2.13.0")]
[module: UnverifiableCode]
namespace Jotunn.Utils
{
	public static class AssetUtils
	{
		public const char AssetBundlePathSeparator = '$';

		public static Texture2D LoadTexture(string texturePath, bool relativePath = true)
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			string text = texturePath;
			if (relativePath)
			{
				text = Path.Combine(Paths.PluginPath, texturePath);
			}
			if (!File.Exists(text))
			{
				return null;
			}
			if (!text.EndsWith(".png") && !text.EndsWith(".jpg"))
			{
				throw new Exception("LoadTexture can only load png or jpg textures");
			}
			byte[] array = File.ReadAllBytes(text);
			Texture2D val = new Texture2D(2, 2);
			val.LoadRawTextureData(array);
			return val;
		}

		public static Sprite LoadSpriteFromFile(string spritePath)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = LoadTexture(spritePath);
			if ((Object)(object)val != (Object)null)
			{
				return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), default(Vector2), 100f);
			}
			return null;
		}

		public static AssetBundle LoadAssetBundle(string bundlePath)
		{
			string text = Path.Combine(Paths.PluginPath, bundlePath);
			if (!File.Exists(text))
			{
				return null;
			}
			return AssetBundle.LoadFromFile(text);
		}

		public static AssetBundle LoadAssetBundleFromResources(string bundleName, Assembly resourceAssembly)
		{
			if (resourceAssembly == null)
			{
				throw new ArgumentNullException("Parameter resourceAssembly can not be null.");
			}
			string text = null;
			try
			{
				text = resourceAssembly.GetManifestResourceNames().Single((string str) => str.EndsWith(bundleName));
			}
			catch (Exception)
			{
			}
			if (text == null)
			{
				Debug.LogError("AssetBundle " + bundleName + " not found in assembly manifest");
				return null;
			}
			using Stream stream = resourceAssembly.GetManifestResourceStream(text);
			return AssetBundle.LoadFromStream(stream);
		}

		public static string LoadText(string path)
		{
			string text = Path.Combine(Paths.PluginPath, path);
			if (!File.Exists(text))
			{
				Debug.LogError("Error, failed to load contents from non-existant path: $" + text);
				return null;
			}
			return File.ReadAllText(text);
		}

		public static Sprite LoadSprite(string assetPath)
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			string text = Path.Combine(Paths.PluginPath, assetPath);
			if (!File.Exists(text))
			{
				return null;
			}
			if (text.Contains('$'.ToString()))
			{
				string[] array = text.Split(new char[1] { '$' });
				string text2 = array[0];
				string text3 = array[1];
				AssetBundle obj = AssetBundle.LoadFromFile(text2);
				Sprite result = obj.LoadAsset<Sprite>(text3);
				obj.Unload(false);
				return result;
			}
			Texture2D val = LoadTexture(text, relativePath: false);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return null;
			}
			return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), Vector2.zero);
		}
	}
}
namespace UnboundLib
{
	public class NetworkEventCallbacks : MonoBehaviourPunCallbacks
	{
		public delegate void NetworkEvent();

		public event NetworkEvent OnJoinedRoomEvent;

		public event NetworkEvent OnLeftRoomEvent;

		public override void OnJoinedRoom()
		{
			this.OnJoinedRoomEvent?.Invoke();
		}

		public override void OnLeftRoom()
		{
			this.OnLeftRoomEvent?.Invoke();
		}

		public override void OnPlayerLeftRoom(Player otherPlayer)
		{
			foreach (Player item in PlayerManager.instance.players.Where((Player p) => p.data.view.ControllerActorNr == otherPlayer.ActorNumber).ToList())
			{
				GameModeManager.CurrentHandler.PlayerLeft(item);
			}
		}
	}
	public static class NetworkingManager
	{
		public delegate void PhotonEvent(object[] objects);

		private static RaiseEventOptions raiseEventOptionsAll;

		private static RaiseEventOptions raiseEventOptionsOthers;

		private static SendOptions reliableSendOptions;

		private static SendOptions unreliableSendOptions;

		private static Dictionary<string, PhotonEvent> events;

		private static Dictionary<Tuple<Type, string>, MethodInfo> rpcMethodCache;

		private static byte ModEventCode;

		static NetworkingManager()
		{
			//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_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			raiseEventOptionsAll = new RaiseEventOptions
			{
				Receivers = (ReceiverGroup)1
			};
			raiseEventOptionsOthers = new RaiseEventOptions
			{
				Receivers = (ReceiverGroup)0
			};
			SendOptions val = default(SendOptions);
			((SendOptions)(ref val)).Reliability = true;
			reliableSendOptions = val;
			val = default(SendOptions);
			((SendOptions)(ref val)).Reliability = false;
			unreliableSendOptions = val;
			events = new Dictionary<string, PhotonEvent>();
			rpcMethodCache = new Dictionary<Tuple<Type, string>, MethodInfo>();
			ModEventCode = 69;
			PhotonNetwork.NetworkingClient.EventReceived += OnEvent;
		}

		public static void RegisterEvent(string eventName, PhotonEvent handler)
		{
			if (events.ContainsKey(eventName))
			{
				throw new Exception("An event handler is already registered with the event name: " + eventName);
			}
			events.Add(eventName, handler);
		}

		public static void RaiseEvent(string eventName, RaiseEventOptions options, params object[] data)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			if (data == null)
			{
				data = Array.Empty<object>();
			}
			List<object> list = new List<object> { eventName };
			list.AddRange(data);
			PhotonNetwork.RaiseEvent(ModEventCode, (object)list.ToArray(), options, reliableSendOptions);
		}

		public static void RaiseEvent(string eventName, params object[] data)
		{
			RaiseEvent(eventName, raiseEventOptionsAll, data);
		}

		public static void RaiseEventOthers(string eventName, params object[] data)
		{
			RaiseEvent(eventName, raiseEventOptionsOthers, data);
		}

		public static void RPC(Type targetType, string methodName, RaiseEventOptions options, SendOptions sendOptions, params object[] data)
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			if (data == null)
			{
				data = Array.Empty<object>();
			}
			if (PhotonNetwork.OfflineMode || PhotonNetwork.CurrentRoom == null)
			{
				MethodInfo rPCMethod = GetRPCMethod(targetType, methodName);
				if (rPCMethod != null)
				{
					rPCMethod.Invoke(null, data.ToArray());
				}
			}
			else
			{
				List<object> list = new List<object> { targetType.AssemblyQualifiedName, methodName };
				list.AddRange(data);
				PhotonNetwork.RaiseEvent(ModEventCode, (object)list.ToArray(), options, sendOptions);
			}
		}

		public static void RPC(Type targetType, string methodName, RaiseEventOptions options, params object[] data)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			RPC(targetType, methodName, options, reliableSendOptions, data);
		}

		public static void RPC(Type targetType, string methodName, params object[] data)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			RPC(targetType, methodName, raiseEventOptionsAll, reliableSendOptions, data);
		}

		public static void RPC_Others(Type targetType, string methodName, params object[] data)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			RPC(targetType, methodName, raiseEventOptionsOthers, reliableSendOptions, data);
		}

		public static void RPC_Unreliable(Type targetType, string methodName, params object[] data)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			RPC(targetType, methodName, raiseEventOptionsAll, unreliableSendOptions, data);
		}

		public static void RPC_Others_Unreliable(Type targetType, string methodName, params object[] data)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			RPC(targetType, methodName, raiseEventOptionsOthers, unreliableSendOptions, data);
		}

		public static void OnEvent(EventData photonEvent)
		{
			if (photonEvent.Code != ModEventCode)
			{
				return;
			}
			object[] array = null;
			try
			{
				array = (object[])photonEvent.CustomData;
			}
			catch (Exception ex)
			{
				Debug.LogError(ex.ToString());
			}
			try
			{
				if (array == null)
				{
					return;
				}
				Type type = Type.GetType((string)array[0]);
				PhotonEvent value;
				if (type != null)
				{
					MethodInfo rPCMethod = GetRPCMethod(type, (string)array[1]);
					if (rPCMethod != null)
					{
						rPCMethod.Invoke(null, array.Skip(2).ToArray());
					}
				}
				else if (events.TryGetValue((string)array[0], out value))
				{
					value?.Invoke(array.Skip(1).ToArray());
				}
			}
			catch (Exception ex2)
			{
				Debug.LogError("Network Error: \n" + ex2.ToString());
			}
		}

		private static MethodInfo GetRPCMethod(Type type, string methodName)
		{
			Tuple<Type, string> key = new Tuple<Type, string>(type, methodName);
			if (rpcMethodCache.ContainsKey(key))
			{
				return rpcMethodCache[key];
			}
			MethodInfo methodInfo = (from m in type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy)
				let attr = m.GetCustomAttribute<UnboundRPC>()
				where attr != null
				let name = attr.EventID ?? m.Name
				where methodName == name
				select m).FirstOrDefault();
			if (methodInfo == null)
			{
				throw new Exception("There is no method '" + type.FullName + "#" + methodName + "' found");
			}
			if (!methodInfo.IsStatic)
			{
				throw new Exception("UnboundRPC methods must be static! Correct this for method '" + type.FullName + "#" + methodInfo.Name + "'");
			}
			rpcMethodCache.Add(key, methodInfo);
			return rpcMethodCache[key];
		}
	}
	[DisallowMultipleComponent]
	public class PingMonitor : MonoBehaviourPunCallbacks
	{
		public struct PingColor
		{
			public string HTMLCode;

			public PingColor(string code)
			{
				HTMLCode = code;
			}
		}

		public Dictionary<int, bool> ConnectedPlayers = new Dictionary<int, bool>();

		public Dictionary<int, int> PlayerPings = new Dictionary<int, int>();

		public Action<int, int> PingUpdateAction;

		public static PingMonitor instance;

		private int pingUpdate;

		private void Start()
		{
			if (PhotonNetwork.OfflineMode || PhotonNetwork.CurrentRoom == null)
			{
				return;
			}
			foreach (Player value in PhotonNetwork.CurrentRoom.Players.Values)
			{
				ConnectedPlayers.Add(value.ActorNumber, value: true);
			}
		}

		private void Awake()
		{
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
			}
			else if ((Object)(object)instance != (Object)(object)this)
			{
				Object.DestroyImmediate((Object)(object)this);
			}
		}

		private void FixedUpdate()
		{
			if (!PhotonNetwork.OfflineMode)
			{
				pingUpdate++;
				if (pingUpdate > 25)
				{
					pingUpdate = 0;
					RPCA_UpdatePings();
				}
			}
		}

		public override void OnJoinedRoom()
		{
			pingUpdate = 0;
			ConnectedPlayers = new Dictionary<int, bool>();
			PlayerPings = new Dictionary<int, int>();
			foreach (Player value in PhotonNetwork.CurrentRoom.Players.Values)
			{
				ConnectedPlayers.Add(value.ActorNumber, value: true);
				PlayerPings.Add(value.ActorNumber, 0);
			}
			((MonoBehaviour)(object)this).ExecuteAfterFrames(15, delegate
			{
				NetworkingManager.RPC_Others(typeof(PingMonitor), "RPCA_UpdatePings");
				RPCA_UpdatePings();
			});
		}

		public override void OnLeftRoom()
		{
			ConnectedPlayers.Clear();
			ConnectedPlayers = new Dictionary<int, bool>();
			PlayerPings.Clear();
			PlayerPings = new Dictionary<int, int>();
		}

		public override void OnPlayerLeftRoom(Player otherPlayer)
		{
			ConnectedPlayers[otherPlayer.ActorNumber] = false;
			PlayerPings[otherPlayer.ActorNumber] = 0;
		}

		public override void OnPlayerEnteredRoom(Player newPlayer)
		{
			ConnectedPlayers[newPlayer.ActorNumber] = true;
			PlayerPings[newPlayer.ActorNumber] = 0;
		}

		public override void OnPlayerPropertiesUpdate(Player targetPlayer, Hashtable changedProps)
		{
			if (!((Dictionary<object, object>)(object)changedProps).TryGetValue((object)"Ping", out object value))
			{
				return;
			}
			PlayerPings[targetPlayer.ActorNumber] = (int)value;
			if (PingUpdateAction == null)
			{
				return;
			}
			try
			{
				PingUpdateAction(targetPlayer.ActorNumber, (int)value);
			}
			catch (Exception ex)
			{
				Debug.LogException(ex);
			}
		}

		public Player[] GetPlayersByOwnerActorNumber(int actorNumber)
		{
			Player[] array = PlayerManager.instance.players.Where((Player player) => player.data.view.OwnerActorNr == actorNumber).ToArray();
			if (array.Length == 0)
			{
				return null;
			}
			return array;
		}

		public PingColor GetPingColors(int ping)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			Color colorGradient = GetColorGradient(Normalize(ping, 40f, 220f, 0f, 1f));
			return new PingColor("#" + ColorUtility.ToHtmlStringRGB(colorGradient));
		}

		private static float Normalize(float val, float valmin, float valmax, float min, float max)
		{
			return (val - valmin) / (valmax - valmin) * (max - min) + min;
		}

		private static Color GetColorGradient(float percentage)
		{
			//IL_0000: 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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			Gradient val = new Gradient();
			GradientColorKey[] array = (GradientColorKey[])(object)new GradientColorKey[3];
			array[0].color = Color.green;
			array[0].time = 0f;
			array[1].color = Color.yellow;
			array[1].time = 0.5f;
			array[2].color = Color.red;
			array[2].time = 1f;
			val.SetKeys(array, (GradientAlphaKey[])(object)new GradientAlphaKey[3]);
			return val.Evaluate(percentage);
		}

		[UnboundRPC]
		private static void RPCA_UpdatePings()
		{
			Hashtable customProperties = PhotonNetwork.LocalPlayer.CustomProperties;
			customProperties[(object)"Ping"] = PhotonNetwork.GetPing();
			PhotonNetwork.LocalPlayer.SetCustomProperties(customProperties, (Hashtable)null, (WebFlags)null);
		}
	}
	[BepInPlugin("com.willis.rounds.unbound", "Rounds Unbound", "3.2.13")]
	[BepInProcess("Rounds.exe")]
	public class Unbound : BaseUnityPlugin
	{
		[StructLayout(LayoutKind.Sequential, Size = 1)]
		private struct NetworkEventType
		{
			public const string StartHandshake = "ModLoader_HandshakeStart";

			public const string FinishHandshake = "ModLoader_HandshakeFinish";
		}

		public delegate void OnJoinedDelegate();

		public delegate void OnLeftDelegate();

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

			public static Action <>9__37_8;

			public static hook_Start <>9__37_3;

			public static hook_Start <>9__37_5;

			public static Func<IGameModeHandler, IEnumerator> <>9__37_6;

			public static hook_Start <>9__37_7;

			public static NetworkingManager.PhotonEvent <>9__41_0;

			public static NetworkingManager.PhotonEvent <>9__41_1;

			public static Func<bool, bool> <>9__42_0;

			public static Func<string, ModOptions.GUIListener> <>9__43_0;

			public static Func<ModOptions.GUIListener, bool> <>9__43_1;

			internal void <.ctor>b__37_8()
			{
				MapManager.instance.levels = LevelManager.activeLevels.ToArray();
				CardManager.RestoreCardToggles();
				ToggleCardsMenuHandler.RestoreCardToggleVisuals();
			}

			internal void <.ctor>b__37_3(orig_Start orig, GM_ArmsRace self)
			{
				((MonoBehaviour)self).StartCoroutine(<.ctor>g__ArmsRaceStartCoroutine|37_2(orig, self));
			}

			internal void <.ctor>b__37_5(orig_Start orig, GM_Test self)
			{
				((MonoBehaviour)self).StartCoroutine(<.ctor>g__SandboxStartCoroutine|37_4(orig, self));
			}

			internal IEnumerator <.ctor>b__37_6(IGameModeHandler handler)
			{
				return SyncModClients.DisableSyncModUi(SyncModClients.uiParent);
			}

			internal void <.ctor>b__37_7(orig_Start orig, CardChoice self)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				for (int i = 0; i < self.cards.Length; i++)
				{
					if (!((DefaultPool)PhotonNetwork.PrefabPool).ResourceCache.ContainsKey(((Object)((Component)self.cards[i]).gameObject).name))
					{
						PhotonNetwork.PrefabPool.RegisterPrefab(((Object)((Component)self.cards[i]).gameObject).name, ((Component)self.cards[i]).gameObject);
					}
				}
				Transform[] array = (Transform[])(object)new Transform[((Component)self).transform.childCount];
				for (int j = 0; j < array.Length; j++)
				{
					array[j] = ((Component)self).transform.GetChild(j);
				}
				self.SetFieldValue("children", array);
				self.cards = CardManager.activeCards.ToArray();
			}

			internal void <Start>b__41_0(object[] data)
			{
				if (PhotonNetwork.IsMasterClient)
				{
					NetworkingManager.RaiseEvent("ModLoader_HandshakeFinish", new object[2]
					{
						GameModeManager.CurrentHandlerID,
						GameModeManager.CurrentHandler?.Settings
					});
				}
				else
				{
					NetworkingManager.RaiseEvent("ModLoader_HandshakeFinish");
				}
			}

			internal void <Start>b__41_1(object[] data)
			{
				MapManager.instance.levels = LevelManager.activeLevels.ToArray();
				if (data.Length != 0)
				{
					GameModeManager.SetGameMode((string)data[0], setActive: false);
					GameModeManager.CurrentHandler.SetSettings((GameSettings)data[1]);
				}
			}

			internal bool <Update>b__42_0(bool b)
			{
				return b;
			}

			internal ModOptions.GUIListener <OnGUI>b__43_0(string md)
			{
				return ModOptions.GUIListeners[md];
			}

			internal bool <OnGUI>b__43_1(ModOptions.GUIListener data)
			{
				return data.guiEnabled;
			}
		}

		private const string ModId = "com.willis.rounds.unbound";

		private const string ModName = "Rounds Unbound";

		public const string Version = "3.2.13";

		public static readonly ConfigFile config = new ConfigFile(Path.Combine(Paths.ConfigPath, "UnboundLib.cfg"), true);

		private Canvas _canvas;

		internal static CardInfo templateCard;

		internal static List<string> loadedGUIDs = new List<string>();

		internal static List<string> loadedMods = new List<string>();

		internal static List<string> loadedVersions = new List<string>();

		internal static List<Action> handShakeActions = new List<Action>();

		public static readonly Dictionary<string, bool> lockInputBools = new Dictionary<string, bool>();

		internal static AssetBundle UIAssets;

		public static AssetBundle toggleUI;

		internal static AssetBundle linkAssets;

		private static GameObject modalPrefab;

		private TextMeshProUGUI text;

		internal static readonly ModCredits modCredits = new ModCredits("UNBOUND", new string[7] { "Willis (Creation, design, networking, custom cards, custom maps, and more)", "Tilastokeskus (Custom game modes, networking, structure)", "Pykess (Custom cards, stability, menus, syncing, extra player colors, disconnect handling, game mode framework)", "Ascyst (Quickplay)", "Boss Sloth Inc. (Menus, UI, custom maps, modded lobby syncing)", "willuwontu (Custom cards, ping UI)", "otDan (UI)" }, "Github", "https://github.com/Rounds-Modding/UnboundLib");

		public static Unbound Instance { get; private set; }

		public Canvas canvas
		{
			get
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)_canvas != (Object)null)
				{
					return _canvas;
				}
				_canvas = new GameObject("UnboundLib Canvas").AddComponent<Canvas>();
				((Component)_canvas).gameObject.AddComponent<GraphicRaycaster>();
				_canvas.renderMode = (RenderMode)0;
				_canvas.pixelPerfect = false;
				Object.DontDestroyOnLoad((Object)(object)_canvas);
				return _canvas;
			}
		}

		[Obsolete("This should not be used anymore instead use CardManager.defaultCards")]
		internal static CardInfo[] defaultCards => CardManager.defaultCards;

		[Obsolete("This should not be used anymore instead use CardManager.activeCards")]
		internal static List<CardInfo> activeCards => CardManager.activeCards.ToList();

		[Obsolete("This should not be used anymore instead use CardManager.inactiveCards")]
		internal static List<CardInfo> inactiveCards => CardManager.inactiveCards;

		public static event OnJoinedDelegate OnJoinedRoom;

		public static event OnLeftDelegate OnLeftRoom;

		public Unbound()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			//IL_0072: 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_007d: Expected O, but got Unknown
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Expected O, but got Unknown
			bool firstTime = true;
			MainMenuHandler.Awake += (hook_Awake)delegate(orig_Awake orig, MainMenuHandler self)
			{
				((MonoBehaviour)(object)this).ExecuteAfterFrames(5, delegate
				{
					MapManager.instance.levels = LevelManager.activeLevels.ToArray();
					CardManager.RestoreCardToggles();
					ToggleCardsMenuHandler.RestoreCardToggleVisuals();
				});
				((MonoBehaviour)this).StartCoroutine(AddTextWhenReady(firstTime ? 2f : 0.1f));
				ModOptions.instance.CreateModOptions(firstTime);
				Credits.Instance.CreateCreditsMenu(firstTime);
				MainMenuLinks.AddLinks(firstTime);
				bool time = firstTime;
				((MonoBehaviour)(object)this).ExecuteAfterSeconds(firstTime ? 0.4f : 0f, delegate
				{
					//IL_0072: Unknown result type (might be due to invalid IL or missing references)
					//IL_007c: Expected O, but got Unknown
					//IL_0088: Unknown result type (might be due to invalid IL or missing references)
					//IL_0092: Expected O, but got Unknown
					//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
					//IL_00d7: Expected O, but got Unknown
					//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
					//IL_00f2: Expected O, but got Unknown
					GameObject gameObject = ((Component)((Component)UIHandler.instance).transform.Find("Canvas/EscapeMenu/Main/Group/Resume")).gameObject;
					GameObject optionsMenu = Object.Instantiate<GameObject>(((Component)((Component)MainMenuHandler.instance).transform.Find("Canvas/ListSelector/Options")).gameObject, ((Component)UIHandler.instance).transform.Find("Canvas/EscapeMenu/Main"));
					Button component = ((Component)optionsMenu.transform.Find("Group/Back")).GetComponent<Button>();
					component.onClick = new ButtonClickedEvent();
					((UnityEvent)component.onClick).AddListener((UnityAction)delegate
					{
						((Component)optionsMenu.transform.Find("Group")).gameObject.SetActive(false);
						((Component)((Component)UIHandler.instance).transform.Find("Canvas/EscapeMenu/Main/Group")).gameObject.SetActive(true);
					});
					GameObject obj4 = Object.Instantiate<GameObject>(gameObject, ((Component)UIHandler.instance).transform.Find("Canvas/EscapeMenu/Main/Group"));
					obj4.transform.SetSiblingIndex(2);
					((TMP_Text)obj4.GetComponentInChildren<TextMeshProUGUI>()).text = "OPTIONS";
					obj4.GetComponent<Button>().onClick = new ButtonClickedEvent();
					((UnityEvent)obj4.GetComponent<Button>().onClick).AddListener((UnityAction)delegate
					{
						((Component)optionsMenu.transform.Find("Group")).gameObject.SetActive(true);
						((Component)((Component)UIHandler.instance).transform.Find("Canvas/EscapeMenu/Main/Group")).gameObject.SetActive(false);
					});
					if (time)
					{
						CardManager.FirstTimeStart();
					}
				});
				firstTime = false;
				orig.Invoke(self);
			};
			MainMenuHandler.Close += (hook_Close)delegate(orig_Close orig, MainMenuHandler self)
			{
				if ((Object)(object)text != (Object)null)
				{
					Object.Destroy((Object)(object)((Component)text).gameObject);
				}
				orig.Invoke(self);
			};
			object obj = <>c.<>9__37_3;
			if (obj == null)
			{
				hook_Start val = delegate(orig_Start orig, GM_ArmsRace self)
				{
					((MonoBehaviour)self).StartCoroutine(ArmsRaceStartCoroutine(orig, self));
					static IEnumerator ArmsRaceStartCoroutine(orig_Start orig, GM_ArmsRace self)
					{
						yield return GameModeManager.TriggerHook("InitStart");
						orig.Invoke(self);
						yield return GameModeManager.TriggerHook("InitEnd");
					}
				};
				<>c.<>9__37_3 = val;
				obj = (object)val;
			}
			GM_ArmsRace.Start += (hook_Start)obj;
			object obj2 = <>c.<>9__37_5;
			if (obj2 == null)
			{
				hook_Start val2 = delegate(orig_Start orig, GM_Test self)
				{
					((MonoBehaviour)self).StartCoroutine(SandboxStartCoroutine(orig, self));
					static IEnumerator SandboxStartCoroutine(orig_Start orig, GM_Test self)
					{
						yield return GameModeManager.TriggerHook("InitStart");
						yield return GameModeManager.TriggerHook("InitEnd");
						yield return GameModeManager.TriggerHook("GameStart");
						orig.Invoke(self);
						yield return GameModeManager.TriggerHook("RoundStart");
						yield return GameModeManager.TriggerHook("BattleStart");
					}
				};
				<>c.<>9__37_5 = val2;
				obj2 = (object)val2;
			}
			GM_Test.Start += (hook_Start)obj2;
			GameModeManager.AddHook("GameStart", (IGameModeHandler handler) => SyncModClients.DisableSyncModUi(SyncModClients.uiParent));
			GameModeManager.AddHook("GameStart", CloseLobby);
			object obj3 = <>c.<>9__37_7;
			if (obj3 == null)
			{
				hook_Start val3 = delegate(orig_Start orig, CardChoice self)
				{
					//IL_0009: Unknown result type (might be due to invalid IL or missing references)
					for (int i = 0; i < self.cards.Length; i++)
					{
						if (!((DefaultPool)PhotonNetwork.PrefabPool).ResourceCache.ContainsKey(((Object)((Component)self.cards[i]).gameObject).name))
						{
							PhotonNetwork.PrefabPool.RegisterPrefab(((Object)((Component)self.cards[i]).gameObject).name, ((Component)self.cards[i]).gameObject);
						}
					}
					Transform[] array = (Transform[])(object)new Transform[((Component)self).transform.childCount];
					for (int j = 0; j < array.Length; j++)
					{
						array[j] = ((Component)self).transform.GetChild(j);
					}
					self.SetFieldValue("children", array);
					self.cards = CardManager.activeCards.ToArray();
				};
				<>c.<>9__37_7 = val3;
				obj3 = (object)val3;
			}
			CardChoice.Start += (hook_Start)obj3;
		}

		private static IEnumerator CloseLobby(IGameModeHandler gm)
		{
			if (PhotonNetwork.IsMasterClient && !PhotonNetwork.OfflineMode)
			{
				PhotonNetwork.CurrentRoom.IsVisible = false;
				PhotonNetwork.CurrentRoom.IsOpen = false;
			}
			yield break;
		}

		private IEnumerator AddTextWhenReady(float delay = 0f, float maxTimeToWait = 10f)
		{
			if (delay > 0f)
			{
				yield return (object)new WaitForSecondsRealtime(delay);
			}
			float time = maxTimeToWait;
			while (time > 0f)
			{
				MainMenuHandler instance = MainMenuHandler.instance;
				object obj;
				if (instance == null)
				{
					obj = null;
				}
				else
				{
					Transform transform = ((Component)instance).transform;
					obj = ((transform != null) ? transform.Find("Canvas/ListSelector/Main/Group") : null);
				}
				if (!((Object)obj == (Object)null))
				{
					break;
				}
				time -= Time.deltaTime;
				yield return null;
			}
			MainMenuHandler instance2 = MainMenuHandler.instance;
			object obj2;
			if (instance2 == null)
			{
				obj2 = null;
			}
			else
			{
				Transform transform2 = ((Component)instance2).transform;
				obj2 = ((transform2 != null) ? transform2.Find("Canvas/ListSelector/Main/Group") : null);
			}
			if (!((Object)obj2 == (Object)null))
			{
				text = MenuHandler.CreateTextAt("UNBOUND", Vector2.zero);
				((Component)text).gameObject.AddComponent<LayoutElement>().ignoreLayout = true;
				((TMP_Text)text).fontSize = 30f;
				((Graphic)text).color = (Color.yellow + Color.red) / 2f;
				((TMP_Text)text).transform.SetParent(((Component)MainMenuHandler.instance).transform.Find("Canvas/ListSelector/Main/Group"), true);
				((TMP_Text)text).transform.SetAsFirstSibling();
				((Transform)((TMP_Text)text).rectTransform).localScale = Vector3.one;
				((Transform)((TMP_Text)text).rectTransform).localPosition = new Vector3(0f, 350f, ((Transform)((TMP_Text)text).rectTransform).localPosition.z);
			}
		}

		private void Awake()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			else if ((Object)(object)Instance != (Object)(object)this)
			{
				Object.DestroyImmediate((Object)(object)((Component)this).gameObject);
				return;
			}
			new Harmony("com.willis.rounds.unbound").PatchAll();
			((Component)this).gameObject.AddComponent<LevelManager>();
			((Component)this).gameObject.AddComponent<CardManager>();
			((Component)this).gameObject.AddComponent<ToggleLevelMenuHandler>();
			((Component)this).gameObject.AddComponent<ToggleCardsMenuHandler>();
			LoadAssets();
			GameModeManager.Init();
			templateCard = Resources.Load<GameObject>("0 Cards/0. PlainCard").GetComponent<CardInfo>();
			templateCard.allowMultiple = true;
		}

		private void Start()
		{
			NetworkingManager.RegisterEvent("ModLoader_HandshakeStart", delegate
			{
				if (PhotonNetwork.IsMasterClient)
				{
					NetworkingManager.RaiseEvent("ModLoader_HandshakeFinish", new object[2]
					{
						GameModeManager.CurrentHandlerID,
						GameModeManager.CurrentHandler?.Settings
					});
				}
				else
				{
					NetworkingManager.RaiseEvent("ModLoader_HandshakeFinish");
				}
			});
			NetworkingManager.RegisterEvent("ModLoader_HandshakeFinish", delegate(object[] data)
			{
				MapManager.instance.levels = LevelManager.activeLevels.ToArray();
				if (data.Length != 0)
				{
					GameModeManager.SetGameMode((string)data[0], setActive: false);
					GameModeManager.CurrentHandler.SetSettings((GameSettings)data[1]);
				}
			});
			CardManager.defaultCards = CardChoice.instance.cards;
			CardInfo[] array = CardManager.defaultCards;
			foreach (CardInfo val in array)
			{
				CardManager.cards.Add(((Object)val).name, new Card("Vanilla", config.Bind<bool>("Cards: Vanilla", ((Object)val).name, true, (ConfigDescription)null), val));
			}
			NetworkEventCallbacks networkEventCallbacks = ((Component)this).gameObject.AddComponent<NetworkEventCallbacks>();
			networkEventCallbacks.OnJoinedRoomEvent += OnJoinedRoomAction;
			networkEventCallbacks.OnJoinedRoomEvent += LevelManager.OnJoinedRoomAction;
			networkEventCallbacks.OnJoinedRoomEvent += CardManager.OnJoinedRoomAction;
			networkEventCallbacks.OnLeftRoomEvent += OnLeftRoomAction;
			networkEventCallbacks.OnLeftRoomEvent += CardManager.OnLeftRoomAction;
			networkEventCallbacks.OnLeftRoomEvent += LevelManager.OnLeftRoomAction;
			((Component)this).gameObject.AddComponent<PingMonitor>();
			networkEventCallbacks.OnJoinedRoomEvent += SyncModClients.RequestSync;
		}

		private void Update()
		{
			if (Input.GetKeyDown((KeyCode)282) && !ModOptions.noDeprecatedMods)
			{
				ModOptions.showModUi = !ModOptions.showModUi;
			}
			GameManager.lockInput = ModOptions.showModUi || DevConsole.isTyping || ToggleLevelMenuHandler.instance.mapMenuCanvas.activeInHierarchy || (Object.op_Implicit((Object)(object)((Component)UIHandler.instance).transform.Find("Canvas/EscapeMenu/Main/Options(Clone)/Group")) && ((Component)((Component)UIHandler.instance).transform.Find("Canvas/EscapeMenu/Main/Options(Clone)/Group")).gameObject.activeInHierarchy) || (Object.op_Implicit((Object)(object)((Component)UIHandler.instance).transform.Find("Canvas/EscapeMenu/Main/Group")) && ((Component)((Component)UIHandler.instance).transform.Find("Canvas/EscapeMenu/Main/Group")).gameObject.activeInHierarchy) || (Object.op_Implicit((Object)(object)((Component)UIHandler.instance).transform.Find("Canvas/EscapeMenu/MOD OPTIONS/Group")) && ((Component)((Component)UIHandler.instance).transform.Find("Canvas/EscapeMenu/MOD OPTIONS/Group")).gameObject.activeInHierarchy) || ToggleCardsMenuHandler.menuOpenFromOutside || lockInputBools.Values.Any((bool b) => b);
		}

		private void OnGUI()
		{
			if (!ModOptions.showModUi)
			{
				return;
			}
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			bool flag = false;
			using (IEnumerator<ModOptions.GUIListener> enumerator = (from md in ModOptions.GUIListeners.Keys
				select ModOptions.GUIListeners[md] into data
				where data.guiEnabled
				select data).GetEnumerator())
			{
				if (enumerator.MoveNext())
				{
					ModOptions.GUIListener current = enumerator.Current;
					if (GUILayout.Button("<- Back", Array.Empty<GUILayoutOption>()))
					{
						current.guiEnabled = false;
					}
					GUILayout.Label(current.modName + " Options", Array.Empty<GUILayoutOption>());
					flag = true;
					current.guiAction?.Invoke();
				}
			}
			if (flag)
			{
				return;
			}
			GUILayout.Label("UnboundLib Options\nThis menu is deprecated", Array.Empty<GUILayoutOption>());
			GUILayout.Label("Mod Options:", Array.Empty<GUILayoutOption>());
			foreach (ModOptions.GUIListener value in ModOptions.GUIListeners.Values)
			{
				if (GUILayout.Button(value.modName, Array.Empty<GUILayoutOption>()))
				{
					value.guiEnabled = true;
				}
			}
			GUILayout.EndVertical();
		}

		private static void LoadAssets()
		{
			toggleUI = AssetUtils.LoadAssetBundleFromResources("togglemenuui", typeof(ToggleLevelMenuHandler).Assembly);
			linkAssets = AssetUtils.LoadAssetBundleFromResources("unboundlinks", typeof(Unbound).Assembly);
			UIAssets = AssetUtils.LoadAssetBundleFromResources("unboundui", typeof(Unbound).Assembly);
			if ((Object)(object)UIAssets != (Object)null)
			{
				modalPrefab = UIAssets.LoadAsset<GameObject>("Modal");
			}
		}

		private static void OnJoinedRoomAction()
		{
			NetworkingManager.RaiseEventOthers("ModLoader_HandshakeStart");
			Unbound.OnJoinedRoom?.Invoke();
			foreach (Action handShakeAction in handShakeActions)
			{
				handShakeAction?.Invoke();
			}
		}

		private static void OnLeftRoomAction()
		{
			Unbound.OnLeftRoom?.Invoke();
		}

		[UnboundRPC]
		public static void BuildInfoPopup(string message)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			InfoPopup infoPopup = new GameObject("Info Popup").AddComponent<InfoPopup>();
			((Transform)((Graphic)infoPopup).rectTransform).SetParent(((Component)Instance.canvas).transform);
			infoPopup.Build(message);
		}

		[UnboundRPC]
		public static void BuildModal(string title, string message)
		{
			BuildModal().Title(title).Message(message).Show();
		}

		public static ModalHandler BuildModal()
		{
			return Object.Instantiate<GameObject>(modalPrefab, ((Component)Instance.canvas).transform).AddComponent<ModalHandler>();
		}

		public static void RegisterCredits(string modName, string[] credits = null, string[] linkTexts = null, string[] linkURLs = null)
		{
			Credits.Instance.RegisterModCredits(new ModCredits(modName, credits, linkTexts, linkURLs));
		}

		public static void RegisterMenu(string name, UnityAction buttonAction, Action<GameObject> guiAction, GameObject parent = null)
		{
			ModOptions.instance.RegisterMenu(name, buttonAction, guiAction, parent);
		}

		public static void RegisterMenu(string name, UnityAction buttonAction, Action<GameObject> guiAction, GameObject parent = null, bool showInPauseMenu = false)
		{
			ModOptions.instance.RegisterMenu(name, buttonAction, guiAction, parent, showInPauseMenu);
		}

		public static void RegisterGUI(string modName, Action guiAction)
		{
			ModOptions.RegisterGUI(modName, guiAction);
		}

		public static void RegisterCredits(string modName, string[] credits = null, string linkText = "", string linkURL = "")
		{
			Credits.Instance.RegisterModCredits(new ModCredits(modName, credits, linkText, linkURL));
		}

		public static void RegisterClientSideMod(string GUID)
		{
			SyncModClients.RegisterClientSideMod(GUID);
		}

		public static void AddAllCardsCallback(Action<CardInfo[]> callback)
		{
			CardManager.AddAllCardsCallback(callback);
		}

		public static void RegisterHandshake(string modId, Action callback)
		{
			NetworkingManager.RegisterEvent("ModLoader_" + modId + "_StartHandshake", delegate
			{
				NetworkingManager.RaiseEvent("ModLoader_" + modId + "_FinishHandshake");
			});
			NetworkingManager.RegisterEvent("ModLoader_" + modId + "_FinishHandshake", delegate
			{
				callback?.Invoke();
			});
			handShakeActions.Add(delegate
			{
				NetworkingManager.RaiseEventOthers("ModLoader_" + modId + "_StartHandshake");
			});
		}

		[Obsolete("This method is obsolete. Use LevelManager.RegisterMaps() instead.", false)]
		public static void RegisterMaps(AssetBundle assetBundle)
		{
			LevelManager.RegisterMaps(assetBundle);
		}

		[Obsolete("This method is obsolete. Use LevelManager.RegisterMaps() instead.", false)]
		public static void RegisterMaps(IEnumerable<string> paths)
		{
			RegisterMaps(paths, "Modded");
		}

		[Obsolete("This method is obsolete. Use LevelManager.RegisterMaps() instead.", false)]
		public static void RegisterMaps(IEnumerable<string> paths, string categoryName)
		{
			LevelManager.RegisterMaps(paths);
		}

		public static bool IsNotPlayingOrConnected()
		{
			if (Object.op_Implicit((Object)(object)GameManager.instance) && !GameManager.instance.battleOngoing)
			{
				if (!PhotonNetwork.OfflineMode)
				{
					return !PhotonNetwork.IsConnected;
				}
				return true;
			}
			return false;
		}

		internal static ConfigEntry<T> BindConfig<T>(string section, string key, T defaultValue, ConfigDescription configDescription = null)
		{
			return config.Bind<T>(EscapeConfigKey(section), EscapeConfigKey(key), defaultValue, configDescription);
		}

		private static string EscapeConfigKey(string key)
		{
			return key.Replace("=", "&eq;").Replace("\n", "&nl;").Replace("\t", "&tab;")
				.Replace("\\", "&esc;")
				.Replace("\"", "&dquot;")
				.Replace("'", "&squot;")
				.Replace("[", "&lsq;")
				.Replace("]", "&rsq;");
		}

		[CompilerGenerated]
		internal static IEnumerator <.ctor>g__ArmsRaceStartCoroutine|37_2(orig_Start orig, GM_ArmsRace self)
		{
			yield return GameModeManager.TriggerHook("InitStart");
			orig.Invoke(self);
			yield return GameModeManager.TriggerHook("InitEnd");
		}

		[CompilerGenerated]
		internal static IEnumerator <.ctor>g__SandboxStartCoroutine|37_4(orig_Start orig, GM_Test self)
		{
			yield return GameModeManager.TriggerHook("InitStart");
			yield return GameModeManager.TriggerHook("InitEnd");
			yield return GameModeManager.TriggerHook("GameStart");
			orig.Invoke(self);
			yield return GameModeManager.TriggerHook("RoundStart");
			yield return GameModeManager.TriggerHook("BattleStart");
		}
	}
	public static class ExtensionMethods
	{
		public static string Sanitize(this string str, string[] invalidSubstrs = null)
		{
			invalidSubstrs = invalidSubstrs ?? new string[7] { "\n", "\t", "\\", "\"", "'", "[", "]" };
			string[] array = invalidSubstrs;
			foreach (string oldValue in array)
			{
				str.Replace(oldValue, string.Empty);
			}
			return str;
		}

		public static T GetOrAddComponent<T>(this GameObject go, bool searchChildren = false) where T : Component
		{
			T val = (searchChildren ? go.GetComponentInChildren<T>() : go.GetComponent<T>());
			if ((Object)(object)val == (Object)null)
			{
				val = go.AddComponent<T>();
			}
			return val;
		}

		public static void ExecuteAfterFrames(this MonoBehaviour mb, int delay, Action action)
		{
			mb.StartCoroutine(ExecuteAfterFramesCoroutine(delay, action));
		}

		public static void ExecuteAfterSeconds(this MonoBehaviour mb, float delay, Action action)
		{
			mb.StartCoroutine(ExecuteAfterSecondsCoroutine(delay, action));
		}

		private static IEnumerator ExecuteAfterFramesCoroutine(int delay, Action action)
		{
			for (int i = 0; i < delay; i++)
			{
				yield return null;
			}
			action();
		}

		private static IEnumerator ExecuteAfterSecondsCoroutine(float delay, Action action)
		{
			yield return (object)new WaitForSeconds(delay);
			action();
		}

		public static void SetAlpha(this Image image, float alpha)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			Color color = ((Graphic)image).color;
			color.a = alpha;
			((Graphic)image).color = color;
		}

		public static int AsMultiplier(this bool value)
		{
			if (!value)
			{
				return -1;
			}
			return 1;
		}

		public static T GetRandom<T>(this IList array)
		{
			return (T)array[Random.Range(0, array.Count)];
		}

		public static void Shuffle<T>(this IList<T> list)
		{
			int num = list.Count;
			while (num > 1)
			{
				num--;
				int index = Random.Range(0, num + 1);
				T value = list[index];
				list[index] = list[num];
				list[num] = value;
			}
		}

		public static V GetValueOrDefault<K, V>(this IDictionary<K, V> dictionary, K key)
		{
			dictionary.TryGetValue(key, out var value);
			return value;
		}

		public static V GetValueOrDefault<K, V>(this IDictionary<K, V> dictionary, K key, V defaultValue)
		{
			if (!dictionary.TryGetValue(key, out var value))
			{
				return defaultValue;
			}
			return value;
		}

		public static Transform FindDeepChild(this Transform aParent, string aName)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			Queue<Transform> queue = new Queue<Transform>();
			queue.Enqueue(aParent);
			while (queue.Count > 0)
			{
				Transform val = queue.Dequeue();
				if (((Object)val).name == aName)
				{
					return val;
				}
				foreach (Transform item2 in val)
				{
					Transform item = item2;
					queue.Enqueue(item);
				}
			}
			return null;
		}

		public static void AddXPosition(this Transform transform, float x)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = transform.position;
			position.x += x;
			transform.position = position;
		}

		public static void AddYPosition(this Transform transform, float y)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = transform.position;
			position.y += y;
			transform.position = position;
		}

		public static void AddZPosition(this Transform transform, float z)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = transform.position;
			position.z += z;
			transform.position = position;
		}

		public static void SetXPosition(this Transform transform, float x)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = transform.position;
			position.x = x;
			transform.position = position;
		}

		public static void SetYPosition(this Transform transform, float y)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = transform.position;
			position.y = y;
			transform.position = position;
		}

		public static void SetZPosition(this Transform transform, float z)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = transform.position;
			position.z = z;
			transform.position = position;
		}

		public static bool IsLayerInMask(this LayerMask layerMask, int layer)
		{
			return ((LayerMask)(ref layerMask)).value == (((LayerMask)(ref layerMask)).value | (1 << layer));
		}

		public static void InsertYieldReturn(this ILGenerator gen, List<CodeInstruction> instructions, int index)
		{
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Expected O, but got Unknown
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Expected O, but got Unknown
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Expected O, but got Unknown
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Expected O, but got Unknown
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Expected O, but got Unknown
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Expected O, but got Unknown
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Expected O, but got Unknown
			Type? declaringType = ((FieldInfo)instructions[1].operand).DeclaringType;
			FieldInfo fieldInfo = GetFieldInfo(declaringType, "<>1__state");
			FieldInfo fieldInfo2 = GetFieldInfo(declaringType, "<>2__current");
			CodeInstruction? obj = instructions.Find((CodeInstruction ins) => ins.opcode == OpCodes.Switch);
			List<Label> list = ((Label[])obj.operand).ToList();
			int count = list.Count;
			Label label = gen.DefineLabel();
			list.Add(label);
			obj.operand = list.ToArray();
			List<CodeInstruction> list2 = new List<CodeInstruction>();
			list2.Add(new CodeInstruction(OpCodes.Stfld, (object)fieldInfo2));
			list2.Add(new CodeInstruction(OpCodes.Ldarg_0, (object)null));
			list2.Add(new CodeInstruction(OpCodes.Ldc_I4, (object)count));
			list2.Add(new CodeInstruction(OpCodes.Stfld, (object)fieldInfo));
			list2.Add(new CodeInstruction(OpCodes.Ldc_I4_1, (object)null));
			list2.Add(new CodeInstruction(OpCodes.Ret, (object)null));
			list2.Add(CodeInstructionExtensions.WithLabels(new CodeInstruction(OpCodes.Ldarg_0, (object)null), new Label[1] { label }));
			list2.Add(new CodeInstruction(OpCodes.Ldc_I4_M1, (object)null));
			list2.Add(new CodeInstruction(OpCodes.Stfld, (object)fieldInfo));
			List<CodeInstruction> collection = list2;
			instructions.InsertRange(index, collection);
		}

		public static void AddYieldReturn(this ILGenerator gen, List<CodeInstruction> instructions)
		{
			gen.InsertYieldReturn(instructions, instructions.Count);
		}

		public static MethodInfo GetMethodInfo(Type type, string methodName)
		{
			MethodInfo methodInfo = null;
			do
			{
				methodInfo = type.GetMethod(methodName, BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
				type = type.BaseType;
			}
			while (methodInfo == null && type != null);
			return methodInfo;
		}

		public static object InvokeMethod(this object obj, string methodName, params object[] arguments)
		{
			if (obj == null)
			{
				throw new ArgumentNullException("obj");
			}
			Type type = obj.GetType();
			MethodInfo methodInfo = GetMethodInfo(type, methodName);
			if (methodInfo == null)
			{
				throw new ArgumentOutOfRangeException("propertyName", $"Couldn't find property {methodName} in type {type.FullName}");
			}
			return methodInfo.Invoke(obj, arguments);
		}

		public static MethodInfo GetMethodInfo(Type type, string methodName, Type[] parameters)
		{
			MethodInfo methodInfo = null;
			do
			{
				methodInfo = type.GetMethod(methodName, BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, parameters, null);
				type = type.BaseType;
			}
			while (methodInfo == null && type != null);
			return methodInfo;
		}

		public static object InvokeMethod(this object obj, string methodName, Type[] argumentOrder, params object[] arguments)
		{
			if (obj == null)
			{
				throw new ArgumentNullException("obj");
			}
			Type type = obj.GetType();
			MethodInfo methodInfo = GetMethodInfo(type, methodName, argumentOrder);
			if (methodInfo == null)
			{
				throw new ArgumentOutOfRangeException("propertyName", $"Couldn't find property {methodName} in type {type.FullName}");
			}
			return methodInfo.Invoke(obj, arguments);
		}

		public static FieldInfo GetFieldInfo(Type type, string fieldName)
		{
			FieldInfo fieldInfo = null;
			do
			{
				fieldInfo = type.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				type = type.BaseType;
			}
			while (fieldInfo == null && type != null);
			return fieldInfo;
		}

		public static object GetFieldValue(this object obj, string fieldName)
		{
			if (obj == null)
			{
				throw new ArgumentNullException("obj");
			}
			Type type = obj.GetType();
			FieldInfo fieldInfo = GetFieldInfo(type, fieldName);
			if (fieldInfo == null)
			{
				throw new ArgumentOutOfRangeException("propertyName", $"Couldn't find property {fieldName} in type {type.FullName}");
			}
			return fieldInfo.GetValue(obj);
		}

		public static void SetFieldValue(this object obj, string fieldName, object val)
		{
			if (obj == null)
			{
				throw new ArgumentNullException("obj");
			}
			Type type = obj.GetType();
			FieldInfo fieldInfo = GetFieldInfo(type, fieldName);
			if (fieldInfo == null)
			{
				throw new ArgumentOutOfRangeException("propertyName", $"Couldn't find property {fieldName} in type {type.FullName}");
			}
			fieldInfo.SetValue(obj, val);
		}

		public static PropertyInfo GetPropertyInfo(Type type, string propertyName)
		{
			PropertyInfo propertyInfo = null;
			do
			{
				propertyInfo = type.GetProperty(propertyName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				type = type.BaseType;
			}
			while (propertyInfo == null && type != null);
			return propertyInfo;
		}

		public static object GetPropertyValue(this object obj, string propertyName)
		{
			if (obj == null)
			{
				throw new ArgumentNullException("obj");
			}
			Type type = obj.GetType();
			PropertyInfo propertyInfo = GetPropertyInfo(type, propertyName);
			if (propertyInfo == null)
			{
				throw new ArgumentOutOfRangeException("propertyName", $"Couldn't find property {propertyName} in type {type.FullName}");
			}
			return propertyInfo.GetValue(obj, null);
		}

		public static void SetPropertyValue(this object obj, string propertyName, object val)
		{
			if (obj == null)
			{
				throw new ArgumentNullException("obj");
			}
			Type type = obj.GetType();
			PropertyInfo propertyInfo = GetPropertyInfo(type, propertyName);
			if (propertyInfo == null)
			{
				throw new ArgumentOutOfRangeException("propertyName", $"Couldn't find property {propertyName} in type {type.FullName}");
			}
			propertyInfo.SetValue(obj, val, null);
		}

		public static object Cast(this Type Type, object data)
		{
			ParameterExpression parameterExpression = Expression.Parameter(typeof(object), "data");
			return Expression.Lambda(Expression.Block(Expression.Convert(Expression.Convert(parameterExpression, data.GetType()), Type)), parameterExpression).Compile().DynamicInvoke(data);
		}
	}
	public static class MonoBehaviourExtensions
	{
		private static readonly ConditionalWeakTable<MonoBehaviour, HashSet<Tuple<int, string>>> pendingRequests = new ConditionalWeakTable<MonoBehaviour, HashSet<Tuple<int, string>>>();

		public static Coroutine SyncMethod(this MonoBehaviour instance, string methodName, int[] actors, params object[] data)
		{
			return instance.StartCoroutine(instance.SyncMethodCoroutine(methodName, actors, data));
		}

		public static Coroutine SyncMethod(this MonoBehaviour instance, string methodName, int actor, params object[] data)
		{
			return instance.SyncMethod(methodName, new int[1] { actor }, data);
		}

		private static IEnumerator SyncMethodCoroutine(this MonoBehaviour instance, string methodName, int[] actors, params object[] data)
		{
			if (PhotonNetwork.OfflineMode || PhotonNetwork.CurrentRoom == null)
			{
				NetworkingManager.RPC(((object)instance).GetType(), methodName, data);
				yield break;
			}
			if (actors == null)
			{
				actors = (from p in PhotonNetwork.CurrentRoom.Players.Values.ToList()
					select p.ActorNumber).ToArray();
			}
			int[] array = actors;
			foreach (int item in array)
			{
				instance.GetPendingRequests().Add(new Tuple<int, string>(item, methodName));
			}
			NetworkingManager.RPC(((object)instance).GetType(), methodName, data);
			while ((from r in instance.GetPendingRequests()
				where r.Item2 == methodName
				select r).Any((Tuple<int, string> r) => actors.Contains(r.Item1)))
			{
				yield return null;
			}
		}

		public static HashSet<Tuple<int, string>> GetPendingRequests(this MonoBehaviour instance)
		{
			return pendingRequests.GetOrCreateValue(instance);
		}

		public static void ClearPendingRequests(this MonoBehaviour instance, int actor)
		{
			HashSet<Tuple<int, string>> orCreateValue = pendingRequests.GetOrCreateValue(instance);
			foreach (Tuple<int, string> item in from t in orCreateValue.ToList()
				where t.Item1 == actor
				select t)
			{
				orCreateValue.Remove(new Tuple<int, string>(actor, item.Item2));
			}
		}

		public static void RemovePendingRequest(this MonoBehaviour instance, int actor, string methodName)
		{
			pendingRequests.GetOrCreateValue(instance).Remove(new Tuple<int, string>(actor, methodName));
		}
	}
	[RequireComponent(typeof(VerticalLayoutGroup), typeof(ContentSizeFitter), typeof(CanvasGroup))]
	public class InfoPopup : Image
	{
		private Text text;

		private CanvasGroup group;

		protected override void Awake()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Expected O, but got Unknown
			((UIBehaviour)this).Start();
			((Graphic)this).color = new Color(0f, 0f, 0f, 25f / 51f);
			text = new GameObject().AddComponent<Text>();
			((Transform)((Graphic)text).rectTransform).SetParent((Transform)(object)((Graphic)this).rectTransform);
			text.alignment = (TextAnchor)4;
			text.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
			text.fontSize = 14;
			text.horizontalOverflow = (HorizontalWrapMode)1;
			text.verticalOverflow = (VerticalWrapMode)1;
			text.supportRichText = true;
			VerticalLayoutGroup component = ((Component)this).GetComponent<VerticalLayoutGroup>();
			bool flag2 = (((HorizontalOrVerticalLayoutGroup)component).childForceExpandWidth = true);
			bool flag4 = (((HorizontalOrVerticalLayoutGroup)component).childForceExpandHeight = flag2);
			bool childControlHeight = (((HorizontalOrVerticalLayoutGroup)component).childControlWidth = flag4);
			((HorizontalOrVerticalLayoutGroup)component).childControlHeight = childControlHeight;
			((LayoutGroup)component).padding = new RectOffset(10, 10, 5, 5);
			ContentSizeFitter component2 = ((Component)this).GetComponent<ContentSizeFitter>();
			component2.horizontalFit = (FitMode)2;
			component2.verticalFit = (FitMode)2;
			group = ((Component)this).GetComponent<CanvasGroup>();
		}

		public void Build(string message)
		{
			text.text = message;
			((MonoBehaviour)this).StartCoroutine(DisplayPopup());
		}

		private IEnumerator DisplayPopup()
		{
			float time = 0f;
			float damp = 0f;
			float val = 0f;
			((Transform)((Graphic)this).rectTransform).position = Vector2.op_Implicit(new Vector2((float)(Screen.width / 2), (float)(Screen.height / 2)));
			while (time < 3f)
			{
				RectTransform rectTransform = ((Graphic)this).rectTransform;
				rectTransform.anchoredPosition += Vector2.up;
				val = Mathf.SmoothDamp(val, 1.25f, ref damp, 2f);
				group.alpha = 1f - val;
				time += Time.deltaTime;
				yield return null;
			}
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
	public class ModalHandler : MonoBehaviour
	{
		private Text title => ((Component)((Component)this).transform.Find("Foreground/Title Bar/Title")).GetComponent<Text>();

		private TextMeshProUGUI content => ((Component)((Component)this).transform.Find("Foreground/Content/Text")).GetComponent<TextMeshProUGUI>();

		private GameObject confirmButton => ((Component)((Component)this).transform.Find("Foreground/Buttons/Got It")).gameObject;

		private GameObject cancelButton => ((Component)((Component)this).transform.Find("Foreground/Buttons/Whatever")).gameObject;

		private void Start()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			((UnityEvent)confirmButton.GetComponent<Button>().onClick).AddListener((UnityAction)delegate
			{
				Object.Destroy((Object)(object)((Component)this).gameObject, 1f);
			});
			((UnityEvent)cancelButton.GetComponent<Button>().onClick).AddListener((UnityAction)delegate
			{
				Object.Destroy((Object)(object)((Component)this).gameObject, 1f);
			});
		}

		public ModalHandler Title(string text)
		{
			title.text = text;
			return this;
		}

		public ModalHandler Message(string text)
		{
			((TMP_Text)content).text = text;
			return this;
		}

		public ModalHandler ConfirmButton(string text, UnityAction action)
		{
			SetupButton(confirmButton, text, action);
			return this;
		}

		public ModalHandler CancelButton(string text, UnityAction action)
		{
			SetupButton(cancelButton, text, action);
			return this;
		}

		private static void SetupButton(GameObject root, string text, UnityAction action)
		{
			((UnityEvent)root.GetComponent<Button>().onClick).AddListener(action);
			TextMeshProUGUI[] componentsInChildren = root.GetComponentsInChildren<TextMeshProUGUI>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				((TMP_Text)componentsInChildren[i]).text = text;
			}
		}

		public void Show()
		{
			((Component)this).GetComponent<Animator>().Play("Fade-in");
		}
	}
}
namespace UnboundLib.Utils
{
	public class CardManager : MonoBehaviour
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Comparison<CardInfo> <>9__2_0;

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

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

			public static Func<string, Card> <>9__11_2;

			public static Func<KeyValuePair<string, Card>, bool> <>9__11_3;

			public static Func<CardInfo, string> <>9__18_0;

			public static Comparison<CardInfo> <>9__20_0;

			public static Func<KeyValuePair<string, Card>, string> <>9__25_1;

			public static Action <>9__27_0;

			public static UnityAction <>9__28_1;

			public static Func<CardInfo, string> <>9__28_2;

			public static Func<Card, CardInfo> <>9__29_0;

			internal int <get_allCards>b__2_0(CardInfo x, CardInfo y)
			{
				return string.CompareOrdinal(((Object)((Component)x).gameObject).name, ((Object)((Component)y).gameObject).name);
			}

			internal string <FirstTimeStart>b__11_0(string k)
			{
				return k;
			}

			internal string <FirstTimeStart>b__11_1(string k)
			{
				return k;
			}

			internal Card <FirstTimeStart>b__11_2(string k)
			{
				return cards[k];
			}

			internal bool <FirstTimeStart>b__11_3(KeyValuePair<string, Card> card)
			{
				return !categories.Contains(card.Value.category);
			}

			internal string <EnableCard>b__18_0(CardInfo i)
			{
				return ((Object)((Component)i).gameObject).name;
			}

			internal int <DisableCard>b__20_0(CardInfo x, CardInfo y)
			{
				return string.CompareOrdinal(((Object)((Component)x).gameObject).name, ((Object)((Component)y).gameObject).name);
			}

			internal string <GetCardsInCategory>b__25_1(KeyValuePair<string, Card> card)
			{
				KeyValuePair<string, Card> keyValuePair = card;
				return keyValuePair.Key;
			}

			internal void <OnJoinedRoomAction>b__27_0()
			{
				if (!PhotonNetwork.IsMasterClient)
				{
					NetworkingManager.RPC_Others(typeof(CardManager), "RPC_CardHandshake", new object[1] { cards.Keys.ToArray() });
				}
			}

			internal void <RPC_CardHandshake>b__28_1()
			{
			}

			internal string <RPC_CardHandshake>b__28_2(CardInfo c)
			{
				return ((Object)((Component)c).gameObject).name;
			}

			internal CardInfo <RPC_HostCardHandshakeResponse>b__29_0(Card card)
			{
				return card.cardInfo;
			}
		}

		public CardManager instance;

		internal static CardInfo[] defaultCards;

		internal static ObservableCollection<CardInfo> activeCards;

		internal static List<CardInfo> inactiveCards = new List<CardInfo>();

		public static readonly List<string> categories = new List<string>();

		internal static readonly Dictionary<string, ConfigEntry<bool>> categoryBools = new Dictionary<string, ConfigEntry<bool>>();

		public static Dictionary<string, Card> cards = new Dictionary<string, Card>();

		private static readonly List<Action<CardInfo[]>> FirstStartCallbacks = new List<Action<CardInfo[]>>();

		internal static CardInfo[] allCards
		{
			get
			{
				List<CardInfo> list = new List<CardInfo>();
				list.AddRange(activeCards);
				list.AddRange(inactiveCards);
				list.Sort((CardInfo x, CardInfo y) => string.CompareOrdinal(((Object)((Component)x).gameObject).name, ((Object)((Component)y).gameObject).name));
				return list.ToArray();
			}
		}

		public void Start()
		{
			instance = this;
			defaultCards = (CardInfo[])CardChoice.instance.cards.Clone();
			activeCards = new ObservableCollection<CardInfo>(defaultCards);
			activeCards.CollectionChanged += CardsChanged;
		}

		public static void FirstTimeStart()
		{
			cards = cards.Keys.OrderBy((string k) => k).ToDictionary((string k) => k, (string k) => cards[k]);
			foreach (KeyValuePair<string, Card> item in cards.Where((KeyValuePair<string, Card> card) => !categories.Contains(card.Value.category)))
			{
				categories.Add(item.Value.category);
			}
			foreach (string category in categories)
			{
				categoryBools.Add(category, Unbound.BindConfig("Card categories", category, defaultValue: true));
			}
			foreach (Action<CardInfo[]> firstStartCallback in FirstStartCallbacks)
			{
				firstStartCallback(allCards);
			}
		}

		public static void RestoreCardToggles()
		{
			foreach (Card value in cards.Values)
			{
				if (value.config.Value)
				{
					EnableCard(value.cardInfo);
				}
				else
				{
					DisableCard(value.cardInfo);
				}
			}
		}

		public static void AddAllCardsCallback(Action<CardInfo[]> callback)
		{
			FirstStartCallbacks.Add(callback);
		}

		internal static void CardsChanged(object sender, NotifyCollectionChangedEventArgs args)
		{
			if (Object.op_Implicit((Object)(object)CardChoice.instance))
			{
				CardChoice.instance.cards = activeCards.ToArray();
			}
		}

		public static CardInfo[] GetCardsInfoWithNames(string[] cardNames)
		{
			return cardNames.Select(GetCardInfoWithName).ToArray();
		}

		public static CardInfo GetCardInfoWithName(string cardName)
		{
			if (!cards.ContainsKey(cardName))
			{
				return null;
			}
			return cards[cardName].cardInfo;
		}

		public static void EnableCards(CardInfo[] cardInfos, bool saved = true)
		{
			for (int i = 0; i < cardInfos.Length; i++)
			{
				EnableCard(cardInfos[i], saved);
			}
		}

		public static void EnableCard(CardInfo cardInfo, bool saved = true)
		{
			if (!activeCards.Contains(cardInfo))
			{
				activeCards.Add(cardInfo);
				activeCards = new ObservableCollection<CardInfo>(activeCards.OrderBy((CardInfo i) => ((Object)((Component)i).gameObject).name));
				activeCards.CollectionChanged += CardsChanged;
			}
			if (inactiveCards.Contains(cardInfo))
			{
				inactiveCards.Remove(cardInfo);
			}
			string name = ((Object)((Component)cardInfo).gameObject).name;
			if (cards.ContainsKey(name))
			{
				cards[name].enabled = true;
				if (saved)
				{
					cards[name].config.Value = true;
				}
			}
		}

		public static void DisableCards(CardInfo[] cardInfos, bool saved = true)
		{
			for (int i = 0; i < cardInfos.Length; i++)
			{
				DisableCard(cardInfos[i], saved);
			}
		}

		public static void DisableCard(CardInfo cardInfo, bool saved = true)
		{
			if (activeCards.Contains(cardInfo))
			{
				activeCards.Remove(cardInfo);
			}
			if (!inactiveCards.Contains(cardInfo))
			{
				inactiveCards.Add(cardInfo);
				inactiveCards.Sort((CardInfo x, CardInfo y) => string.CompareOrdinal(((Object)((Component)x).gameObject).name, ((Object)((Component)y).gameObject).name));
			}
			string name = ((Object)((Component)cardInfo).gameObject).name;
			if (cards.ContainsKey(name))
			{
				cards[name].enabled = false;
				if (saved)
				{
					cards[name].config.Value = false;
				}
			}
		}

		public static void EnableCategory(string categoryName)
		{
			if (categoryBools.ContainsKey(categoryName))
			{
				categoryBools[categoryName].Value = true;
			}
			string[] cardsInCategory = GetCardsInCategory(categoryName);
			foreach (string key in cardsInCategory)
			{
				EnableCard(cards[key].cardInfo);
			}
		}

		public static void DisableCategory(string categoryName)
		{
			if (categoryBools.ContainsKey(categoryName))
			{
				categoryBools[categoryName].Value = false;
			}
			string[] cardsInCategory = GetCardsInCategory(categoryName);
			foreach (string key in cardsInCategory)
			{
				DisableCard(cards[key].cardInfo);
			}
		}

		public static bool IsCardActive(CardInfo card)
		{
			return activeCards.Contains(card);
		}

		public static bool IsCategoryActive(string categoryName)
		{
			if (categoryBools.ContainsKey(categoryName))
			{
				return categoryBools[categoryName].Value;
			}
			return false;
		}

		public static string[] GetCardsInCategory(string category)
		{
			return cards.Where(delegate(KeyValuePair<string, Card> card)
			{
				KeyValuePair<string, Card> keyValuePair2 = card;
				return keyValuePair2.Value.category == category;
			}).Select(delegate(KeyValuePair<string, Card> card)
			{
				KeyValuePair<string, Card> keyValuePair = card;
				return keyValuePair.Key;
			}).ToArray();
		}

		public static void OnLeftRoomAction()
		{
			RestoreCardToggles();
			ToggleCardsMenuHandler.RestoreCardToggleVisuals();
		}

		public static void OnJoinedRoomAction()
		{
			CardChoice.instance.cards = activeCards.ToArray();
			((MonoBehaviour)(object)Unbound.Instance).ExecuteAfterFrames(45, delegate
			{
				if (!PhotonNetwork.IsMasterClient)
				{
					NetworkingManager.RPC_Others(typeof(CardManager), "RPC_CardHandshake", new object[1] { cards.Keys.ToArray() });
				}
			});
		}

		[UnboundRPC]
		private static void RPC_CardHandshake(string[] cardsArray)
		{
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Expected O, but got Unknown
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Expected O, but got Unknown
			if (!PhotonNetwork.IsMasterClient)
			{
				return;
			}
			List<string> disabledCards = new List<string>();
			foreach (string cardName2 in cards.Keys.Where((string cardName) => !cardsArray.Contains(cardName)))
			{
				DisableCard(cards[cardName2].cardInfo, saved: false);
				disabledCards.Add(cardName2);
				foreach (KeyValuePair<GameObject, Action> item in ToggleCardsMenuHandler.cardObjs.Where((KeyValuePair<GameObject, Action> c) => ((Object)c.Key).name == cardName2))
				{
					ToggleCardsMenuHandler.UpdateVisualsCardObj(item.Key);
				}
			}
			if (disabledCards.Count != 0)
			{
				ModalHandler modalHandler = Unbound.BuildModal().Title("These cards have been disabled because someone didn't have them").Message(string.Join(", ", disabledCards.ToArray()))
					.CancelButton("Copy", (UnityAction)delegate
					{
						Unbound.BuildInfoPopup("Copied Message!");
						GUIUtility.systemCopyBuffer = string.Join(", ", disabledCards.ToArray());
					});
				object obj = <>c.<>9__28_1;
				if (obj == null)
				{
					UnityAction val = delegate
					{
					};
					<>c.<>9__28_1 = val;
					obj = (object)val;
				}
				modalHandler.CancelButton("Cancel", (UnityAction)obj).Show();
			}
			NetworkingManager.RPC_Others(typeof(CardManager), "RPC_HostCardHandshakeResponse", new object[1] { activeCards.Select((CardInfo c) => ((Object)((Component)c).gameObject).name).ToArray() });
		}

		[UnboundRPC]
		private static void RPC_HostCardHandshakeResponse(string[] cardsArray)
		{
			foreach (CardInfo item in cards.Values.Select((Card card) => card.cardInfo))
			{
				string cardObjectName = ((Object)((Component)item).gameObject).name;
				if (cardsArray.Contains(cardObjectName))
				{
					EnableCard(item, saved: false);
					foreach (KeyValuePair<GameObject, Action> item2 in ToggleCardsMenuHandler.cardObjs.Where((KeyValuePair<GameObject, Action> c) => ((Object)c.Key).name == cardObjectName))
					{
						ToggleCardsMenuHandler.UpdateVisualsCardObj(item2.Key);
					}
					continue;
				}
				DisableCard(item, saved: false);
				foreach (KeyValuePair<GameObject, Action> item3 in ToggleCardsMenuHandler.cardObjs.Where((KeyValuePair<GameObject, Action> c) => ((Object)c.Key).name == cardObjectName))
				{
					ToggleCardsMenuHandler.UpdateVisualsCardObj(item3.Key);
				}
			}
		}
	}
	public class Card
	{
		public bool enabled;

		public string category;

		public CardInfo cardInfo;

		public ConfigEntry<bool> config;

		public Card(string category, ConfigEntry<bool> config, CardInfo cardInfo)
		{
			this.category = category;
			enabled = config.Value;
			this.cardInfo = cardInfo;
			this.config = config;
		}
	}
	public static class ExtraPlayerSkins
	{
		public const int NumSkins = 32;

		public static PlayerSkin[] skins;

		private static readonly PlayerSkin[] extraSkinBases;

		public static int numberOfSkins => skins.Length;

		public static string GetTeamColorName(int teamID)
		{
			return teamID switch
			{
				0 => "Orange", 
				1 => "Blue", 
				2 => "Red", 
				3 => "Green", 
				4 => "Yellow", 
				5 => "Purple", 
				6 => "Magenta", 
				7 => "Cyan", 
				8 => "Tangerine", 
				9 => "Light Blue", 
				10 => "Peach", 
				11 => "Lime", 
				12 => "Light Yellow", 
				13 => "Orchid", 
				14 => "Pink", 
				15 => "Aquamarine", 
				16 => "Dark Orange", 
				17 => "Dark Blue", 
				18 => "Dark Red", 
				19 => "Dark Green", 
				20 => "Dark Yellow", 
				21 => "Indigo", 
				22 => "Cerise", 
				23 => "Teal", 
				24 => "Burnt Orange", 
				25 => "Midnight Blue", 
				26 => "Maroon", 
				27 => "Evergreen", 
				28 => "Gold", 
				29 => "Violet", 
				30 => "Ruby", 
				31 => "Dark Cyan", 
				_ => (teamID + 1).ToString(), 
			};
		}

		public static PlayerSkin GetPlayerSkinColors(int colorID)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			colorID = Math.mod(colorID, numberOfSkins);
			if ((Object)(object)skins[colorID] != (Object)null)
			{
				return skins[colorID];
			}
			PlayerSkinBank val = (PlayerSkinBank)(typeof(PlayerSkinBank).GetProperty("Instance", BindingFlags.Static | BindingFlags.NonPublic)?.GetValue(null, null));
			PlayerSkin component = ((Component)Object.Instantiate<PlayerSkin>(((int)val != 0) ? val.skins[colorID % 4].currentPlayerSkin : null)).gameObject.GetComponent<PlayerSkin>();
			Object.DontDestroyOnLoad((Object)(object)component);
			PlayerSkin val2 = extraSkinBases[colorID];
			component.color = val2.color;
			component.backgroundColor = val2.backgroundColor;
			component.winText = val2.winText;
			component.particleEffect = val2.particleEffect;
			PlayerSkinParticle componentInChildren = ((Component)component).GetComponentInChildren<PlayerSkinParticle>();
			MainModule main = ((Component)componentInChildren).GetComponent<ParticleSystem>().main;
			MinMaxGradient startColor = ((MainModule)(ref main)).startColor;
			((MinMaxGradient)(ref startColor)).colorMin = val2.backgroundColor;
			((MinMaxGradient)(ref startColor)).colorMax = val2.color;
			((MainModule)(ref main)).startColor = startColor;
			componentInChildren.SetFieldValue("startColor1", val2.backgroundColor);
			componentInChildren.SetFieldValue("startColor2", val2.color);
			skins[colorID] = component;
			return skins[colorID];
		}

		static ExtraPlayerSkins()
		{
			//IL_0024: 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)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Expected O, but got Unknown
			//IL_0117: 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_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_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Expected O, but got Unknown
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: 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_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Expected O, but got Unknown
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: 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_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Expected O, but got Unknown
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: 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_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_031a: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Expected O, but got Unknown
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_032c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_0346: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0360: Unknown result type (might be due to invalid IL or missing references)
			//IL_0365: Unknown result type (might be due to invalid IL or missing references)
			//IL_036a: Unknown result type (might be due to invalid IL or missing references)
			//IL_037f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0384: 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_03a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a9: Expected O, but got Unknown
			//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0403: Unknown result type (might be due to invalid IL or missing references)
			//IL_0408: 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_0422: 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_042d: Expected O, but got Unknown
			//IL_042f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0434: Unknown result type (might be due to invalid IL or missing references)
			//IL_0449: Unknown result type (might be due to invalid IL or missing references)
			//IL_044e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0453: Unknown result type (might be due to invalid IL or missing references)
			//IL_0468: Unknown result type (might be due to invalid IL or missing references)
			//IL_046d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0472: 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_048c: 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_04ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b1: Expected O, but got Unknown
			//IL_04b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cd: 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_04d7: Unknown result type (might be due to invalid IL or missing references)
			//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_04f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_050b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0510: Unknown result type (might be due to invalid IL or missing references)
			//IL_0515: Unknown result type (might be due to invalid IL or missing references)
			//IL_052a: Unknown result type (might be due to invalid IL or missing references)
			//IL_052f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0535: Expected O, but got Unknown
			//IL_0538: Unknown result type (might be due to invalid IL or missing references)
			//IL_053d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0552: Unknown result type (might be due to invalid IL or missing references)
			//IL_0557: Unknown result type (might be due to invalid IL or missing references)
			//IL_055c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0571: Unknown result type (might be due to invalid IL or missing references)
			//IL_0576: Unknown result type (might be due to invalid IL or missing references)
			//IL_057b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0590: Unknown result type (might be due to invalid IL or missing references)
			//IL_0595: Unknown result type (might be due to invalid IL or missing references)
			//IL_059a: Unknown result type (might be due to invalid IL or missing references)
			//IL_05af: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ba: Expected O, but got Unknown
			//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_05d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0600: Unknown result type (might be due to invalid IL or missing references)
			//IL_0615: Unknown result type (might be due to invalid IL or missing references)
			//IL_061a: Unknown result type (might be due to invalid IL or missing references)
			//IL_061f: 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_0639: Unknown result type (might be due to invalid IL or missing references)
			//IL_063f: Expected O, but got Unknown
			//IL_0642: Unknown result type (might be due to invalid IL or missing references)
			//IL_0647: Unknown result type (might be due to invalid IL or missing references)
			//IL_065c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0661: Unknown result type (might be due to invalid IL or missing references)
			//IL_0666: Unknown result type (might be due to invalid IL or missing references)
			//IL_067b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0680: Unknown result type (might be due to invalid IL or missing references)
			//IL_0685: Unknown result type (might be due to invalid IL or missing references)
			//IL_069a: Unknown result type (might be due to invalid IL or missing references)
			//IL_069f: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06be: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c4: Expected O, but got Unknown
			//IL_06c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0700: Unknown result type (might be due to invalid IL or missing references)
			//IL_0705: Unknown result type (might be due to invalid IL or missing references)
			//IL_070a: Unknown result type (might be due to invalid IL or missing references)
			//IL_071f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0724: Unknown result type (might be due to invalid IL or missing references)
			//IL_0729: Unknown result type (might be due to invalid IL or missing references)
			//IL_073e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0743: Unknown result type (might be due to invalid IL or missing references)
			//IL_0749: Expected O, but got Unknown
			//IL_074c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0751: Unknown result type (might be due to invalid IL or missing references)
			//IL_0766: Unknown result type (might be due to invalid IL or missing references)
			//IL_076b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0770: Unknown result type (might be due to invalid IL or missing references)
			//IL_0785: Unknown result type (might be due to invalid IL or missing references)
			//IL_078a: Unknown result type (might be due to invalid IL or missing references)
			//IL_078f: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ce: Expected O, but got Unknown
			//IL_07d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_07eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_080a: Unknown result type (might be due to invalid IL or missing references)
			//IL_080f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0814: Unknown result type (might be due to invalid IL or missing references)
			//IL_0829: Unknown result type (might be due to invalid IL or missing references)
			//IL_082e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0833: Unknown result type (might be due to invalid IL or missing references)
			//IL_0848: Unknown result type (might be due to invalid IL or missing references)
			//IL_084d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0853: Expected O, but got Unknown
			//IL_0856: Unknown result type (might be due to invalid IL or missing references)
			//IL_085b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0870: Unknown result type (might be due to invalid IL or missing references)
			//IL_0875: Unknown result type (might be due to invalid IL or missing references)
			//IL_087a: Unknown result type (might be due to invalid IL or missing references)
			//IL_088f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0894: Unknown result type (might be due to invalid IL or missing references)
			//IL_0899: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_08cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d8: Expected O, but got Unknown
			//IL_08db: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_08fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0914: Unknown result type (might be due to invalid IL or missing references)
			//IL_0919: Unknown result type (might be due to invalid IL or missing references)
			//IL_091e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0933: Unknown result type (might be due to invalid IL or missing references)
			//IL_0938: Unknown result type (might be due to invalid IL or missing references)
			//IL_093d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0952: Unknown result type (might be due to invalid IL or missing references)
			//IL_0957: Unknown result type (might be due to invalid IL or missing references)
			//IL_095d: Expected O, but got Unknown
			//IL_0960: Unknown result type (might be due to invalid IL or missing references)
			//IL_0965: 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_097f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0984: Unknown result type (might be due to invalid IL or missing references)
			//IL_0999: Unknown result type (might be due to invalid IL or missing references)
			//IL_099e: Unknown result type (might be due to invalid IL or missing references)
			//IL_09a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_09b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_09bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_09d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_09dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e2: Expected O, but got Unknown
			//IL_09e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a04: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a09: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a1e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a23: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a28: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a3d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a42: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a47: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a5c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a61: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a67: Expected O, but got Unknown
			//IL_0a6a: 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_0a84: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a89: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a8e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aa3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aa8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aad: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ac2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ac7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0acc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ae1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ae6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aec: Expected O, but got Unknown
			//IL_0aef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0af4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b09: Unknown result type (might be due to invalid I