Decompiled source of BiggerLobby v1.5.6

BiggerLobbyRuntime.dll

Decompiled 6 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
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;
using System.Security.Permissions;
using System.Text;
using Bifrost.ConstEnum;
using HarmonyLib;
using MelonLoader;
using Microsoft.CodeAnalysis;
using MimesisPatches;
using ReluProtocol;
using ReluProtocol.Enum;
using Steamworks;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: MelonInfo(typeof(MelonEntry), "BiggerLobby", "1.5.6", "medovanx", "https://github.com/medovanx/mimesis-patches")]
[assembly: MelonGame("ReLUGames", "MIMESIS")]
[assembly: HarmonyDontPatchAll]
[assembly: AssemblyCompany("Mohamed Darwesh")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Mohamed Darwesh (github.com/medovanx)")]
[assembly: AssemblyFileVersion("1.5.6.0")]
[assembly: AssemblyInformationalVersion("1.5.6+5d8a458c1e569e466f17909139850fad2af55972")]
[assembly: AssemblyProduct("BiggerLobbyRuntime")]
[assembly: AssemblyTitle("BiggerLobbyRuntime")]
[assembly: AssemblyMetadata("AI_Assisted_Creation", "This assembly was partially or fully created with the assistance of Generative AI (code, refactoring and documentation).")]
[assembly: AssemblyMetadata("AI_Model_Vendor", "Anthropic (Claude)")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.5.6.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace MimesisPatches
{
	internal sealed class PatchMenu : MonoBehaviour
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Comparison<Dictionary<string, object>> <>9__8_1;

			public static UnityAction <>9__25_0;

			internal int <Register>b__8_1(Dictionary<string, object> a, Dictionary<string, object> b)
			{
				return string.CompareOrdinal((string)a["name"], (string)b["name"]);
			}

			internal void <BuildWindow>b__25_0()
			{
				Application.OpenURL("https://github.com/medovanx/mimesis-patches");
			}
		}

		public const string Repo = "medovanx/mimesis-patches";

		public const string RepoUrl = "https://github.com/medovanx/mimesis-patches";

		private const string SizeKey = "medovanx.patches.window";

		private static readonly Vector2 MinSize = new Vector2(900f, 560f);

		private const string RegistryKey = "medovanx.patches.registry";

		private const string OwnerKey = "medovanx.patches.owner";

		private static readonly Color ChipColor = new Color(0f, 0f, 0f, 0.55f);

		private static readonly Color UpdateColor = new Color(0.85f, 0.45f, 0.05f, 0.85f);

		private RectTransform _row;

		private TMP_Text _chipText;

		private Image _chipBg;

		private TMP_FontAsset _font;

		private GameObject _window;

		private RectTransform _sidebar;

		private RectTransform _content;

		private string _selected;

		private static int _hovered;

		private static IntPtr _hand;

		private const int IDC_HAND = 32649;

		private static List<Dictionary<string, object>> Entries => (AppDomain.CurrentDomain.GetData("medovanx.patches.registry") as List<Dictionary<string, object>>) ?? new List<Dictionary<string, object>>();

		public static void Register(string name, Version version, Func<string> status = null, Action<RectTransform, TMP_FontAsset> build = null)
		{
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Expected O, but got Unknown
			List<Dictionary<string, object>> list = AppDomain.CurrentDomain.GetData("medovanx.patches.registry") as List<Dictionary<string, object>>;
			if (list == null)
			{
				AppDomain.CurrentDomain.SetData("medovanx.patches.registry", list = new List<Dictionary<string, object>>());
			}
			list.RemoveAll((Dictionary<string, object> e) => (string)e["name"] == name);
			list.Add(new Dictionary<string, object>
			{
				["name"] = name,
				["version"] = new Version(version.Major, version.Minor, Math.Max(version.Build, 0)),
				["status"] = status,
				["build"] = ((build == null) ? null : ((Action<RectTransform, TMP_FontAsset>)delegate(RectTransform rt, TMP_FontAsset font)
				{
					PatchUi.Refreshers.Clear();
					build(rt, font);
					PatchUi.RefreshAll();
				}))
			});
			list.Sort((Dictionary<string, object> a, Dictionary<string, object> b) => string.CompareOrdinal((string)a["name"], (string)b["name"]));
			if (AppDomain.CurrentDomain.GetData("medovanx.patches.owner") == null)
			{
				AppDomain.CurrentDomain.SetData("medovanx.patches.owner", name);
				GameObject val = new GameObject("MedovanxPatchMenu");
				Object.DontDestroyOnLoad((Object)val);
				val.AddComponent<PatchMenu>();
			}
		}

		private static Version Latest(Dictionary<string, object> e)
		{
			if (!e.TryGetValue("latest", out var value))
			{
				return null;
			}
			return value as Version;
		}

		private static bool HasUpdate(Dictionary<string, object> e)
		{
			if (Latest(e) != null)
			{
				return Latest(e) > (Version)e["version"];
			}
			return false;
		}

		private IEnumerator Start()
		{
			WaitForSeconds wait = new WaitForSeconds(0.5f);
			while (true)
			{
				GameObject val = GameObject.Find("UIPrefab_MainMenu(Clone)") ?? GameObject.Find("UIPrefab_MainMenu");
				object obj;
				if (!((Object)(object)val != (Object)null))
				{
					obj = null;
				}
				else
				{
					Transform obj2 = val.transform.Find("VersionTextRect/versionText");
					obj = ((obj2 != null) ? ((Component)obj2).GetComponent<TMP_Text>() : null);
				}
				TMP_Text val2 = (TMP_Text)obj;
				if ((Object)(object)val2 == (Object)null)
				{
					if ((Object)(object)_row != (Object)null)
					{
						((Component)_row).gameObject.SetActive(false);
					}
					_hovered = 0;
				}
				else if ((Object)(object)((Graphic)val2).canvas != (Object)null)
				{
					_font = val2.font;
					if ((Object)(object)_row == (Object)null)
					{
						BuildChip(((Component)((Graphic)val2).canvas.rootCanvas).transform, val2);
					}
					List<Dictionary<string, object>> entries = Entries;
					int num = entries.Count(HasUpdate);
					_chipText.text = $"Patches ({entries.Count})" + ((num > 0) ? $", {num} update{((num > 1) ? "s" : "")}" : "");
					((Graphic)_chipBg).color = ((num > 0) ? UpdateColor : ChipColor);
					bool flag = val.activeInHierarchy && ((Object)(object)Hub.s == (Object)null || Hub.s.pdata == null || (Object)(object)Hub.s.pdata.main == (Object)null);
					((Component)_row).gameObject.SetActive(flag);
					if (!flag)
					{
						_hovered = 0;
						Close();
					}
				}
				yield return wait;
			}
		}

		private void BuildChip(Transform canvas, TMP_Text version)
		{
			//IL_0019: 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_0058: 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_0060: 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_007c: 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_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Expected O, but got Unknown
			//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_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Expected O, but got Unknown
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Expected O, but got Unknown
			//IL_01df: 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)
			_row = new GameObject("PatchChips", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>();
			((Transform)_row).SetParent(canvas, false);
			((Transform)_row).SetAsLastSibling();
			RectTransform row = _row;
			RectTransform row2 = _row;
			Vector2 val = (_row.pivot = Vector2.zero);
			Vector2 anchorMin = (row2.anchorMax = val);
			row.anchorMin = anchorMin;
			_row.anchoredPosition = new Vector2(24f, 20f);
			_row.sizeDelta = new Vector2(600f, 30f);
			HorizontalLayoutGroup obj = ((Component)_row).gameObject.AddComponent<HorizontalLayoutGroup>();
			((LayoutGroup)obj).childAlignment = (TextAnchor)6;
			bool childControlWidth = (((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true);
			((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = childControlWidth;
			childControlWidth = (((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false);
			((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = childControlWidth;
			GameObject val3 = new GameObject("Chip_Patches", new Type[3]
			{
				typeof(RectTransform),
				typeof(Image),
				typeof(Button)
			});
			val3.transform.SetParent((Transform)(object)_row, false);
			_chipBg = val3.GetComponent<Image>();
			Button component = val3.GetComponent<Button>();
			((Selectable)component).targetGraphic = (Graphic)(object)_chipBg;
			ColorBlock colors = ((Selectable)component).colors;
			((ColorBlock)(ref colors)).highlightedColor = new Color(1.6f, 1.6f, 1.6f, 1f);
			((Selectable)component).colors = colors;
			((UnityEvent)component.onClick).AddListener(new UnityAction(Open));
			Hover(val3);
			HorizontalLayoutGroup obj2 = val3.AddComponent<HorizontalLayoutGroup>();
			((LayoutGroup)obj2).padding = new RectOffset(12, 12, 4, 4);
			childControlWidth = (((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = true);
			((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = childControlWidth;
			childControlWidth = (((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = false);
			((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandWidth = childControlWidth;
			_chipText = (TMP_Text)(object)new GameObject("Text", new Type[1] { typeof(RectTransform) }).AddComponent<TextMeshProUGUI>();
			_chipText.transform.SetParent(val3.transform, false);
			_chipText.font = version.font;
			_chipText.fontSize = version.fontSize * 0.85f;
			((Graphic)_chipText).color = PatchUi.Text;
			((Graphic)_chipText).raycastTarget = false;
			Debug.Log((object)"[Patches] Main menu chip added");
		}

		private void Open()
		{
			if ((Object)(object)_window == (Object)null)
			{
				BuildWindow();
			}
			_window.SetActive(true);
			List<Dictionary<string, object>> entries = Entries;
			if (_selected == null || entries.All((Dictionary<string, object> e) => (string)e["name"] != _selected))
			{
				_selected = entries.FirstOrDefault()?["name"] as string;
			}
			BuildSidebar();
			Select(_selected);
		}

		private void Close()
		{
			if ((Object)(object)_window != (Object)null)
			{
				_window.SetActive(false);
			}
		}

		private void BuildWindow()
		{
			//IL_0032: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Expected O, but got Unknown
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: 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_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: 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_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Expected O, but got Unknown
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_033a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_035f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_0362: Unknown result type (might be due to invalid IL or missing references)
			//IL_0369: Unknown result type (might be due to invalid IL or missing references)
			//IL_0371: Unknown result type (might be due to invalid IL or missing references)
			//IL_0388: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0401: Unknown result type (might be due to invalid IL or missing references)
			//IL_0416: Unknown result type (might be due to invalid IL or missing references)
			//IL_042b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0440: Unknown result type (might be due to invalid IL or missing references)
			//IL_0454: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_050a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0524: Unknown result type (might be due to invalid IL or missing references)
			//IL_053e: Unknown result type (might be due to invalid IL or missing references)
			//IL_055d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0567: Expected O, but got Unknown
			//IL_05a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0609: Unknown result type (might be due to invalid IL or missing references)
			//IL_0482: Unknown result type (might be due to invalid IL or missing references)
			//IL_0487: Unknown result type (might be due to invalid IL or missing references)
			//IL_048d: Expected O, but got Unknown
			Canvas component = new GameObject("PatchesWindow", new Type[3]
			{
				typeof(Canvas),
				typeof(CanvasScaler),
				typeof(GraphicRaycaster)
			}).GetComponent<Canvas>();
			((Component)component).transform.SetParent(((Component)this).transform, false);
			component.renderMode = (RenderMode)0;
			component.sortingOrder = 200;
			CanvasScaler component2 = ((Component)component).GetComponent<CanvasScaler>();
			component2.uiScaleMode = (ScaleMode)1;
			component2.referenceResolution = new Vector2(1920f, 1080f);
			component2.matchWidthOrHeight = 1f;
			_window = ((Component)component).gameObject;
			RectTransform obj = PatchUi.Box(((Component)component).transform, "Dim", new Color(0f, 0f, 0f, 0.55f));
			PatchUi.Stretch(obj);
			Button obj2 = ((Component)obj).gameObject.AddComponent<Button>();
			((Selectable)obj2).transition = (Transition)0;
			((UnityEvent)obj2.onClick).AddListener(new UnityAction(Close));
			RectTransform val = PatchUi.Box(((Component)component).transform, "Panel", new Color(0.06f, 0.06f, 0.06f, 0.96f));
			val.sizeDelta = new Vector2(Mathf.Clamp(PlayerPrefs.GetFloat("medovanx.patches.window.w", 1100f), MinSize.x, 1900f), Mathf.Clamp(PlayerPrefs.GetFloat("medovanx.patches.window.h", 760f), MinSize.y, 1060f));
			val.anchoredPosition = new Vector2(PlayerPrefs.GetFloat("medovanx.patches.window.x", 0f), PlayerPrefs.GetFloat("medovanx.patches.window.y", 0f));
			WindowFrame.AddMove(val);
			TMP_Text obj3 = PatchUi.Label((Transform)(object)val, _font, "Patches", 30f);
			Object.Destroy((Object)(object)((Component)obj3).GetComponent<LayoutElement>());
			obj3.rectTransform.anchorMin = new Vector2(0f, 1f);
			obj3.rectTransform.anchorMax = new Vector2(1f, 1f);
			obj3.rectTransform.pivot = new Vector2(0f, 1f);
			obj3.rectTransform.offsetMin = new Vector2(28f, -64f);
			obj3.rectTransform.offsetMax = new Vector2(-80f, -16f);
			RectTransform val2 = PatchUi.Box((Transform)(object)val, "Close", PatchUi.Off);
			Vector2 val3 = default(Vector2);
			((Vector2)(ref val3))..ctor(1f, 1f);
			val2.pivot = val3;
			Vector2 anchorMin = (val2.anchorMax = val3);
			val2.anchorMin = anchorMin;
			val2.anchoredPosition = new Vector2(-16f, -16f);
			val2.sizeDelta = new Vector2(44f, 44f);
			((Graphic)((Component)val2).GetComponent<Image>()).color = PatchUi.Off;
			Button obj4 = ((Component)val2).gameObject.AddComponent<Button>();
			((Selectable)obj4).targetGraphic = (Graphic)(object)((Component)val2).GetComponent<Image>();
			((UnityEvent)obj4.onClick).AddListener(new UnityAction(Close));
			Hover(((Component)val2).gameObject);
			float[] array = new float[2] { 45f, -45f };
			foreach (float num in array)
			{
				RectTransform obj5 = PatchUi.Box((Transform)(object)val2, "Bar", PatchUi.Text);
				obj5.sizeDelta = new Vector2(22f, 3f);
				((Vector2)(ref val3))..ctor(0.5f, 0.5f);
				obj5.pivot = val3;
				anchorMin = (obj5.anchorMax = val3);
				obj5.anchorMin = anchorMin;
				obj5.anchoredPosition = Vector2.zero;
				((Transform)obj5).localRotation = Quaternion.Euler(0f, 0f, num);
				((Graphic)((Component)obj5).GetComponent<Image>()).raycastTarget = false;
			}
			TMP_Text obj6 = PatchUi.Label((Transform)(object)val, _font, "Made by <b>Mohamed Darwesh</b> (@medovanx)   |   <u>github.com/medovanx/mimesis-patches</u>", 18f, PatchUi.Dim);
			Object.Destroy((Object)(object)((Component)obj6).GetComponent<LayoutElement>());
			obj6.alignment = (TextAlignmentOptions)514;
			((Graphic)obj6).raycastTarget = true;
			RectTransform rectTransform = obj6.rectTransform;
			rectTransform.anchorMin = new Vector2(0f, 0f);
			rectTransform.anchorMax = new Vector2(1f, 0f);
			rectTransform.pivot = new Vector2(0.5f, 0f);
			rectTransform.offsetMin = new Vector2(16f, 12f);
			rectTransform.offsetMax = new Vector2(-16f, 44f);
			ButtonClickedEvent onClick = ((Component)obj6).gameObject.AddComponent<Button>().onClick;
			object obj7 = <>c.<>9__25_0;
			if (obj7 == null)
			{
				UnityAction val6 = delegate
				{
					Application.OpenURL("https://github.com/medovanx/mimesis-patches");
				};
				<>c.<>9__25_0 = val6;
				obj7 = (object)val6;
			}
			((UnityEvent)onClick).AddListener((UnityAction)obj7);
			Hover(((Component)obj6).gameObject);
			_sidebar = PatchUi.Box((Transform)(object)val, "Sidebar", new Color(1f, 1f, 1f, 0.04f));
			_sidebar.anchorMin = new Vector2(0f, 0f);
			_sidebar.anchorMax = new Vector2(0f, 1f);
			_sidebar.pivot = new Vector2(0f, 0.5f);
			_sidebar.offsetMin = new Vector2(16f, 56f);
			_sidebar.offsetMax = new Vector2(296f, -80f);
			VerticalLayoutGroup obj8 = ((Component)_sidebar).gameObject.AddComponent<VerticalLayoutGroup>();
			((LayoutGroup)obj8).padding = new RectOffset(8, 8, 8, 8);
			((HorizontalOrVerticalLayoutGroup)obj8).spacing = 6f;
			bool childControlWidth = (((HorizontalOrVerticalLayoutGroup)obj8).childControlHeight = true);
			((HorizontalOrVerticalLayoutGroup)obj8).childControlWidth = childControlWidth;
			((HorizontalOrVerticalLayoutGroup)obj8).childForceExpandHeight = false;
			_content = new GameObject("Content", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>();
			((Transform)_content).SetParent((Transform)(object)val, false);
			_content.anchorMin = Vector2.zero;
			_content.anchorMax = Vector2.one;
			_content.offsetMin = new Vector2(320f, 56f);
			_content.offsetMax = new Vector2(-24f, -80f);
			VerticalLayoutGroup obj9 = ((Component)_content).gameObject.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)obj9).spacing = 14f;
			childControlWidth = (((HorizontalOrVerticalLayoutGroup)obj9).childControlHeight = true);
			((HorizontalOrVerticalLayoutGroup)obj9).childControlWidth = childControlWidth;
			((HorizontalOrVerticalLayoutGroup)obj9).childForceExpandHeight = false;
			WindowFrame.AddResize(val);
		}

		private void BuildSidebar()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: 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)
			foreach (Transform item in (Transform)_sidebar)
			{
				Object.Destroy((Object)(object)((Component)item).gameObject);
			}
			foreach (Dictionary<string, object> entry in Entries)
			{
				string name = (string)entry["name"];
				string label = name + "  <size=70%><color=#A6AAA0>v" + ((Version)entry["version"]).ToString(3) + "</color></size>" + (HasUpdate(entry) ? "  <color=#E08A1E>●</color>" : "");
				Button obj = PatchUi.Button((Transform)(object)_sidebar, _font, label, delegate
				{
					_selected = name;
					Select(name);
				}, 260f, 48f);
				TMP_Text componentInChildren = ((Component)obj).GetComponentInChildren<TMP_Text>();
				componentInChildren.alignment = (TextAlignmentOptions)4097;
				componentInChildren.margin = new Vector4(14f, 0f, 8f, 0f);
				((Graphic)((Component)obj).GetComponent<Image>()).color = ((name == _selected) ? PatchUi.On : PatchUi.Off);
			}
		}

		private void Select(string name)
		{
			//IL_0104: 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_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Expected O, but got Unknown
			BuildSidebar();
			foreach (Transform item in (Transform)_content)
			{
				Object.Destroy((Object)(object)((Component)item).gameObject);
			}
			Dictionary<string, object> dictionary = Entries.FirstOrDefault((Dictionary<string, object> x) => (string)x["name"] == name);
			if (dictionary == null)
			{
				return;
			}
			PatchUi.Label((Transform)(object)_content, _font, name + "  <size=70%><color=#A6AAA0>v" + ((Version)dictionary["version"]).ToString(3) + "</color></size>", 30f, null, 40f);
			if (dictionary["status"] is Func<string> func)
			{
				string text = null;
				try
				{
					text = func();
				}
				catch
				{
				}
				if (!string.IsNullOrEmpty(text))
				{
					PatchUi.Label((Transform)(object)_content, _font, text, 18f, PatchUi.Dim, 26f);
				}
			}
			if (!(dictionary["build"] is Action<RectTransform, TMP_FontAsset> action))
			{
				return;
			}
			RectTransform val = ScrollArea((Transform)(object)_content);
			VerticalLayoutGroup obj2 = ((Component)val).gameObject.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)obj2).spacing = 14f;
			((LayoutGroup)obj2).padding = new RectOffset(0, 24, 8, 16);
			bool childControlWidth = (((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = true);
			((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = childControlWidth;
			((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = false;
			((Component)val).gameObject.AddComponent<ContentSizeFitter>().verticalFit = (FitMode)2;
			try
			{
				action(val, _font);
			}
			catch (Exception value)
			{
				Debug.LogError((object)$"[{name}] Options page failed: {value}");
			}
		}

		private RectTransform ScrollArea(Transform parent)
		{
			//IL_0018: 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_009d: 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)
			//IL_00dd: 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_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: 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_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: 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_0177: 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_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: 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_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			RectTransform component = new GameObject("Scroll", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>();
			((Transform)component).SetParent(parent, false);
			((Component)component).gameObject.AddComponent<LayoutElement>().flexibleHeight = 1f;
			RectTransform component2 = new GameObject("Viewport", new Type[2]
			{
				typeof(RectTransform),
				typeof(RectMask2D)
			}).GetComponent<RectTransform>();
			((Transform)component2).SetParent((Transform)(object)component, false);
			PatchUi.Stretch(component2);
			((Graphic)((Component)component2).gameObject.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0f);
			RectTransform component3 = new GameObject("Options", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>();
			((Transform)component3).SetParent((Transform)(object)component2, false);
			component3.anchorMin = new Vector2(0f, 1f);
			component3.anchorMax = new Vector2(1f, 1f);
			component3.pivot = new Vector2(0.5f, 1f);
			Vector2 offsetMin = (component3.offsetMax = Vector2.zero);
			component3.offsetMin = offsetMin;
			RectTransform val = PatchUi.Box((Transform)(object)component, "Scrollbar", new Color(1f, 1f, 1f, 0.05f));
			val.anchorMin = new Vector2(1f, 0f);
			val.anchorMax = Vector2.one;
			val.pivot = new Vector2(1f, 0.5f);
			val.sizeDelta = new Vector2(8f, 0f);
			RectTransform component4 = new GameObject("Handle Area", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>();
			((Transform)component4).SetParent((Transform)(object)val, false);
			PatchUi.Stretch(component4);
			RectTransform val2 = PatchUi.Box((Transform)(object)component4, "Handle", new Color(1f, 1f, 1f, 0.3f));
			offsetMin = (val2.offsetMax = Vector2.zero);
			val2.offsetMin = offsetMin;
			Scrollbar val3 = ((Component)val).gameObject.AddComponent<Scrollbar>();
			val3.handleRect = val2;
			((Selectable)val3).targetGraphic = (Graphic)(object)((Component)val2).GetComponent<Image>();
			val3.direction = (Direction)2;
			ScrollRect obj = ((Component)component).gameObject.AddComponent<ScrollRect>();
			obj.viewport = component2;
			obj.content = component3;
			obj.horizontal = false;
			obj.movementType = (MovementType)2;
			obj.scrollSensitivity = 30f;
			obj.verticalScrollbar = val3;
			obj.verticalScrollbarVisibility = (ScrollbarVisibility)1;
			return component3;
		}

		[DllImport("user32.dll")]
		private static extern IntPtr LoadCursor(IntPtr instance, int name);

		[DllImport("user32.dll")]
		private static extern IntPtr SetCursor(IntPtr cursor);

		private static void Hover(GameObject target)
		{
			EventTrigger hover = target.AddComponent<EventTrigger>();
			On((EventTriggerType)0, 1);
			On((EventTriggerType)1, -1);
			void On(EventTriggerType type, int delta)
			{
				//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_0013: 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_001a: Expected O, but got Unknown
				Entry val = new Entry
				{
					eventID = type
				};
				((UnityEvent<BaseEventData>)(object)val.callback).AddListener((UnityAction<BaseEventData>)delegate
				{
					_hovered = Mathf.Max(0, _hovered + delta);
				});
				hover.triggers.Add(val);
			}
		}

		private void LateUpdate()
		{
			if (_hovered > 0)
			{
				if (_hand == IntPtr.Zero)
				{
					_hand = LoadCursor(IntPtr.Zero, 32649);
				}
				SetCursor(_hand);
			}
		}
	}
	internal sealed class WindowFrame : MonoBehaviour, IDragHandler, IEventSystemHandler, IEndDragHandler, IBeginDragHandler, IPointerEnterHandler, IPointerExitHandler
	{
		private const float MinW = 900f;

		private const float MinH = 560f;

		private const float Edge = 8f;

		private const float Corner = 22f;

		private const float TitleBar = 72f;

		private const int IDC_SIZENWSE = 32642;

		private const int IDC_SIZENESW = 32643;

		private const int IDC_SIZEWE = 32644;

		private const int IDC_SIZENS = 32645;

		private const int IDC_SIZEALL = 32646;

		private RectTransform _panel;

		private Vector2Int _dir;

		private int _cursor;

		private bool _hover;

		private bool _dragging;

		private IntPtr _handle;

		[DllImport("user32.dll")]
		private static extern IntPtr LoadCursor(IntPtr instance, int name);

		[DllImport("user32.dll")]
		private static extern IntPtr SetCursor(IntPtr cursor);

		private static WindowFrame Make(RectTransform panel, string name, Vector2 anchorMin, Vector2 anchorMax, Vector2 offsetMin, Vector2 offsetMax, Vector2Int dir, int cursor)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: 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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: 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)
			RectTransform obj = PatchUi.Box((Transform)(object)panel, name, new Color(1f, 1f, 1f, 0.001f));
			obj.anchorMin = anchorMin;
			obj.anchorMax = anchorMax;
			obj.offsetMin = offsetMin;
			obj.offsetMax = offsetMax;
			WindowFrame windowFrame = ((Component)obj).gameObject.AddComponent<WindowFrame>();
			windowFrame._panel = panel;
			windowFrame._dir = dir;
			windowFrame._cursor = cursor;
			return windowFrame;
		}

		public static void AddMove(RectTransform panel)
		{
			//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_0024: 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)
			Make(panel, "TitleBar", new Vector2(0f, 1f), Vector2.one, new Vector2(8f, -72f), new Vector2(-8f, -8f), Vector2Int.zero, 32646);
		}

		public static void AddResize(RectTransform panel)
		{
			//IL_0006: 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_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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_00a4: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: 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_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			Make(panel, "Left", Vector2.zero, new Vector2(0f, 1f), new Vector2(0f, 22f), new Vector2(8f, -22f), new Vector2Int(-1, 0), 32644);
			Make(panel, "Right", new Vector2(1f, 0f), Vector2.one, new Vector2(-8f, 22f), new Vector2(0f, -22f), new Vector2Int(1, 0), 32644);
			Make(panel, "Top", new Vector2(0f, 1f), Vector2.one, new Vector2(22f, -8f), new Vector2(-22f, 0f), new Vector2Int(0, -1), 32645);
			Make(panel, "Bottom", Vector2.zero, new Vector2(1f, 0f), new Vector2(22f, 0f), new Vector2(-22f, 8f), new Vector2Int(0, 1), 32645);
			Make(panel, "TopLeft", new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(0f, -22f), new Vector2(22f, 0f), new Vector2Int(-1, -1), 32642);
			Make(panel, "TopRight", Vector2.one, Vector2.one, new Vector2(-22f, -22f), Vector2.zero, new Vector2Int(1, -1), 32643);
			Make(panel, "BottomLeft", Vector2.zero, Vector2.zero, Vector2.zero, new Vector2(22f, 22f), new Vector2Int(-1, 1), 32643);
			WindowFrame windowFrame = Make(panel, "BottomRight", new Vector2(1f, 0f), new Vector2(1f, 0f), new Vector2(-22f, 0f), new Vector2(0f, 22f), new Vector2Int(1, 1), 32642);
			Vector2 val = default(Vector2);
			for (int i = 0; i < 3; i++)
			{
				RectTransform obj = PatchUi.Box(((Component)windowFrame).transform, "Line", new Color(1f, 1f, 1f, 0.35f));
				float num = 5f + 5f * (float)i;
				((Vector2)(ref val))..ctor(1f, 0f);
				obj.anchorMax = val;
				obj.anchorMin = val;
				obj.sizeDelta = new Vector2(num * 1.414f, 2f);
				obj.anchoredPosition = new Vector2(-4f - num / 2f, 4f + num / 2f);
				((Transform)obj).localRotation = Quaternion.Euler(0f, 0f, 45f);
				((Graphic)((Component)obj).GetComponent<Image>()).raycastTarget = false;
			}
		}

		public void OnPointerEnter(PointerEventData e)
		{
			_hover = true;
		}

		public void OnPointerExit(PointerEventData e)
		{
			_hover = false;
		}

		public void OnBeginDrag(PointerEventData e)
		{
			_dragging = true;
		}

		private void LateUpdate()
		{
			if (_hover || _dragging)
			{
				if (_handle == IntPtr.Zero)
				{
					_handle = LoadCursor(IntPtr.Zero, _cursor);
				}
				SetCursor(_handle);
			}
		}

		public void OnDrag(PointerEventData e)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: 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_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_004d: 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_0078: 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_015e: 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_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: 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_01ac: 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_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: 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)
			Canvas componentInParent = ((Component)_panel).GetComponentInParent<Canvas>();
			Vector2 val = e.delta / (((Object)(object)componentInParent != (Object)null) ? componentInParent.scaleFactor : 1f);
			if (_dir == Vector2Int.zero)
			{
				RectTransform panel = _panel;
				panel.anchoredPosition += val;
			}
			else
			{
				Vector2 sizeDelta = _panel.sizeDelta;
				Vector2 val2 = default(Vector2);
				((Vector2)(ref val2))..ctor((((Vector2Int)(ref _dir)).x == 0) ? sizeDelta.x : Mathf.Clamp(sizeDelta.x + (float)((Vector2Int)(ref _dir)).x * val.x, 900f, 1900f), (((Vector2Int)(ref _dir)).y == 0) ? sizeDelta.y : Mathf.Clamp(sizeDelta.y - (float)((Vector2Int)(ref _dir)).y * val.y, 560f, 1060f));
				Vector2 val3 = val2 - sizeDelta;
				_panel.sizeDelta = val2;
				RectTransform panel2 = _panel;
				panel2.anchoredPosition += new Vector2((float)((Vector2Int)(ref _dir)).x * val3.x / 2f, (float)(-((Vector2Int)(ref _dir)).y) * val3.y / 2f);
			}
			Rect rect = ((RectTransform)((Component)componentInParent).transform).rect;
			Vector2 val4 = ((Rect)(ref rect)).size / 2f;
			Vector2 anchoredPosition = _panel.anchoredPosition;
			_panel.anchoredPosition = new Vector2(Mathf.Clamp(anchoredPosition.x, 0f - val4.x, val4.x), Mathf.Clamp(anchoredPosition.y, 0f - val4.y - _panel.sizeDelta.y / 2f + 80f, val4.y - _panel.sizeDelta.y / 2f));
		}

		public void OnEndDrag(PointerEventData e)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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)
			_dragging = false;
			PlayerPrefs.SetFloat("medovanx.patches.window.w", _panel.sizeDelta.x);
			PlayerPrefs.SetFloat("medovanx.patches.window.h", _panel.sizeDelta.y);
			PlayerPrefs.SetFloat("medovanx.patches.window.x", _panel.anchoredPosition.x);
			PlayerPrefs.SetFloat("medovanx.patches.window.y", _panel.anchoredPosition.y);
			PlayerPrefs.Save();
		}
	}
	internal static class PatchUi
	{
		public static readonly Color Text = new Color(0.9f, 0.92f, 0.88f, 1f);

		public static readonly Color Dim = new Color(0.65f, 0.67f, 0.63f, 1f);

		public static readonly Color Off = new Color(1f, 1f, 1f, 0.08f);

		public static readonly Color On = new Color(0.85f, 0.55f, 0.1f, 0.95f);

		public static readonly Color Accent = new Color(0.85f, 0.45f, 0.05f, 1f);

		public static readonly List<Action> Refreshers = new List<Action>();

		public static void RefreshAll()
		{
			foreach (Action refresher in Refreshers)
			{
				refresher();
			}
		}

		public static TMP_Text Label(Transform parent, TMP_FontAsset font, string text, float size = 22f, Color? color = null, float height = 0f)
		{
			//IL_0018: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			TextMeshProUGUI val = new GameObject("Label", new Type[1] { typeof(RectTransform) }).AddComponent<TextMeshProUGUI>();
			((TMP_Text)val).transform.SetParent(parent, false);
			if ((Object)(object)font != (Object)null)
			{
				((TMP_Text)val).font = font;
			}
			((TMP_Text)val).fontSize = size;
			((Graphic)val).color = (Color)(((??)color) ?? Text);
			((TMP_Text)val).text = text;
			((Graphic)val).raycastTarget = false;
			((TMP_Text)val).enableWordWrapping = true;
			LayoutElement val2 = ((Component)val).gameObject.AddComponent<LayoutElement>();
			if (height > 0f)
			{
				val2.preferredHeight = height;
			}
			return (TMP_Text)(object)val;
		}

		public static RectTransform Box(Transform parent, string name, Color color)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			RectTransform component = new GameObject(name, new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			}).GetComponent<RectTransform>();
			((Transform)component).SetParent(parent, false);
			((Graphic)((Component)component).GetComponent<Image>()).color = color;
			return component;
		}

		public static void Stretch(RectTransform rt)
		{
			//IL_0001: 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_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_001e: 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)
			rt.anchorMin = Vector2.zero;
			rt.anchorMax = Vector2.one;
			Vector2 offsetMin = (rt.offsetMax = Vector2.zero);
			rt.offsetMin = offsetMin;
		}

		public static Button Button(Transform parent, TMP_FontAsset font, string label, Action onClick, float width = 160f, float height = 44f)
		{
			//IL_000f: 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_0062: Expected O, but got Unknown
			RectTransform val = Box(parent, label, Off);
			LayoutElement obj = ((Component)val).gameObject.AddComponent<LayoutElement>();
			obj.preferredWidth = width;
			obj.preferredHeight = height;
			Button obj2 = ((Component)val).gameObject.AddComponent<Button>();
			((Selectable)obj2).targetGraphic = (Graphic)(object)((Component)val).GetComponent<Image>();
			((UnityEvent)obj2.onClick).AddListener((UnityAction)delegate
			{
				onClick();
				RefreshAll();
			});
			TMP_Text obj3 = Label((Transform)(object)val, font, label, 20f);
			obj3.alignment = (TextAlignmentOptions)514;
			Stretch(obj3.rectTransform);
			Object.Destroy((Object)(object)((Component)obj3).GetComponent<LayoutElement>());
			return obj2;
		}

		public static RectTransform Row(Transform parent, float height = 48f)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			RectTransform component = new GameObject("Row", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>();
			((Transform)component).SetParent(parent, false);
			HorizontalLayoutGroup obj = ((Component)component).gameObject.AddComponent<HorizontalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)obj).spacing = 10f;
			((LayoutGroup)obj).childAlignment = (TextAnchor)3;
			bool childControlWidth = (((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true);
			((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = childControlWidth;
			childControlWidth = (((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false);
			((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = childControlWidth;
			((Component)component).gameObject.AddComponent<LayoutElement>().preferredHeight = height;
			return component;
		}

		public static void Options(Transform parent, TMP_FontAsset font, string title, params (string label, Func<bool> selected, Action select)[] options)
		{
			Options(parent, font, title, 160f, options);
		}

		public static void Options(Transform parent, TMP_FontAsset font, string title, float width, params (string label, Func<bool> selected, Action select)[] options)
		{
			RectTransform parent2 = Row(parent);
			((Component)Label((Transform)(object)parent2, font, title)).GetComponent<LayoutElement>().preferredWidth = 190f;
			for (int i = 0; i < options.Length; i++)
			{
				(string, Func<bool>, Action) tuple = options[i];
				string item = tuple.Item1;
				Func<bool> selected = tuple.Item2;
				Action item2 = tuple.Item3;
				Image img = ((Component)Button((Transform)(object)parent2, font, item, item2, width)).GetComponent<Image>();
				Refreshers.Add(delegate
				{
					//IL_001a: 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)
					((Graphic)img).color = (selected() ? On : Off);
				});
			}
		}

		public static void OnOff(Transform parent, TMP_FontAsset font, string title, Func<bool> get, Action<bool> set)
		{
			Options(parent, font, title, ("On", get, delegate
			{
				set(obj: true);
			}), ("Off", () => !get(), delegate
			{
				set(obj: false);
			}));
		}

		public static void Number(Transform parent, TMP_FontAsset font, string title, Func<int> get, Action<int> set, int fallback)
		{
			//IL_006c: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: 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)
			RectTransform parent2 = Row(parent);
			((Component)Label((Transform)(object)parent2, font, title)).GetComponent<LayoutElement>().preferredWidth = 190f;
			RectTransform val = Box((Transform)(object)parent2, "Field", new Color(1f, 1f, 1f, 0.08f));
			LayoutElement obj = ((Component)val).gameObject.AddComponent<LayoutElement>();
			obj.preferredWidth = 200f;
			obj.preferredHeight = 44f;
			RectTransform component = new GameObject("Text Area", new Type[2]
			{
				typeof(RectTransform),
				typeof(RectMask2D)
			}).GetComponent<RectTransform>();
			((Transform)component).SetParent((Transform)(object)val, false);
			Stretch(component);
			component.offsetMin = new Vector2(12f, 4f);
			component.offsetMax = new Vector2(-12f, -4f);
			TextMeshProUGUI val2 = new GameObject("Text", new Type[1] { typeof(RectTransform) }).AddComponent<TextMeshProUGUI>();
			((TMP_Text)val2).transform.SetParent((Transform)(object)component, false);
			Stretch(((TMP_Text)val2).rectTransform);
			if ((Object)(object)font != (Object)null)
			{
				((TMP_Text)val2).font = font;
			}
			((TMP_Text)val2).fontSize = 22f;
			((Graphic)val2).color = Text;
			((TMP_Text)val2).alignment = (TextAlignmentOptions)4097;
			TMP_InputField input = ((Component)val).gameObject.AddComponent<TMP_InputField>();
			input.textViewport = component;
			input.textComponent = (TMP_Text)(object)val2;
			input.contentType = (ContentType)2;
			input.characterLimit = 7;
			input.SetTextWithoutNotify(get().ToString());
			((UnityEvent<string>)(object)input.onEndEdit).AddListener((UnityAction<string>)delegate(string s)
			{
				set((int.TryParse(s, out var result) && result >= 0) ? result : fallback);
				RefreshAll();
			});
			Refreshers.Add(delegate
			{
				if (!input.isFocused)
				{
					input.SetTextWithoutNotify(get().ToString());
				}
			});
		}

		public static void Section(Transform parent, TMP_FontAsset font, string title)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_0073: 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)
			RectTransform component = new GameObject("Section", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>();
			((Transform)component).SetParent(parent, false);
			VerticalLayoutGroup obj = ((Component)component).gameObject.AddComponent<VerticalLayoutGroup>();
			bool childControlWidth = (((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true);
			((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = childControlWidth;
			((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false;
			((HorizontalOrVerticalLayoutGroup)obj).spacing = 4f;
			((LayoutGroup)obj).padding = new RectOffset(0, 0, 10, 2);
			Label((Transform)(object)component, font, title.ToUpperInvariant(), 17f, Accent, 24f).characterSpacing = 6f;
			((Component)Box((Transform)(object)component, "Line", new Color(1f, 1f, 1f, 0.12f))).gameObject.AddComponent<LayoutElement>().preferredHeight = 1f;
		}

		public static Slider Slider(Transform parent, TMP_FontAsset font, string title, int min, int max, Func<int> get, Action<int> set, string suffix = "", string description = null)
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: 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_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: 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_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: 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_02ab: Unknown result type (might be due to invalid IL or missing references)
			RectTransform val = Row(parent, (description == null) ? 48f : 58f);
			if (description == null)
			{
				((Component)Label((Transform)(object)val, font, title)).GetComponent<LayoutElement>().preferredWidth = 190f;
			}
			else
			{
				RectTransform component = new GameObject("Title", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>();
				((Transform)component).SetParent((Transform)(object)val, false);
				VerticalLayoutGroup obj = ((Component)component).gameObject.AddComponent<VerticalLayoutGroup>();
				bool childControlWidth = (((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true);
				((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = childControlWidth;
				((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false;
				((LayoutGroup)obj).childAlignment = (TextAnchor)3;
				((HorizontalOrVerticalLayoutGroup)obj).spacing = 0f;
				((Component)component).gameObject.AddComponent<LayoutElement>().preferredWidth = 190f;
				Label((Transform)(object)component, font, title, 22f, null, 28f);
				Label((Transform)(object)component, font, description, 15f, Dim, 20f);
			}
			RectTransform component2 = new GameObject("Slider", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>();
			((Transform)component2).SetParent((Transform)(object)val, false);
			LayoutElement obj2 = ((Component)component2).gameObject.AddComponent<LayoutElement>();
			obj2.preferredWidth = 360f;
			obj2.preferredHeight = 28f;
			RectTransform obj3 = Box((Transform)(object)component2, "Track", Off);
			obj3.anchorMin = new Vector2(0f, 0.5f);
			obj3.anchorMax = new Vector2(1f, 0.5f);
			obj3.sizeDelta = new Vector2(0f, 8f);
			RectTransform component3 = new GameObject("Fill Area", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>();
			((Transform)component3).SetParent((Transform)(object)component2, false);
			component3.anchorMin = new Vector2(0f, 0.5f);
			component3.anchorMax = new Vector2(1f, 0.5f);
			component3.sizeDelta = new Vector2(0f, 8f);
			RectTransform val2 = Box((Transform)(object)component3, "Fill", On);
			val2.sizeDelta = Vector2.zero;
			RectTransform component4 = new GameObject("Handle Area", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>();
			((Transform)component4).SetParent((Transform)(object)component2, false);
			Stretch(component4);
			component4.offsetMin = new Vector2(8f, 0f);
			component4.offsetMax = new Vector2(-8f, 0f);
			RectTransform val3 = Box((Transform)(object)component4, "Handle", Text);
			val3.sizeDelta = new Vector2(16f, 0f);
			Slider slider = ((Component)component2).gameObject.AddComponent<Slider>();
			slider.fillRect = val2;
			slider.handleRect = val3;
			((Selectable)slider).targetGraphic = (Graphic)(object)((Component)val3).GetComponent<Image>();
			slider.direction = (Direction)0;
			slider.minValue = min;
			slider.maxValue = max;
			slider.wholeNumbers = true;
			slider.SetValueWithoutNotify((float)get());
			TMP_Text value = Label((Transform)(object)val, font, get() + suffix);
			((Component)value).GetComponent<LayoutElement>().preferredWidth = 80f;
			((UnityEvent<float>)(object)slider.onValueChanged).AddListener((UnityAction<float>)delegate(float v)
			{
				set((int)v);
				RefreshAll();
			});
			Refreshers.Add(delegate
			{
				slider.SetValueWithoutNotify((float)get());
				value.text = get() + suffix;
			});
			return slider;
		}
	}
	public sealed class MelonEntry : MelonMod
	{
		private static Action _init;

		public override void OnInitializeMelon()
		{
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Expected O, but got Unknown
			MethodInfo methodInfo = typeof(MelonEntry).Assembly.GetType(((MelonBase)this).Info.Name + ".Plugin")?.GetMethod("Init", Type.EmptyTypes);
			if (methodInfo == null)
			{
				((MelonBase)this).LoggerInstance.Error(((MelonBase)this).Info.Name + ".Plugin.Init not found");
				return;
			}
			_init = (Action)Delegate.CreateDelegate(typeof(Action), methodInfo);
			((MelonBase)this).HarmonyInstance.Patch((MethodBase)AccessTools.Method(typeof(Hub), "Awake", (Type[])null, (Type[])null), new HarmonyMethod(typeof(MelonEntry), "HubAwake", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			((MelonBase)this).LoggerInstance.Msg(((MelonBase)this).Info.Name + " " + ((MelonBase)this).Info.Version + " loaded; starts with the game");
		}

		private static void HubAwake()
		{
			_init?.Invoke();
		}
	}
}
namespace BiggerLobby
{
	[HarmonyPatch(typeof(UIPrefab_InGameMenu))]
	internal static class InGameMenuPatch
	{
		private const float RowScale = 0.62f;

		private static readonly Color PlaceholderColor = new Color(1f, 1f, 1f, 0.35f);

		private static readonly Dictionary<TMP_Text, (Color, TextAlignmentOptions, Vector2)> NameStyles = new Dictionary<TMP_Text, (Color, TextAlignmentOptions, Vector2)>();

		private const float SlotCenterX = -75f;

		private static readonly Dictionary<GameObject, List<GameObject>> Hidden = new Dictionary<GameObject, List<GameObject>>();

		private static readonly Color SlotBackground = new Color(0f, 0f, 0f, 0.45f);

		private static readonly Dictionary<TMP_Text, TMP_Text> Numbers = new Dictionary<TMP_Text, TMP_Text>();

		[HarmonyPrefix]
		[HarmonyPatch("OnEnable")]
		private static void AddRowsOnEnable(UIPrefab_InGameMenu __instance)
		{
			AddRows(__instance);
		}

		[HarmonyPrefix]
		[HarmonyPatch("Start")]
		private static void AddRowsOnStart(UIPrefab_InGameMenu __instance)
		{
			AddRows(__instance);
		}

		private static void AddRows(UIPrefab_InGameMenu menu)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: 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_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Expected O, but got Unknown
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			List<PlayerUIElement> playerUIElements = menu.playerUIElements;
			if (playerUIElements.Count >= 2 && playerUIElements.Count < 10)
			{
				RectTransform val = (RectTransform)playerUIElements[0].container.transform.parent;
				HorizontalOrVerticalLayoutGroup component = ((Component)val).GetComponent<HorizontalOrVerticalLayoutGroup>();
				LogLayout("before", val, component);
				PlayerUIElement val2 = playerUIElements[playerUIElements.Count - 1];
				while (playerUIElements.Count < 10)
				{
					GameObject val3 = Object.Instantiate<GameObject>(val2.container, (Transform)(object)val);
					((Object)val3).name = "Player" + (playerUIElements.Count + 1);
					val3.transform.SetSiblingIndex(playerUIElements[playerUIElements.Count - 1].container.transform.GetSiblingIndex() + 1);
					Transform transform = val2.container.transform;
					Transform transform2 = val3.transform;
					playerUIElements.Add(new PlayerUIElement
					{
						container = val3,
						nickNameText = UiUtil.Map<TMP_Text>(transform, transform2, val2.nickNameText),
						avatarButton = UiUtil.Map<Button>(transform, transform2, val2.avatarButton),
						volumeSlider = UiUtil.Map<Slider>(transform, transform2, val2.volumeSlider),
						speakButton = UiUtil.Map<Button>(transform, transform2, val2.speakButton),
						infoButton = UiUtil.Map<Button>(transform, transform2, val2.infoButton),
						kickButton = UiUtil.Map<Button>(transform, transform2, val2.kickButton),
						pingImage = UiUtil.Map<Image>(transform, transform2, val2.pingImage)
					});
				}
				if ((Object)(object)component != (Object)null)
				{
					component.childForceExpandHeight = false;
					component.childControlHeight = false;
					component.childScaleHeight = true;
					component.spacing = 2f;
				}
				for (int i = 0; i < playerUIElements.Count; i++)
				{
					((Transform)(RectTransform)playerUIElements[i].container.transform).localScale = Vector3.one * 0.62f;
					AddNumber(playerUIElements[i], i + 1);
					AddBackground(playerUIElements[i]);
					CenterNameAndSlider(playerUIElements[i]);
				}
				Transform obj = ((Transform)val).Find("InviteRinkCopy");
				RectTransform val4 = (RectTransform)(object)((obj is RectTransform) ? obj : null);
				if ((Object)(object)val4 != (Object)null)
				{
					Rect rect = val.rect;
					float num = ((Rect)(ref rect)).width / 2f + -46.5f;
					rect = val.rect;
					val4.anchoredPosition = new Vector2(num, 0f - ((Rect)(ref rect)).height - 40f);
				}
				LayoutRebuilder.ForceRebuildLayoutImmediate(val);
				LogLayout("after", val, component);
			}
		}

		private static void LogLayout(string when, RectTransform parent, HorizontalOrVerticalLayoutGroup g)
		{
			//IL_0046: 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_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Expected O, but got Unknown
			//IL_01a9: 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_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			StringBuilder stringBuilder = new StringBuilder($"[BiggerLobby] menu layout {when}: parent {((Object)parent).name} rect={parent.rect} ");
			stringBuilder.Append(((Object)(object)g == (Object)null) ? "no layout group" : $"{((object)g).GetType().Name} spacing={g.spacing} align={((LayoutGroup)g).childAlignment} pad={((LayoutGroup)g).padding} ctrlH={g.childControlHeight} expandH={g.childForceExpandHeight} scaleH={g.childScaleHeight}");
			foreach (RectTransform item in (Transform)parent)
			{
				RectTransform val = item;
				stringBuilder.Append($"\n  {((Object)val).name} active={((Component)val).gameObject.activeSelf} pos={val.anchoredPosition} size={val.sizeDelta} anchors={val.anchorMin}-{val.anchorMax} pivot={val.pivot} scale={((Transform)val).localScale.x}");
			}
			Debug.Log((object)stringBuilder.ToString());
		}

		private static void CenterNameAndSlider(PlayerUIElement row)
		{
			SetY((Component)(object)row.nickNameText, 20f);
			SetY((Component)(object)row.infoButton, 20f);
			SetY((Component)(object)row.volumeSlider, -18f);
			SetY((Component)(object)row.speakButton, -18f);
			SetY((Component)(object)row.pingImage, -18f);
			static void SetY(Component c, float y)
			{
				//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_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)c == (Object)null))
				{
					RectTransform val = (RectTransform)c.transform;
					val.anchoredPosition = new Vector2(val.anchoredPosition.x, y);
				}
			}
		}

		private static void AddBackground(PlayerUIElement row)
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: 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_005d: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			Transform transform = row.container.transform;
			if (!((Object)(object)transform.Find("SlotBackground") != (Object)null))
			{
				GameObject val = new GameObject("SlotBackground", new Type[2]
				{
					typeof(RectTransform),
					typeof(Image)
				});
				RectTransform val2 = (RectTransform)val.transform;
				((Transform)val2).SetParent(transform, false);
				((Transform)val2).SetAsFirstSibling();
				val2.anchoredPosition = new Vector2(-75f, 0f);
				val2.sizeDelta = new Vector2(720f, 96f);
				Image component = val.GetComponent<Image>();
				((Graphic)component).color = SlotBackground;
				((Graphic)component).raycastTarget = false;
			}
		}

		private static void AddNumber(PlayerUIElement row, int n)
		{
			//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_008a: Unknown result type (might be due to invalid IL or missing references)
			TMP_Text nickNameText = row.nickNameText;
			if (!((Object)(object)nickNameText == (Object)null) && !Numbers.ContainsKey(nickNameText))
			{
				TMP_Text component = Object.Instantiate<GameObject>(((Component)nickNameText).gameObject, row.container.transform).GetComponent<TMP_Text>();
				((Object)component).name = "SlotNumber";
				component.text = n.ToString();
				component.alignment = (TextAlignmentOptions)4100;
				RectTransform rectTransform = component.rectTransform;
				rectTransform.sizeDelta = new Vector2(60f, rectTransform.sizeDelta.y);
				rectTransform.anchoredPosition = new Vector2(-400f, 0f);
				Numbers[nickNameText] = component;
			}
		}

		[HarmonyTranspiler]
		[HarmonyPatch("OnEnable")]
		[HarmonyPatch("SetPingImage")]
		private static IEnumerable<CodeInstruction> FourToTen(IEnumerable<CodeInstruction> code)
		{
			foreach (CodeInstruction item in code)
			{
				yield return (item.opcode == OpCodes.Ldc_I4_4) ? CodeInstructionExtensions.MoveLabelsFrom(new CodeInstruction(OpCodes.Ldc_I4_S, (object)(sbyte)10), item) : item;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("SetRemoteVolumeController_v2")]
		private static void ClearPlaceholders(UIPrefab_InGameMenu __instance)
		{
			foreach (PlayerUIElement playerUIElement in __instance.playerUIElements)
			{
				SetPlaceholder(playerUIElement, on: false);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("SetRemoteVolumeController_v2")]
		private static void ShowPlaceholders(UIPrefab_InGameMenu __instance)
		{
			int num = Traverse.Create((object)__instance).Field("playerInfos").GetValue<IList>()?.Count ?? 0;
			List<PlayerUIElement> playerUIElements = __instance.playerUIElements;
			for (int i = 0; i < playerUIElements.Count; i++)
			{
				if (i >= num)
				{
					SetPlaceholder(playerUIElements[i], on: true);
					continue;
				}
				Component[] array = (Component[])(object)new Component[4]
				{
					(Component)playerUIElements[i].avatarButton,
					(Component)playerUIElements[i].volumeSlider,
					(Component)playerUIElements[i].speakButton,
					(Component)playerUIElements[i].pingImage
				};
				foreach (Component val in array)
				{
					if ((Object)(object)val != (Object)null)
					{
						val.gameObject.SetActive(true);
					}
				}
			}
		}

		private static void SetPlaceholder(PlayerUIElement row, bool on)
		{
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: 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_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)row?.container == (Object)null)
			{
				return;
			}
			if (!Hidden.TryGetValue(row.container, out var value))
			{
				value = (Hidden[row.container] = new List<GameObject>());
			}
			if (on)
			{
				Component[] array = (Component[])(object)new Component[6]
				{
					(Component)row.avatarButton,
					(Component)row.volumeSlider,
					(Component)row.speakButton,
					(Component)row.infoButton,
					(Component)row.kickButton,
					(Component)row.pingImage
				};
				foreach (Component val in array)
				{
					if ((Object)(object)val != (Object)null && val.gameObject.activeSelf)
					{
						val.gameObject.SetActive(false);
						value.Add(val.gameObject);
					}
				}
			}
			else
			{
				foreach (GameObject item in value)
				{
					if ((Object)(object)item != (Object)null)
					{
						item.SetActive(true);
					}
				}
				value.Clear();
			}
			TMP_Text nickNameText = row.nickNameText;
			if (!((Object)(object)nickNameText == (Object)null))
			{
				if (!NameStyles.ContainsKey(nickNameText))
				{
					NameStyles[nickNameText] = (((Graphic)nickNameText).color, nickNameText.alignment, nickNameText.rectTransform.anchoredPosition);
				}
				var (color, alignment, anchoredPosition) = NameStyles[nickNameText];
				if (on)
				{
					row.container.SetActive(true);
					nickNameText.text = "Empty slot";
					((Graphic)nickNameText).color = PlaceholderColor;
					nickNameText.alignment = (TextAlignmentOptions)514;
					nickNameText.rectTransform.anchoredPosition = new Vector2(-75f, 0f);
				}
				else
				{
					((Graphic)nickNameText).color = color;
					nickNameText.alignment = alignment;
					nickNameText.rectTransform.anchoredPosition = anchoredPosition;
				}
			}
		}
	}
	[HarmonyPatch]
	internal static class LobbySizePatch
	{
		private static readonly FieldInfo MaxField = AccessTools.Field(typeof(DataConsts), "C_MaxPlayerCount");

		[HarmonyPostfix]
		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		private static void RaiseLimit(DataConsts __instance)
		{
			MaxField.SetValue(__instance, 10);
			Debug.Log((object)$"[BiggerLobby] Player limit set to {10}");
		}

		[HarmonyTranspiler]
		[HarmonyPatch(typeof(UIPrefab_SurvivalResult), "PatchParameter")]
		private static IEnumerable<CodeInstruction> ResultScreenKeepsFour(IEnumerable<CodeInstruction> code)
		{
			return KeepFour(code);
		}

		[HarmonyTranspiler]
		[HarmonyPatch(typeof(VWorld), "AdminCommandSaveGameData")]
		private static IEnumerable<CodeInstruction> TestHelperKeepsFour(IEnumerable<CodeInstruction> code)
		{
			return KeepFour(code);
		}

		private static IEnumerable<CodeInstruction> KeepFour(IEnumerable<CodeInstruction> code)
		{
			foreach (CodeInstruction item in code)
			{
				if (CodeInstructionExtensions.LoadsField(item, MaxField, false))
				{
					yield return CodeInstructionExtensions.MoveLabelsFrom(new CodeInstruction(OpCodes.Pop, (object)null), item);
					yield return new CodeInstruction(OpCodes.Ldc_I4_4, (object)null);
				}
				else
				{
					yield return item;
				}
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(SteamMatchmaking), "CreateLobby")]
		private static void LobbyRoom(ref int cMaxMembers)
		{
			cMaxMembers = 10;
		}
	}
	public static class Plugin
	{
		public const int MaxPlayers = 10;

		private static bool _initialized;

		public static void Init()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			if (_initialized)
			{
				return;
			}
			_initialized = true;
			try
			{
				new Harmony("medovanx.biggerlobby").PatchAll(typeof(Plugin).Assembly);
				PatchMenu.Register("BiggerLobby", typeof(Plugin).Assembly.GetName().Version, () => $"Lobbies hold {10} players, difficulty scaling {(ScalingPatch.Enabled ? "on" : "off")}", delegate(RectTransform page, TMP_FontAsset font)
				{
					//IL_0056: Unknown result type (might be due to invalid IL or missing references)
					PatchUi.OnOff((Transform)(object)page, font, "Difficulty scaling", () => ScalingPatch.Enabled, delegate(bool v)
					{
						ScalingPatch.Enabled = v;
					});
					PatchUi.Label((Transform)(object)page, font, "Above 4 players (host only):\n• Quota × players / 4   (10 players: ×2.5)\n• Shop prices +12.5% per extra player   (×1.75)\n• Monster budget +10% per extra player   (×1.6)\n• +1 mimic per 3 extra players   (+2)", 20f, PatchUi.Dim);
				});
				Debug.Log((object)$"[BiggerLobby] v{typeof(Plugin).Assembly.GetName().Version.ToString(3)}: patches applied ({10} players)");
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("[BiggerLobby] Failed to apply UI patches: " + ex));
			}
		}
	}
	[HarmonyPatch]
	internal static class ResultScreenPatch
	{
		private static readonly Dictionary<int, List<RectTransform>> Extra = new Dictionary<int, List<RectTransform>>();

		private static List<RectTransform> Columns(Component screen, RectTransform p4, int count)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Expected O, but got Unknown
			List<RectTransform> list = new List<RectTransform>();
			Transform parent = ((Transform)p4).parent;
			for (int i = 1; i <= 4; i++)
			{
				list.Add((RectTransform)parent.Find("Player" + i));
			}
			if (!Extra.TryGetValue(((Object)screen).GetInstanceID(), out var value))
			{
				value = (Extra[((Object)screen).GetInstanceID()] = new List<RectTransform>());
			}
			while (value.Count < 6)
			{
				RectTransform val = (RectTransform)Object.Instantiate<GameObject>(((Component)p4).gameObject, parent).transform;
				((Object)val).name = "Player" + (5 + value.Count);
				value.Add(val);
			}
			list.AddRange(value);
			for (int j = 4; j < list.Count; j++)
			{
				((Component)list[j]).gameObject.SetActive(j < count);
			}
			return list;
		}

		private static void Reset(Transform col)
		{
			string[] array = new string[5] { "Survival", "Killed", "Wasted", "Award", "WellDone" };
			foreach (string suffix in array)
			{
				Graphic val = UiUtil.Find<Graphic>(col, suffix);
				if ((Object)(object)val != (Object)null)
				{
					((Component)val).gameObject.SetActive(false);
				}
			}
		}

		private static string AwardText(AwardType award)
		{
			//IL_0000: 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_0018: Expected I4, but got Unknown
			return (award - 1) switch
			{
				0 => Hub.GetL10NText("STRING_SETTLEMENT_REPORT_CASE_1", Array.Empty<object>()), 
				1 => Hub.GetL10NText("STRING_SETTLEMENT_REPORT_CASE_2", Array.Empty<object>()), 
				2 => Hub.GetL10NText("STRING_SETTLEMENT_REPORT_CASE_3", Array.Empty<object>()), 
				3 => Hub.GetL10NText("STRING_SETTLEMENT_REPORT_CASE_4", Array.Empty<object>()), 
				_ => "", 
			};
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(UIPrefab_SurvivalResult), "PatchParameter")]
		private static void Survival(UIPrefab_SurvivalResult __instance, object[] parameters)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0073: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected I4, but got Unknown
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			int num = Mathf.Min((int)parameters[2], 10);
			if (num <= 4)
			{
				return;
			}
			RectTransform val = (RectTransform)__instance.UE_P4Name.transform.parent;
			List<RectTransform> list = Columns((Component)(object)__instance, val, num);
			for (int i = 4; i < num; i++)
			{
				RectTransform val2 = list[i];
				Reset((Transform)(object)val2);
				UiUtil.Find<TMP_Text>((Transform)(object)val2, "Name").SetText(parameters[3 * i + 3].ToString());
				eActorSurvivalState val3 = (eActorSurvivalState)parameters[3 * i + 4];
				string text = (int)val3 switch
				{
					0 => "Survival", 
					2 => "Killed", 
					1 => "Wasted", 
					_ => null, 
				};
				if (text != null)
				{
					TMP_Text obj = UiUtil.Find<TMP_Text>((Transform)(object)val2, text);
					if (obj != null)
					{
						((Component)obj).gameObject.SetActive(true);
					}
				}
				TMP_Text obj2 = UiUtil.Find<TMP_Text>((Transform)(object)val2, "Award");
				obj2.SetText(AwardText((AwardType)parameters[3 * i + 5]));
				((Component)obj2).gameObject.SetActive(true);
			}
			Rect rect = ((RectTransform)((Transform)val).parent).rect;
			float colW = ((Rect)(ref rect)).width / 4f;
			Rect rect2 = val.rect;
			UiUtil.Grid(list, num, colW, ((Rect)(ref rect2)).height, ((Rect)(ref rect)).width, 0f);
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(UIPrefab_DeathMatchResult), "PatchParameter")]
		private static void DeathMatch(UIPrefab_DeathMatchResult __instance, object[] parameters)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: 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_012a: 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_0134: Unknown result type (might be due to invalid IL or missing references)
			int num = Mathf.Min(parameters.Length / 3, 10);
			if (num <= 4)
			{
				return;
			}
			RectTransform val = (RectTransform)__instance.UE_P4Name.transform.parent;
			List<RectTransform> list = Columns((Component)(object)__instance, val, num);
			List<GameObject> value = Traverse.Create((object)__instance).Field("stampObjectsToShow").GetValue<List<GameObject>>();
			for (int i = 4; i < num; i++)
			{
				RectTransform val2 = list[i];
				Reset((Transform)(object)val2);
				UiUtil.Find<TMP_Text>((Transform)(object)val2, "Name").SetText(parameters[3 * i].ToString());
				if ((bool)parameters[3 * i + 1])
				{
					value.Add(((Component)UiUtil.Find<Image>((Transform)(object)val2, "WellDone")).gameObject);
					((Component)UiUtil.Find<TMP_Text>((Transform)(object)val2, "Survival")).gameObject.SetActive(true);
					((Component)__instance.UE_NoSurvivors).gameObject.SetActive(false);
				}
				else
				{
					TMP_Text obj = UiUtil.Find<TMP_Text>((Transform)(object)val2, "Award");
					obj.SetText(parameters[3 * i + 2].ToString());
					((Component)obj).gameObject.SetActive(true);
				}
			}
			Rect rect = val.rect;
			float width = ((Rect)(ref rect)).width;
			rect = val.rect;
			float height = ((Rect)(ref rect)).height;
			rect = ((RectTransform)((Transform)val).parent).rect;
			UiUtil.Grid(list, num, width, height, ((Rect)(ref rect)).width, 0f);
		}
	}
	[HarmonyPatch]
	internal static class ScalingPatch
	{
		private static GameSessionInfo _session;

		public static bool Enabled
		{
			get
			{
				return PlayerPrefs.GetInt("medovanx.BiggerLobby.Scaling", 1) == 1;
			}
			set
			{
				PlayerPrefs.SetInt("medovanx.BiggerLobby.Scaling", value ? 1 : 0);
				PlayerPrefs.Save();
			}
		}

		public static int SessionPlayers
		{
			get
			{
				GameSessionInfo session = _session;
				if (session == null)
				{
					return 0;
				}
				return session.TotalPlayerSteamIDs.Count;
			}
		}

		private static int Players
		{
			get
			{
				if (!Enabled)
				{
					return 4;
				}
				return Mathf.Max(SessionPlayers, 4);
			}
		}

		private static int Extra => Players - 4;

		public static float QuotaFactor => (float)Players / 4f;

		public static float PriceFactor => 1f + 0.125f * (float)Extra;

		public static float MonsterFactor => 1f + 0.1f * (float)Extra;

		public static int ExtraMimics => Extra / 3;

		[HarmonyPostfix]
		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		private static void TrackSession(GameSessionInfo __instance)
		{
			_session = __instance;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameSessionInfo), "GetCurrencyThreshold")]
		private static void ScaleQuota(GameSessionInfo __instance, ref int __result)
		{
			_session = __instance;
			__result = Mathf.RoundToInt((float)__result * QuotaFactor);
		}

		[HarmonyTranspiler]
		[HarmonyPatch(typeof(MaintenanceRoom), "SaveGameData")]
		private static IEnumerable<CodeInstruction> SaveUnscaledQuota(IEnumerable<CodeInstruction> code)
		{
			MethodInfo setter = AccessTools.PropertySetter(typeof(MMSaveGameData), "TargetCurrency");
			foreach (CodeInstruction x in code)
			{
				if (CodeInstructionExtensions.Calls(x, setter))
				{
					yield return CodeInstruction.Call(typeof(ScalingPatch), "Unscaled", (Type[])null, (Type[])null);
				}
				yield return x;
			}
		}

		private static int Unscaled(int scaled)
		{
			if (_session == null)
			{
				return Mathf.RoundToInt((float)scaled / QuotaFactor);
			}
			return _session._targetCurrency;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(ExcelDataManager), "GetShopGroupInfo")]
		private static void ScalePrice(ref (int masterid, int price, float discountRate) __result)
		{
			__result.price = Mathf.RoundToInt((float)__result.price * PriceFactor);
		}

		[HarmonyPostfix]
		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		private static void ScaleMonsters(DungeonRoom __instance, VRoomManager roomManager)
		{
			_session = roomManager.GetGameSessionInfo() ?? _session;
			__instance._normalMonsterThreatLimit = Mathf.RoundToInt((float)__instance._normalMonsterThreatLimit * MonsterFactor);
			__instance._normalMonsterThreatRemain = __instance._normalMonsterThreatLimit;
			__instance._mimicSpawnCountMax += ExtraMimics;
			__instance._mimicSpawnCountRemain = __instance._mimicSpawnCountMax;
			Debug.Log((object)$"[BiggerLobby] Scaling for {Players} players: quota x{QuotaFactor:0.##}, prices x{PriceFactor:0.##}, monsters x{MonsterFactor:0.##}, mimics +{ExtraMimics}");
		}
	}
	[HarmonyPatch]
	internal static class SpectatorListPatch
	{
		private static readonly HashSet<int> _logged = new HashSet<int>();

		[HarmonyPostfix]
		[HarmonyPatch(typeof(UIPrefab_Spectator_PlayerListView), "Start")]
		private static void AddRows(UIPrefab_Spectator_PlayerListView __instance)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_006c: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: 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_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			UIPrefab_Spectator_PlayerListViewItem[] playerListViewItems = __instance.playerListViewItems;
			if (playerListViewItems != null && playerListViewItems.Length >= 2 && playerListViewItems.Length < 10)
			{
				Canvas.ForceUpdateCanvases();
				RectTransform val = (RectTransform)((Component)playerListViewItems[0]).transform.parent;
				if ((Object)(object)val != (Object)null)
				{
					LayoutRebuilder.ForceRebuildLayoutImmediate(val);
				}
				RectTransform val2 = (RectTransform)((Component)playerListViewItems[0]).transform;
				RectTransform val3 = (RectTransform)((Component)playerListViewItems[1]).transform;
				RectTransform val4 = (RectTransform)((Component)playerListViewItems[^1]).transform;
				Vector2 val5 = val3.anchoredPosition - val2.anchoredPosition;
				if (((Vector2)(ref val5)).sqrMagnitude < 1f)
				{
					Rect rect = val2.rect;
					((Vector2)(ref val5))..ctor(0f, (0f - Mathf.Max(((Rect)(ref rect)).height, 40f)) * 1.3f);
				}
				UIPrefab_Spectator_PlayerListViewItem[] array = (UIPrefab_Spectator_PlayerListViewItem[])(object)new UIPrefab_Spectator_PlayerListViewItem[10];
				playerListViewItems.CopyTo(array, 0);
				for (int i = playerListViewItems.Length; i < array.Length; i++)
				{
					GameObject obj = Object.Instantiate<GameObject>(((Component)val4).gameObject, ((Transform)val4).parent, false);
					((Object)obj).name = ((Object)((Component)val4).gameObject).name + "_" + i;
					obj.SetActive(true);
					((RectTransform)obj.transform).anchoredPosition = val4.anchoredPosition + val5 * (float)(i - playerListViewItems.Length + 1);
					UIPrefab_Spectator_PlayerListViewItem component = obj.GetComponent<UIPrefab_Spectator_PlayerListViewItem>();
					component.UE_Name_Text.SetText(string.Empty);
					component.SpriteChangeAnimation.TurnOff();
					((Component)component.IsPossessor).gameObject.SetActive(false);
					array[i] = component;
				}
				__instance.playerListViewItems = array;
				Debug.Log((object)$"[BiggerLobby] Spectator list: {playerListViewItems.Length} -> {array.Length} rows, step {val5}, parent {((val != null) ? ((Object)val).name : null)} layout {((val == null) ? null : ((object)((Component)val).GetComponent<LayoutGroup>())?.GetType().Name) ?? "none"}, mask {(Object)(object)((val != null) ? ((Component)val).GetComponentInParent<RectMask2D>() : null) != (Object)null || (Object)(object)((val != null) ? ((Component)val).GetComponentInParent<Mask>() : null) != (Object)null}");
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(UIPrefab_Spectator_PlayerListView), "UpdatePlayerListView")]
		private static void LogRows(UIPrefab_Spectator_PlayerListView __instance, List<Tuple<int, bool, bool, bool>> actorsInfo)
		{
			if (actorsInfo != null && actorsInfo.Count > 4 && _logged.Add(((Object)__instance).GetInstanceID()))
			{
				UIPrefab_Spectator_PlayerListViewItem[] array = (UIPrefab_Spectator_PlayerListViewItem[])(((object)__instance.playerListViewItems) ?? ((object)new UIPrefab_Spectator_PlayerListViewItem[0]));
				Debug.Log((object)($"[BiggerLobby] Spectator list update: {actorsInfo.Count} players, {array.Length} rows:\n" + string.Join("\n", array.Select(delegate(UIPrefab_Spectator_PlayerListViewItem r, int i)
				{
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					//IL_000c: Expected O, but got Unknown
					//IL_0057: 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_0078: Unknown result type (might be due to invalid IL or missing references)
					RectTransform val = (RectTransform)((Component)r).transform;
					DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(30, 5);
					defaultInterpolatedStringHandler.AppendLiteral("  ");
					defaultInterpolatedStringHandler.AppendFormatted(i);
					defaultInterpolatedStringHandler.AppendLiteral(": active=");
					defaultInterpolatedStringHandler.AppendFormatted(((Component)r).gameObject.activeInHierarchy);
					defaultInterpolatedStringHandler.AppendLiteral(" pos=");
					defaultInterpolatedStringHandler.AppendFormatted<Vector2>(val.anchoredPosition);
					defaultInterpolatedStringHandler.AppendLiteral(" size=");
					Rect rect = val.rect;
					defaultInterpolatedStringHandler.AppendFormatted<Vector2>(((Rect)(ref rect)).size);
					defaultInterpolatedStringHandler.AppendLiteral(" text='");
					defaultInterpolatedStringHandler.AppendFormatted(r.UE_Name_Text.text);
					defaultInterpolatedStringHandler.AppendLiteral("'");
					return defaultInterpolatedStringHandler.ToStringAndClear();
				}))));
			}
		}
	}
	internal static class UiUtil
	{
		public static T Find<T>(Transform root, string suffix) where T : Component
		{
			return ((Component)root).GetComponentsInChildren<T>(true).FirstOrDefault((T c) => ((Object)(object)c).name.EndsWith(suffix));
		}

		public static T Map<T>(Transform templateRoot, Transform cloneRoot, T templatePart) where T : Component
		{
			if ((Object)(object)templatePart == (Object)null)
			{
				return default(T);
			}
			List<int> list = new List<int>();
			Transform val = ((Component)templatePart).transform;
			while ((Object)(object)val != (Object)(object)templateRoot)
			{
				if ((Object)(object)val == (Object)null)
				{
					return ((Component)cloneRoot).GetComponentsInChildren<T>(true).FirstOrDefault((T c) => ((Object)(object)c).name == ((Object)(object)templatePart).name);
				}
				list.Insert(0, val.GetSiblingIndex());
				val = val.parent;
			}
			Transform val2 = cloneRoot;
			foreach (int item in list)
			{
				val2 = val2.GetChild(item);
			}
			return ((Component)val2).GetComponent<T>();
		}

		public static void Grid(IList<RectTransform> cols, int count, float colW, float colH, float areaW, float top, int perRow = 5)
		{
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: 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_00f7: 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)
			LayoutGroup component = ((Component)((Transform)cols[0]).parent).GetComponent<LayoutGroup>();
			if ((Object)(object)component != (Object)null)
			{
				((Behaviour)component).enabled = false;
			}
			int num = Mathf.Min(count, perRow);
			int num2 = Mathf.CeilToInt((float)count / (float)perRow);
			float num3 = Mathf.Min(new float[3]
			{
				1f,
				areaW / ((float)num * colW),
				1.6f / (float)num2
			});
			float num4 = (areaW - (float)num * colW * num3) / 2f;
			Vector2 val2 = default(Vector2);
			for (int i = 0; i < cols.Count; i++)
			{
				RectTransform val = cols[i];
				if (i >= count)
				{
					((Component)val).gameObject.SetActive(false);
					continue;
				}
				int num5 = i / perRow;
				int num6 = i % perRow;
				((Vector2)(ref val2))..ctor(0f, 1f);
				val.anchorMax = val2;
				val.anchorMin = val2;
				val.pivot = new Vector2(0.5f, 0.5f);
				val.sizeDelta = new Vector2(colW, colH);
				((Transform)val).localScale = Vector3.one * num3;
				val.anchoredPosition = new Vector2(num4 + ((float)num6 + 0.5f) * colW * num3, top - ((float)num5 + 0.5f) * colH * num3);
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}