Decompiled source of CorewoodFortified v1.0.5

plugins/CorewoodFortified.dll

Decompiled 4 days ago
using System;
using System.Collections;
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.InteropServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using HarmonyLib;
using Jotunn;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Extensions;
using Jotunn.Managers;
using Jotunn.Utils;
using MagicMike.ModSettings;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Rendering;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("CorewoodFortified")]
[assembly: AssemblyDescription("https://discord.gg/mnr36G6J4x")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("MagicMike")]
[assembly: AssemblyProduct("CorewoodFortified")]
[assembly: AssemblyCopyright("Copyright © MagicMike 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")]
[assembly: AssemblyFileVersion("1.0.5")]
[assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.5.0")]
[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 MagicMike.ModSettings
{
	internal sealed class ResetIcon : MaskableGraphic
	{
		private const int Segments = 28;

		protected override void OnPopulateMesh(VertexHelper vh)
		{
			//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_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: 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_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: 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_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: 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_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: 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_0162: Unknown result type (might be due to invalid IL or missing references)
			vh.Clear();
			Rect pixelAdjustedRect = ((Graphic)this).GetPixelAdjustedRect();
			Vector2 center = ((Rect)(ref pixelAdjustedRect)).center;
			float num = Mathf.Min(((Rect)(ref pixelAdjustedRect)).width, ((Rect)(ref pixelAdjustedRect)).height) * 0.36f;
			float num2 = num * 0.3f;
			for (int i = 0; i < 28; i++)
			{
				float angle = Mathf.Lerp(60f, 330f, (float)i / 28f) * ((float)Math.PI / 180f);
				float angle2 = Mathf.Lerp(60f, 330f, (float)(i + 1) / 28f) * ((float)Math.PI / 180f);
				Quad(vh, Polar(center, num + num2 * 0.5f, angle), Polar(center, num + num2 * 0.5f, angle2), Polar(center, num - num2 * 0.5f, angle2), Polar(center, num - num2 * 0.5f, angle));
			}
			float num3 = 5.7595863f;
			Vector2 val = Polar(center, num, num3);
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(0f - Mathf.Sin(num3), Mathf.Cos(num3));
			Vector2 val3 = default(Vector2);
			((Vector2)(ref val3))..ctor(Mathf.Cos(num3), Mathf.Sin(num3));
			float num4 = num2 * 2.2f;
			Triangle(vh, val + val2 * num4, val + val3 * num4 * 0.9f, val - val3 * num4 * 0.9f);
		}

		private static Vector2 Polar(Vector2 centre, float radius, float angle)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			return centre + new Vector2(Mathf.Cos(angle), Mathf.Sin(angle)) * radius;
		}

		private void Quad(VertexHelper vh, Vector2 a, Vector2 b, Vector2 c, Vector2 d)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			int currentVertCount = vh.currentVertCount;
			Vertex(vh, a);
			Vertex(vh, b);
			Vertex(vh, c);
			Vertex(vh, d);
			vh.AddTriangle(currentVertCount, currentVertCount + 1, currentVertCount + 2);
			vh.AddTriangle(currentVertCount, currentVertCount + 2, currentVertCount + 3);
		}

		private void Triangle(VertexHelper vh, Vector2 a, Vector2 b, Vector2 c)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			int currentVertCount = vh.currentVertCount;
			Vertex(vh, a);
			Vertex(vh, b);
			Vertex(vh, c);
			vh.AddTriangle(currentVertCount, currentVertCount + 1, currentVertCount + 2);
		}

		private void Vertex(VertexHelper vh, Vector2 position)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			UIVertex simpleVert = UIVertex.simpleVert;
			simpleVert.position = Vector2.op_Implicit(position);
			simpleVert.color = Color32.op_Implicit(((Graphic)this).color);
			vh.AddVert(simpleVert);
		}
	}
	internal sealed class DownArrowIcon : MaskableGraphic
	{
		protected override void OnPopulateMesh(VertexHelper vh)
		{
			//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_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: 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_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: 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_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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			vh.Clear();
			Rect pixelAdjustedRect = ((Graphic)this).GetPixelAdjustedRect();
			UIVertex simpleVert = UIVertex.simpleVert;
			simpleVert.color = Color32.op_Implicit(((Graphic)this).color);
			simpleVert.position = Vector2.op_Implicit(new Vector2(((Rect)(ref pixelAdjustedRect)).xMin, ((Rect)(ref pixelAdjustedRect)).yMax));
			vh.AddVert(simpleVert);
			simpleVert.position = Vector2.op_Implicit(new Vector2(((Rect)(ref pixelAdjustedRect)).xMax, ((Rect)(ref pixelAdjustedRect)).yMax));
			vh.AddVert(simpleVert);
			simpleVert.position = Vector2.op_Implicit(new Vector2(((Rect)(ref pixelAdjustedRect)).center.x, ((Rect)(ref pixelAdjustedRect)).yMin));
			vh.AddVert(simpleVert);
			vh.AddTriangle(0, 1, 2);
		}
	}
	internal sealed class CloseIcon : MaskableGraphic
	{
		protected override void OnPopulateMesh(VertexHelper vh)
		{
			//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_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			vh.Clear();
			Rect pixelAdjustedRect = ((Graphic)this).GetPixelAdjustedRect();
			Vector2 center = ((Rect)(ref pixelAdjustedRect)).center;
			float num = Mathf.Min(((Rect)(ref pixelAdjustedRect)).width, ((Rect)(ref pixelAdjustedRect)).height) * 0.5f;
			float thickness = Mathf.Max(2f, num * 0.28f);
			Bar(vh, center + new Vector2(0f - num, 0f - num), center + new Vector2(num, num), thickness);
			Bar(vh, center + new Vector2(0f - num, num), center + new Vector2(num, 0f - num), thickness);
		}

		private void Bar(VertexHelper vh, Vector2 from, Vector2 to, float thickness)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = to - from;
			float num = 0f - ((Vector2)(ref val)).normalized.y;
			val = to - from;
			Vector2 val2 = new Vector2(num, ((Vector2)(ref val)).normalized.x) * (thickness * 0.5f);
			int currentVertCount = vh.currentVertCount;
			UIVertex simpleVert = UIVertex.simpleVert;
			simpleVert.color = Color32.op_Implicit(((Graphic)this).color);
			simpleVert.position = Vector2.op_Implicit(from + val2);
			vh.AddVert(simpleVert);
			simpleVert.position = Vector2.op_Implicit(to + val2);
			vh.AddVert(simpleVert);
			simpleVert.position = Vector2.op_Implicit(to - val2);
			vh.AddVert(simpleVert);
			simpleVert.position = Vector2.op_Implicit(from - val2);
			vh.AddVert(simpleVert);
			vh.AddTriangle(currentVertCount, currentVertCount + 1, currentVertCount + 2);
			vh.AddTriangle(currentVertCount, currentVertCount + 2, currentVertCount + 3);
		}
	}
	internal static class ModSettings
	{
		internal const int Version = 30;

		internal const string GuidPrefix = "MagicMike.";

		private const string HostKey = "MagicMike.ModSettings.Host";

		private const string VersionKey = "MagicMike.ModSettings.Version";

		private static readonly string s_id = typeof(ModSettings).Assembly.GetName().Name;

		private static bool s_initialised;

		private static ConfigEntry<float> s_panelX;

		private static ConfigEntry<float> s_panelY;

		internal static ConfigFile Config { get; private set; }

		internal static ConfigEntry<KeyboardShortcut> ToggleKey { get; private set; }

		internal static ConfigEntry<float> ScrollSpeed { get; private set; }

		internal static Vector2 PanelPosition
		{
			get
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				if (s_panelX == null)
				{
					return Vector2.zero;
				}
				return new Vector2(s_panelX.Value, s_panelY.Value);
			}
			set
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				if (s_panelX != null)
				{
					s_panelX.Value = value.x;
					s_panelY.Value = value.y;
				}
			}
		}

		internal static bool IsHost => AppDomain.CurrentDomain.GetData("MagicMike.ModSettings.Host") as string == s_id;

		public static void Init(BaseUnityPlugin plugin)
		{
			if (!s_initialised)
			{
				s_initialised = true;
				AppDomain currentDomain = AppDomain.CurrentDomain;
				if (!(currentDomain.GetData("MagicMike.ModSettings.Version") is int num) || 30 > num)
				{
					currentDomain.SetData("MagicMike.ModSettings.Version", 30);
					currentDomain.SetData("MagicMike.ModSettings.Host", s_id);
				}
				((Component)plugin).gameObject.AddComponent<ModSettingsDriver>();
			}
		}

		internal static void StartHost()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_0033: 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_007e: Expected O, but got Unknown
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Expected O, but got Unknown
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Expected O, but got Unknown
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Expected O, but got Unknown
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Expected O, but got Unknown
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Expected O, but got Unknown
			Config = new ConfigFile(Path.Combine(Paths.ConfigPath, "MagicMike.ModSettings.cfg"), true);
			ToggleKey = Config.Bind<KeyboardShortcut>("General", "Toggle Key", new KeyboardShortcut((KeyCode)288, Array.Empty<KeyCode>()), "The key that opens and closes the Mod Settings panel.");
			ScrollSpeed = Config.Bind<float>("General", "Scroll Speed", 3f, new ConfigDescription("How many setting rows the list moves for each notch of the mouse wheel.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f), Array.Empty<object>()));
			s_panelX = Config.Bind<float>("General", "Panel Position X", 0f, new ConfigDescription("Where the panel was last dragged to, across from the centre of the screen.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				Browsable = false
			} }));
			s_panelY = Config.Bind<float>("General", "Panel Position Y", 0f, new ConfigDescription("Where the panel was last dragged to, up from the centre of the screen.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				Browsable = false
			} }));
			new Harmony("MagicMike.ModSettings").Patch((MethodBase)AccessTools.Method(typeof(Menu), "Update", (Type[])null, (Type[])null), new HarmonyMethod(typeof(ModSettings), "MenuUpdatePrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}

		private static bool MenuUpdatePrefix()
		{
			return !SettingsPanel.IsOpen;
		}
	}
	internal sealed class ModSettingsDriver : MonoBehaviour
	{
		private SettingsPanel m_panel;

		private void Start()
		{
			if (!ModSettings.IsHost)
			{
				Object.Destroy((Object)(object)this);
			}
			else
			{
				ModSettings.StartHost();
			}
		}

		private void Update()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (ModSettings.ToggleKey == null)
			{
				return;
			}
			KeyboardShortcut value = ModSettings.ToggleKey.Value;
			if (!((KeyboardShortcut)(ref value)).IsDown() || IsTyping() || ((Object)(object)m_panel != (Object)null && m_panel.IsCapturingKey))
			{
				return;
			}
			if ((Object)(object)m_panel == (Object)null)
			{
				if (GUIManager.IsHeadless() || (Object)(object)GUIManager.CustomGUIFront == (Object)null)
				{
					return;
				}
				m_panel = SettingsPanel.Create();
			}
			m_panel.Toggle();
		}

		private static bool IsTyping()
		{
			if (SettingsPanel.IsOpen)
			{
				return false;
			}
			if (!Console.IsVisible() && !TextInput.IsVisible())
			{
				if ((Object)(object)Chat.instance != (Object)null)
				{
					return Chat.instance.HasFocus();
				}
				return false;
			}
			return true;
		}
	}
	internal sealed class SettingRow
	{
		public const float RowHeight = 40f;

		private const float ResetSize = 28f;

		private const float NumberWidth = 76f;

		public readonly SettingInfo Setting;

		public readonly GameObject Root;

		private readonly SettingsPanel m_panel;

		private readonly Image m_background;

		private readonly TMP_Text m_label;

		private readonly Button m_reset;

		private Toggle m_toggle;

		private Slider m_slider;

		private TMP_InputField m_input;

		private TMP_Dropdown m_dropdown;

		private Button m_keyButton;

		private TMP_Text m_keyLabel;

		private object[] m_choices;

		private Color m_stripe = Theme.RowEven;

		private bool m_hovered;

		private bool m_refreshing;

		private ConfigEntryBase Entry => Setting.Entry;

		public bool IsDefault => object.Equals(Entry.BoxedValue, Entry.DefaultValue);

		public SettingRow(SettingsPanel panel, Transform parent, SettingInfo setting)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: 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_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: 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_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: 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_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: 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_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Expected O, but got Unknown
			m_panel = panel;
			Setting = setting;
			Root = Widgets.Row(parent, 40f);
			m_background = Root.AddComponent<Image>();
			((Graphic)m_background).color = m_stripe;
			HoverRelay hoverRelay = Root.AddComponent<HoverRelay>();
			hoverRelay.OnEnter = delegate
			{
				SetHovered(hovered: true);
			};
			hoverRelay.OnExit = delegate
			{
				SetHovered(hovered: false);
			};
			m_label = Widgets.Label(Root.transform, "", 20f, Theme.Text, (TextAlignmentOptions)4097);
			m_label.enableAutoSizing = true;
			m_label.fontSizeMin = 14f;
			m_label.fontSizeMax = 20f;
			Widgets.Place(((Component)m_label).gameObject, new Vector2(0f, 0f), new Vector2(0.42f, 1f), new Vector2(12f, 2f), new Vector2(-8f, -2f));
			GameObject val = Widgets.Child(Root.transform, "Control");
			Widgets.Place(val, new Vector2(0.42f, 0f), new Vector2(1f, 1f), new Vector2(0f, 6f), new Vector2(-46f, -6f));
			BuildControl(val.transform);
			m_reset = Widgets.IconButton<ResetIcon>(Root.transform, 3f);
			Widgets.Place(((Component)m_reset).gameObject, new Vector2(1f, 0.5f), new Vector2(1f, 0.5f), new Vector2(-36f, -14f), new Vector2(-8f, 14f));
			((UnityEvent)m_reset.onClick).AddListener((UnityAction)delegate
			{
				SetValue(Entry.DefaultValue);
			});
			Refresh();
		}

		public bool Matches(string search)
		{
			if (!string.IsNullOrEmpty(search) && !Contains(Setting.Name, search) && !Contains(Setting.Section, search))
			{
				return Contains(Setting.Description, search);
			}
			return true;
		}

		public void SetStripe(bool odd)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			m_stripe = (odd ? Theme.RowOdd : Theme.RowEven);
			((Graphic)m_background).color = (m_hovered ? Theme.RowHover : m_stripe);
		}

		private void SetHovered(bool hovered)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			m_hovered = hovered;
			((Graphic)m_background).color = (hovered ? Theme.RowHover : m_stripe);
			m_panel.ShowDescription(hovered ? this : null);
		}

		public void Refresh()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			bool isReadOnly = Setting.IsReadOnly;
			string text = (Setting.Synced ? ("  <size=70%><color=" + Theme.Tag(Theme.Muted) + ">" + (isReadOnly ? "server, locked" : "server") + "</color></size>") : "");
			m_label.text = Setting.Name + text;
			((Graphic)m_label).color = (isReadOnly ? Theme.Muted : Theme.Text);
			((Selectable)m_reset).interactable = !isReadOnly && !IsDefault;
			((Component)m_reset).gameObject.SetActive(!IsDefault);
			m_refreshing = true;
			try
			{
				object value = Entry.BoxedValue;
				if ((Object)(object)m_toggle != (Object)null)
				{
					Toggle toggle = m_toggle;
					bool flag = default(bool);
					int num;
					if (value is bool)
					{
						flag = (bool)value;
						num = 1;
					}
					else
					{
						num = 0;
					}
					toggle.SetIsOnWithoutNotify((byte)((uint)num & (flag ? 1u : 0u)) != 0);
					((Selectable)m_toggle).interactable = !isReadOnly;
				}
				if ((Object)(object)m_slider != (Object)null)
				{
					m_slider.SetValueWithoutNotify(Convert.ToSingle(value, CultureInfo.InvariantCulture));
					((Selectable)m_slider).interactable = !isReadOnly;
				}
				if ((Object)(object)m_dropdown != (Object)null)
				{
					m_dropdown.SetValueWithoutNotify(Math.Max(0, Array.FindIndex(m_choices, (object c) => object.Equals(c, value))));
					((Selectable)m_dropdown).interactable = !isReadOnly;
				}
				if ((Object)(object)m_input != (Object)null && !m_input.isFocused)
				{
					m_input.SetTextWithoutNotify(Format(value));
					((Selectable)m_input).interactable = !isReadOnly;
				}
				if ((Object)(object)m_keyButton != (Object)null)
				{
					m_keyLabel.text = (m_panel.IsCapturing(this) ? ("<color=" + Theme.Tag(Theme.AccentBright) + ">Press a key...</color>") : Format(value));
					((Selectable)m_keyButton).interactable = !isReadOnly;
				}
			}
			finally
			{
				m_refreshing = false;
			}
		}

		private void BuildControl(Transform parent)
		{
			//IL_0057: 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_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: 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_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Expected O, but got Unknown
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0304: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: 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_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: 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_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			Type settingType = Entry.SettingType;
			ConfigDescription description = Entry.Description;
			AcceptableValueBase acceptable = ((description != null) ? description.AcceptableValues : null);
			if (settingType == typeof(bool))
			{
				m_toggle = Widgets.Toggle(parent);
				Widgets.Place(((Component)m_toggle).gameObject, new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), new Vector2(0f, -12f), new Vector2(24f, 12f));
				((UnityEvent<bool>)(object)m_toggle.onValueChanged).AddListener((UnityAction<bool>)delegate(bool on)
				{
					SetValue(on);
				});
				return;
			}
			if (settingType == typeof(KeyCode) || settingType == typeof(KeyboardShortcut))
			{
				m_keyButton = Widgets.Button(parent, "", 15f);
				Widgets.Place(((Component)m_keyButton).gameObject, Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero);
				m_keyLabel = ((Component)m_keyButton).GetComponentInChildren<TMP_Text>(true);
				((UnityEvent)m_keyButton.onClick).AddListener((UnityAction)delegate
				{
					m_panel.StartCapture(this);
				});
				return;
			}
			object[] choices = GetChoices(settingType, acceptable);
			if (choices != null)
			{
				m_choices = choices;
				m_dropdown = Widgets.Dropdown(parent, 15f);
				Widgets.Place(((Component)m_dropdown).gameObject, Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero);
				m_dropdown.options = ((IEnumerable<object>)choices).Select((Func<object, OptionData>)((object c) => new OptionData(Format(c)))).ToList();
				((UnityEvent<int>)(object)m_dropdown.onValueChanged).AddListener((UnityAction<int>)delegate(int i)
				{
					SetValue(m_choices[i]);
				});
				return;
			}
			if (IsNumber(settingType) && TryGetRange(acceptable, out var min, out var max))
			{
				m_slider = Widgets.Slider(parent);
				Widgets.Place(((Component)m_slider).gameObject, new Vector2(0f, 0f), new Vector2(1f, 1f), new Vector2(2f, 2f), new Vector2(-90f, -2f));
				m_slider.minValue = min;
				m_slider.maxValue = max;
				m_slider.wholeNumbers = IsWholeNumber(settingType);
				((UnityEvent<float>)(object)m_slider.onValueChanged).AddListener((UnityAction<float>)delegate(float v)
				{
					SetValue(v);
				});
			}
			m_input = Widgets.Input(parent, 15f);
			if ((Object)(object)m_slider != (Object)null)
			{
				Widgets.Place(((Component)m_input).gameObject, new Vector2(1f, 0f), new Vector2(1f, 1f), new Vector2(-76f, 0f), Vector2.zero);
			}
			else
			{
				Widgets.Place(((Component)m_input).gameObject, Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero);
			}
			m_input.contentType = (ContentType)(IsNumber(settingType) ? (IsWholeNumber(settingType) ? 2 : 3) : 0);
			((UnityEvent<string>)(object)m_input.onEndEdit).AddListener((UnityAction<string>)OnInputSubmitted);
		}

		private void OnInputSubmitted(string text)
		{
			if (m_refreshing)
			{
				return;
			}
			try
			{
				SetValue(TomlTypeConverter.ConvertToValue(text.Replace(',', '.'), Entry.SettingType));
			}
			catch (Exception)
			{
				Refresh();
			}
		}

		public void SetValue(object value)
		{
			if (m_refreshing || Setting.IsReadOnly)
			{
				return;
			}
			try
			{
				if (value != null && value.GetType() != Entry.SettingType && IsNumber(Entry.SettingType))
				{
					value = Convert.ChangeType(value, Entry.SettingType, CultureInfo.InvariantCulture);
				}
				Entry.BoxedValue = value;
			}
			catch (Exception ex)
			{
				Logger.LogWarning((object)("[ModSettings] Could not set " + Setting.Name + ": " + ex.Message));
			}
			Refresh();
		}

		private unsafe static string Format(object value)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			if (value != null)
			{
				if (!(value is float num))
				{
					if (!(value is double num2))
					{
						if (value is KeyboardShortcut val)
						{
							if ((int)((KeyboardShortcut)(ref val)).MainKey != 0)
							{
								return ((object)(*(KeyboardShortcut*)(&val))/*cast due to .constrained prefix*/).ToString();
							}
							return "None";
						}
						return Convert.ToString(value, CultureInfo.InvariantCulture);
					}
					return num2.ToString("0.###", CultureInfo.InvariantCulture);
				}
				return num.ToString("0.###", CultureInfo.InvariantCulture);
			}
			return "";
		}

		private static object[] GetChoices(Type type, AcceptableValueBase acceptable)
		{
			if (acceptable != null && ((object)acceptable).GetType().IsGenericType && ((object)acceptable).GetType().GetGenericTypeDefinition() == typeof(AcceptableValueList<>) && ((object)acceptable).GetType().GetProperty("AcceptableValues")?.GetValue(acceptable) is Array { Length: >0 } array)
			{
				return array.Cast<object>().ToArray();
			}
			if (type.IsEnum && !type.IsDefined(typeof(FlagsAttribute), inherit: false))
			{
				return Enum.GetValues(type).Cast<object>().Distinct()
					.ToArray();
			}
			return null;
		}

		private static bool TryGetRange(AcceptableValueBase acceptable, out float min, out float max)
		{
			min = (max = 0f);
			if (acceptable == null || !((object)acceptable).GetType().IsGenericType || ((object)acceptable).GetType().GetGenericTypeDefinition() != typeof(AcceptableValueRange<>))
			{
				return false;
			}
			min = Convert.ToSingle(((object)acceptable).GetType().GetProperty("MinValue").GetValue(acceptable), CultureInfo.InvariantCulture);
			max = Convert.ToSingle(((object)acceptable).GetType().GetProperty("MaxValue").GetValue(acceptable), CultureInfo.InvariantCulture);
			return max > min;
		}

		private static bool IsNumber(Type type)
		{
			if (!IsWholeNumber(type) && !(type == typeof(float)) && !(type == typeof(double)))
			{
				return type == typeof(decimal);
			}
			return true;
		}

		private static bool IsWholeNumber(Type type)
		{
			if (!(type == typeof(int)) && !(type == typeof(long)) && !(type == typeof(short)) && !(type == typeof(byte)) && !(type == typeof(uint)) && !(type == typeof(ulong)) && !(type == typeof(ushort)))
			{
				return type == typeof(sbyte);
			}
			return true;
		}

		private static bool Contains(string text, string search)
		{
			if (text != null)
			{
				return text.IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0;
			}
			return false;
		}
	}
	internal sealed class ModInfo
	{
		public string Name;

		public string Version;

		public ConfigFile Config;

		public List<SettingInfo> Settings;
	}
	internal sealed class SettingInfo
	{
		public ConfigEntryBase Entry;

		public string Section;

		public string Name;

		public string Description;

		public bool Synced;

		public object Attributes;

		public bool IsReadOnly => SettingsDiscovery.GetField<bool?>(Attributes, "ReadOnly") == true;
	}
	internal static class SettingsDiscovery
	{
		private static readonly Regex s_sectionNumber = new Regex("^\\s*(\\d+)\\s*-\\s*");

		private static readonly Regex s_syncTag = new Regex("\\s*\\[(Not )?Synced with Server\\]\\s*$");

		public static List<ModInfo> FindMods()
		{
			List<ModInfo> list = new List<ModInfo>();
			foreach (PluginInfo value in Chainloader.PluginInfos.Values)
			{
				if (!((Object)(object)value.Instance == (Object)null) && value.Metadata.GUID.StartsWith("MagicMike.", StringComparison.OrdinalIgnoreCase))
				{
					list.Add(Describe(value.Metadata.Name, value.Metadata.Version.ToString(), value.Instance.Config));
				}
			}
			list.Sort((ModInfo a, ModInfo b) => string.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase));
			if (ModSettings.Config != null)
			{
				list.Add(Describe("Mod Settings Panel", 30.ToString(), ModSettings.Config));
			}
			return list;
		}

		private static ModInfo Describe(string name, string version, ConfigFile config)
		{
			List<(SettingInfo, int, int, int)> list = new List<(SettingInfo, int, int, int)>();
			int num = 0;
			foreach (KeyValuePair<ConfigDefinition, ConfigEntryBase> item3 in config)
			{
				ConfigEntryBase value = item3.Value;
				ConfigDescription description = value.Description;
				object obj = ((description == null) ? null : description.Tags?.FirstOrDefault((object t) => t != null && t.GetType().Name == "ConfigurationManagerAttributes"));
				if (GetField<bool?>(obj, "Browsable") != false)
				{
					Match match = s_sectionNumber.Match(value.Definition.Section);
					SettingInfo obj2 = new SettingInfo
					{
						Entry = value,
						Section = (match.Success ? value.Definition.Section.Substring(match.Length) : value.Definition.Section),
						Name = (GetField<string>(obj, "DispName") ?? value.Definition.Key)
					};
					Regex regex = s_syncTag;
					ConfigDescription description2 = value.Description;
					obj2.Description = regex.Replace(((description2 != null) ? description2.Description : null) ?? "", "").Trim();
					obj2.Synced = GetField<bool>(obj, "IsAdminOnly");
					obj2.Attributes = obj;
					SettingInfo item = obj2;
					int item2 = (match.Success ? int.Parse(match.Groups[1].Value) : int.MaxValue);
					list.Add((item, item2, GetField<int?>(obj, "Order").GetValueOrDefault(), num++));
				}
			}
			List<SettingInfo> settings = (from f in list.OrderBy<(SettingInfo, int, int, int), int>(((SettingInfo setting, int section, int order, int index) f) => f.section).ThenBy<(SettingInfo, int, int, int), string>(((SettingInfo setting, int section, int order, int index) f) => f.setting.Section, StringComparer.OrdinalIgnoreCase).ThenByDescending<(SettingInfo, int, int, int), int>(((SettingInfo setting, int section, int order, int index) f) => f.order)
					.ThenBy<(SettingInfo, int, int, int), int>(((SettingInfo setting, int section, int order, int index) f) => f.index)
				select f.setting).ToList();
			return new ModInfo
			{
				Name = name,
				Version = version,
				Config = config,
				Settings = settings
			};
		}

		public static T GetField<T>(object target, string name)
		{
			if (target == null)
			{
				return default(T);
			}
			Type type = target.GetType();
			object obj = type.GetField(name, BindingFlags.Instance | BindingFlags.Public)?.GetValue(target) ?? type.GetProperty(name, BindingFlags.Instance | BindingFlags.Public)?.GetValue(target);
			if (obj is T)
			{
				return (T)obj;
			}
			return default(T);
		}
	}
	internal sealed class SettingsPanel : MonoBehaviour
	{
		private const float MaxWidth = 1040f;

		private const float MaxHeight = 760f;

		private const float Margin = 32f;

		private const float RefreshInterval = 1f;

		private const float ModTitleWidth = 300f;

		private const float SectionTop = 162f;

		private const float SectionRowHeight = 32f;

		private const float SectionGap = 5f;

		private const int MaxSectionsPerRow = 7;

		private static readonly KeyCode[] s_modifiers;

		private static readonly KeyCode[] s_bindableKeys;

		private static string s_lastMod;

		private readonly List<SettingRow> m_rows = new List<SettingRow>();

		private readonly List<(GameObject header, List<SettingRow> rows)> m_sections = new List<(GameObject, List<SettingRow>)>();

		private readonly List<string> m_sectionNames = new List<string>();

		private readonly List<(Button button, TMP_Text label, GameObject header)> m_sectionButtons = new List<(Button, TMP_Text, GameObject)>();

		private RectTransform m_sectionBar;

		private GameObject m_shownSection;

		private GameObject m_jumpedTo;

		private float m_jumpedOffset;

		private readonly Dictionary<ConfigFile, bool> m_savedSaveOnSet = new Dictionary<ConfigFile, bool>();

		private readonly HashSet<ConfigFile> m_changedFiles = new HashSet<ConfigFile>();

		private readonly List<(Button button, TMP_Text label)> m_tabs = new List<(Button, TMP_Text)>();

		private List<ModInfo> m_mods = new List<ModInfo>();

		private ModInfo m_selected;

		private RectTransform m_tabBar;

		private ScrollRect m_settingsList;

		private TMP_Text m_modTitle;

		private TMP_Text m_description;

		private TMP_Text m_hint;

		private TMP_Text m_empty;

		private TMP_InputField m_search;

		private RectTransform m_panel;

		private DragMove m_drag;

		private SettingRow m_capturing;

		private int m_captureFrame;

		private float m_nextRefresh;

		private bool m_inputFocusedLastFrame;

		private bool m_destroying;

		private static string DescriptionHint => "<color=" + Theme.Tag(Theme.Muted) + ">Hover over a setting to see what it does.</color>";

		public static bool IsOpen { get; private set; }

		public bool IsCapturingKey => m_capturing != null;

		public static SettingsPanel Create()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_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_0060: 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)
			Transform transform = GUIManager.CustomGUIFront.transform;
			Image val = Widgets.Box(transform, "MagicMikeModSettings", Theme.Dim);
			Widgets.Fill(((Component)val).gameObject);
			SettingsPanel settingsPanel = ((Component)val).gameObject.AddComponent<SettingsPanel>();
			Rect rect = ((RectTransform)transform).rect;
			Vector2 size = ((Rect)(ref rect)).size;
			settingsPanel.Build(Mathf.Min(1040f, size.x * 0.9f), Mathf.Min(760f, size.y * 0.9f));
			((Component)val).gameObject.SetActive(false);
			return settingsPanel;
		}

		private void Build(float width, float height)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_0044: 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_0055: 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_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: 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_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Expected O, but got Unknown
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Expected O, but got Unknown
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Expected O, but got Unknown
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0323: 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_03a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: Unknown result type (might be due to invalid IL or missing references)
			//IL_03be: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0403: Unknown result type (might be due to invalid IL or missing references)
			//IL_0412: Unknown result type (might be due to invalid IL or missing references)
			//IL_0421: Unknown result type (might be due to invalid IL or missing references)
			//IL_0441: Unknown result type (might be due to invalid IL or missing references)
			//IL_048c: Unknown result type (might be due to invalid IL or missing references)
			//IL_049b: 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_04b9: 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_04da: Expected O, but got Unknown
			//IL_04eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f5: Expected O, but got Unknown
			//IL_050c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0511: 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_052f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0550: 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_0589: Unknown result type (might be due to invalid IL or missing references)
			//IL_0598: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0602: Unknown result type (might be due to invalid IL or missing references)
			//IL_0611: Unknown result type (might be due to invalid IL or missing references)
			//IL_0620: Unknown result type (might be due to invalid IL or missing references)
			//IL_063c: Unknown result type (might be due to invalid IL or missing references)
			//IL_068a: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e1: Unknown result type (might be due to invalid IL or missing references)
			Image val = Widgets.Box(((Component)this).transform, "Panel", Theme.Panel, Theme.PanelOutline, 2f);
			RectTransform val2 = (RectTransform)((Component)val).transform;
			Vector2 val3 = default(Vector2);
			((Vector2)(ref val3))..ctor(0.5f, 0.5f);
			val2.anchorMax = val3;
			val2.anchorMin = val3;
			val2.sizeDelta = new Vector2(width, height);
			Transform transform = ((Component)val).transform;
			m_panel = val2;
			m_drag = ((Component)val).gameObject.AddComponent<DragMove>();
			m_drag.Target = val2;
			m_drag.OnMoved = delegate(Vector2 position)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				ModSettings.PanelPosition = position;
			};
			Image obj = Widgets.Box(transform, "TitleBar", Theme.Header);
			Widgets.Place(((Component)obj).gameObject, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(12f, -66f), new Vector2(-12f, -12f));
			Widgets.Place(((Component)Widgets.Box(((Component)obj).transform, "Accent", Theme.Accent)).gameObject, new Vector2(0f, 0f), new Vector2(0f, 1f), Vector2.zero, new Vector2(4f, 0f));
			Widgets.Place(((Component)Widgets.Label(((Component)obj).transform, "Magic Mike's Mod Settings", 26f, Theme.TextBright, (TextAlignmentOptions)514, bold: true)).gameObject, Vector2.zero, Vector2.one, new Vector2(120f, 0f), new Vector2(-120f, 0f));
			Button obj2 = Widgets.IconButton<CloseIcon>(((Component)obj).transform, 9f);
			Widgets.Place(((Component)obj2).gameObject, new Vector2(1f, 0.5f), new Vector2(1f, 0.5f), new Vector2(-46f, -15f), new Vector2(-12f, 15f));
			((UnityEvent)obj2.onClick).AddListener(new UnityAction(Close));
			Button obj3 = Widgets.Button(((Component)obj).transform, "Re-centre", 14f);
			Widgets.Place(((Component)obj3).gameObject, new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), new Vector2(16f, -15f), new Vector2(106f, 15f));
			((UnityEvent)obj3.onClick).AddListener(new UnityAction(ResetPosition));
			m_tabBar = (RectTransform)Widgets.Child(transform, "Tabs").transform;
			Widgets.Place(((Component)m_tabBar).gameObject, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(32f, -108f), new Vector2(-32f, -74f));
			m_modTitle = Widgets.Label(transform, "", 20f, Theme.Text, (TextAlignmentOptions)4097, bold: true);
			m_modTitle.enableAutoSizing = true;
			m_modTitle.fontSizeMin = 14f;
			m_modTitle.fontSizeMax = 20f;
			m_modTitle.textWrappingMode = (TextWrappingModes)0;
			m_modTitle.overflowMode = (TextOverflowModes)1;
			Widgets.Place(((Component)m_modTitle).gameObject, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(36f, -154f), new Vector2(332f, -116f));
			m_search = Widgets.Input(transform, 17f, "Search settings...");
			Widgets.Place(((Component)m_search).gameObject, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(344f, -154f), new Vector2(-32f, -116f));
			m_search.textViewport.offsetMax = new Vector2(-46f, -2f);
			((UnityEvent<string>)(object)m_search.onValueChanged).AddListener((UnityAction<string>)delegate
			{
				ApplySearch();
			});
			Button obj4 = Widgets.IconButton<CloseIcon>(((Component)m_search).transform, 9f);
			Widgets.Place(((Component)obj4).gameObject, new Vector2(1f, 0.5f), new Vector2(1f, 0.5f), new Vector2(-38f, -15f), new Vector2(-4f, 15f));
			((UnityEvent)obj4.onClick).AddListener((UnityAction)delegate
			{
				m_search.text = "";
			});
			m_sectionBar = (RectTransform)Widgets.Child(transform, "Sections").transform;
			m_settingsList = Widgets.ScrollView(transform);
			Widgets.Place(((Component)m_settingsList).gameObject, Vector2.zero, Vector2.one, new Vector2(32f, 166f), new Vector2(-32f, -204f));
			m_empty = Widgets.Label((Transform)(object)m_settingsList.viewport, "No settings match your search.", 17f, Theme.Muted, (TextAlignmentOptions)514);
			Widgets.Place(((Component)m_empty).gameObject, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0f, -60f), new Vector2(0f, -20f));
			((Component)m_empty).gameObject.SetActive(false);
			Image val4 = Widgets.Box(transform, "Description", Theme.Field, Theme.FieldOutline);
			Widgets.Place(((Component)val4).gameObject, new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(32f, 48f), new Vector2(-32f, 158f));
			m_description = Widgets.Label(((Component)val4).transform, DescriptionHint, 18f, Theme.Text, (TextAlignmentOptions)257);
			m_description.textWrappingMode = (TextWrappingModes)1;
			m_description.overflowMode = (TextOverflowModes)3;
			Widgets.Fill(((Component)m_description).gameObject, 8f);
			m_hint = Widgets.Label(transform, "", 14f, Theme.Muted, (TextAlignmentOptions)514);
			Widgets.Place(((Component)m_hint).gameObject, new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(32f, 14f), new Vector2(-32f, 40f));
		}

		public void Open()
		{
			//IL_0031: 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_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			if (IsOpen)
			{
				return;
			}
			IsOpen = true;
			((Component)this).gameObject.SetActive(true);
			((Component)this).transform.SetAsLastSibling();
			m_panel.anchoredPosition = m_drag.Clamp(ModSettings.PanelPosition);
			GUIManager.BlockInput(true);
			m_mods = SettingsDiscovery.FindMods();
			foreach (ModInfo mod in m_mods)
			{
				if (!m_savedSaveOnSet.ContainsKey(mod.Config))
				{
					m_savedSaveOnSet[mod.Config] = mod.Config.SaveOnConfigSet;
					mod.Config.SaveOnConfigSet = false;
					mod.Config.SettingChanged += OnSettingChanged;
				}
			}
			BuildTabs();
			Select(m_mods.FirstOrDefault((ModInfo m) => m.Name == s_lastMod) ?? m_mods.FirstOrDefault());
			m_hint.text = "Press " + ((object)ModSettings.ToggleKey.Value/*cast due to .constrained prefix*/).ToString() + " or Esc to close   |   Changes are saved when the panel closes";
		}

		public void Close()
		{
			if (!IsOpen)
			{
				return;
			}
			IsOpen = false;
			m_capturing = null;
			GUIManager.BlockInput(false);
			if (!m_destroying)
			{
				((Component)this).gameObject.SetActive(false);
			}
			foreach (KeyValuePair<ConfigFile, bool> item in m_savedSaveOnSet)
			{
				item.Key.SettingChanged -= OnSettingChanged;
				item.Key.SaveOnConfigSet = item.Value;
				if (m_changedFiles.Contains(item.Key))
				{
					try
					{
						item.Key.Save();
					}
					catch (Exception ex)
					{
						Logger.LogWarning((object)("[ModSettings] Could not save " + item.Key.ConfigFilePath + ": " + ex.Message));
					}
				}
			}
			bool num = m_changedFiles.Count > 0;
			m_savedSaveOnSet.Clear();
			m_changedFiles.Clear();
			if (num)
			{
				SyncWithServer();
			}
		}

		public void Toggle()
		{
			if (IsOpen)
			{
				Close();
			}
			else
			{
				Open();
			}
		}

		private void OnDestroy()
		{
			m_destroying = true;
			Close();
		}

		private void OnSettingChanged(object sender, SettingChangedEventArgs args)
		{
			object obj;
			if (args == null)
			{
				obj = null;
			}
			else
			{
				ConfigEntryBase changedSetting = args.ChangedSetting;
				obj = ((changedSetting != null) ? changedSetting.ConfigFile : null);
			}
			if (obj == null)
			{
				obj = ((sender is ConfigFile) ? sender : null);
			}
			ConfigFile val = (ConfigFile)obj;
			if (val != null)
			{
				m_changedFiles.Add(val);
			}
		}

		private static void SyncWithServer()
		{
			if ((Object)(object)ZNet.instance == (Object)null)
			{
				return;
			}
			string[] array = new string[2] { "InvokeOnConfigurationWindowClosed", "SynchronizeChangedConfig" };
			foreach (string text in array)
			{
				try
				{
					AccessTools.Method(typeof(SynchronizationManager), text, (Type[])null, (Type[])null)?.Invoke(SynchronizationManager.Instance, null);
				}
				catch (Exception ex)
				{
					Logger.LogWarning((object)("[ModSettings] Could not sync settings with the server (" + text + "): " + (ex.InnerException ?? ex).Message));
				}
			}
		}

		private void ResetPosition()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			m_panel.anchoredPosition = Vector2.zero;
			ModSettings.PanelPosition = Vector2.zero;
		}

		private void BuildTabs()
		{
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Expected O, but got Unknown
			ClearChildren((Transform)(object)m_tabBar);
			m_tabs.Clear();
			int num = Math.Max(1, m_mods.Count);
			for (int i = 0; i < m_mods.Count; i++)
			{
				ModInfo mod = m_mods[i];
				Button val = Widgets.Button((Transform)(object)m_tabBar, mod.Name, 19f);
				Widgets.Place(((Component)val).gameObject, new Vector2((float)i / (float)num, 0f), new Vector2((float)(i + 1) / (float)num, 1f), new Vector2(2.5f, 0f), new Vector2(-2.5f, 0f));
				TMP_Text componentInChildren = ((Component)val).GetComponentInChildren<TMP_Text>(true);
				componentInChildren.enableAutoSizing = true;
				componentInChildren.fontSizeMin = 12f;
				componentInChildren.fontSizeMax = 19f;
				((UnityEvent)val.onClick).AddListener((UnityAction)delegate
				{
					Select(mod);
				});
				m_tabs.Add((val, componentInChildren));
			}
		}

		private void HighlightSelectedTab()
		{
			//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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: 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_0075: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < m_tabs.Count && i < m_mods.Count; i++)
			{
				bool flag = m_mods[i] == m_selected;
				var (val, val2) = m_tabs[i];
				((Selectable)val).colors = (flag ? Theme.Colors(Theme.Selected, Theme.Selected, Theme.ButtonPressed, Theme.ButtonDisabled) : Theme.Colors(Theme.Button, Theme.ButtonHover, Theme.ButtonPressed, Theme.ButtonDisabled));
				((Graphic)val2).color = (flag ? Theme.TextBright : Theme.Text);
				val2.fontStyle = (FontStyles)(flag ? 1 : 0);
			}
		}

		private void Select(ModInfo mod)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			m_selected = mod;
			m_capturing = null;
			s_lastMod = mod?.Name;
			HighlightSelectedTab();
			m_modTitle.text = ((mod == null) ? "No settings found" : (mod.Name + "  <size=70%><color=" + Theme.Tag(Theme.Muted) + ">v" + mod.Version + "</color></size>"));
			ShowDescription(null);
			ClearChildren((Transform)(object)m_settingsList.content);
			m_rows.Clear();
			m_sections.Clear();
			m_sectionNames.Clear();
			m_shownSection = (m_jumpedTo = null);
			if (mod == null)
			{
				BuildSectionButtons();
				return;
			}
			string text = null;
			List<SettingRow> list = null;
			foreach (SettingInfo setting in mod.Settings)
			{
				if (setting.Section != text)
				{
					text = setting.Section;
					list = new List<SettingRow>();
					m_sections.Add((BuildSectionHeader(text), list));
					m_sectionNames.Add(text);
				}
				SettingRow item = new SettingRow(this, (Transform)(object)m_settingsList.content, setting);
				m_rows.Add(item);
				list.Add(item);
			}
			BuildSectionButtons();
			ApplySearch();
			m_settingsList.verticalNormalizedPosition = 1f;
		}

		private void BuildSectionButtons()
		{
			//IL_0071: 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_0092: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Expected O, but got Unknown
			ClearChildren((Transform)(object)m_sectionBar);
			m_sectionButtons.Clear();
			int count = m_sections.Count;
			int num = ((count != 0) ? ((count <= 7) ? 1 : 2) : 0);
			int num2 = ((num != 0) ? Mathf.CeilToInt((float)count / (float)num) : 0);
			float num3 = (float)num * 32f + (float)Math.Max(0, num - 1) * 5f;
			Widgets.Place(((Component)m_sectionBar).gameObject, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(32f, 0f - (162f + num3)), new Vector2(-32f, -162f));
			RectTransform val = (RectTransform)((Component)m_settingsList).transform;
			val.offsetMax = new Vector2(val.offsetMax.x, 0f - (162f + num3 + ((num > 0) ? 10f : 0f)));
			for (int i = 0; i < count; i++)
			{
				int num4 = i / num2;
				int num5 = i % num2;
				int num6 = ((num4 == num - 1) ? (count - num4 * num2) : num2);
				GameObject header = m_sections[i].header;
				Button val2 = Widgets.Button((Transform)(object)m_sectionBar, m_sectionNames[i]);
				Widgets.Place(((Component)val2).gameObject, new Vector2((float)num5 / (float)num6, 1f - (float)(num4 + 1) / (float)num), new Vector2((float)(num5 + 1) / (float)num6, 1f - (float)num4 / (float)num), new Vector2(2.5f, (num4 < num - 1) ? 2.5f : 0f), new Vector2(-2.5f, (num4 > 0) ? (-2.5f) : 0f));
				TMP_Text componentInChildren = ((Component)val2).GetComponentInChildren<TMP_Text>(true);
				componentInChildren.enableAutoSizing = true;
				componentInChildren.fontSizeMin = 11f;
				componentInChildren.fontSizeMax = 16f;
				componentInChildren.textWrappingMode = (TextWrappingModes)0;
				componentInChildren.overflowMode = (TextOverflowModes)1;
				((UnityEvent)val2.onClick).AddListener((UnityAction)delegate
				{
					JumpTo(header);
				});
				m_sectionButtons.Add((val2, componentInChildren, header));
			}
			HighlightSection(null);
		}

		private void JumpTo(GameObject header)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: 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)
			if (!((Object)(object)header == (Object)null))
			{
				if (!header.activeSelf)
				{
					m_search.text = "";
				}
				RectTransform content = m_settingsList.content;
				LayoutRebuilder.ForceRebuildLayoutImmediate(content);
				Rect rect = content.rect;
				float height = ((Rect)(ref rect)).height;
				rect = m_settingsList.viewport.rect;
				float num = Mathf.Max(0f, height - ((Rect)(ref rect)).height);
				float num2 = Mathf.Clamp(SectionOffset(header) - 2f, 0f, num);
				m_settingsList.StopMovement();
				content.anchoredPosition = new Vector2(content.anchoredPosition.x, num2);
				m_jumpedTo = header;
				m_jumpedOffset = num2;
				HighlightSection(header);
			}
		}

		private static float SectionOffset(GameObject header)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			RectTransform val = (RectTransform)header.transform;
			float y = val.anchoredPosition.y;
			Rect rect = val.rect;
			return 0f - (y + ((Rect)(ref rect)).height * (1f - val.pivot.y));
		}

		private GameObject SectionShown()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			float y = m_settingsList.content.anchoredPosition.y;
			if ((Object)(object)m_jumpedTo != (Object)null && Mathf.Abs(y - m_jumpedOffset) < 1f)
			{
				return m_jumpedTo;
			}
			m_jumpedTo = null;
			GameObject val = null;
			foreach (var section in m_sections)
			{
				GameObject item = section.header;
				if (item.activeSelf && ((Object)(object)val == (Object)null || SectionOffset(item) <= y + 4f))
				{
					val = item;
				}
			}
			return val;
		}

		private void HighlightSection(GameObject shown)
		{
			//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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			m_shownSection = shown;
			foreach (var sectionButton in m_sectionButtons)
			{
				Button item = sectionButton.button;
				TMP_Text item2 = sectionButton.label;
				bool flag = (Object)(object)sectionButton.header == (Object)(object)shown;
				((Selectable)item).colors = (flag ? Theme.Colors(Theme.Selected, Theme.Selected, Theme.ButtonPressed, Theme.ButtonDisabled) : Theme.Colors(Theme.Button, Theme.ButtonHover, Theme.ButtonPressed, Theme.ButtonDisabled));
				((Graphic)item2).color = (flag ? Theme.TextBright : Theme.Text);
			}
		}

		private GameObject BuildSectionHeader(string section)
		{
			//IL_001b: 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_0057: 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_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = Widgets.Row((Transform)(object)m_settingsList.content, 34f);
			((Graphic)obj.AddComponent<Image>()).color = Theme.Header;
			Widgets.Place(((Component)Widgets.Box(obj.transform, "Accent", Theme.Accent)).gameObject, new Vector2(0f, 0f), new Vector2(0f, 1f), Vector2.zero, new Vector2(4f, 0f));
			Widgets.Place(((Component)Widgets.Label(obj.transform, section, 17f, Theme.TextBright, (TextAlignmentOptions)4097, bold: true)).gameObject, Vector2.zero, Vector2.one, new Vector2(16f, 0f), new Vector2(-8f, 0f));
			return obj;
		}

		private void ApplySearch()
		{
			string search = m_search.text?.Trim();
			bool flag = false;
			foreach (var section in m_sections)
			{
				GameObject item = section.header;
				List<SettingRow> item2 = section.rows;
				bool flag2 = false;
				bool flag3 = false;
				foreach (SettingRow item3 in item2)
				{
					bool flag4 = item3.Matches(search);
					item3.Root.SetActive(flag4);
					if (flag4)
					{
						item3.SetStripe(flag3);
						flag3 = !flag3;
						flag2 = true;
					}
				}
				item.SetActive(flag2);
				flag = flag || flag2;
			}
			((Component)m_empty).gameObject.SetActive(!flag && m_selected != null);
		}

		public void ShowDescription(SettingRow row)
		{
			//IL_0115: 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)
			if (row == null)
			{
				m_description.text = DescriptionHint;
				return;
			}
			SettingInfo setting = row.Setting;
			List<string> list = new List<string> { "Default: " + FormatDefault(setting.Entry) };
			ConfigDescription description = setting.Entry.Description;
			AcceptableValueBase val = ((description != null) ? description.AcceptableValues : null);
			if (val != null && ((object)val).GetType().IsGenericType && ((object)val).GetType().GetGenericTypeDefinition() == typeof(AcceptableValueRange<>))
			{
				list.Add("Range: " + ((object)val).GetType().GetProperty("MinValue").GetValue(val)?.ToString() + " to " + ((object)val).GetType().GetProperty("MaxValue").GetValue(val));
			}
			if (setting.Synced)
			{
				list.Add(setting.IsReadOnly ? "Set by the server (only an admin can change it)" : "Synced from the server");
			}
			m_description.text = "<b><color=" + Theme.Tag(Theme.TextBright) + ">" + setting.Name + "</color></b>   <size=85%><color=" + Theme.Tag(Theme.Muted) + ">" + string.Join("   |   ", list) + "</color></size>\n" + setting.Description;
		}

		private unsafe static string FormatDefault(ConfigEntryBase entry)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			object defaultValue = entry.DefaultValue;
			if (defaultValue is KeyboardShortcut val)
			{
				if ((int)((KeyboardShortcut)(ref val)).MainKey != 0)
				{
					return ((object)(*(KeyboardShortcut*)(&val))/*cast due to .constrained prefix*/).ToString();
				}
				return "None";
			}
			return TomlTypeConverter.ConvertToString(defaultValue, entry.SettingType);
		}

		public bool IsCapturing(SettingRow row)
		{
			return m_capturing == row;
		}

		public void StartCapture(SettingRow row)
		{
			if (!row.Setting.IsReadOnly)
			{
				SettingRow capturing = m_capturing;
				m_capturing = row;
				m_captureFrame = Time.frameCount;
				capturing?.Refresh();
				row.Refresh();
			}
		}

		private void EndCapture(object value)
		{
			SettingRow capturing = m_capturing;
			m_capturing = null;
			if (value != null)
			{
				capturing.SetValue(value);
			}
			capturing.Refresh();
		}

		private void Update()
		{
			if (!IsOpen)
			{
				return;
			}
			if (m_capturing != null)
			{
				UpdateCapture();
			}
			else if (Input.GetKeyDown((KeyCode)27) && !m_inputFocusedLastFrame)
			{
				Close();
				return;
			}
			m_settingsList.scrollSensitivity = ModSettings.ScrollSpeed.Value * 42f;
			GameObject val = SectionShown();
			if ((Object)(object)val != (Object)(object)m_shownSection)
			{
				HighlightSection(val);
			}
			if (Time.unscaledTime >= m_nextRefresh)
			{
				m_nextRefresh = Time.unscaledTime + 1f;
				foreach (SettingRow row in m_rows)
				{
					row.Refresh();
				}
			}
			GameObject val2 = (((Object)(object)EventSystem.current != (Object)null) ? EventSystem.current.currentSelectedGameObject : null);
			TMP_InputField val3 = (((Object)(object)val2 != (Object)null) ? val2.GetComponent<TMP_InputField>() : null);
			m_inputFocusedLastFrame = (Object)(object)val3 != (Object)null && val3.isFocused;
		}

		private void UpdateCapture()
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			if (Time.frameCount == m_captureFrame)
			{
				return;
			}
			if (Input.GetKeyDown((KeyCode)27))
			{
				EndCapture(null);
				return;
			}
			bool flag = m_capturing.Setting.Entry.SettingType == typeof(KeyboardShortcut);
			KeyCode[] array = s_bindableKeys;
			foreach (KeyCode val in array)
			{
				if (Input.GetKeyDown(val))
				{
					if (!flag)
					{
						EndCapture(val);
						return;
					}
					if (Array.IndexOf(s_modifiers, val) < 0)
					{
						EndCapture((object)new KeyboardShortcut(val, HeldModifiers(val)));
						return;
					}
				}
			}
			if (!flag)
			{
				return;
			}
			array = s_modifiers;
			foreach (KeyCode val2 in array)
			{
				if (Input.GetKeyUp(val2))
				{
					EndCapture((object)new KeyboardShortcut(val2, HeldModifiers(val2)));
					break;
				}
			}
		}

		private static KeyCode[] HeldModifiers(KeyCode except)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			return s_modifiers.Where((KeyCode m) => m != except && Input.GetKey(m)).ToArray();
		}

		private static void ClearChildren(Transform parent)
		{
			for (int num = parent.childCount - 1; num >= 0; num--)
			{
				GameObject gameObject = ((Component)parent.GetChild(num)).gameObject;
				gameObject.SetActive(false);
				gameObject.transform.SetParent((Transform)null, false);
				Object.Destroy((Object)(object)gameObject);
			}
		}

		static SettingsPanel()
		{
			KeyCode[] array = new KeyCode[6];
			RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			s_modifiers = (KeyCode[])(object)array;
			s_bindableKeys = (from KeyCode k in Enum.GetValues(typeof(KeyCode))
				where (int)k != 0 && (int)k < 330
				select k).Distinct().ToArray();
		}
	}
	internal static class Theme
	{
		public static readonly Color Dim = new Color(0f, 0f, 0f, 0.68f);

		public static readonly Color DimConfirm = new Color(0f, 0f, 0f, 0.44f);

		public static readonly Color Panel = new Color(0.2f, 0.135f, 0.105f, 0.99f);

		public static readonly Color PanelOutline = new Color(0.62f, 0.34f, 0.11f, 1f);

		public static readonly Color Header = new Color(0.29f, 0.17f, 0.09f, 1f);

		public static readonly Color Field = new Color(0.09f, 0.07f, 0.06f, 0.92f);

		public static readonly Color FieldHover = new Color(0.15f, 0.11f, 0.08f, 0.95f);

		public static readonly Color FieldOutline = new Color(0.42f, 0.27f, 0.14f, 1f);

		public static readonly Color Button = new Color(0.16f, 0.13f, 0.11f, 0.98f);

		public static readonly Color ButtonHover = new Color(0.3f, 0.2f, 0.12f, 1f);

		public static readonly Color ButtonPressed = new Color(0.42f, 0.27f, 0.12f, 1f);

		public static readonly Color ButtonDisabled = new Color(0.13f, 0.11f, 0.1f, 0.6f);

		public static readonly Color ButtonOutline = new Color(0.55f, 0.32f, 0.12f, 0.9f);

		public static readonly Color Selected = new Color(0.34f, 0.22f, 0.12f, 1f);

		public static readonly Color Track = new Color(0.12f, 0.1f, 0.1f, 0.95f);

		public static readonly Color ScrollHandle = new Color(0.72f, 0.4f, 0.13f, 1f);

		public static readonly Color SliderHandleOutline = new Color(0f, 0f, 0f, 0.6f);

		public static readonly Color ListBackground = new Color(0f, 0f, 0f, 0.1f);

		public static readonly Color Accent = new Color(0.95f, 0.62f, 0.17f, 1f);

		public static readonly Color AccentBright = new Color(1f, 0.72f, 0.28f, 1f);

		public static readonly Color Text = new Color(0.92f, 0.78f, 0.52f, 1f);

		public static readonly Color TextBright = new Color(1f, 0.64f, 0.12f, 1f);

		public static readonly Color Muted = new Color(0.62f, 0.54f, 0.44f, 1f);

		public static readonly Color Caret = new Color(1f, 0.78f, 0.28f, 1f);

		public static readonly Color TextSelection = new Color(0.82f, 0.48f, 0.12f, 0.52f);

		public static readonly Color RowEven = new Color(0f, 0f, 0f, 0.14f);

		public static readonly Color RowOdd = new Color(0f, 0f, 0f, 0.05f);

		public static readonly Color RowHover = new Color(0.62f, 0.34f, 0.11f, 0.16f);

		public static string Tag(Color color)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return "#" + ColorUtility.ToHtmlStringRGBA(color);
		}

		public static ColorBlock Colors(Color normal, Color hover, Color pressed, Color disabled)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			ColorBlock defaultColorBlock = ColorBlock.defaultColorBlock;
			((ColorBlock)(ref defaultColorBlock)).normalColor = normal;
			((ColorBlock)(ref defaultColorBlock)).highlightedColor = hover;
			((ColorBlock)(ref defaultColorBlock)).pressedColor = pressed;
			((ColorBlock)(ref defaultColorBlock)).selectedColor = normal;
			((ColorBlock)(ref defaultColorBlock)).disabledColor = disabled;
			((ColorBlock)(ref defaultColorBlock)).colorMultiplier = 1f;
			((ColorBlock)(ref defaultColorBlock)).fadeDuration = 0.08f;
			return defaultColorBlock;
		}
	}
	internal static class Widgets
	{
		private static TMP_FontAsset s_font;

		public static TMP_FontAsset Font
		{
			get
			{
				if ((Object)(object)s_font == (Object)null)
				{
					s_font = GUIManager.Instance.TMP_AveriaSansLibre;
				}
				if ((Object)(object)s_font == (Object)null)
				{
					s_font = ((IEnumerable<TMP_FontAsset>)Resources.FindObjectsOfTypeAll<TMP_FontAsset>()).FirstOrDefault((Func<TMP_FontAsset, bool>)((TMP_FontAsset f) => ((Object)f).name.Contains("Averia")));
				}
				if ((Object)(object)s_font == (Object)null)
				{
					s_font = TMP_Settings.defaultFontAsset;
				}
				return s_font;
			}
		}

		public static RectTransform Place(GameObject go, Vector2 anchorMin, Vector2 anchorMax, Vector2 offsetMin, Vector2 offsetMax)
		{
			//IL_0006: 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_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			RectTransform val = (RectTransform)go.transform;
			val.anchorMin = anchorMin;
			val.anchorMax = anchorMax;
			val.pivot = new Vector2(0.5f, 0.5f);
			val.offsetMin = offsetMin;
			val.offsetMax = offsetMax;
			return val;
		}

		public static void Fill(GameObject go, float inset = 0f)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			Place(go, Vector2.zero, Vector2.one, new Vector2(inset, inset), new Vector2(0f - inset, 0f - inset));
		}

		public static GameObject Child(Transform parent, string name)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(parent, false);
			return val;
		}

		public static Image Box(Transform parent, string name, Color color, Color? outline = null, float outlineWidth = 1f)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Child(parent, name);
			Image obj = val.AddComponent<Image>();
			((Graphic)obj).color = color;
			if (outline.HasValue)
			{
				Outline obj2 = val.AddComponent<Outline>();
				((Shadow)obj2).effectColor = outline.Value;
				((Shadow)obj2).effectDistance = new Vector2(outlineWidth, 0f - outlineWidth);
			}
			return obj;
		}

		public static TMP_Text Label(Transform parent, string text, float size, Color color, TextAlignmentOptions alignment = (TextAlignmentOptions)4097, bool bold = false)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Child(parent, "Text");
			val.SetActive(false);
			TextMeshProUGUI obj = val.AddComponent<TextMeshProUGUI>();
			((TMP_Text)obj).font = Font;
			((TMP_Text)obj).fontSize = size;
			((Graphic)obj).color = color;
			((TMP_Text)obj).alignment = alignment;
			((TMP_Text)obj).fontStyle = (FontStyles)(bold ? 1 : 0);
			((TMP_Text)obj).richText = true;
			((TMP_Text)obj).textWrappingMode = (TextWrappingModes)0;
			((TMP_Text)obj).overflowMode = (TextOverflowModes)1;
			((Graphic)obj).raycastTarget = false;
			((TMP_Text)obj).text = text;
			val.SetActive(true);
			return (TMP_Text)(object)obj;
		}

		public static Button Button(Transform parent, string text, float fontSize = 16f)
		{
			//IL_0006: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: 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)
			Image val = Box(parent, "Button", Color.white, Theme.ButtonOutline);
			Button obj = ((Component)val).gameObject.AddComponent<Button>();
			((Selectable)obj).targetGraphic = (Graphic)(object)val;
			((Selectable)obj).colors = Theme.Colors(Theme.Button, Theme.ButtonHover, Theme.ButtonPressed, Theme.ButtonDisabled);
			AddClickSound(((Component)obj).gameObject);
			Fill(((Component)Label(((Component)val).transform, text, fontSize, Theme.Text, (TextAlignmentOptions)514)).gameObject, 4f);
			return obj;
		}

		public static Button IconButton<T>(Transform parent, float inset) where T : MaskableGraphic
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			Button obj = Button(parent, "", 14f);
			GameObject obj2 = Child(((Component)obj).transform, typeof(T).Name);
			obj2.AddComponent<CanvasRenderer>();
			T val = obj2.AddComponent<T>();
			((Graphic)(object)val).color = Theme.Accent;
			((Graphic)(object)val).raycastTarget = false;
			Fill(obj2, inset);
			return obj;
		}

		public static Toggle Toggle(Transform parent)
		{
			//IL_0006: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			Image val = Box(parent, "Toggle", Color.white, Theme.FieldOutline);
			Toggle obj = ((Component)val).gameObject.AddComponent<Toggle>();
			((Selectable)obj).targetGraphic = (Graphic)(object)val;
			((Selectable)obj).colors = Theme.Colors(Theme.Field, Theme.FieldHover, Theme.ButtonPressed, Theme.ButtonDisabled);
			Image val2 = Box(((Component)val).transform, "Check", Theme.Accent);
			Fill(((Component)val2).gameObject, 5f);
			((Graphic)val2).raycastTarget = false;
			obj.graphic = (Graphic)(object)val2;
			AddClickSound(((Component)obj).gameObject);
			return obj;
		}

		public static Slider Slider(Transform parent)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: 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_0063: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: 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_00c5: 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_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: 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_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Expected O, but got Unknown
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: 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_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Expected O, but got Unknown
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: 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)
			GameObject obj = Child(parent, "Slider");
			Slider val = obj.AddComponent<Slider>();
			Place(((Component)Box(obj.transform, "Track", Theme.Track, Theme.FieldOutline)).gameObject, new Vector2(0f, 0.5f), new Vector2(1f, 0.5f), new Vector2(0f, -4f), new Vector2(0f, 4f));
			GameObject obj2 = Child(obj.transform, "Fill Area");
			Place(obj2, new Vector2(0f, 0.5f), new Vector2(1f, 0.5f), new Vector2(0f, -4f), new Vector2(0f, 4f));
			Image val2 = Box(obj2.transform, "Fill", Theme.Accent);
			Fill(((Component)val2).gameObject);
			((Graphic)val2).raycastTarget = false;
			GameObject obj3 = Child(obj.transform, "Handle Slide Area");
			Place(obj3, Vector2.zero, Vector2.one, new Vector2(6f, 3f), new Vector2(-6f, -3f));
			Image val3 = Box(obj3.transform, "Handle", Color.white, Theme.SliderHandleOutline);
			RectTransform val4 = (RectTransform)((Component)val3).transform;
			val4.anchorMin = new Vector2(0f, 0f);
			val4.anchorMax = new Vector2(0f, 1f);
			val4.sizeDelta = new Vector2(12f, 0f);
			val.fillRect = (RectTransform)((Component)val2).transform;
			val.handleRect = val4;
			((Selectable)val).targetGraphic = (Graphic)(object)val3;
			((Selectable)val).colors = Theme.Colors(Theme.Accent, Theme.AccentBright, Theme.AccentBright, Theme.Muted);
			val.direction = (Direction)0;
			return val;
		}

		public static TMP_InputField Input(Transform parent, float fontSize, string placeholder = "")
		{
			//IL_0006: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Expected O, but got Unknown
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			Image val = Box(parent, "Input", Color.white, Theme.FieldOutline);
			TMP_InputField obj = ((Component)val).gameObject.AddComponent<TMP_InputField>();
			((Selectable)obj).targetGraphic = (Graphic)(object)val;
			((Selectable)obj).colors = Theme.Colors(Theme.Field, Theme.FieldHover, Theme.FieldHover, Theme.ButtonDisabled);
			GameObject val2 = Child(((Component)val).transform, "Text Area");
			val2.AddComponent<RectMask2D>();
			Place(val2, Vector2.zero, Vector2.one, new Vector2(8f, 2f), new Vector2(-8f, -2f));
			TMP_Text val3 = Label(val2.transform, "", fontSize, Theme.Text, (TextAlignmentOptions)4097);
			Fill(((Component)val3).gameObject);
			val3.overflowMode = (TextOverflowModes)0;
			TMP_Text val4 = Label(val2.transform, placeholder, fontSize, Theme.Muted, (TextAlignmentOptions)4097);
			Fill(((Component)val4).gameObject);
			val4.fontStyle = (FontStyles)2;
			obj.textViewport = (RectTransform)val2.transform;
			obj.textComponent = val3;
			obj.placeholder = (Graphic)(object)val4;
			obj.fontAsset = Font;
			obj.pointSize = fontSize;
			obj.richText = false;
			obj.lineType = (LineType)0;
			obj.customCaretColor = true;
			obj.caretColor = Theme.Caret;
			obj.caretWidth = 2;
			obj.selectionColor = Theme.TextSelection;
			obj.restoreOriginalTextOnEscape = true;
			return obj;
		}

		public static TMP_Dropdown Dropdown(Transform parent, float fontSize)
		{
			//IL_0049: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00ba: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: 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_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_032c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0365: Unknown result type (might be due to invalid IL or missing references)
			//IL_0374: Unknown result type (might be due to invalid IL or missing references)
			//IL_0394: 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_01c3: 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_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = WithDefaultFont(() => TMP_DefaultControls.CreateDropdown(default(