Decompiled source of CrabDevKit v1.4.0

BepInEx/patchers/lammas123.CrabDevPreloader.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.IL2CPP.Hook;
using BepInEx.Logging;
using BepInEx.Preloader.Core.Patching;
using CrabDevPreloader.Patchers;
using HarmonyLib;
using HarmonyLib.Public.Patching;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace CrabDevPreloader
{
	[PatcherPluginInfo("lammas123.CrabDevPreloader", "CrabDevPreloader", "1.4.0")]
	public sealed class CrabDevPreloader : BasePatcher
	{
		internal static CrabDevPreloader Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		public override void Initialize()
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
			CultureInfo.CurrentUICulture = CultureInfo.InvariantCulture;
			CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture;
			CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture;
			Instance = this;
			Logger = ((BasePatcher)this).Log;
			DetourFailures.Init();
			Common.Init();
			ManualLogSource log = ((BasePatcher)this).Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(15, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Initialized [");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CrabDevPreloader");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.4.0");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("]");
			}
			log.LogInfo(val);
		}

		[TargetType("UnityEngine.AssetBundleModule.dll", "UnityEngine.AssetBundle")]
		public void PatchAssetBundle(TypeDefinition type)
		{
			AssetBundlePatcher.Patch(type);
		}
	}
	public static class DetourFailures
	{
		public static readonly List<string> failures = new List<string>();

		public static event Action FailureRecorded;

		internal static void Init()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			((BasePatcher)CrabDevPreloader.Instance).Log.LogInfo((object)"Applying Harmony patches for DetourFailures...");
			new Harmony("CrabDevPreloader").PatchAll(typeof(DetourFailures));
		}

		public static void Record(Exception ex, IL2CPPDetourMethodPatcher patcher)
		{
			string message = ex.Message;
			MethodBase original = ((MethodPatcher)patcher).Original;
			failures.Add($"Detour failed for {original}: {message}");
			DetourFailures.FailureRecorded?.Invoke();
		}

		[HarmonyPatch(typeof(IL2CPPDetourMethodPatcher), "Init")]
		[HarmonyTranspiler]
		internal static IEnumerable<CodeInstruction> TranspileIL2CPPDetourMethodPatcherInit(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> codes = instructions.ToList();
			bool injected = false;
			for (int i = 0; i < codes.Count; i++)
			{
				CodeInstruction code = codes[i];
				yield return code;
				if (!injected && !(code.opcode != OpCodes.Stloc_S) && code.operand is LocalBuilder { LocalIndex: 5 } localBuilder && !(localBuilder.LocalType != typeof(Exception)))
				{
					yield return new CodeInstruction(OpCodes.Ldloc_S, (object)localBuilder);
					yield return new CodeInstruction(OpCodes.Ldarg_0, (object)null);
					yield return CodeInstruction.Call(typeof(DetourFailures), "Record", (Type[])null, (Type[])null);
					((BasePatcher)CrabDevPreloader.Instance).Log.LogInfo((object)"Transpiled DetourFailures.Record after IL2CPPDetourMethodPatcher.Init's catch(Exception ex).");
					injected = true;
				}
			}
			if (!injected)
			{
				((BasePatcher)CrabDevPreloader.Instance).Log.LogWarning((object)"Failed to transpile DetourFailures.Record after IL2CPPDetourMethodPatcher.Init's catch(Exception ex)!");
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "lammas123.CrabDevPreloader";

		public const string PLUGIN_NAME = "CrabDevPreloader";

		public const string PLUGIN_VERSION = "1.4.0";
	}
}
namespace CrabDevPreloader.Patchers
{
	internal static class AssetBundlePatcher
	{
		internal static void Patch(TypeDefinition type)
		{
			CrabDevPreloader.Logger.LogMessage((object)"Patching AssetBundle...");
			RestoreBaseType(type);
			RestoreIntPtrCtor(type);
			CrabDevPreloader.Logger.LogMessage((object)"Patched AssetBundle");
		}

		private static void RestoreBaseType(TypeDefinition type)
		{
			if (((MemberReference)(object)type.BaseType).MemberEquals((MemberReference)(object)Common.il2CppSystemObjectType))
			{
				CrabDevPreloader.Logger.LogInfo((object)"AssetBundle already inherits Il2CppSystem.Object, skipping");
				return;
			}
			CrabDevPreloader.Logger.LogDebug((object)"Restoring AssetBundle.BaseType to Il2CppSystem.Object...");
			type.BaseType = ((MemberReference)type).Module.ImportReference((TypeReference)(object)Common.il2CppSystemObjectType);
			CrabDevPreloader.Logger.LogInfo((object)"Restored AssetBundle.BaseType to Il2CppSystem.Object");
		}

		private static void RestoreIntPtrCtor(TypeDefinition type)
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Expected O, but got Unknown
			//IL_00c5: 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_00e7: 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)
			if (((IEnumerable<MethodDefinition>)type.Methods).Any((MethodDefinition m) => m.IsConstructor && !m.IsStatic && ((MethodReference)m).Parameters.Count == 1 && ((MemberReference)(object)((ParameterReference)((MethodReference)m).Parameters[0]).ParameterType).MemberEquals((MemberReference)(object)((MemberReference)type).Module.TypeSystem.IntPtr)))
			{
				CrabDevPreloader.Logger.LogInfo((object)"AssetBundle(IntPtr) constructor already exists, skipping");
				return;
			}
			CrabDevPreloader.Logger.LogDebug((object)"Restoring AssetBundle(IntPtr) constructor...");
			MethodDefinition val = new MethodDefinition(".ctor", (MethodAttributes)6278, ((MemberReference)type).Module.TypeSystem.Void);
			((MethodReference)val).Parameters.Add(new ParameterDefinition("ptr", (ParameterAttributes)0, ((MemberReference)type).Module.TypeSystem.IntPtr));
			CrabDevPreloader.Logger.LogDebug((object)"Writing AssetBundle(IntPtr) constructor body...");
			ILProcessor iLProcessor = val.Body.GetILProcessor();
			CrabDevPreloader.Logger.LogDebug((object)" base(ptr);");
			iLProcessor.Append(iLProcessor.Create(OpCodes.Ldarg_0));
			iLProcessor.Append(iLProcessor.Create(OpCodes.Ldarg_1));
			iLProcessor.Append(iLProcessor.Create(OpCodes.Call, ((MemberReference)type).Module.ImportReference((MethodReference)(object)Common.il2CppSystemObjectIntPtrCtor)));
			iLProcessor.Append(iLProcessor.Create(OpCodes.Ret));
			type.Methods.Add(val);
			CrabDevPreloader.Logger.LogInfo((object)"Restored AssetBundle(IntPtr) constructor");
		}
	}
	internal static class Common
	{
		internal static AssemblyDefinition il2CppmscorlibAssembly;

		internal static TypeDefinition il2CppSystemObjectType;

		internal static MethodDefinition il2CppSystemObjectIntPtrCtor;

		internal static void Init()
		{
			il2CppmscorlibAssembly = ReadUnhollowedAssembly("Il2Cppmscorlib.dll");
			il2CppSystemObjectType = il2CppmscorlibAssembly.MainModule.GetType("Il2CppSystem.Object");
			il2CppSystemObjectIntPtrCtor = ((IEnumerable<MethodDefinition>)il2CppSystemObjectType.Methods).First((MethodDefinition m) => m.IsConstructor && !m.IsStatic && ((MethodReference)m).Parameters.Count == 1 && ((ParameterReference)((MethodReference)m).Parameters[0]).ParameterType == il2CppmscorlibAssembly.MainModule.TypeSystem.IntPtr);
		}

		internal static AssemblyDefinition ReadUnhollowedAssembly(string assemblyName)
		{
			return AssemblyDefinition.ReadAssembly(Path.Combine(Paths.BepInExRootPath, "unhollowed", assemblyName));
		}

		internal static bool MemberEquals(this MemberReference a, MemberReference b)
		{
			if (a == b)
			{
				return true;
			}
			if (a == null || b == null)
			{
				return false;
			}
			if (a.FullName == b.FullName)
			{
				return a.Module.Assembly.FullName == b.Module.Assembly.FullName;
			}
			return false;
		}
	}
}

BepInEx/plugins/lammas123.CrabDevKit.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.IL2CPP;
using BepInEx.IL2CPP.Utils;
using BepInEx.Logging;
using CodeStage.AntiCheat.ObscuredTypes;
using CrabDevKit.Intermediary;
using CrabDevKit.Utilities;
using CrabDevPreloader;
using HarmonyLib;
using Il2CppSystem;
using Il2CppSystem.Collections;
using Il2CppSystem.Collections.Generic;
using Il2CppSystem.Collections.ObjectModel;
using Il2CppSystem.IO;
using Il2CppSystem.Runtime.InteropServices;
using Il2CppSystem.Text;
using Il2CppSystem.Text.RegularExpressions;
using Microsoft.CodeAnalysis;
using MilkShake;
using SteamworksNative;
using TMPro;
using UnhollowerBaseLib;
using UnhollowerBaseLib.Attributes;
using UnhollowerRuntimeLib;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class ParamCollectionAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace CrabDevKit
{
	internal static class Patches
	{
		[HarmonyPatch(typeof(MonoBehaviourPublicGataInefObInUnique), "Method_Private_Void_GameObject_Boolean_Vector3_Quaternion_0")]
		[HarmonyPatch(typeof(MonoBehaviourPublicCSDi2UIInstObUIloDiUnique), "Method_Private_Void_0")]
		[HarmonyPrefix]
		internal static bool PreBepinexDetection()
		{
			return false;
		}

		[HarmonyPatch(typeof(MonoBehaviourPublicObInVoAwVoVoVoVoVoVoUnique), "Awake")]
		[HarmonyPostfix]
		internal static void PostMainManagerAwake()
		{
			DetourFailures.FailureRecorded -= CrabDevKit.Instance.PromptDetourFailures;
			DetourFailures.FailureRecorded += CrabDevKit.Instance.PromptDetourFailures;
			if (DetourFailures.failures.Count != 0)
			{
				CrabDevKit.Instance.PromptDetourFailures();
			}
		}
	}
	[BepInPlugin("lammas123.CrabDevKit", "CrabDevKit", "1.4.0")]
	public sealed class CrabDevKit : BasePlugin
	{
		internal static CrabDevKit Instance { get; private set; }

		internal static CrabNet CrabNet { get; private set; }

		public override void Load()
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
			CultureInfo.CurrentUICulture = CultureInfo.InvariantCulture;
			CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture;
			CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture;
			Instance = this;
			CrabNet = new CrabNet();
			FakeClients.Init();
			CrabUi.Init();
			new Harmony("CrabDevKit").PatchAll(typeof(Patches));
			ManualLogSource log = ((BasePlugin)this).Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(15, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Initialized [");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CrabDevKit");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.4.0");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("]");
			}
			log.LogInfo(val);
		}

		internal void PromptDetourFailures()
		{
			foreach (string failure in DetourFailures.failures)
			{
				MonoBehaviourPublicGaprLi1ObGaprInUnique.Instance.NewPrompt("CrabDevKit - DetourFailures", "<size=26>" + failure + "</size>");
			}
			MonoBehaviourPublicGaprLi1ObGaprInUnique.Instance.NewPrompt("CrabDevKit - DetourFailures", "<size=26>The most common way to fix these issue(s) is to restart your computer.\nHowever, if that doesn't help, then reach out on CrabGame+ for additional support!\n\nDiscord: <link=\"https://discord.gg/jBGMZqndT3\"><u>https://discord.gg/jBGMZqndT3</u></link></size>");
			List<GameObject> prompts = MonoBehaviourPublicGaprLi1ObGaprInUnique.Instance.prompts;
			((Component)prompts[prompts.Count - 1].GetComponent<MonoBehaviourPublicTehefiTeVeSiVeUnique>().filler).gameObject.AddComponent<MonoBehaviourPublicIPointerClickHandlerIEventSystemHandlerStStUnique>();
			MonoBehaviourPublicGaprLi1ObGaprInUnique.Instance.NewPrompt("CrabDevKit - DetourFailures", $"<size=26>Detour failed for {DetourFailures.failures.Count} Il2Cpp method(s).\n\nYou may find the failed patches in your console or LogOutput.log, but they'll also be shown here!\n\nPress Continue for more.</size>");
			DetourFailures.failures.Clear();
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "lammas123.CrabDevKit";

		public const string PLUGIN_NAME = "CrabDevKit";

		public const string PLUGIN_VERSION = "1.4.0";
	}
}
namespace CrabDevKit.Utilities
{
	public static class ChatUtil
	{
		public enum MessageType
		{
			Normal,
			Server,
			Styled
		}

		public static int MaxMessageLength
		{
			get
			{
				if (!((Object)(object)MonoBehaviourPublicRaovTMinTemeColoonCoUnique.Instance != (Object)null))
				{
					return 80;
				}
				return MonoBehaviourPublicRaovTMinTemeColoonCoUnique.Instance.get_maxMsgLength();
			}
		}

		public static int MaxConsecutiveChars
		{
			get
			{
				if (!((Object)(object)MonoBehaviourPublicRaovTMinTemeColoonCoUnique.Instance != (Object)null))
				{
					return 5;
				}
				return MonoBehaviourPublicRaovTMinTemeColoonCoUnique.Instance.get_deobf_maxConsecutiveChars();
			}
		}

		public static string FormatMessage(string str)
		{
			return Regex.Replace(str, $"(.)(?<=\\1{{{MaxConsecutiveChars}}})", string.Empty, RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.CultureInvariant);
		}

		public static void SendMessage(ulong recipientClientId, string message, MessageType messageType = MessageType.Server, string displayName = null)
		{
			SendMessage(message, messageType, displayName, new <>z__ReadOnlySingleElementList<ulong>(recipientClientId));
		}

		public static void SendMessage(string message, MessageType messageType = MessageType.Server, string displayName = null, IEnumerable<ulong> recipientClientIds = null)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			ulong value = 0uL;
			message = FormatMessage(message ?? string.Empty);
			if (messageType == MessageType.Server)
			{
				displayName = string.Empty;
				value = 1uL;
			}
			else if (displayName == null)
			{
				displayName = string.Empty;
			}
			ObjectPublicIDisposableLi1ByInByBoUnique val = new ObjectPublicIDisposableLi1ByInByBoUnique(2);
			val.Write(value);
			val.Write(displayName);
			val.Write(message);
			val.WriteLength();
			IEnumerable<ulong> enumerable = recipientClientIds;
			if (enumerable == null)
			{
				KeyCollection<ulong, int> keys = MonoBehaviourPublicCSDi2UIInstObUIloDiUnique.steamIdToUID.Keys;
				int num = 0;
				ulong[] array = new ulong[keys.Count];
				Enumerator<ulong, int> enumerator = keys.GetEnumerator();
				while (enumerator.MoveNext())
				{
					ulong current = enumerator.Current;
					array[num] = current;
					num++;
				}
				enumerable = new <>z__ReadOnlyArray<ulong>(array);
			}
			foreach (ulong item in enumerable)
			{
				if (messageType == MessageType.Styled)
				{
					byte[] bytes = BitConverter.GetBytes(item);
					for (int i = 0; i < bytes.Length; i++)
					{
						val.field_Private_List_1_Byte_0[i + 8] = bytes[i];
					}
				}
				MonoBehaviourPublicInStInpabyDiInpaby2Unique.SendPacket(new CSteamID(item), val, ServerSendExtensions.get_deobf_reliable(), (EnumNPublicSealedvaTo3vToUnique)0);
			}
			val.Dispose();
		}

		public static string[] FormatGameModeDescription(string description)
		{
			List<string> list = description.Split('\n', StringSplitOptions.RemoveEmptyEntries).ToList();
			for (int i = 0; i < list.Count; i++)
			{
				list[i] = list[i].Replace('•', '*');
				while (list[i].Length > MaxMessageLength)
				{
					int num = list[i].LastIndexOf(' ', MaxMessageLength - 1, 20);
					if (num == -1)
					{
						num = MaxMessageLength;
					}
					int index = i + 1;
					string text = list[i];
					int num2 = num;
					list.Insert(index, text.Substring(num2, text.Length - num2));
					list[i] = list[i].Substring(0, num);
				}
			}
			return list.ToArray();
		}
	}
	public sealed class CrabNet
	{
		public delegate void MessageHandler(ulong clientId, ObjectPublicIDisposableLi1ByInByBoUnique packet);

		internal static class Patches
		{
			private static readonly Il2CppStructArray<IntPtr> _messagePtrs = new Il2CppStructArray<IntPtr>(70L);

			[HarmonyPatch(typeof(MonoBehaviourPublicInStInpabyDiInpaby2Unique), "CheckForPackets")]
			[HarmonyPostfix]
			internal static void PostSteamPacketManagerCheckForPackets()
			{
				int num;
				do
				{
					num = SteamNetworkingMessages.ReceiveMessagesOnChannel(123, _messagePtrs, 70);
					if (num == 0)
					{
						break;
					}
					for (int i = 0; i < num; i++)
					{
						SteamNetworkingMessage_t message = Marshal.PtrToStructure<SteamNetworkingMessage_t>(((Il2CppArrayBase<IntPtr>)(object)_messagePtrs)[i]);
						CrabDevKit.CrabNet.HandleMessage(message);
					}
				}
				while (num == 70);
			}

			[HarmonyPatch(typeof(MonoBehaviourPublicObInUIgaStCSBoStcuCSUnique), "Method_Private_Void_LobbyEnter_t_PDM_1")]
			[HarmonyPostfix]
			[HarmonyPriority(int.MaxValue)]
			internal static void PostSteamManagerLobbyEnter(LobbyEnter_t param_1)
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				if (MonoBehaviourPublicCSDi2UIInstObUIloDiUnique.Instance.get_currentLobby().m_SteamID == param_1.m_ulSteamIDLobby)
				{
					CrabDevKit.CrabNet.RegisterMessageHandlers();
				}
			}
		}

		private uint _nextId;

		private readonly Dictionary<string, uint> _registeredMessageHandlers = new Dictionary<string, uint>();

		private readonly Dictionary<uint, MessageHandler> _messageHandlers = new Dictionary<uint, MessageHandler>();

		private const string ProtocolVersion = "1";

		private const int SendFlag = 8;

		private const int MessageChannel = 123;

		private const int MessagesPerFrame = 70;

		internal CrabNet()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			new Harmony("CrabDevKit.CrabNet").PatchAll(typeof(Patches));
		}

		public static bool RegisterMessageHandler(string messageId, MessageHandler messageHandler)
		{
			if (CrabDevKit.CrabNet == null)
			{
				throw new InvalidOperationException("CrabNet has yet to be initialized. Ensure your plugin is depending on CrabDevKit, so that it initializes CrabNet before you use it!");
			}
			if (string.IsNullOrEmpty(messageId))
			{
				throw new ArgumentNullException("messageId", "messageId may not be null or empty.");
			}
			if (!messageId.Contains(':'))
			{
				throw new ArgumentException("A colon ':' separator character was expected in the messageId parameter. Your messageId should follow this format -> PluginName:MessageId", "messageId");
			}
			if (messageHandler == null)
			{
				throw new ArgumentNullException("messageHandler");
			}
			return CrabDevKit.CrabNet.RegisterMessageHandlerInternal(messageId, messageHandler);
		}

		private bool RegisterMessageHandlerInternal(string messageId, MessageHandler messageHandler)
		{
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Expected O, but got Unknown
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Expected O, but got Unknown
			if (string.IsNullOrEmpty(messageId))
			{
				throw new ArgumentNullException("messageId", "messageId may not be null or empty.");
			}
			if (messageHandler == null)
			{
				throw new ArgumentNullException("messageHandler");
			}
			if (Object.op_Implicit((Object)(object)MonoBehaviourPublicObInUIgaStCSBoStcuCSUnique.Instance))
			{
				((BasePlugin)CrabDevKit.Instance).Log.LogWarning((object)"Message handlers must be registered on plugin load!");
				return false;
			}
			bool flag = default(bool);
			if (_registeredMessageHandlers.ContainsKey(messageId))
			{
				ManualLogSource log = ((BasePlugin)CrabDevKit.Instance).Log;
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(34, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Message handler '");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(messageId);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' already exists!");
				}
				log.LogWarning(val);
				return false;
			}
			uint nextId = _nextId;
			_nextId++;
			_registeredMessageHandlers.Add(messageId, nextId);
			_messageHandlers.Add(nextId, messageHandler);
			ManualLogSource log2 = ((BasePlugin)CrabDevKit.Instance).Log;
			BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(31, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Registered message handler: ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(messageId);
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" (");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<uint>(nextId);
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(")");
			}
			log2.LogInfo(val2);
			return true;
		}

		private void RegisterMessageHandlers()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			CSteamID val = MonoBehaviourPublicCSDi2UIInstObUIloDiUnique.Instance.get_currentLobby();
			SteamMatchmaking.SetLobbyMemberData(val, "CrabNetVersion", "1.4.0");
			SteamMatchmaking.SetLobbyMemberData(val, "CrabNetProtocol", "1");
			foreach (var (text2, num2) in _registeredMessageHandlers)
			{
				SteamMatchmaking.SetLobbyMemberData(val, $"CrabNet:Message.{num2}", text2);
			}
			((BasePlugin)CrabDevKit.Instance).Log.LogInfo((object)"Registered message handlers for lobby.");
		}

		public static bool SendMessage(string messageId, ObjectPublicIDisposableLi1ByInByBoUnique packet, [ParamCollection] IEnumerable<ulong> clientIds)
		{
			if (CrabDevKit.CrabNet == null)
			{
				throw new InvalidOperationException("CrabNet has yet to be initialized. Ensure your plugin is depending on CrabDevKit, so that it initializes CrabNet before you use it!");
			}
			if (string.IsNullOrEmpty(messageId))
			{
				throw new ArgumentNullException("messageId", "messageId may not be null or empty.");
			}
			if (packet == null)
			{
				throw new ArgumentNullException("packet");
			}
			if (clientIds == null)
			{
				throw new ArgumentNullException("clientIds");
			}
			return CrabDevKit.CrabNet.SendMessageInternal(messageId, packet, clientIds.Select((Func<ulong, CSteamID>)((ulong clientId) => new CSteamID(clientId))));
		}

		public static bool SendMessage(string messageId, ObjectPublicIDisposableLi1ByInByBoUnique packet, [ParamCollection] IEnumerable<CSteamID> steamIds)
		{
			if (CrabDevKit.CrabNet == null)
			{
				throw new InvalidOperationException("CrabNet has yet to be initialized. Ensure your plugin is depending on CrabDevKit, so that it initializes CrabNet before you use it!");
			}
			if (string.IsNullOrEmpty(messageId))
			{
				throw new ArgumentNullException("messageId", "messageId may not be null or empty.");
			}
			if (packet == null)
			{
				throw new ArgumentNullException("packet");
			}
			if (steamIds == null)
			{
				throw new ArgumentNullException("steamIds");
			}
			return CrabDevKit.CrabNet.SendMessageInternal(messageId, packet, steamIds);
		}

		private bool SendMessageInternal(string messageId, ObjectPublicIDisposableLi1ByInByBoUnique packet, IEnumerable<CSteamID> steamIds)
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Expected O, but got Unknown
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Expected O, but got Unknown
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Expected O, but got Unknown
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrEmpty(messageId))
			{
				throw new ArgumentNullException("messageId", "messageId may not be null or empty.");
			}
			if (packet == null)
			{
				throw new ArgumentNullException("packet");
			}
			if (steamIds == null)
			{
				throw new ArgumentNullException("steamIds");
			}
			bool flag = default(bool);
			if (!_registeredMessageHandlers.TryGetValue(messageId, out var value))
			{
				ManualLogSource log = ((BasePlugin)CrabDevKit.Instance).Log;
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(34, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Message handler '");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(messageId);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' does not exist!");
				}
				log.LogWarning(val);
				return false;
			}
			ObjectPublicIDisposableLi1ByInByBoUnique val2 = new ObjectPublicIDisposableLi1ByInByBoUnique();
			val2.Write((int)value);
			val2.Write(packet.CloneBytes());
			foreach (CSteamID steamId in steamIds)
			{
				if (string.IsNullOrEmpty(SteamMatchmaking.GetLobbyMemberData(MonoBehaviourPublicCSDi2UIInstObUIloDiUnique.Instance.get_currentLobby(), steamId, "CrabNetVersion")))
				{
					ManualLogSource log2 = ((BasePlugin)CrabDevKit.Instance).Log;
					BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(52, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<ulong>(steamId.m_SteamID);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" does not have CrabNet, and cannot receive messages!");
					}
					log2.LogWarning(val);
					continue;
				}
				string lobbyMemberData = SteamMatchmaking.GetLobbyMemberData(MonoBehaviourPublicCSDi2UIInstObUIloDiUnique.Instance.get_currentLobby(), steamId, "CrabNetProtocol");
				if (!string.IsNullOrEmpty(lobbyMemberData) && lobbyMemberData != "1")
				{
					ManualLogSource log3 = ((BasePlugin)CrabDevKit.Instance).Log;
					BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(95, 3, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<ulong>(steamId.m_SteamID);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is using a different CrabNet protocol than you, and cannot receive messages! ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(lobbyMemberData);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (THEM) != ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1");
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (YOU)");
					}
					log3.LogWarning(val);
				}
				else if (steamId == SteamUser.GetSteamID())
				{
					ObjectPublicIDisposableLi1ByInByBoUnique packet2 = new ObjectPublicIDisposableLi1ByInByBoUnique(Il2CppStructArray<byte>.op_Implicit(val2.CloneBytes()));
					HandleMessage(steamId.m_SteamID, packet2);
				}
				else
				{
					MonoBehaviourPublicInStInpabyDiInpaby2Unique.SendPacket(steamId, val2, 8, (EnumNPublicSealedvaTo3vToUnique)123);
				}
			}
			val2.Dispose();
			packet.Dispose();
			return true;
		}

		private void HandleMessage(SteamNetworkingMessage_t message)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			ulong steamID = message.m_identityPeer.GetSteamID64();
			int cbSize = message.m_cbSize;
			IntPtr pData = message.m_pData;
			Il2CppStructArray<byte> val = new Il2CppStructArray<byte>((long)cbSize);
			Marshal.Copy(pData, val, 0, cbSize);
			ObjectPublicIDisposableLi1ByInByBoUnique val2 = new ObjectPublicIDisposableLi1ByInByBoUnique();
			val2.SetBytes(Il2CppArrayBase<byte>.op_Implicit((Il2CppArrayBase<byte>)(object)val));
			HandleMessage(steamID, val2);
		}

		private void HandleMessage(ulong clientId, ObjectPublicIDisposableLi1ByInByBoUnique packet)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Expected O, but got Unknown
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Expected O, but got Unknown
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Expected O, but got Unknown
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Expected O, but got Unknown
			bool flag = default(bool);
			if (string.IsNullOrEmpty(SteamMatchmaking.GetLobbyMemberData(MonoBehaviourPublicCSDi2UIInstObUIloDiUnique.Instance.get_currentLobby(), new CSteamID(clientId), "CrabNetVersion")))
			{
				ManualLogSource log = ((BasePlugin)CrabDevKit.Instance).Log;
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(56, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<ulong>(clientId);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" does not have CrabNet, you cannot handle their message!");
				}
				log.LogWarning(val);
				return;
			}
			string lobbyMemberData = SteamMatchmaking.GetLobbyMemberData(MonoBehaviourPublicCSDi2UIInstObUIloDiUnique.Instance.get_currentLobby(), new CSteamID(clientId), "CrabNetProtocol");
			if (!string.IsNullOrEmpty(lobbyMemberData) && lobbyMemberData != "1")
			{
				ManualLogSource log2 = ((BasePlugin)CrabDevKit.Instance).Log;
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(99, 3, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<ulong>(clientId);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is using a different CrabNet protocol than you, you cannot handle their message! ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(lobbyMemberData);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (THEM) != ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (YOU)");
				}
				log2.LogWarning(val);
				return;
			}
			try
			{
				uint value = (uint)packet.ReadInt();
				string lobbyMemberData2 = SteamMatchmaking.GetLobbyMemberData(MonoBehaviourPublicCSDi2UIInstObUIloDiUnique.Instance.get_currentLobby(), new CSteamID(clientId), $"CrabNet:Message.{value}");
				if (string.IsNullOrEmpty(lobbyMemberData2))
				{
					ManualLogSource log3 = ((BasePlugin)CrabDevKit.Instance).Log;
					BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(37, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Unable to identify messageId from '");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<uint>(value);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'!");
					}
					log3.LogWarning(val);
				}
				else if (!_registeredMessageHandlers.TryGetValue(lobbyMemberData2, out value))
				{
					ManualLogSource log4 = ((BasePlugin)CrabDevKit.Instance).Log;
					BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(16, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(lobbyMemberData2);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is not defined!");
					}
					log4.LogWarning(val);
				}
				else
				{
					_messageHandlers[value](clientId, packet);
					packet.Dispose();
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log5 = ((BasePlugin)CrabDevKit.Instance).Log;
				BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(42, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("An exception occurred handling a message:\n");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex);
				}
				log5.LogError(val2);
			}
		}
	}
	public static class CrabUi
	{
		public delegate void CrabCallback();

		public sealed class CrabToggle : MonoBehaviour
		{
			internal bool state;

			internal GameObject innerGO;

			[HideFromIl2Cpp]
			public bool State
			{
				[HideFromIl2Cpp]
				get
				{
					return state;
				}
				[HideFromIl2Cpp]
				set
				{
					if (state != value)
					{
						state = value;
						innerGO.SetActive(state);
						this.Callback?.Invoke();
					}
				}
			}

			[HideFromIl2Cpp]
			public event CrabCallback Callback;

			public void Pressed()
			{
				State = !State;
			}
		}

		public sealed class CrabSlider : MonoBehaviour
		{
			internal Slider slider;

			internal TextMeshProUGUI text;

			[HideFromIl2Cpp]
			public Slider Slider => slider;

			[HideFromIl2Cpp]
			public TextMeshProUGUI Text => text;

			[HideFromIl2Cpp]
			public event CrabCallback Callback;

			public void Changed(float state)
			{
				((TMP_Text)text).text = state.ToString();
				this.Callback?.Invoke();
			}
		}

		public sealed class CrabScroll : MonoBehaviour
		{
			internal int state;

			internal object[] options;

			internal TextMeshProUGUI text;

			internal RawImage leftButtonImg;

			internal RawImage rightButtonImg;

			[HideFromIl2Cpp]
			public int State
			{
				[HideFromIl2Cpp]
				get
				{
					return state;
				}
				[HideFromIl2Cpp]
				set
				{
					value = Mathf.Clamp(value, 0, options.Length - 1);
					if (state != value)
					{
						state = value;
						((TMP_Text)text).text = options[state].ToString();
						((Behaviour)leftButtonImg).enabled = state != 0;
						((Behaviour)rightButtonImg).enabled = state != options.Length - 1;
						this.Callback?.Invoke();
					}
				}
			}

			[HideFromIl2Cpp]
			public IReadOnlyList<object> Options
			{
				[HideFromIl2Cpp]
				get
				{
					return options;
				}
				[HideFromIl2Cpp]
				set
				{
					if (value != null && value.Count >= 0)
					{
						options = value.ToArray();
						state = Mathf.Clamp(state, 0, options.Length - 1);
						((TMP_Text)text).text = options[state].ToString();
						((Behaviour)leftButtonImg).enabled = state != 0;
						((Behaviour)rightButtonImg).enabled = state != options.Length - 1;
						this.Callback?.Invoke();
					}
				}
			}

			[HideFromIl2Cpp]
			public event CrabCallback Callback;

			public void ScrollLeft()
			{
				State--;
			}

			public void ScrollRight()
			{
				State++;
			}
		}

		public sealed class CrabKeybind : MonoBehaviour
		{
			internal MonoBehaviour1PublicTekeIncuStUnique setting;

			internal TextMeshProUGUI text;

			[HideFromIl2Cpp]
			public KeyCode Key
			{
				[HideFromIl2Cpp]
				get
				{
					return (KeyCode)setting.currentKey;
				}
				[HideFromIl2Cpp]
				set
				{
					//IL_000b: Unknown result type (might be due to invalid IL or missing references)
					//IL_000c: Invalid comparison between I4 and Unknown
					//IL_0019: Unknown result type (might be due to invalid IL or missing references)
					//IL_0036: Unknown result type (might be due to invalid IL or missing references)
					//IL_003c: Expected I4, but got Unknown
					//IL_0026: Unknown result type (might be due to invalid IL or missing references)
					//IL_0028: Invalid comparison between Unknown and I4
					//IL_002a: Unknown result type (might be due to invalid IL or missing references)
					//IL_002d: Invalid comparison between Unknown and I4
					if (setting.currentKey != (int)value && (Enum.IsDefined(typeof(KeyCode), value) || (int)value == -1 || (int)value == -2))
					{
						setting.currentKey = (int)value;
						((TMP_Text)text).text = setting.intToKeyCode(setting.currentKey);
						this.Callback?.Invoke();
					}
				}
			}

			[HideFromIl2Cpp]
			public event CrabCallback Callback;

			public void KeybindUpdated()
			{
				((TMP_Text)text).text = setting.intToKeyCode(setting.currentKey);
				this.Callback?.Invoke();
			}
		}

		public sealed class CrabButton : MonoBehaviour
		{
			[HideFromIl2Cpp]
			public event CrabCallback Callback;

			public void Pressed()
			{
				this.Callback?.Invoke();
			}
		}

		public sealed class CrabDropdown : MonoBehaviour
		{
			internal TMP_Dropdown dropdown;

			[HideFromIl2Cpp]
			public TMP_Dropdown Dropdown => dropdown;

			[HideFromIl2Cpp]
			public event CrabCallback SelectCallback;

			[HideFromIl2Cpp]
			public event CrabCallback ApplyCallback;

			public void OptionSelected(int _)
			{
				this.SelectCallback?.Invoke();
			}

			public void ApplyPressed()
			{
				this.ApplyCallback?.Invoke();
			}
		}

		internal static class Patches
		{
			[HarmonyPatch(typeof(MonoBehaviourPublicObInVoAwVoVoVoVoVoVoUnique), "Awake")]
			[HarmonyPostfix]
			internal static void PostMainManagerAwake()
			{
				TMP_Settings.instance.m_warningsDisabled = true;
				SceneInit();
			}

			[HarmonyPatch(typeof(MonoBehaviourPublicBubaObcafoObseingrObUnique), "Start")]
			[HarmonyPriority(800)]
			[HarmonyPostfix]
			internal static void PostSettingsStart(MonoBehaviourPublicBubaObcafoObseingrObUnique __instance)
			{
				SettingsMenu = ((Component)__instance).gameObject;
				GetCategory(SettingsMenu, "Gameplay", out var tabGO, out var categoryGO, out var contentGO);
				GetCategory(SettingsMenu, "Controls", out categoryGO, out tabGO, out var contentGO2);
				GetCategory(SettingsMenu, "Graphics", out tabGO, out categoryGO, out var contentGO3);
				GetCategory(SettingsMenu, "Video", out categoryGO, out tabGO, out var contentGO4);
				GetCategory(SettingsMenu, "Audio", out tabGO, out categoryGO, out var contentGO5);
				GameplaySettingsContent = contentGO;
				ControlsSettingsContent = contentGO2;
				GraphicsSettingsContent = contentGO3;
				VideoSettingsContent = contentGO4;
				AudioSettingsContent = contentGO5;
			}
		}

		private static bool _sceneInitialized;

		public static GameObject SettingsMenu { get; private set; }

		public static GameObject GameplaySettingsContent { get; private set; }

		public static GameObject ControlsSettingsContent { get; private set; }

		public static GameObject GraphicsSettingsContent { get; private set; }

		public static GameObject VideoSettingsContent { get; private set; }

		public static GameObject AudioSettingsContent { get; private set; }

		public static Dictionary<string, TMP_FontAsset> Fonts { get; private set; } = new Dictionary<string, TMP_FontAsset>();

		public static Dictionary<string, Texture> Textures { get; private set; } = new Dictionary<string, Texture>();

		public static Dictionary<string, Sprite> Sprites { get; private set; } = new Dictionary<string, Sprite>();

		public static TMP_FontAsset RobotoBoldFont
		{
			get
			{
				if (!Fonts.TryGetValue("Roboto-Bold SDF", out var value))
				{
					throw new InvalidOperationException();
				}
				return value;
			}
		}

		public static TMP_FontAsset RobotoBoldUnderlayFont
		{
			get
			{
				if (!Fonts.TryGetValue("Roboto-Bold SDF_UNDERLAY", out var value))
				{
					throw new InvalidOperationException();
				}
				return value;
			}
		}

		public static Texture Arrow
		{
			get
			{
				if (!Textures.TryGetValue("Arrow", out var value))
				{
					throw new InvalidOperationException();
				}
				return value;
			}
		}

		public static Texture Circle
		{
			get
			{
				if (!Textures.TryGetValue("Circle", out var value))
				{
					throw new InvalidOperationException();
				}
				return value;
			}
		}

		public static Texture HollowCircle
		{
			get
			{
				if (!Textures.TryGetValue("HollowCircle", out var value))
				{
					throw new InvalidOperationException();
				}
				return value;
			}
		}

		public static Texture GradientBottLong
		{
			get
			{
				if (!Textures.TryGetValue("GradientBottLong", out var value))
				{
					throw new InvalidOperationException();
				}
				return value;
			}
		}

		public static Texture GradientLeft
		{
			get
			{
				if (!Textures.TryGetValue("GradientLeft", out var value))
				{
					throw new InvalidOperationException();
				}
				return value;
			}
		}

		public static Sprite DropdownArrow
		{
			get
			{
				if (!Sprites.TryGetValue("DropdownArrow", out var value))
				{
					throw new InvalidOperationException();
				}
				return value;
			}
		}

		public static Sprite UIMask
		{
			get
			{
				if (!Sprites.TryGetValue("UIMask", out var value))
				{
					throw new InvalidOperationException();
				}
				return value;
			}
		}

		public static Sprite Checkmark
		{
			get
			{
				if (!Sprites.TryGetValue("Checkmark", out var value))
				{
					throw new InvalidOperationException();
				}
				return value;
			}
		}

		internal static void Init()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			ClassInjector.RegisterTypeInIl2Cpp<CrabToggle>();
			ClassInjector.RegisterTypeInIl2Cpp<CrabSlider>();
			ClassInjector.RegisterTypeInIl2Cpp<CrabScroll>();
			ClassInjector.RegisterTypeInIl2Cpp<CrabKeybind>();
			ClassInjector.RegisterTypeInIl2Cpp<CrabButton>();
			ClassInjector.RegisterTypeInIl2Cpp<CrabDropdown>();
			new Harmony("CrabDevKit.CrabUi").PatchAll(typeof(Patches));
		}

		internal static void SceneInit()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Expected O, but got Unknown
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Expected O, but got Unknown
			if (_sceneInitialized)
			{
				return;
			}
			Scene activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).name != "Menu")
			{
				return;
			}
			_sceneInitialized = true;
			foreach (Object item in (Il2CppArrayBase<Object>)(object)Object.FindObjectsOfType(Il2CppType.Of<TextMeshProUGUI>(), true))
			{
				TextMeshProUGUI val = new TextMeshProUGUI(((Il2CppObjectBase)item).Pointer);
				if ((Object)(object)((TMP_Text)val).font != (Object)null)
				{
					Fonts[((Object)((TMP_Text)val).font).name] = ((TMP_Text)val).font;
				}
			}
			foreach (Object item2 in (Il2CppArrayBase<Object>)(object)Object.FindObjectsOfType(Il2CppType.Of<RawImage>(), true))
			{
				RawImage val2 = new RawImage(((Il2CppObjectBase)item2).Pointer);
				if ((Object)(object)val2.texture != (Object)null)
				{
					Textures[((Object)val2.texture).name] = val2.texture;
				}
			}
			foreach (Object item3 in (Il2CppArrayBase<Object>)(object)Object.FindObjectsOfType(Il2CppType.Of<Image>(), true))
			{
				Image val3 = new Image(((Il2CppObjectBase)item3).Pointer);
				if ((Object)(object)val3.sprite != (Object)null)
				{
					Sprites[((Object)val3.sprite).name] = val3.sprite;
				}
			}
		}

		public static void GetCategory(GameObject menuGO, string name, out GameObject tabGO, out GameObject categoryGO, out GameObject contentGO)
		{
			if ((Object)(object)menuGO == (Object)null)
			{
				throw new Exception("menuGO cannot be null.");
			}
			if (string.IsNullOrEmpty(name))
			{
				throw new Exception("name cannot be null or empty.");
			}
			Transform val = menuGO.transform.Find(name);
			int num = val.GetSiblingIndex() - 1;
			tabGO = ((Component)menuGO.transform.GetChild(0).GetChild(0).GetChild(num)).gameObject;
			categoryGO = ((Component)val).gameObject;
			contentGO = ((Component)val.GetChild(0).GetChild(0)).gameObject;
		}

		public static GameObject GetSetting(GameObject contentGO)
		{
			throw new NotImplementedException();
		}

		public static GameObject CreateMenu(string name)
		{
			throw new NotImplementedException();
		}

		public static void CreateCategory(GameObject menuGO, string name, out GameObject tabGO, out GameObject categoryGO, out GameObject contentGO, int index = int.MaxValue)
		{
			throw new NotImplementedException();
		}

		public static GameObject CreateSetting(GameObject contentGO, string name, int index = int.MaxValue, Vector2? size = null, Color? backgroundColor = null, bool childControlWidth = true, bool childControlHeight = true, bool childForceExpandWidth = false, bool childForceExpandHeight = false, bool childScaleWidth = false, bool childScaleHeight = false, float spacing = 5f, RectOffset padding = null)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: 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_00b4: 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_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Expected O, but got Unknown
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Expected O, but got Unknown
			if ((Object)(object)contentGO == (Object)null)
			{
				throw new Exception("contentGO cannot be null.");
			}
			if (string.IsNullOrEmpty(name))
			{
				throw new Exception("name cannot be null or empty.");
			}
			Vector2 valueOrDefault = size.GetValueOrDefault();
			if (!size.HasValue)
			{
				((Vector2)(ref valueOrDefault))..ctor(0f, 50f);
				size = valueOrDefault;
			}
			Color valueOrDefault2 = backgroundColor.GetValueOrDefault();
			if (!backgroundColor.HasValue)
			{
				((Color)(ref valueOrDefault2))..ctor(0f, 0f, 0f, 0.298f);
				backgroundColor = valueOrDefault2;
			}
			if (padding == null)
			{
				padding = new RectOffset
				{
					left = 15,
					right = 15,
					top = 5,
					bottom = 5
				};
			}
			GameObject val = new GameObject(name);
			val.transform.SetParent(contentGO.transform);
			val.transform.SetSiblingIndex(index);
			val.transform.localScale = Vector3.one;
			val.AddComponent<RectTransform>().sizeDelta = size.Value;
			val.AddComponent<CanvasRenderer>().cullTransparentMesh = false;
			((Graphic)val.AddComponent<RawImage>()).color = backgroundColor.Value;
			HorizontalLayoutGroup obj = val.AddComponent<HorizontalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = childControlWidth;
			((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = childControlHeight;
			((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = childForceExpandWidth;
			((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = childForceExpandHeight;
			((HorizontalOrVerticalLayoutGroup)obj).childScaleWidth = childScaleWidth;
			((HorizontalOrVerticalLayoutGroup)obj).childScaleHeight = childScaleHeight;
			((HorizontalOrVerticalLayoutGroup)obj).spacing = spacing;
			((LayoutGroup)obj).padding = padding;
			return val;
		}

		public static GameObject CreateLabel(GameObject settingGO, string label, int index = int.MaxValue, Vector2? size = null, TMP_FontAsset font = null, float fontSize = 40f, Color? textColor = null, bool childControlWidth = true, bool childControlHeight = true, bool childForceExpandWidth = true, bool childForceExpandHeight = true, bool childScaleWidth = false, bool childScaleHeight = false)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			//IL_00a5: 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_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_0075: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)settingGO == (Object)null)
			{
				throw new Exception("settingGO cannot be null.");
			}
			if (string.IsNullOrEmpty(label))
			{
				throw new Exception("label cannot be null or empty.");
			}
			Vector2 valueOrDefault = size.GetValueOrDefault();
			if (!size.HasValue)
			{
				((Vector2)(ref valueOrDefault))..ctor(0f, 40f);
				size = valueOrDefault;
			}
			if (font == null)
			{
				font = RobotoBoldFont;
			}
			Color valueOrDefault2 = textColor.GetValueOrDefault();
			if (!textColor.HasValue)
			{
				valueOrDefault2 = Color.white;
				textColor = valueOrDefault2;
			}
			GameObject val = new GameObject(label);
			val.transform.SetParent(settingGO.transform);
			val.transform.SetSiblingIndex(index);
			val.transform.localScale = Vector3.one;
			val.AddComponent<RectTransform>().sizeDelta = size.Value;
			val.AddComponent<CanvasRenderer>().cullTransparentMesh = false;
			RawImage obj = val.AddComponent<RawImage>();
			((Behaviour)obj).enabled = false;
			((Graphic)obj).color = Color.red;
			HorizontalLayoutGroup obj2 = val.AddComponent<HorizontalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = childControlWidth;
			((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = childControlHeight;
			((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = childForceExpandWidth;
			((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandWidth = childForceExpandHeight;
			((HorizontalOrVerticalLayoutGroup)obj2).childScaleWidth = childScaleWidth;
			((HorizontalOrVerticalLayoutGroup)obj2).childScaleHeight = childScaleHeight;
			((LayoutGroup)obj2).childAlignment = (TextAnchor)3;
			GameObject val2 = new GameObject("Text (TMP)");
			val2.transform.SetParent(val.transform);
			val2.transform.localScale = Vector3.one;
			val2.AddComponent<RectTransform>().sizeDelta = size.Value;
			val2.AddComponent<CanvasRenderer>().cullTransparentMesh = false;
			TextMeshProUGUI obj3 = val2.AddComponent<TextMeshProUGUI>();
			((TMP_Text)obj3).text = label;
			((TMP_Text)obj3).font = font;
			((TMP_Text)obj3).fontSize = fontSize;
			((Graphic)obj3).color = textColor.Value;
			((TMP_Text)obj3).alignment = (TextAlignmentOptions)513;
			return val;
		}

		public static CrabToggle CreateToggle(GameObject settingGO, string name, int index = int.MaxValue, bool initialState = false, float size = 40f, Color? outerColor = null, Color? innerColor = null, RectOffset padding = null)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			//IL_009c: Expected O, but got Unknown
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: 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_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Expected O, but got Unknown
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Expected O, but got Unknown
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			if ((Object)(object)settingGO == (Object)null)
			{
				throw new Exception("settingGO cannot be null.");
			}
			if (string.IsNullOrEmpty(name))
			{
				throw new Exception("name cannot be null or empty.");
			}
			Color valueOrDefault = outerColor.GetValueOrDefault();
			if (!outerColor.HasValue)
			{
				valueOrDefault = Color.white;
				outerColor = valueOrDefault;
			}
			valueOrDefault = innerColor.GetValueOrDefault();
			if (!innerColor.HasValue)
			{
				valueOrDefault = Color.white;
				innerColor = valueOrDefault;
			}
			if (padding == null)
			{
				padding = new RectOffset
				{
					left = 0,
					right = 10,
					top = 0,
					bottom = 0
				};
			}
			GameObject val = new GameObject(name);
			GameObject val2 = val;
			val2 = val;
			val2.transform.SetParent(settingGO.transform);
			val2.transform.SetSiblingIndex(index);
			val2.transform.localScale = Vector3.one;
			val2.AddComponent<RectTransform>().sizeDelta = Vector2.one * size;
			val2.AddComponent<CanvasRenderer>().cullTransparentMesh = false;
			RawImage obj = val2.AddComponent<RawImage>();
			((Behaviour)obj).enabled = false;
			((Graphic)obj).color = Color.red;
			HorizontalLayoutGroup obj2 = val2.AddComponent<HorizontalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = false;
			((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = false;
			((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = true;
			((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandWidth = true;
			((LayoutGroup)obj2).childAlignment = (TextAnchor)5;
			((LayoutGroup)obj2).padding = padding;
			GameObject val3 = new GameObject("Button");
			val3.transform.SetParent(val2.transform);
			val3.transform.localScale = Vector3.one;
			val3.AddComponent<RectTransform>().sizeDelta = Vector2.one * size;
			val3.AddComponent<CanvasRenderer>().cullTransparentMesh = false;
			CrabToggle crabToggle = val3.AddComponent<CrabToggle>();
			((UnityEventBase)val3.AddComponent<Button>().onClick).AddListener((Object)(object)crabToggle, ((Object)crabToggle).GetIl2CppType().GetMethod("Pressed"));
			RawImage obj3 = val3.AddComponent<RawImage>();
			obj3.texture = HollowCircle;
			((Graphic)obj3).color = outerColor.Value;
			val3.AddComponent<MonoBehaviourPublicIPointerEnterHandlerIEventSystemHandlerIPointerClickHandlerUnique>();
			GameObject val4 = new GameObject("Toggle");
			val4.transform.SetParent(val3.transform);
			val4.transform.localScale = Vector3.one * 0.5f;
			val4.SetActive(initialState);
			RectTransform obj4 = val4.AddComponent<RectTransform>();
			obj4.sizeDelta = Vector2.zero;
			obj4.anchorMin = Vector2.zero;
			obj4.anchorMax = Vector2.one;
			val4.AddComponent<CanvasRenderer>().cullTransparentMesh = false;
			RawImage obj5 = val4.AddComponent<RawImage>();
			obj5.texture = Circle;
			((Graphic)obj5).color = innerColor.Value;
			crabToggle.state = initialState;
			crabToggle.innerGO = val4;
			return crabToggle;
		}

		public static CrabSlider CreateSlider(GameObject settingGO, string name, int index = int.MaxValue, float minState = 0f, float maxState = 10f, float initialState = 5f, bool wholeNumbers = true, Vector2? size = null, float fillHeight = 10f, float handleWidth = 15f, Vector2? valueSize = null, TMP_FontAsset font = null, Color? textColor = null, Color? backgroundColor = null, Color? fillColor = null, Color? valueTextBackgroundColor = null)
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: 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_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_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Expected O, but got Unknown
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Expected O, but got Unknown
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: 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_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0331: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Expected O, but got Unknown
			//IL_0360: Unknown result type (might be due to invalid IL or missing references)
			//IL_037c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c9: 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_03d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0403: Unknown result type (might be due to invalid IL or missing references)
			//IL_0419: Unknown result type (might be due to invalid IL or missing references)
			//IL_0425: Unknown result type (might be due to invalid IL or missing references)
			//IL_042f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0442: Unknown result type (might be due to invalid IL or missing references)
			//IL_0459: Unknown result type (might be due to invalid IL or missing references)
			//IL_0460: Expected O, but got Unknown
			//IL_0479: Unknown result type (might be due to invalid IL or missing references)
			//IL_0495: Unknown result type (might be due to invalid IL or missing references)
			//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_04be: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_04e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0508: Unknown result type (might be due to invalid IL or missing references)
			//IL_051e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0531: Unknown result type (might be due to invalid IL or missing references)
			//IL_053b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0547: Unknown result type (might be due to invalid IL or missing references)
			//IL_0561: Unknown result type (might be due to invalid IL or missing references)
			//IL_0568: Expected O, but got Unknown
			//IL_0581: Unknown result type (might be due to invalid IL or missing references)
			//IL_0594: 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_05c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05da: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_062a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)settingGO == (Object)null)
			{
				throw new Exception("settingGO cannot be null.");
			}
			if (string.IsNullOrEmpty(name))
			{
				throw new Exception("name cannot be null or empty.");
			}
			if (minState > maxState)
			{
				throw new Exception("minState should be less than or equal to maxState.");
			}
			initialState = Mathf.Clamp(initialState, minState, maxState);
			Vector2 valueOrDefault = size.GetValueOrDefault();
			if (!size.HasValue)
			{
				((Vector2)(ref valueOrDefault))..ctor(230f, 40f);
				size = valueOrDefault;
			}
			valueOrDefault = valueSize.GetValueOrDefault();
			if (!valueSize.HasValue)
			{
				((Vector2)(ref valueOrDefault))..ctor(90f, 40f);
				valueSize = valueOrDefault;
			}
			if (font == null)
			{
				font = RobotoBoldFont;
			}
			Color value = textColor.GetValueOrDefault();
			if (!textColor.HasValue)
			{
				value = Color.white;
				textColor = value;
			}
			value = backgroundColor.GetValueOrDefault();
			if (!backgroundColor.HasValue)
			{
				((Color)(ref value))..ctor(0f, 0f, 0f, 0.5804f);
				backgroundColor = value;
			}
			value = fillColor.GetValueOrDefault();
			if (!fillColor.HasValue)
			{
				((Color)(ref value))..ctor(0.2235f, 0.2745f, 0.8f);
				fillColor = value;
			}
			value = valueTextBackgroundColor.GetValueOrDefault();
			if (!valueTextBackgroundColor.HasValue)
			{
				((Color)(ref value))..ctor(0f, 0f, 0f, 0.502f);
				valueTextBackgroundColor = value;
			}
			GameObject val = new GameObject(name);
			val.transform.SetParent(settingGO.transform);
			val.transform.SetSiblingIndex(index);
			val.transform.localScale = Vector3.one;
			val.AddComponent<RectTransform>().sizeDelta = new Vector2(size.Value.x + valueSize.Value.x + 25f, size.Value.y);
			val.AddComponent<CanvasRenderer>().cullTransparentMesh = false;
			RawImage obj = val.AddComponent<RawImage>();
			((Behaviour)obj).enabled = false;
			((Graphic)obj).color = Color.red;
			HorizontalLayoutGroup obj2 = val.AddComponent<HorizontalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = false;
			((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = false;
			((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = false;
			((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandWidth = false;
			((HorizontalOrVerticalLayoutGroup)obj2).spacing = 25f;
			((LayoutGroup)obj2).childAlignment = (TextAnchor)4;
			GameObject val2 = new GameObject("Slider");
			val2.transform.SetParent(val.transform);
			val2.transform.localScale = Vector3.one;
			val2.AddComponent<RectTransform>().sizeDelta = size.Value;
			CrabSlider crabSlider = val2.AddComponent<CrabSlider>();
			Slider val3 = val2.AddComponent<Slider>();
			val3.wholeNumbers = wholeNumbers;
			val3.minValue = minState;
			val3.maxValue = maxState;
			val3.value = initialState;
			((UnityEventBase)val3.onValueChanged).AddListener((Object)(object)crabSlider, ((Object)crabSlider).GetIl2CppType().GetMethod("Changed"));
			GameObject val4 = new GameObject("Background");
			val4.transform.SetParent(val2.transform);
			val4.transform.localScale = Vector3.one;
			RectTransform obj3 = val4.AddComponent<RectTransform>();
			obj3.anchorMax = new Vector2(0.9787f, 0.75f);
			obj3.anchorMin = new Vector2(0.0213f, 0.25f);
			obj3.sizeDelta = new Vector2(0f, 0f - fillHeight);
			val4.AddComponent<CanvasRenderer>().cullTransparentMesh = false;
			((Graphic)val4.AddComponent<Image>()).color = backgroundColor.Value;
			GameObject val5 = new GameObject("Fill Area");
			val5.transform.SetParent(val2.transform);
			val5.transform.localScale = Vector3.one;
			RectTransform obj4 = val5.AddComponent<RectTransform>();
			obj4.anchorMax = new Vector2(0.9787f, 0.75f);
			obj4.anchorMin = new Vector2(0.0213f, 0.25f);
			obj4.sizeDelta = new Vector2(0f, 0f - fillHeight);
			GameObject val6 = new GameObject("Fill");
			val6.transform.SetParent(val5.transform);
			val6.transform.localScale = Vector3.one;
			RectTransform val7 = val6.AddComponent<RectTransform>();
			val7.anchorMax = new Vector2(1f, 1f);
			val7.anchorMin = new Vector2(0f, 0f);
			val7.sizeDelta = new Vector2(0f, 0f);
			((Transform)val7).localPosition = Vector3.zero;
			val6.AddComponent<CanvasRenderer>().cullTransparentMesh = false;
			((Graphic)val6.AddComponent<Image>()).color = fillColor.Value;
			val3.fillRect = val7;
			GameObject val8 = new GameObject("Handle Slide Area");
			val8.transform.SetParent(val2.transform);
			val8.transform.localScale = Vector3.one;
			RectTransform obj5 = val8.AddComponent<RectTransform>();
			obj5.anchorMax = new Vector2(1f, 1f);
			obj5.anchorMin = new Vector2(0f, 0f);
			obj5.sizeDelta = new Vector2(-20f, 0f);
			GameObject val9 = new GameObject("Handle");
			val9.transform.SetParent(val8.transform);
			val9.transform.localScale = Vector3.one;
			RectTransform val10 = val9.AddComponent<RectTransform>();
			val10.anchorMax = new Vector2(1f, 1f);
			val10.anchorMin = new Vector2(1f, 0f);
			val10.sizeDelta = new Vector2(handleWidth, 0f);
			val9.AddComponent<CanvasRenderer>().cullTransparentMesh = false;
			val9.AddComponent<Image>();
			val9.AddComponent<MonoBehaviourPublicIPointerEnterHandlerIEventSystemHandlerIPointerClickHandlerUnique>();
			val3.handleRect = val10;
			GameObject val11 = new GameObject("Value Text");
			val11.transform.SetParent(val.transform);
			val11.transform.localScale = Vector3.one;
			val11.AddComponent<RectTransform>().sizeDelta = valueSize.Value;
			val11.AddComponent<CanvasRenderer>().cullTransparentMesh = false;
			((Graphic)val11.AddComponent<RawImage>()).color = valueTextBackgroundColor.Value;
			GameObject val12 = new GameObject("Text (TMP)");
			val12.transform.SetParent(val11.transform);
			val12.transform.localScale = Vector3.one;
			val12.AddComponent<RectTransform>().sizeDelta = valueSize.Value;
			val12.AddComponent<CanvasRenderer>().cullTransparentMesh = false;
			TextMeshProUGUI val13 = val12.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val13).text = initialState.ToString();
			((TMP_Text)val13).font = font;
			((Graphic)val13).color = textColor.Value;
			((TMP_Text)val13).alignment = (TextAlignmentOptions)514;
			crabSlider.slider = val3;
			crabSlider.text = val13;
			return crabSlider;
		}

		public static CrabScroll CreateScroll(GameObject settingGO, string name, int index = int.MaxValue, int initialState = 0, IReadOnlyList<object> options = null, float size = 40f, float textWidth = 300f, TMP_FontAsset font = null, Color? textColor = null, Color? buttonColor = null)
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected O, but got Unknown
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Expected O, but got Unknown
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: 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_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Expected O, but got Unknown
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: 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_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Expected O, but got Unknown
			//IL_036e: 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_0386: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e7: 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_03f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0404: Unknown result type (might be due to invalid IL or missing references)
			//IL_0425: Unknown result type (might be due to invalid IL or missing references)
			//IL_0443: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)settingGO == (Object)null)
			{
				throw new Exception("settingGO cannot be null.");
			}
			if (string.IsNullOrEmpty(name))
			{
				throw new Exception("name cannot be null or empty.");
			}
			if (options == null || options.Count == 0)
			{
				throw new Exception("options cannot be null or empty.");
			}
			initialState = Mathf.Clamp(initialState, 0, options.Count - 1);
			if (font == null)
			{
				font = RobotoBoldFont;
			}
			Color valueOrDefault = textColor.GetValueOrDefault();
			if (!textColor.HasValue)
			{
				valueOrDefault = Color.white;
				textColor = valueOrDefault;
			}
			valueOrDefault = buttonColor.GetValueOrDefault();
			if (!buttonColor.HasValue)
			{
				valueOrDefault = Color.white;
				buttonColor = valueOrDefault;
			}
			GameObject val = new GameObject(name);
			val.transform.SetParent(settingGO.transform);
			val.transform.SetSiblingIndex(index);
			val.transform.localScale = Vector3.one;
			val.AddComponent<RectTransform>().sizeDelta = new Vector2(size * 2f + textWidth, size);
			val.AddComponent<CanvasRenderer>().cullTransparentMesh = false;
			RawImage obj = val.AddComponent<RawImage>();
			((Behaviour)obj).enabled = false;
			((Graphic)obj).color = Color.red;
			HorizontalLayoutGroup obj2 = val.AddComponent<HorizontalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = false;
			((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = false;
			((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = false;
			((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandWidth = false;
			((LayoutGroup)obj2).childAlignment = (TextAnchor)4;
			CrabScroll crabScroll = val.AddComponent<CrabScroll>();
			GameObject val2 = new GameObject("Left");
			val2.transform.SetParent(val.transform);
			val2.transform.localScale = Vector3.one;
			val2.AddComponent<RectTransform>().sizeDelta = Vector2.one * size;
			val2.AddComponent<CanvasRenderer>().cullTransparentMesh = false;
			RawImage obj3 = val2.AddComponent<RawImage>();
			((Behaviour)obj3).enabled = false;
			((Graphic)obj3).color = Color.red;
			GameObject val3 = new GameObject("Button");
			val3.transform.SetParent(val2.transform);
			val3.transform.localScale = new Vector3(-1f, 1f, 1f);
			val3.AddComponent<RectTransform>().sizeDelta = Vector2.one * size;
			val3.AddComponent<CanvasRenderer>().cullTransparentMesh = false;
			((UnityEventBase)val3.AddComponent<Button>().onClick).AddListener((Object)(object)crabScroll, ((Object)crabScroll).GetIl2CppType().GetMethod("ScrollLeft"));
			val3.AddComponent<MonoBehaviourPublicIPointerEnterHandlerIEventSystemHandlerIPointerClickHandlerUnique>();
			RawImage val4 = val3.AddComponent<RawImage>();
			val4.texture = Arrow;
			((Graphic)val4).color = buttonColor.Value;
			((Behaviour)val4).enabled = initialState != 0;
			GameObject val5 = new GameObject("Text");
			val5.transform.SetParent(val.transform);
			val5.transform.localScale = Vector3.one;
			val5.AddComponent<RectTransform>().sizeDelta = new Vector2(textWidth, size);
			val5.AddComponent<CanvasRenderer>().cullTransparentMesh = false;
			RawImage obj4 = val5.AddComponent<RawImage>();
			((Behaviour)obj4).enabled = false;
			((Graphic)obj4).color = Color.red;
			GameObject val6 = new GameObject("Text (TMP)");
			val6.transform.SetParent(val5.transform);
			val6.transform.localScale = Vector3.one;
			val6.AddComponent<RectTransform>().sizeDelta = new Vector2(textWidth, size);
			val6.AddComponent<CanvasRenderer>().cullTransparentMesh = false;
			TextMeshProUGUI val7 = val6.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val7).text = options[initialState].ToString();
			((TMP_Text)val7).font = font;
			((Graphic)val7).color = textColor.Value;
			((TMP_Text)val7).alignment = (TextAlignmentOptions)514;
			GameObject val8 = new GameObject("Right");
			val8.transform.SetParent(val.transform);
			val8.transform.localScale = Vector3.one;
			val8.AddComponent<RectTransform>().sizeDelta = Vector2.one * size;
			val8.AddComponent<CanvasRenderer>().cullTransparentMesh = false;
			RawImage obj5 = val8.AddComponent<RawImage>();
			((Behaviour)obj5).enabled = false;
			((Graphic)obj5).color = Color.red;
			GameObject val9 = new GameObject("Button");
			val9.transform.SetParent(val8.transform);
			val9.transform.localScale = Vector3.one;
			val9.AddComponent<RectTransform>().sizeDelta = Vector2.one * size;
			val9.AddComponent<CanvasRenderer>().cullTransparentMesh = false;
			((UnityEventBase)val9.AddComponent<Button>().onClick).AddListener((Object)(object)crabScroll, ((Object)crabScroll).GetIl2CppType().GetMethod("ScrollRight"));
			val9.AddComponent<MonoBehaviourPublicIPointerEnterHandlerIEventSystemHandlerIPointerClickHandlerUnique>();
			RawImage val10 = val9.AddComponent<RawImage>();
			val10.texture = Arrow;
			((Graphic)val10).color = buttonColor.Value;
			((Behaviour)val10).enabled = initialState != options.Count - 1;
			crabScroll.text = val7;
			crabScroll.leftButtonImg = val4;
			crabScroll.rightButtonImg = val10;
			crabScroll.state = initialState;
			crabScroll.options = options.ToArray();
			return crabScroll;
		}

		public static CrabKeybind CreateKeybind(GameObject settingGO, string name, int index = int.MaxValue, KeyCode initialKey = (KeyCode)0, Vector2? size = null, TMP_FontAsset font = null, Color? textColor = null, ColorBlock? buttonColors = null)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Invalid comparison between Unknown and I4
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Invalid comparison between Unknown and I4
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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_0194: Expected O, but got Unknown
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Expected O, but got Unknown
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Expected O, but got Unknown
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0321: Expected I4, but got Unknown
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_035d: Expected O, but got Unknown
			//IL_0376: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d6: Expected I4, but got Unknown
			//IL_00c2: 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_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)settingGO == (Object)null)
			{
				throw new Exception("settingGO cannot be null.");
			}
			if (string.IsNullOrEmpty(name))
			{
				throw new Exception("name cannot be null or empty.");
			}
			if (!Enum.IsDefined(typeof(KeyCode), initialKey) && (int)initialKey != -1 && (int)initialKey != -2)
			{
				throw new Exception("initialKey cannot be invalid.");
			}
			Vector2 valueOrDefault = size.GetValueOrDefault();
			if (!size.HasValue)
			{
				((Vector2)(ref valueOrDefault))..ctor(300f, 40f);
				size = valueOrDefault;
			}
			if (font == null)
			{
				font = RobotoBoldFont;
			}
			Color valueOrDefault2 = textColor.GetValueOrDefault();
			if (!textColor.HasValue)
			{
				valueOrDefault2 = Color.white;
				textColor = valueOrDefault2;
			}
			ColorBlock valueOrDefault3 = buttonColors.GetValueOrDefault();
			if (!buttonColors.HasValue)
			{
				ColorBlock val = default(ColorBlock);
				((ColorBlock)(ref val)).normalColor = new Color(0f, 0f, 0f, 0.502f);
				((ColorBlock)(ref val)).highlightedColor = new Color(0.7075f, 0.7075f, 0.7075f, 0.502f);
				((ColorBlock)(ref val)).pressedColor = new Color(0f, 0f, 0f, 1f);
				((ColorBlock)(ref val)).selectedColor = new Color(0f, 0f, 0f, 0.502f);
				((ColorBlock)(ref val)).disabledColor = new Color(0.7843f, 0.7843f, 0.7843f, 0.502f);
				((ColorBlock)(ref val)).colorMultiplier = 1f;
				((ColorBlock)(ref val)).fadeDuration = 0.1f;
				valueOrDefault3 = val;
				buttonColors = valueOrDefault3;
			}
			GameObject val2 = new GameObject(name);
			val2.transform.SetParent(settingGO.transform);
			val2.transform.SetSiblingIndex(index);
			val2.transform.localScale = Vector3.one;
			val2.AddComponent<RectTransform>().sizeDelta = size.Value;
			val2.AddComponent<CanvasRenderer>().cullTransparentMesh = false;
			RawImage obj = val2.AddComponent<RawImage>();
			((Behaviour)obj).enabled = false;
			((Graphic)obj).color = Color.red;
			HorizontalLayoutGroup obj2 = val2.AddComponent<HorizontalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = false;
			((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = false;
			((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = false;
			((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandWidth = false;
			((LayoutGroup)obj2).childAlignment = (TextAnchor)4;
			CrabKeybind crabKeybind = val2.AddComponent<CrabKeybind>();
			crabKeybind.setting = val2.AddComponent<MonoBehaviour1PublicTekeIncuStUnique>();
			GameObject val3 = new GameObject("Button");
			val3.transform.SetParent(val2.transform);
			val3.transform.localScale = Vector3.one;
			val3.AddComponent<RectTransform>().sizeDelta = size.Value;
			val3.AddComponent<CanvasRenderer>().cullTransparentMesh = false;
			val3.AddComponent<RawImage>();
			Button obj3 = val3.AddComponent<Button>();
			((Selectable)obj3).colors = buttonColors.Value;
			((UnityEventBase)obj3.onClick).AddListener((Object)(object)crabKeybind.setting, ((Object)crabKeybind.setting).GetIl2CppType().GetMethod("StartListening"));
			val3.AddComponent<MonoBehaviourPublicIPointerEnterHandlerIEventSystemHandlerIPointerClickHandlerUnique>();
			GameObject val4 = new GameObject("Text (TMP)");
			val4.transform.SetParent(val3.transform);
			val4.transform.localScale = Vector3.one;
			val4.AddComponent<RectTransform>().sizeDelta = size.Value;
			val4.AddComponent<CanvasRenderer>().cullTransparentMesh = false;
			TextMeshProUGUI val5 = val4.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val5).text = crabKeybind.setting.intToKeyCode((int)initialKey);
			((TMP_Text)val5).font = font;
			((Graphic)val5).color = textColor.Value;
			((TMP_Text)val5).alignment = (TextAlignmentOptions)514;
			crabKeybind.text = val5;
			GameObject val6 = new GameObject("Fake Text");
			val6.transform.SetParent(val4.transform);
			val6.transform.localScale = Vector3.one;
			val6.SetActive(false);
			val6.AddComponent<RectTransform>().sizeDelta = size.Value;
			crabKeybind.setting.keyText = val6.AddComponent<TextMeshProUGUI>();
			((Behaviour)crabKeybind.setting.keyText).enabled = false;
			crabKeybind.setting.set_actionName(name);
			crabKeybind.setting.currentKey = (int)initialKey;
			((UnityEventBase)((MonoBehaviourPublicIncuObm_ObUnique)crabKeybind.setting).m_OnClick).AddListener((Object)(object)crabKeybind, ((Object)crabKeybind).GetIl2CppType().GetMethod("KeybindUpdated"));
			return crabKeybind;
		}

		public static CrabButton CreateButton(GameObject settingGO, string name, int index = int.MaxValue, float height = 40f, Vector2? size = null, float glossWidth = 20f, float glossHeight = 12f, RectOffset padding = null, Color? buttonColor = null, ColorBlock? buttonColors = null, TMP_FontAsset font = null, Color? textColor = null)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: 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_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Expected O, but got Unknown
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Expected O, but got Unknown
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Expected O, but got Unknown
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Unknown result type (might be due to invalid IL or missing references)
			//IL_0307: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0363: Unknown result type (might be due to invalid IL or missing references)
			//IL_0378: Unknown result type (might be due to invalid IL or missing references)
			//IL_038d: Unknown result type (might be due to invalid IL or missing references)
			//IL_039e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fe: 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_040f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0424: Unknown result type (might be due to invalid IL or missing references)
			//IL_0439: 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_045f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0469: Unknown result type (might be due to invalid IL or missing references)
			//IL_0494: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_050f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0520: 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_0555: Unknown result type (might be due to invalid IL or missing references)
			//IL_0564: Unknown result type (might be due to invalid IL or missing references)
			//IL_0569: Unknown result type (might be due to invalid IL or missing references)
			//IL_057a: Unknown result type (might be due to invalid IL or missing references)
			//IL_058f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0599: Unknown result type (might be due to invalid IL or missing references)
			//IL_059f: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05da: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ef: 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_060a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0635: Unknown result type (might be due to invalid IL or missing references)
			//IL_0644: Unknown result type (might be due to invalid IL or missing references)
			//IL_0649: Unknown result type (might be due to invalid IL or missing references)
			//IL_065a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0660: Unknown result type (might be due to invalid IL or missing references)
			//IL_066a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0670: Unknown result type (might be due to invalid IL or missing references)
			//IL_067a: 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_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)settingGO == (Object)null)
			{
				throw new Exception("settingGO cannot be null.");
			}
			if (string.IsNullOrEmpty(name))
			{
				throw new Exception("name cannot be null or empty.");
			}
			Vector2 valueOrDefault = size.GetValueOrDefault();
			if (!size.HasValue)
			{
				((Vector2)(ref valueOrDefault))..ctor(151.92f, 39.3f);
				size = valueOrDefault;
			}
			if (padding == null)
			{
				padding = new RectOffset
				{
					left = 0,
					right = 10,
					top = 0,
					bottom = 0
				};
			}
			Color value = buttonColor.GetValueOrDefault();
			if (!buttonColor.HasValue)
			{
				((Color)(ref value))..ctor(1f, 0f, 0.0285f, 1f);
				buttonColor = value;
			}
			ColorBlock valueOrDefault2 = buttonColors.GetValueOrDefault();
			if (!buttonColors.HasValue)
			{
				ColorBlock val = default(ColorBlock);
				((ColorBlock)(ref val)).normalColor = Color.white;
				((ColorBlock)(ref val)).highlightedColor = new Color(0.7453f, 0.7453f, 0.7453f, 1f);
				((ColorBlock)(ref val)).pressedColor = new Color(0.5f, 0.5f, 0.5f, 1f);
				((ColorBlock)(ref val)).selectedColor = new Color(0.9608f, 0.9608f, 0.9608f, 1f);
				((ColorBlock)(ref val)).disabledColor = new Color(0.7843f, 0.7843f, 0.7843f, 0.502f);
				((ColorBlock)(ref val)).colorMultiplier = 1f;
				((ColorBlock)(ref val)).fadeDuration = 0.1f;
				valueOrDefault2 = val;
				buttonColors = valueOrDefault2;
			}
			if (font == null)
			{
				font = RobotoBoldUnderlayFont;
			}
			value = textColor.GetValueOrDefault();
			if (!textColor.HasValue)
			{
				value = Color.white;
				textColor = value;
			}
			GameObject val2 = new GameObject(name);
			val2.transform.SetParent(settingGO.transform);
			val2.transform.SetSiblingIndex(index);
			val2.transform.localScale = Vector3.one;
			val2.AddComponent<RectTransform>().sizeDelta = new Vector2(size.Value.x, height);
			val2.AddComponent<CanvasRenderer>().cullTransparentMesh = false;
			RawImage obj = val2.AddComponent<RawImage>();
			((Behaviour)obj).enabled = false;
			((Graphic)obj).color = Color.red;
			HorizontalLayoutGroup obj2 = val2.AddComponent<HorizontalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = false;
			((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = false;
			((LayoutGroup)obj2).childAlignment = (TextAnchor)5;
			((LayoutGroup)obj2).padding = padding;
			GameObject val3 = new GameObject("UiButtonKids");
			val3.transform.SetParent(val2.transform);
			val3.transform.localScale = Vector3.one;
			RectTransform obj3 = val3.AddComponent<RectTransform>();
			obj3.anchorMax = new Vector2(0f, 1f);
			obj3.anchorMin = new Vector2(0f, 1f);
			obj3.sizeDelta = size.Value;
			val3.AddComponent<CanvasRenderer>();
			((Graphic)val3.AddComponent<Image>()).color = buttonColor.Value;
			CrabButton crabButton = val3.AddComponent<CrabButton>();
			Button obj4 = val3.AddComponent<Button>();
			((UnityEventBase)obj4.onClick).AddListener((Object)(object)crabButton, ((Object)crabButton).GetIl2CppType().GetMethod("Pressed"));
			((Selectable)obj4).colors = buttonColors.Value;
			val3.AddComponent<MonoBehaviourPublicIPointerEnterHandlerIEventSystemHandlerIPointerClickHandlerUnique>();
			GameObject val4 = new GameObject("Top Gloss");
			val4.transform.SetParent(val3.transform);
			val4.transform.localEulerAngles = new Vector3(0f, 0f, 180f);
			val4.transform.localScale = Vector3.one;
			RectTransform obj5 = val4.AddComponent<RectTransform>();
			obj5.anchoredPosition = Vector2.zero;
			obj5.anchorMax = new Vector2(1f, 1f);
			obj5.anchorMin = new Vector2(0f, 1f);
			obj5.pivot = new Vector2(0.5f, 0f);
			obj5.sizeDelta = new Vector2(0f, glossHeight);
			val4.AddComponent<CanvasRenderer>();
			RawImage obj6 = val4.AddComponent<RawImage>();
			obj6.texture = GradientBottLong;
			((Graphic)obj6).color = new Color(0f, 0f, 0f, 0.3569f);
			GameObject val5 = new GameObject("Bottom Gloss");
			val5.transform.SetParent(val3.transform);
			val5.transform.localScale = Vector3.one;
			RectTransform obj7 = val5.AddComponent<RectTransform>();
			obj7.anchoredPosition = Vector2.zero;
			obj7.anchorMax = new Vector2(1f, 0f);
			obj7.anchorMin = new Vector2(0f, 0f);
			obj7.pivot = new Vector2(0.5f, 0f);
			obj7.sizeDelta = new Vector2(0f, glossHeight);
			val5.AddComponent<CanvasRenderer>();
			RawImage obj8 = val5.AddComponent<RawImage>();
			obj8.texture = GradientBottLong;
			((Graphic)obj8).color = new Color(0f, 0f, 0f, 0.3569f);
			GameObject val6 = new GameObject("Left Gloss");
			val6.transform.SetParent(val3.transform);
			val6.transform.localScale = Vector3.one;
			RectTransform obj9 = val6.AddComponent<RectTransform>();
			obj9.anchoredPosition = Vector2.zero;
			obj9.anchorMax = new Vector2(0f, 1f);
			obj9.anchorMin = new Vector2(0f, 0f);
			obj9.pivot = new Vector2(0f, 0.5f);
			obj9.sizeDelta = new Vector2(glossWidth, 0f);
			val6.AddComponent<CanvasRenderer>();
			RawImage obj10 = val6.AddComponent<RawImage>();
			obj10.texture = GradientLeft;
			((Graphic)obj10).color = new Color(0f, 0f, 0f, 0.3569f);
			GameObject val7 = new GameObject("Right Gloss");
			val7.transform.SetParent(val3.transform);
			val7.transform.localEulerAngles = new Vector3(0f, 0f, 180f);
			val7.transform.localScale = Vector3.one;
			RectTransform obj11 = val7.AddComponent<RectTransform>();
			obj11.anchoredPosition = Vector2.zero;
			obj11.anchorMax = new Vector2(1f, 1f);
			obj11.anchorMin = new Vector2(1f, 0f);
			obj11.pivot = new Vector2(0f, 0.5f);
			obj11.sizeDelta = new Vector2(glossWidth, 0f);
			val7.AddComponent<CanvasRenderer>();
			RawImage obj12 = val7.AddComponent<RawImage>();
			obj12.texture = GradientLeft;
			((Graphic)obj12).color = new Color(0f, 0f, 0f, 0.3569f);
			GameObject val8 = new GameObject("Text (TMP)");
			val8.transform.SetParent(val3.transform);
			val8.transform.localScale = Vector3.one;
			val8.AddComponent<RectTransform>().anchoredPosition = Vector2.zero;
			val8.AddComponent<CanvasRenderer>();
			TextMeshProUGUI obj13 = va