Decompiled source of conflictmodlist v1.1.10

plugins/conflictmodlist.dll

Decompiled 2 hours ago
using System;
using System.Buffers.Binary;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net.NetworkInformation;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
using System.Text.RegularExpressions;
using System.Threading;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using CellMenu;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.Attributes;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using SNetwork;
using Steamworks;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("conflictmodlist")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.10.0")]
[assembly: AssemblyInformationalVersion("1.1.10+4bc2d1370df4d830809eed0a5b7ca5ac94d082ec")]
[assembly: AssemblyProduct("conflictmodlist")]
[assembly: AssemblyTitle("conflictmodlist")]
[assembly: AssemblyVersion("1.1.10.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 TeamModVersions
{
	internal static class HikariaLoadoutAnchor
	{
		internal static Vector3 Fallback(TextMeshPro template, RectTransform card)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			RectTransform rectTransform = ((TMP_Text)template).rectTransform;
			Vector2 pivot = rectTransform.pivot;
			Vector3 localScale = ((Transform)card).localScale;
			float num = 1525f - pivot.x * 1000f * localScale.x;
			float num2 = 1f - pivot.y;
			Rect rect = rectTransform.rect;
			return new Vector3(num, -515f + (num2 * ((Rect)(ref rect)).height - card.sizeDelta.y) * localScale.y, 0f);
		}
	}
	internal sealed class LobbyButtons
	{
		private sealed record Entry(CM_PlayerLobbyBar Bar, Transform Parent, ulong Player, CM_Item Item, RectTransform Rect, BoxCollider2D Hit, SpriteRenderer Plate);

		private readonly record struct Anchor(ButtonBox Box, float Z);

		private sealed record Seat(CM_PlayerLobbyBar Bar, Transform Parent, ulong Player, bool Local, Anchor? Clothes, Anchor? Remembered, Anchor[] Gear);

		private sealed record Memory(IntPtr Root, int ScreenW, int ScreenH, Anchor Box);

		private readonly Dictionary<int, Entry> entries = new Dictionary<int, Entry>();

		private readonly Dictionary<IntPtr, Memory> remembered = new Dictionary<IntPtr, Memory>();

		private CM_PageLoadout? owner;

		private Action<ulong>? select;

		private Sprite? square;

		private Entry? localChip;

		internal bool CompareRect(int column, CM_PlayerLobbyBar bar, bool bot, out Transform? owner, out Rect bounds, out float z)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			owner = null;
			bounds = default(Rect);
			z = 0f;
			Entry entry = (bot ? localChip : entries.GetValueOrDefault(column));
			if (entry == null || (Object)(object)entry.Rect == (Object)null || !((Component)entry.Rect).gameObject.activeInHierarchy)
			{
				return false;
			}
			bounds = entry.Rect.rect;
			if (!bot)
			{
				if ((Object)(object)entry.Bar != (Object)(object)bar)
				{
					return false;
				}
				owner = (Transform?)(object)entry.Rect;
			}
			else
			{
				GameObject hasPlayerRoot = bar.m_hasPlayerRoot;
				if ((Object)(object)hasPlayerRoot == (Object)null || !hasPlayerRoot.activeInHierarchy)
				{
					return false;
				}
				Vector3 localPosition = ((Transform)entry.Rect).localPosition;
				owner = hasPlayerRoot.transform;
				bounds = new Rect(((Rect)(ref bounds)).x + localPosition.x, ((Rect)(ref bounds)).y + localPosition.y, ((Rect)(ref bounds)).width, ((Rect)(ref bounds)).height);
				z = localPosition.z;
			}
			return true;
		}

		internal void Update(CM_PageLoadout page, Action<ulong> choose)
		{
			if ((Object)(object)owner != (Object)(object)page)
			{
				Clear();
			}
			if ((Object)(object)page == (Object)null || !((CM_PageBase)page).m_isActive || !((Component)page).gameObject.activeInHierarchy || page.m_playerLobbyBars == null)
			{
				Clear();
				return;
			}
			owner = page;
			select = choose;
			try
			{
				Reconcile(page);
			}
			catch
			{
				Clear();
				throw;
			}
		}

		internal void Clear()
		{
			select = null;
			owner = null;
			localChip = null;
			foreach (Entry value in entries.Values)
			{
				Retire(value.Item);
			}
			entries.Clear();
			remembered.Clear();
			if ((Object)(object)square != (Object)null)
			{
				Object.Destroy((Object)(object)square);
			}
			square = null;
		}

		private static void Retire(CM_Item? item)
		{
			if (!((Object)(object)item == (Object)null))
			{
				((Component)item).gameObject.SetActive(false);
				item.OnBtnPressCallback = null;
				Object.Destroy((Object)(object)((Component)item).gameObject);
			}
		}

		private static ulong Player(CM_PlayerLobbyBar bar)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			SNet_Player player = bar.m_player;
			if ((Object)(object)player == (Object)null || player.IsBot)
			{
				return 0uL;
			}
			if (player.IsLocal)
			{
				ulong steamID = SteamUser.GetSteamID().m_SteamID;
				if (steamID != 0L)
				{
					return steamID;
				}
			}
			return player.Lookup;
		}

		private void Press(int slot, Entry expected)
		{
			if (!entries.TryGetValue(slot, out Entry value) || (object)value != expected || (Object)(object)owner == (Object)null || !((CM_PageBase)owner).m_isActive || (Object)(object)value.Item == (Object)null || !((Component)value.Item).gameObject.activeInHierarchy)
			{
				return;
			}
			Il2CppReferenceArray<CM_PlayerLobbyBar> playerLobbyBars = owner.m_playerLobbyBars;
			if (playerLobbyBars != null && slot < ((Il2CppArrayBase<CM_PlayerLobbyBar>)(object)playerLobbyBars).Length)
			{
				CM_PlayerLobbyBar val = ((Il2CppArrayBase<CM_PlayerLobbyBar>)(object)playerLobbyBars)[slot];
				if ((Object)(object)val != (Object)null && (Object)(object)val == (Object)(object)value.Bar && (Object)(object)val.m_hasPlayerRoot != (Object)null && (Object)(object)val.m_hasPlayerRoot.transform == (Object)(object)value.Parent && Player(val) == value.Player && (!val.m_loadoutHidden || Drawn(val, val.m_hasPlayerRoot.transform)))
				{
					select?.Invoke(value.Player);
				}
			}
		}

		private void Reconcile(CM_PageLoadout page)
		{
			//IL_0481: Unknown result type (might be due to invalid IL or missing references)
			//IL_0486: Unknown result type (might be due to invalid IL or missing references)
			//IL_049b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_050b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0510: Unknown result type (might be due to invalid IL or missing references)
			//IL_0593: Unknown result type (might be due to invalid IL or missing references)
			//IL_0598: Unknown result type (might be due to invalid IL or missing references)
			//IL_059d: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05de: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0703: Unknown result type (might be due to invalid IL or missing references)
			Il2CppReferenceArray<CM_PlayerLobbyBar> playerLobbyBars = page.m_playerLobbyBars;
			Seat[] array = new Seat[((Il2CppArrayBase<CM_PlayerLobbyBar>)(object)playerLobbyBars).Length];
			List<Bounds> list = new List<Bounds>();
			Anchor? anchor = null;
			HashSet<IntPtr> seen = new HashSet<IntPtr>();
			for (int i = 0; i < ((Il2CppArrayBase<CM_PlayerLobbyBar>)(object)playerLobbyBars).Length; i++)
			{
				CM_PlayerLobbyBar val = ((Il2CppArrayBase<CM_PlayerLobbyBar>)(object)playerLobbyBars)[i];
				if (!((Object)(object)val == (Object)null) && !((Object)(object)val.m_hasPlayerRoot == (Object)null))
				{
					Transform transform = val.m_hasPlayerRoot.transform;
					Anchor? anchor2 = ReadAnchor(transform, val.m_clothesButton);
					Anchor[] array2 = Gear(transform, val, list);
					bool flag = anchor2.HasValue || array2.Length != 0 || NameDrawn(val);
					ulong num = ((((Component)transform).gameObject.activeInHierarchy && (!val.m_loadoutHidden || flag)) ? Player(val) : 0);
					bool flag2 = num != 0L && val.m_player.IsLocal;
					Anchor? anchor3 = Remember(val, transform, anchor2, seen);
					array[i] = new Seat(val, transform, num, flag2, anchor2, anchor3, array2);
					if (flag2)
					{
						anchor = anchor2 ?? anchor3;
					}
					if ((Object)(object)val.m_clothesButton != (Object)null)
					{
						Protect(((Component)val.m_clothesButton).transform, list);
					}
					if ((Object)(object)val.m_boosterImplantSlotHolder != (Object)null)
					{
						Protect(((Component)val.m_boosterImplantSlotHolder).transform, list);
					}
					if ((Object)(object)val.m_newClothesIcon != (Object)null)
					{
						Protect(val.m_newClothesIcon.transform, list);
					}
					Protect(transform.Find($"UI_ModListButton_{i}"), list);
					AddLabel(val.m_nickText, list);
					AddLabel(val.m_weaponsHeaderText, list);
					AddLabel(val.m_boosterImplantsHeaderText, list);
					AddLabel(val.m_statusText, list);
				}
			}
			foreach (IntPtr item in new List<IntPtr>(remembered.Keys).FindAll((IntPtr k) => !seen.Contains(k)))
			{
				remembered.Remove(item);
			}
			MainMenuGuiLayer guiLayer = ((CM_PageBase)page).m_guiLayer;
			object obj;
			if (guiLayer == null)
			{
				obj = null;
			}
			else
			{
				CameraController menuCamera = guiLayer.m_menuCamera;
				obj = ((menuCamera != null) ? menuCamera.m_camera : null);
			}
			Camera val2 = (Camera)obj;
			HashSet<int> keep = new HashSet<int>();
			HashSet<ulong> hashSet = new HashSet<ulong>();
			List<ButtonBox> list2 = new List<ButtonBox>(list.Count);
			localChip = null;
			List<ButtonBox> list3 = new List<ButtonBox>(8);
			for (int num2 = 0; num2 < array.Length; num2++)
			{
				Seat seat = array[num2];
				if ((object)seat == null || seat.Player == 0L || (Object)(object)Template(seat.Bar) == (Object)null || hashSet.Contains(seat.Player))
				{
					continue;
				}
				list3.Clear();
				if (seat.Bar.m_loadoutHidden || seat.Bar.m_introDone)
				{
					Anchor[] gear = seat.Gear;
					foreach (Anchor anchor4 in gear)
					{
						list3.Add(anchor4.Box);
					}
				}
				ButtonBox? buttonBox = ButtonLayout.Anchor(seat.Local, seat.Clothes?.Box, seat.Remembered?.Box, list3, anchor?.Box);
				if (!buttonBox.HasValue)
				{
					continue;
				}
				ButtonBox valueOrDefault = buttonBox.GetValueOrDefault();
				float num4;
				if (!seat.Clothes.HasValue && !seat.Remembered.HasValue && anchor.HasValue)
				{
					Anchor valueOrDefault2 = anchor.GetValueOrDefault();
					if (valueOrDefault2.Box == valueOrDefault)
					{
						num4 = valueOrDefault2.Z;
						goto IL_0474;
					}
				}
				num4 = Depth(seat, valueOrDefault);
				goto IL_0474;
				IL_0474:
				float num5 = num4;
				Transform parent = seat.Parent;
				Matrix4x4 worldToLocalMatrix = parent.worldToLocalMatrix;
				list2.Clear();
				foreach (Bounds item2 in list)
				{
					list2.Add(Project(item2, worldToLocalMatrix));
				}
				float num6 = float.PositiveInfinity;
				float num7 = float.PositiveInfinity;
				Seat[] array3 = array;
				foreach (Seat seat2 in array3)
				{
					if (!(seat2 == null) && !((Object)(object)seat2.Parent == (Object)(object)parent))
					{
						float x = parent.InverseTransformPoint(seat2.Parent.position).x;
						if (x > 1f)
						{
							num6 = Math.Min(num6, x);
						}
						if (x < -1f)
						{
							num7 = Math.Min(num7, 0f - x);
						}
					}
				}
				float num8 = valueOrDefault.Left + (float.IsFinite(num6) ? num6 : num7) - 4f;
				if ((Object)(object)val2 != (Object)null)
				{
					Vector3 val3 = val2.WorldToViewportPoint(parent.TransformPoint(new Vector3(valueOrDefault.Right, valueOrDefault.Bottom, num5)));
					if (val3.z <= 0f || val3.y < 0f || val3.y >= 1f)
					{
						continue;
					}
					Vector3 val4 = val2.ViewportToWorldPoint(new Vector3(1f, val3.y, val3.z));
					num8 = Math.Min(num8, parent.InverseTransformPoint(val4).x - 4f);
				}
				LobbyButtonPlan? lobbyButtonPlan = ButtonLayout.Place(seat.Player, seat.Local, valueOrDefault, null, num8, list2);
				if (!lobbyButtonPlan.HasValue)
				{
					continue;
				}
				LobbyButtonPlan valueOrDefault3 = lobbyButtonPlan.GetValueOrDefault();
				if (!entries.TryGetValue(num2, out Entry value) || (Object)(object)value.Item == (Object)null || (Object)(object)value.Bar != (Object)(object)seat.Bar || (Object)(object)value.Parent != (Object)(object)parent || value.Player != valueOrDefault3.Player)
				{
					if (value != null)
					{
						Retire(value.Item);
					}
					value = (entries[num2] = Build(page, num2, seat));
				}
				Apply(value, valueOrDefault3.Rect, num5);
				if (seat.Local)
				{
					localChip = value;
				}
				list.Add(((Renderer)value.Plate).bounds);
				keep.Add(num2);
				hashSet.Add(valueOrDefault3.Player);
			}
			int[] array4 = entries.Keys.Where((int item) => !keep.Contains(item)).ToArray();
			foreach (int key in array4)
			{
				Retire(entries[key].Item);
				entries.Remove(key);
			}
		}

		private Anchor? Remember(CM_PlayerLobbyBar bar, Transform parent, Anchor? clothes, HashSet<IntPtr> seen)
		{
			IntPtr pointer = ((Il2CppObjectBase)bar).Pointer;
			if (pointer == IntPtr.Zero)
			{
				return clothes;
			}
			seen.Add(pointer);
			if (clothes.HasValue)
			{
				Anchor valueOrDefault = clothes.GetValueOrDefault();
				remembered[pointer] = new Memory(((Il2CppObjectBase)parent).Pointer, Screen.width, Screen.height, valueOrDefault);
				return valueOrDefault;
			}
			if (!remembered.TryGetValue(pointer, out Memory value) || !(value.Root == ((Il2CppObjectBase)parent).Pointer) || value.ScreenW != Screen.width || value.ScreenH != Screen.height)
			{
				return null;
			}
			return value.Box;
		}

		private static Anchor[] Gear(Transform parent, CM_PlayerLobbyBar bar, List<Bounds> obstacles)
		{
			Il2CppArrayBase<CM_InventorySlotItem> componentsInChildren = ((Component)bar).GetComponentsInChildren<CM_InventorySlotItem>(false);
			List<Anchor> list = new List<Anchor>(componentsInChildren.Length);
			foreach (CM_InventorySlotItem item in componentsInChildren)
			{
				if ((Object)(object)item == (Object)null)
				{
					continue;
				}
				Protect(((Component)item).transform, obstacles);
				if (!((CM_LobbyScrollItem)item).m_inIntro)
				{
					Anchor? anchor = Measure(parent, item);
					if (anchor.HasValue)
					{
						Anchor valueOrDefault = anchor.GetValueOrDefault();
						list.Add(valueOrDefault);
					}
				}
			}
			return list.ToArray();
		}

		private static Anchor? Measure(Transform parent, CM_InventorySlotItem slot)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: 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_015b: 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_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			Transform val = null;
			Bounds b = default(Bounds);
			SpriteRenderer edge = ((CM_LobbyScrollItem)slot).m_edge;
			if ((Object)(object)edge != (Object)null && ((Renderer)edge).enabled && ((Component)edge).gameObject.activeInHierarchy)
			{
				Bounds bounds = ((Renderer)edge).bounds;
				ButtonBox box = Project(bounds, parent.worldToLocalMatrix);
				if (box.Valid)
				{
					return new Anchor(box, parent.InverseTransformPoint(((Bounds)(ref bounds)).center).z);
				}
			}
			Collider2D slotCollider = ((CM_LobbyScrollItem)slot).m_slotCollider;
			BoxCollider2D val2 = ((slotCollider != null) ? ((Il2CppObjectBase)slotCollider).TryCast<BoxCollider2D>() : null) ?? ((CM_Item)slot).m_collider;
			if ((Object)(object)val2 != (Object)null && val2.size.x > 0f && val2.size.y > 0f)
			{
				val = ((Component)val2).transform;
				((Bounds)(ref b))..ctor(Vector2.op_Implicit(((Collider2D)val2).offset), Vector2.op_Implicit(val2.size));
			}
			else
			{
				RectTransform rectTrans = ((RectTransformComp)slot).RectTrans;
				if ((Object)(object)rectTrans == (Object)null)
				{
					return null;
				}
				val = (Transform)(object)rectTrans;
				Rect rect = rectTrans.rect;
				Vector3 val3 = Vector2.op_Implicit(((Rect)(ref rect)).center);
				rect = rectTrans.rect;
				((Bounds)(ref b))..ctor(val3, Vector2.op_Implicit(((Rect)(ref rect)).size));
			}
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			Matrix4x4 m = parent.worldToLocalMatrix * val.localToWorldMatrix;
			ButtonBox box2 = Project(b, m);
			if (!box2.Valid)
			{
				return null;
			}
			return new Anchor(box2, ((Matrix4x4)(ref m)).MultiplyPoint3x4(((Bounds)(ref b)).center).z);
		}

		private static bool Drawn(CM_PlayerLobbyBar bar, Transform parent)
		{
			if (!((Component)parent).gameObject.activeInHierarchy)
			{
				return false;
			}
			if (ReadAnchor(parent, bar.m_clothesButton).HasValue || NameDrawn(bar) || AnyGear(bar))
			{
				return true;
			}
			return false;
		}

		private static bool AnyGear(CM_PlayerLobbyBar bar)
		{
			foreach (CM_InventorySlotItem componentsInChild in ((Component)bar).GetComponentsInChildren<CM_InventorySlotItem>(false))
			{
				if ((Object)(object)componentsInChild != (Object)null && !((CM_LobbyScrollItem)componentsInChild).m_inIntro)
				{
					return true;
				}
			}
			return false;
		}

		private static bool NameDrawn(CM_PlayerLobbyBar bar)
		{
			TextMeshPro nickText = bar.m_nickText;
			if ((Object)(object)nickText != (Object)null)
			{
				return ((Behaviour)nickText).isActiveAndEnabled;
			}
			return false;
		}

		private static float Depth(Seat seat, ButtonBox anchor)
		{
			Anchor? clothes = seat.Clothes;
			if (clothes.HasValue)
			{
				Anchor valueOrDefault = clothes.GetValueOrDefault();
				if (valueOrDefault.Box == anchor)
				{
					return valueOrDefault.Z;
				}
			}
			clothes = seat.Remembered;
			if (clothes.HasValue)
			{
				Anchor valueOrDefault2 = clothes.GetValueOrDefault();
				if (valueOrDefault2.Box == anchor)
				{
					return valueOrDefault2.Z;
				}
			}
			Anchor[] gear = seat.Gear;
			for (int i = 0; i < gear.Length; i++)
			{
				Anchor anchor2 = gear[i];
				if (anchor2.Box.Left == anchor.Left && anchor2.Box.Bottom == anchor.Bottom)
				{
					return anchor2.Z;
				}
			}
			return 0f;
		}

		private static CM_Item? Template(CM_PlayerLobbyBar bar)
		{
			return bar.m_inviteButton ?? bar.m_permissionButton ?? bar.m_matchmakeButton;
		}

		private static Anchor? ReadAnchor(Transform parent, CM_LobbyScrollItem? clothes)
		{
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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_00d2: 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_00db: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: 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_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: 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_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)clothes == (Object)null || !((Component)clothes).gameObject.activeInHierarchy)
			{
				return null;
			}
			Collider2D slotCollider = clothes.m_slotCollider;
			BoxCollider2D val = ((slotCollider != null) ? ((Il2CppObjectBase)slotCollider).TryCast<BoxCollider2D>() : null) ?? ((CM_Item)clothes).m_collider;
			Transform val2;
			Bounds b = default(Bounds);
			if ((Object)(object)val != (Object)null && ((Behaviour)val).isActiveAndEnabled && val.size.x > 0f && val.size.y > 0f)
			{
				val2 = ((Component)val).transform;
				((Bounds)(ref b))..ctor(Vector2.op_Implicit(((Collider2D)val).offset), Vector2.op_Implicit(val.size));
			}
			else
			{
				RectTransform rectTrans = ((RectTransformComp)clothes).RectTrans;
				if ((Object)(object)rectTrans == (Object)null)
				{
					return null;
				}
				val2 = (Transform)(object)rectTrans;
				Rect rect = rectTrans.rect;
				Vector3 val3 = Vector2.op_Implicit(((Rect)(ref rect)).center);
				rect = rectTrans.rect;
				((Bounds)(ref b))..ctor(val3, Vector2.op_Implicit(((Rect)(ref rect)).size));
			}
			Matrix4x4 m = parent.worldToLocalMatrix * val2.localToWorldMatrix;
			ButtonBox box = Project(b, m);
			if (!box.Valid)
			{
				return null;
			}
			return new Anchor(box, ((Matrix4x4)(ref m)).MultiplyPoint3x4(((Bounds)(ref b)).center).z);
		}

		private static ButtonBox Project(Bounds b, Matrix4x4 m)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: 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_0029: 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_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((Matrix4x4)(ref m)).MultiplyPoint3x4(((Bounds)(ref b)).center);
			Vector3 extents = ((Bounds)(ref b)).extents;
			float num = Math.Abs(m.m00 * extents.x) + Math.Abs(m.m01 * extents.y) + Math.Abs(m.m02 * extents.z);
			float num2 = Math.Abs(m.m10 * extents.x) + Math.Abs(m.m11 * extents.y) + Math.Abs(m.m12 * extents.z);
			return new ButtonBox(val.x - num, val.y - num2, val.x + num, val.y + num2);
		}

		private static void Protect(Transform? control, List<Bounds> obstacles)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)control == (Object)null || !((Component)control).gameObject.activeInHierarchy)
			{
				return;
			}
			foreach (Collider2D componentsInChild in ((Component)control).GetComponentsInChildren<Collider2D>(false))
			{
				if (((Behaviour)componentsInChild).enabled)
				{
					obstacles.Add(componentsInChild.bounds);
				}
			}
			foreach (Renderer componentsInChild2 in ((Component)control).GetComponentsInChildren<Renderer>(false))
			{
				if (componentsInChild2.enabled)
				{
					obstacles.Add(componentsInChild2.bounds);
				}
			}
		}

		private static void AddLabel(TextMeshPro? label, List<Bounds> obstacles)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)label != (Object)null && ((Behaviour)label).isActiveAndEnabled && label.renderer.enabled)
			{
				obstacles.Add(label.renderer.bounds);
			}
		}

		private Entry Build(CM_PageLoadout page, int slot, Seat seat)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Expected O, but got Unknown
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: 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_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: 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_0170: 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_0181: 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_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			//IL_039e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_035f: Unknown result type (might be due to invalid IL or missing references)
			//IL_036e: Unknown result type (might be due to invalid IL or missing references)
			CM_Item val = Template(seat.Bar) ?? throw new InvalidOperationException("Lobby bar without a native button template");
			CM_Item val2 = ((Il2CppObjectBase)((GuiLayer)((CM_PageBase)page).m_guiLayer).AddRectComp(((Component)val).gameObject, (GuiAnchor)4, Vector2.zero, seat.Parent)).Cast<CM_Item>();
			try
			{
				((Component)val2).gameObject.SetActive(false);
				((Object)val2).name = $"TeamModVersions_Compare_{slot}";
				val2.ID = 23870194 + slot;
				val2.m_onBtnPress = new UnityEvent();
				val2.OnBtnHoverChanged = null;
				val2.m_showOnHover = null;
				bool flag = (val2.m_clickBlink = false);
				bool alphaSpriteOnHover = (val2.m_alphaTextOnHover = flag);
				val2.m_alphaSpriteOnHover = alphaSpriteOnHover;
				RectTransform rectTrans = ((RectTransformComp)val2).RectTrans;
				Vector2 val3 = (rectTrans.pivot = new Vector2(0.5f, 0.5f));
				Vector2 anchorMin = (rectTrans.anchorMax = val3);
				rectTrans.anchorMin = anchorMin;
				((Transform)rectTrans).localScale = Vector3.one;
				((Transform)rectTrans).localRotation = Quaternion.identity;
				TextMeshPro val6 = ((Component)val2).GetComponent<TextMeshPro>() ?? ((Component)val2).GetComponentInChildren<TextMeshPro>(true);
				if ((Object)(object)val6 == (Object)null)
				{
					throw new InvalidOperationException("Invite template missing TMP label");
				}
				if ((Object)(object)val6.transform != (Object)(object)rectTrans)
				{
					RectTransform rectTransform = ((TMP_Text)val6).rectTransform;
					((Transform)rectTransform).SetParent((Transform)(object)rectTrans, false);
					rectTransform.anchorMin = Vector2.zero;
					rectTransform.anchorMax = Vector2.one;
					anchorMin = (rectTransform.offsetMax = Vector2.zero);
					rectTransform.offsetMin = anchorMin;
					((Transform)rectTransform).localRotation = Quaternion.identity;
					((Transform)rectTransform).localScale = Vector3.one;
					((Component)rectTransform).gameObject.SetActive(true);
				}
				BoxCollider2D val7 = ((Component)val2).GetComponent<BoxCollider2D>() ?? ((Component)val2).gameObject.AddComponent<BoxCollider2D>();
				foreach (Collider2D componentsInChild in ((Component)val2).GetComponentsInChildren<Collider2D>(true))
				{
					((Behaviour)componentsInChild).enabled = (Object)(object)componentsInChild == (Object)(object)val7;
				}
				foreach (Renderer componentsInChild2 in ((Component)val2).GetComponentsInChildren<Renderer>(true))
				{
					componentsInChild2.enabled = (Object)(object)componentsInChild2 == (Object)(object)val6.renderer;
				}
				val2.m_collider = val7;
				val7.autoTiling = false;
				val7.edgeRadius = 0f;
				((Collider2D)val7).offset = Vector2.zero;
				val2.SetText("模组对照");
				((TMP_Text)val6).text = "模组对照";
				((Graphic)val6).color = Color32.op_Implicit(new Color32(byte.MaxValue, (byte)212, (byte)76, byte.MaxValue));
				((TMP_Text)val6).fontStyle = (FontStyles)1;
				((TMP_Text)val6).enableWordWrapping = false;
				((TMP_Text)val6).overflowMode = (TextOverflowModes)3;
				((TMP_Text)val6).enableAutoSizing = true;
				((TMP_Text)val6).fontSizeMin = 1f;
				((TMP_Text)val6).fontSizeMax = 240f;
				((TMP_Text)val6).margin = new Vector4(3f, 1f, 3f, 1f);
				((TMP_Text)val6).alignment = (TextAlignmentOptions)514;
				GameObject val8 = new GameObject("ComparePlate");
				val8.transform.SetParent((Transform)(object)rectTrans, false);
				val8.layer = ((Component)val2).gameObject.layer;
				SpriteRenderer val9 = val8.AddComponent<SpriteRenderer>();
				if ((Object)(object)square == (Object)null)
				{
					square = Sprite.Create(Texture2D.whiteTexture, new Rect(0f, 0f, 1f, 1f), new Vector2(0.5f, 0.5f), 1f, 0u, (SpriteMeshType)0);
				}
				val9.sprite = square;
				val9.color = Color32.op_Implicit(new Color32((byte)43, (byte)45, (byte)47, byte.MaxValue));
				((Renderer)val9).sortingLayerID = val6.renderer.sortingLayerID;
				((Renderer)val9).sortingOrder = val6.renderer.sortingOrder;
				val6.renderer.sortingOrder = ((Renderer)val9).sortingOrder + 1;
				Entry entry = new Entry(seat.Bar, seat.Parent, seat.Player, val2, rectTrans, val7, val9);
				val2.OnBtnPressCallback = DelegateSupport.ConvertDelegate<Action<int>>((Delegate)(Action<int>)delegate
				{
					Press(slot, entry);
				});
				return entry;
			}
			catch
			{
				Retire(val2);
				throw;
			}
		}

		private static void Apply(Entry e, ButtonBox b, float z)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(b.Width, b.Height);
			e.Rect.sizeDelta = val;
			((Transform)e.Rect).localPosition = new Vector3(b.Left + val.x / 2f, b.Bottom + val.y / 2f, z);
			((Component)e.Plate).transform.localScale = new Vector3(val.x, val.y, 1f);
			e.Hit.size = val;
			if (!((Component)e.Item).gameObject.activeSelf)
			{
				((Component)e.Item).gameObject.SetActive(true);
			}
		}
	}
	internal sealed class LobbyInventory
	{
		private ulong lobbyId;

		private readonly Dictionary<ulong, (string Header, ModEntry[] Mods)> peers = new Dictionary<ulong, (string, ModEntry[])>();

		private ModEntry[]? local;

		private (string Header, string[] Parts)? outgoing;

		private float nextPublish;

		internal bool RosterConfirmed { get; private set; }

		internal string? Notice { get; private set; }

		internal void Reset()
		{
			lobbyId = 0uL;
			peers.Clear();
			nextPublish = 0f;
			RosterConfirmed = false;
		}

		internal void Withdraw()
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			if (lobbyId != 0L && SNet.IsInLobby)
			{
				SNet_Lobby lobby = SNet.Lobby;
				ulong? obj;
				if (lobby == null)
				{
					obj = null;
				}
				else
				{
					SNet_LobbyIdentifier identifier = lobby.Identifier;
					obj = ((identifier != null) ? new ulong?(identifier.ID) : ((ulong?)null));
				}
				if (obj == lobbyId)
				{
					SteamMatchmaking.SetLobbyMemberData(new CSteamID(lobbyId), "hc.tmv.v1", "-");
				}
			}
		}

		internal PlayerColumn[] Sample(float now)
		{
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: 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_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_0377: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0393: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_035d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0504: Unknown result type (might be due to invalid IL or missing references)
			//IL_0506: Unknown result type (might be due to invalid IL or missing references)
			//IL_0511: Unknown result type (might be due to invalid IL or missing references)
			//IL_068f: Unknown result type (might be due to invalid IL or missing references)
			RosterConfirmed = false;
			Notice = null;
			SNet_Player localPlayer = SNet.LocalPlayer;
			if (localPlayer == null)
			{
				Reset();
				return Array.Empty<PlayerColumn>();
			}
			ModEntry[] first = (from p in ((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.Values
				select p.Metadata into m
				where !string.IsNullOrWhiteSpace(m.GUID)
				select new ModEntry(m.GUID, m.Name ?? m.GUID, ((object)m.Version)?.ToString() ?? string.Empty)).OrderBy<ModEntry, string>((ModEntry m) => m.Id, StringComparer.Ordinal).ToArray();
			if (local == null || !first.SequenceEqual(local))
			{
				local = first;
				outgoing = null;
				try
				{
					outgoing = InventoryWire.Encode(local);
				}
				catch (InvalidDataException ex)
				{
					Plugin.Logger.LogWarning((object)ex.Message);
				}
				nextPublish = 0f;
			}
			string text = Name(localPlayer.NickName, "本机") + "(你)";
			long num;
			if (!SNet.IsInLobby)
			{
				num = 0L;
			}
			else
			{
				SNet_Lobby lobby = SNet.Lobby;
				ulong? obj;
				if (lobby == null)
				{
					obj = null;
				}
				else
				{
					SNet_LobbyIdentifier identifier = lobby.Identifier;
					obj = ((identifier != null) ? new ulong?(identifier.ID) : ((ulong?)null));
				}
				ulong? num2 = obj;
				num = (long)num2.GetValueOrDefault();
			}
			ulong num3 = (ulong)num;
			if (num3 == 0L)
			{
				Reset();
				Notice = "尚未加入 Steam 大厅,仅显示本机。";
				return new PlayerColumn[1]
				{
					new PlayerColumn(localPlayer.Lookup, text, local)
				};
			}
			if (lobbyId != num3)
			{
				Reset();
				lobbyId = num3;
			}
			CSteamID lobby2 = new CSteamID(num3);
			CSteamID mySteam = SteamUser.GetSteamID();
			ulong steamID = mySteam.m_SteamID;
			int numLobbyMembers = SteamMatchmaking.GetNumLobbyMembers(lobby2);
			Dictionary<ulong, CSteamID> members = new Dictionary<ulong, CSteamID>();
			for (int num4 = 0; num4 < Math.Min(numLobbyMembers, 32); num4++)
			{
				CSteamID lobbyMemberByIndex = SteamMatchmaking.GetLobbyMemberByIndex(lobby2, num4);
				if (lobbyMemberByIndex.m_SteamID != 0L)
				{
					members.TryAdd(lobbyMemberByIndex.m_SteamID, lobbyMemberByIndex);
				}
			}
			if (steamID == 0L || !members.ContainsKey(steamID))
			{
				peers.Clear();
				nextPublish = 0f;
				Notice = "Steam 大厅名单暂不可用,仅显示本机。";
				return new PlayerColumn[1]
				{
					new PlayerColumn(localPlayer.Lookup, text, local)
				};
			}
			(string, string[])? tuple;
			if (now >= nextPublish)
			{
				nextPublish = now + 6f;
				tuple = outgoing;
				if (tuple.HasValue)
				{
					(string, string[]) valueOrDefault = tuple.GetValueOrDefault();
					if (valueOrDefault.Item1 != Read(mySteam, "hc.tmv.v1") || valueOrDefault.Item2.Where((string part, int index) => part != Read(mySteam, InventoryWire.PartKey(index))).Any())
					{
						for (int num5 = 0; num5 < valueOrDefault.Item2.Length; num5++)
						{
							SteamMatchmaking.SetLobbyMemberData(lobby2, InventoryWire.PartKey(num5), valueOrDefault.Item2[num5]);
						}
						SteamMatchmaking.SetLobbyMemberData(lobby2, "hc.tmv.v1", valueOrDefault.Item1);
					}
				}
				else if (Read(mySteam, "hc.tmv.v1") != "-")
				{
					SteamMatchmaking.SetLobbyMemberData(lobby2, "hc.tmv.v1", "-");
				}
			}
			tuple = outgoing;
			if (!tuple.HasValue)
			{
				Notice = "本机清单无法发送;队友看不到你的版本。";
			}
			Dictionary<ulong, (int, string)> dictionary = new Dictionary<ulong, (int, string)>();
			List<SNet_Player> lobbyPlayers = SNet.LobbyPlayers;
			if (lobbyPlayers != null)
			{
				for (int num6 = 0; num6 < lobbyPlayers.Count; num6++)
				{
					SNet_Player val = lobbyPlayers[num6];
					if (val != null && !val.IsBot)
					{
						ulong num7 = (val.IsLocal ? steamID : val.Lookup);
						if (num7 != 0L)
						{
							int num8 = val.PlayerSlotIndex();
							dictionary[num7] = ((num8 < 0) ? int.MaxValue : num8, val.IsLocal ? text : Name(val.NickName, $"队友 {num6 + 1}"));
						}
					}
				}
			}
			dictionary.TryAdd(steamID, (localPlayer.PlayerSlotIndex(), text));
			RosterConfirmed = lobbyPlayers != null && numLobbyMembers == members.Count && dictionary.Keys.All(members.ContainsKey);
			ulong key;
			foreach (KeyValuePair<ulong, CSteamID> item2 in members)
			{
				item2.Deconstruct(out key, out var value);
				ulong key2 = key;
				CSteamID val2 = value;
				dictionary.TryAdd(key2, (int.MaxValue, Name(SteamFriends.GetFriendPersonaName(val2), "队友")));
			}
			ulong[] array = peers.Keys.Where((ulong k) => !members.ContainsKey(k)).ToArray();
			foreach (ulong key3 in array)
			{
				peers.Remove(key3);
			}
			List<PlayerColumn> list = new List<PlayerColumn>();
			foreach (KeyValuePair<ulong, (int, string)> item3 in from p in dictionary
				orderby p.Value.Slot, p.Key
				select p)
			{
				item3.Deconstruct(out key, out var value2);
				(int, string) tuple2 = value2;
				ulong num10 = key;
				string item = tuple2.Item2;
				if (num10 == steamID)
				{
					list.Add(new PlayerColumn(num10, item, local));
					continue;
				}
				if (!members.TryGetValue(num10, out var peer))
				{
					list.Add(new PlayerColumn(num10, item, null));
					continue;
				}
				string text2 = Read(peer, "hc.tmv.v1");
				ModEntry[] entries;
				if (peers.TryGetValue(num10, out (string, ModEntry[]) value3) && value3.Item1 == text2)
				{
					list.Add(new PlayerColumn(num10, item, value3.Item2));
				}
				else if (InventoryWire.TryDecode(text2, (int i) => Read(peer, InventoryWire.PartKey(i)), out entries) && entries != null)
				{
					peers[num10] = (text2, entries);
					list.Add(new PlayerColumn(num10, item, entries));
				}
				else
				{
					peers.Remove(num10);
					list.Add(new PlayerColumn(num10, item, null));
				}
			}
			return list.ToArray();
			string Read(CSteamID member, string text3)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				return SteamMatchmaking.GetLobbyMemberData(lobby2, member, text3) ?? string.Empty;
			}
		}

		private static string Name(string? value, string fallback)
		{
			if (!string.IsNullOrWhiteSpace(value))
			{
				return value.Trim();
			}
			return fallback;
		}
	}
	internal sealed class LobbyNetworkHud
	{
		private sealed class Seat
		{
			internal CM_PlayerLobbyBar? Bar;

			internal Transform? Root;

			internal ulong Id;

			internal bool Bot;

			internal bool Local;

			internal bool Ready;

			internal bool Warned;

			internal bool HadChip;

			internal string? Text;

			internal string? Rendered;

			internal string? State;

			internal TextMeshPro? Label;

			internal Transform? Plate;

			internal void Reset()
			{
				if ((Object)(object)Label != (Object)null)
				{
					((Component)Label).gameObject.SetActive(false);
					Object.Destroy((Object)(object)((Component)Label).gameObject);
				}
				Label = null;
				Plate = null;
				Root = null;
				Bar = null;
				Text = (Rendered = (State = null));
				Ready = (Warned = (HadChip = false));
			}
		}

		private readonly Seat[] seats = new Seat[4]
		{
			new Seat(),
			new Seat(),
			new Seat(),
			new Seat()
		};

		private Sprite? square;

		internal void Clear()
		{
			Seat[] array = seats;
			for (int i = 0; i < array.Length; i++)
			{
				array[i].Reset();
			}
			if ((Object)(object)square != (Object)null)
			{
				Object.Destroy((Object)(object)square);
			}
			square = null;
		}

		internal bool Refresh(CM_PageLoadout page, TeamNetwork network, bool dataDue)
		{
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			Il2CppReferenceArray<CM_PlayerLobbyBar> playerLobbyBars = page.m_playerLobbyBars;
			bool flag = false;
			for (int i = 0; i < seats.Length; i++)
			{
				Seat seat = seats[i];
				try
				{
					CM_PlayerLobbyBar val = ((playerLobbyBars != null && i < ((Il2CppArrayBase<CM_PlayerLobbyBar>)(object)playerLobbyBars).Length) ? ((Il2CppArrayBase<CM_PlayerLobbyBar>)(object)playerLobbyBars)[i] : null);
					GameObject val2 = ((val != null) ? val.m_hasPlayerRoot : null);
					if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null || !val2.activeInHierarchy)
					{
						flag |= (Object)(object)seat.Bar != (Object)null;
						seat.Reset();
						continue;
					}
					int playerSlotIndex = val.m_playerSlotIndex;
					SNet_PlayerSlotManager slots = SNet.Slots;
					SNet_Player val3 = (((Object)(object)slots != (Object)null && playerSlotIndex >= 0 && playerSlotIndex < seats.Length) ? slots.GetPlayerInSlot(playerSlotIndex) : val.m_player);
					if ((Object)(object)val3 == (Object)null)
					{
						flag |= (Object)(object)seat.Bar != (Object)null;
						seat.Reset();
						continue;
					}
					bool isBot = val3.IsBot;
					bool flag2 = !isBot && val3.IsLocal;
					ulong num = (isBot ? 0 : val3.Lookup);
					if ((Object)(object)seat.Bar != (Object)(object)val || (Object)(object)seat.Root != (Object)(object)val2.transform || seat.Id != num || seat.Bot != isBot || seat.Local != flag2)
					{
						seat.Reset();
						seat.Bar = val;
						seat.Root = val2.transform;
						seat.Id = num;
						seat.Bot = isBot;
						seat.Local = flag2;
						flag = true;
					}
					TextMeshPro weaponsHeaderText = val.m_weaponsHeaderText;
					bool flag3 = val.m_introDone || ((Object)(object)weaponsHeaderText != (Object)null && ((Behaviour)weaponsHeaderText).isActiveAndEnabled && weaponsHeaderText.renderer.enabled && ((Graphic)weaponsHeaderText).color.a > 0f);
					flag |= seat.Ready != flag3;
					seat.Ready = flag3;
					if (dataDue || seat.Text == null)
					{
						seat.Text = network.SlotText(num, flag2, isBot);
					}
				}
				catch (Exception e)
				{
					seat.Ready = false;
					Warn(seat, i, "read", e);
				}
			}
			return flag;
		}

		private static void Warn(Seat s, int i, string stage, Exception e)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			if (!s.Warned)
			{
				ManualLogSource logger = Plugin.Logger;
				bool flag = default(bool);
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(12, 3, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[槽位网络] 第");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(i + 1);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("栏 ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(stage);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(e);
				}
				logger.LogWarning(val);
			}
			s.Warned = true;
		}

		private static void State(Seat s, int i, string state)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			if (s.State != state)
			{
				ManualLogSource logger = Plugin.Logger;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(10, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[槽位网络] 第");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(i + 1);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("栏 ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(state);
				}
				logger.LogInfo(val);
				s.State = state;
			}
		}

		private static Color Tint(int rgb, float alpha = 1f)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			return new Color((float)((rgb >> 16) & 0xFF) / 255f, (float)((rgb >> 8) & 0xFF) / 255f, (float)(rgb & 0xFF) / 255f, alpha);
		}

		private static void Rule(SpriteRenderer plate, Transform parent, Sprite sprite, int layer, bool tab, bool bot)
		{
			//IL_0027: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			float num = (tab ? 0.23f : 1f);
			float num2 = 0.025f;
			GameObject val = new GameObject(tab ? "ChannelTab" : "HeaderRule")
			{
				layer = layer
			};
			Transform transform = val.transform;
			transform.SetParent(parent, false);
			transform.localPosition = new Vector3((num - 1f) / 2f, (1f - num2) / 2f, 0f);
			transform.localScale = new Vector3(num, num2, 1f);
			SpriteRenderer obj = val.AddComponent<SpriteRenderer>();
			obj.sprite = sprite;
			obj.color = Tint((tab && !bot) ? 16113206 : 14804449, tab ? 1f : 0.4f);
			((Renderer)obj).sortingLayerID = ((Renderer)plate).sortingLayerID;
			((Renderer)obj).sortingOrder = ((Renderer)plate).sortingOrder + ((!tab) ? 1 : 2);
		}

		private void Attach(Seat s, TextMeshPro template, int i)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0021: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: 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_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Expected O, but got Unknown
			//IL_01b7: 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_0188: Unknown result type (might be due to invalid IL or missing references)
			Object val = Object.Instantiate((Object)(object)template, s.Root, false);
			TextMeshPro val2 = new TextMeshPro(((Il2CppObjectBase)val).Pointer);
			TextMeshPro val3 = val2;
			s.Label = val2;
			TextMeshPro val4 = val3;
			try
			{
				((Component)val4).gameObject.SetActive(false);
				((Object)((Component)val4).gameObject).name = $"ConflictModList_Network_{i}";
				((Behaviour)val4).enabled = true;
				val4.renderer.enabled = true;
				((TMP_Text)val4).fontStyle = (FontStyles)(((TMP_Text)val4).fontStyle & -17);
				((TMP_Text)val4).enableAutoSizing = false;
				((TMP_Text)val4).fontSize = 25f;
				((TMP_Text)val4).richText = true;
				((TMP_Text)val4).enableWordWrapping = false;
				((TMP_Text)val4).overflowMode = (TextOverflowModes)0;
				((Graphic)val4).color = Color.white;
				((TMP_Text)val4).margin = Vector4.zero;
				((TMP_Text)val4).alignment = (TextAlignmentOptions)1025;
				((TMP_Text)val4).outlineColor = new Color32((byte)12, (byte)12, (byte)12, byte.MaxValue);
				((TMP_Text)val4).outlineWidth = 0.2f;
				RectTransform rectTransform = ((TMP_Text)val4).rectTransform;
				Vector2 anchorMin = (rectTransform.anchorMax = new Vector2(0.5f, 0.5f));
				rectTransform.anchorMin = anchorMin;
				rectTransform.pivot = Vector2.zero;
				GameObject val6 = new GameObject("NetworkPlate");
				val6.transform.SetParent((Transform)(object)rectTransform, false);
				val6.layer = ((Component)val4).gameObject.layer;
				SpriteRenderer val7 = val6.AddComponent<SpriteRenderer>();
				if ((Object)(object)square == (Object)null)
				{
					square = Sprite.Create(Texture2D.whiteTexture, new Rect(0f, 0f, 1f, 1f), new Vector2(0.5f, 0.5f), 1f, 0u, (SpriteMeshType)0);
				}
				val7.sprite = square;
				val7.color = Tint(2172194, 0f);
				((Renderer)val7).sortingLayerID = val4.renderer.sortingLayerID;
				((Renderer)val7).sortingOrder = val4.renderer.sortingOrder;
				val4.renderer.sortingOrder = ((Renderer)val7).sortingOrder + 3;
				s.Plate = val6.transform;
				Rule(val7, s.Plate, square, val6.layer, tab: false, s.Bot);
				Rule(val7, s.Plate, square, val6.layer, tab: true, s.Bot);
			}
			catch
			{
				((Component)val4).gameObject.SetActive(false);
				Object.Destroy((Object)(object)((Component)val4).gameObject);
				s.Label = null;
				s.Plate = null;
				throw;
			}
		}

		internal void Present(LobbyButtons buttons, Camera? camera)
		{
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: 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_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: 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_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: 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_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_0393: Unknown result type (might be due to invalid IL or missing references)
			//IL_039a: Expected O, but got Unknown
			bool flag2 = default(bool);
			for (int i = 0; i < seats.Length; i++)
			{
				Seat seat = seats[i];
				if ((Object)(object)seat.Bar == (Object)null || (Object)(object)seat.Root == (Object)null)
				{
					continue;
				}
				try
				{
					if (!seat.Ready || seat.Text == null)
					{
						if ((Object)(object)seat.Label != (Object)null && ((Component)seat.Label).gameObject.activeSelf)
						{
							((Component)seat.Label).gameObject.SetActive(false);
						}
						State(seat, i, "waiting-equipment");
						continue;
					}
					WatermarkGuiLayer watermarkLayer = GuiManager.WatermarkLayer;
					object obj;
					if (watermarkLayer == null)
					{
						obj = null;
					}
					else
					{
						PUI_Watermark watermark = watermarkLayer.m_watermark;
						obj = ((watermark != null) ? watermark.m_watermarkText : null);
					}
					TextMeshPro val = (TextMeshPro)obj;
					if ((Object)(object)seat.Label == (Object)null && (Object)(object)val == (Object)null)
					{
						State(seat, i, "waiting-watermark");
						continue;
					}
					Transform owner;
					Rect bounds;
					float z;
					bool flag = buttons.CompareRect(i, seat.Bar, seat.Bot, out owner, out bounds, out z) && (Object)(object)owner != (Object)null;
					if (!flag && !seat.Bar.m_introDone && (Object)(object)seat.Label == (Object)null)
					{
						State(seat, i, "waiting-button-row");
						continue;
					}
					if ((Object)(object)seat.Label == (Object)null)
					{
						Attach(seat, val, i);
					}
					TextMeshPro label = seat.Label;
					RectTransform rectTransform = ((TMP_Text)label).rectTransform;
					if (seat.Rendered != seat.Text)
					{
						string text = (((TMP_Text)label).text = FieldTerminalTheme.Format(seat.Text, i, seat.Bot));
						Vector2 preferredValues = ((TMP_Text)label).GetPreferredValues(text);
						rectTransform.sizeDelta = new Vector2(Math.Max(1f, preferredValues.x) + 6f, Math.Max(1f, preferredValues.y) + 6f);
						((TMP_Text)label).margin = new Vector4(3f, 3f, 3f, 3f);
						Transform? plate = seat.Plate;
						Vector2 sizeDelta = rectTransform.sizeDelta;
						plate.localScale = new Vector3(sizeDelta.x, sizeDelta.y, 1f);
						plate.localPosition = new Vector3(sizeDelta.x / 2f, sizeDelta.y / 2f, 0f);
						seat.Rendered = seat.Text;
					}
					if (flag)
					{
						Vector3 val2 = owner.TransformPoint(new Vector3(((Rect)(ref bounds)).xMin, ((Rect)(ref bounds)).yMax, z));
						Vector3 val3 = seat.Root.InverseTransformPoint(val2);
						float num = 2f;
						if ((Object)(object)camera != (Object)null)
						{
							Vector3 val4 = camera.WorldToScreenPoint(val2);
							float num2 = camera.WorldToScreenPoint(seat.Root.TransformPoint(val3 + Vector3.up)).y - val4.y;
							if (val4.z > 0f && float.IsFinite(num2) && num2 > 0.001f)
							{
								num = 2f / num2;
							}
						}
						((Transform)rectTransform).localPosition = new Vector3(val3.x, val3.y + num, val3.z);
						seat.HadChip = true;
					}
					else if (!seat.HadChip && (Object)(object)val != (Object)null)
					{
						((Transform)rectTransform).localPosition = HikariaLoadoutAnchor.Fallback(val, rectTransform);
					}
					if (!((Component)label).gameObject.activeSelf)
					{
						((Component)label).gameObject.SetActive(true);
					}
					string text3 = (flag ? "native-tmp/compare-row" : (seat.HadChip ? "native-tmp/retained-row" : "native-tmp/reference-row"));
					if (seat.State != text3)
					{
						((TMP_Text)label).ForceMeshUpdate(false, false);
						ManualLogSource logger = Plugin.Logger;
						BepInExInfoLogInterpolatedStringHandler val5 = new BepInExInfoLogInterpolatedStringHandler(26, 4, ref flag2);
						if (flag2)
						{
							((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("[槽位网络] 第");
							((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<int>(i + 1);
							((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("栏 ");
							((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<string>(text3);
							((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(" glyphs=");
							((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<int>(((TMP_Text)label).textInfo.characterCount);
							((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(" active=");
							((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<bool>(((Component)label).gameObject.activeInHierarchy);
						}
						logger.LogInfo(val5);
						seat.State = text3;
					}
				}
				catch (Exception e)
				{
					Warn(seat, i, "native-tmp", e);
				}
			}
		}
	}
	[BepInPlugin("hawchow.conflictmodlist", "conflictmodlist", "1.1.10")]
	public sealed class Plugin : BasePlugin
	{
		internal const string ModName = "conflictmodlist";

		internal const string Id = "hawchow.conflictmodlist";

		internal const string Version = "1.1.10";

		internal static ManualLogSource Logger;

		internal static ConfigEntry<bool> ShowMatches;

		internal static TeamVersionsDriver? Driver;

		private Harmony? patches;

		public override void Load()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			Logger = ((BasePlugin)this).Log;
			ShowMatches = ((BasePlugin)this).Config.Bind<bool>("Display", "ShowMatchingMods", false, "默认隐藏全队已加载且版本一致的模组。开启后,在版本差异表末尾单独显示这些模组。此项只影响本机显示。");
			Driver = ((BasePlugin)this).AddComponent<TeamVersionsDriver>();
			patches = new Harmony("hawchow.conflictmodlist");
			patches.PatchAll(typeof(Plugin).Assembly);
			if (PatchLobbyPress(patches))
			{
				Driver.EnableMouseActions();
			}
			ManualLogSource logger = Logger;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(23, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("conflictmodlist");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" 已加载,通过 Steam 大厅同步模组版本。");
			}
			logger.LogInfo(val);
		}

		private bool PatchLobbyPress(Harmony harmony)
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			try
			{
				MethodInfo methodInfo = AccessTools.Method(typeof(CM_PageBase), "UpdateButtonPress", Type.EmptyTypes, (Type[])null);
				if (methodInfo == null)
				{
					Logger.LogWarning((object)"大厅没有 CM_PageBase.UpdateButtonPress:面板按压无法拦截,仍可使用键盘。");
					return false;
				}
				return harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(AccessTools.Method(typeof(LobbyPressPatch), "Prefix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null) != null;
			}
			catch (Exception ex)
			{
				ManualLogSource logger = Logger;
				bool flag = default(bool);
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(26, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("挂大厅按压前缀失败:面板按压无法拦截,仍可使用键盘:");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
				}
				logger.LogWarning(val);
				return false;
			}
		}

		public override bool Unload()
		{
			TeamVersionsDriver driver = Driver;
			Driver = null;
			try
			{
				if ((Object)(object)driver != (Object)null)
				{
					driver.Shutdown();
				}
			}
			finally
			{
				try
				{
					Harmony? obj = patches;
					if (obj != null)
					{
						obj.UnpatchSelf();
					}
				}
				finally
				{
					if ((Object)(object)driver != (Object)null)
					{
						Object.Destroy((Object)(object)driver);
					}
				}
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(CM_PageLoadout), "SetPageActive")]
	internal static class PageActive
	{
		[HarmonyPostfix]
		private static void After(CM_PageLoadout __instance, bool __0)
		{
			Plugin.Driver?.SetPage(__instance, __0);
		}
	}
	[HarmonyPatch(typeof(CM_PageLoadout), "SetPopupVisible", new Type[] { typeof(bool) })]
	internal static class PagePopup
	{
		[HarmonyPostfix]
		private static void After(CM_PageLoadout __instance, bool __0)
		{
			Plugin.Driver?.SetPopupVisible(__instance, __0);
		}
	}
	internal static class LobbyPressPatch
	{
		internal static bool Prefix(CM_PageBase __instance)
		{
			try
			{
				return !(Plugin.Driver?.SuppressLobbyPress(__instance) ?? false);
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogDebug((object)ex.Message);
				return true;
			}
		}
	}
	internal sealed class TeamNetwork
	{
		private sealed class SteamIO : INetworkIO
		{
			private const int Channel = 1414354433;

			private readonly Dictionary<ulong, int> estimates = new Dictionary<ulong, int>();

			private Il2CppStructArray<byte>? buffer;

			private Harmony? counters;

			private bool unavailable;

			private static long steamRx;

			private static long steamTx;

			private static long gameRx;

			private static long gameTx;

			private readonly PayloadMeter meter = new PayloadMeter();

			private NetworkScope meterScope;

			private static NetworkInterface[]? interfaces;

			private static long interfacesAt;

			private string? interfaceSet;

			private NetworkSource announced;

			private static bool hostAnnounced;

			private static NetworkTotal SteamBytes()
			{
				return new NetworkTotal(Interlocked.Read(in steamRx), Interlocked.Read(in steamTx), NetworkSource.Steam);
			}

			private static NetworkTotal GameBytes()
			{
				return new NetworkTotal(Interlocked.Read(in gameRx), Interlocked.Read(in gameTx), NetworkSource.Game);
			}

			private static NetworkScope Current()
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Invalid comparison between Unknown and I4
				//IL_0041: Unknown result type (might be due to invalid IL or missing references)
				if (SNet.IsInLobby && (int)SNet.CoreType == 2)
				{
					SNet_Lobby lobby = SNet.Lobby;
					SNet_LobbyIdentifier val = ((lobby != null) ? lobby.Identifier : null);
					if (val != null)
					{
						SNet_SessionHub sessionHub = SNet.SessionHub;
						if (sessionHub != null)
						{
							SNet_Player localPlayer = SNet.LocalPlayer;
							if (localPlayer != null)
							{
								ulong steamID = SteamUser.GetSteamID().m_SteamID;
								if (steamID == 0L || localPlayer.Lookup != steamID)
								{
									return default(NetworkScope);
								}
								return new NetworkScope(val.ID, (uint)sessionHub.SessionID, steamID);
							}
						}
					}
				}
				return default(NetworkScope);
			}

			public NetworkRoster Roster()
			{
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				//IL_0074: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: Unknown result type (might be due to invalid IL or missing references)
				estimates.Clear();
				NetworkScope networkScope = Current();
				if (networkScope.Lobby == 0L)
				{
					Release();
					return default(NetworkRoster);
				}
				CSteamID val = default(CSteamID);
				((CSteamID)(ref val))..ctor(networkScope.Lobby);
				int numLobbyMembers = SteamMatchmaking.GetNumLobbyMembers(val);
				if ((numLobbyMembers < 1 || numLobbyMembers > 4) ? true : false)
				{
					Release();
					return default(NetworkRoster);
				}
				ulong[] array = new ulong[numLobbyMembers];
				for (int i = 0; i < numLobbyMembers; i++)
				{
					array[i] = SteamMatchmaking.GetLobbyMemberByIndex(val, i).m_SteamID;
				}
				if (!array.Contains(networkScope.Self) || array.Contains(0uL) || array.Distinct().Count() != numLobbyMembers)
				{
					Release();
					return default(NetworkRoster);
				}
				if (networkScope != meterScope)
				{
					meter.Reset(SteamBytes(), GameBytes());
					meterScope = networkScope;
					announced = NetworkSource.None;
				}
				List<SNet_Player> lobbyPlayers = SNet.LobbyPlayers;
				if (lobbyPlayers != null && lobbyPlayers.Count <= 32)
				{
					for (int j = 0; j < lobbyPlayers.Count; j++)
					{
						SNet_Player val2 = lobbyPlayers[j];
						if (val2 != null && !val2.IsBot && !val2.IsLocal && array.Contains(val2.Lookup))
						{
							estimates[val2.Lookup] = val2.Ping;
						}
					}
				}
				return new NetworkRoster(networkScope, array, SteamUtils.GetServerRealTime());
			}

			public (int Route, int Estimate) Inspect(ulong peer, bool compatible)
			{
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				//IL_0048: Unknown result type (might be due to invalid IL or missing references)
				if (!estimates.TryGetValue(peer, out var value))
				{
					return (Route: 0, Estimate: -1);
				}
				if (!compatible)
				{
					return NetworkLink.CachedEstimate(value);
				}
				P2PSessionState_t val = default(P2PSessionState_t);
				if (!SteamNetworking.GetP2PSessionState(new CSteamID(peer), ref val) || val.m_bConnectionActive == 0 || val.m_eP2PSessionError != 0)
				{
					return NetworkLink.CachedEstimate(value);
				}
				return (Route: (val.m_bUsingRelay == 0) ? 1 : 2, Estimate: value);
			}

			public string? Read(NetworkScope scope, ulong author)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				return SteamMatchmaking.GetLobbyMemberData(new CSteamID(scope.Lobby), new CSteamID(author), "tmv.net2");
			}

			public void Write(NetworkScope scope, string text)
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				if (scope.Lobby != 0L && Current() == scope)
				{
					SteamMatchmaking.SetLobbyMemberData(new CSteamID(scope.Lobby), "tmv.net2", text);
				}
			}

			public ulong NewEpoch()
			{
				ulong num;
				do
				{
					num = BitConverter.ToUInt64(RandomNumberGenerator.GetBytes(8));
				}
				while (num == 0L);
				return num;
			}

			public bool Send(ulong peer, byte[] bytes)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return SteamNetworking.SendP2PPacket(new CSteamID(peer), Il2CppStructArray<byte>.op_Implicit(bytes), (uint)bytes.Length, (EP2PSend)1, 1414354433);
			}

			public bool Receive(out ulong peer, out byte[] bytes)
			{
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				peer = 0uL;
				bytes = Array.Empty<byte>();
				if (buffer == null)
				{
					buffer = new Il2CppStructArray<byte>(53L);
				}
				uint num = default(uint);
				CSteamID val = default(CSteamID);
				if (!SteamNetworking.ReadP2PPacket(buffer, (uint)((Il2CppArrayBase<byte>)(object)buffer).Length, ref num, ref val, 1414354433))
				{
					return false;
				}
				if (num == 52)
				{
					peer = val.m_SteamID;
					bytes = new byte[num];
					for (int i = 0; i < bytes.Length; i++)
					{
						bytes[i] = ((Il2CppArrayBase<byte>)(object)buffer)[i];
					}
				}
				return true;
			}

			public NetworkTotal PayloadTotals()
			{
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_0078: Expected O, but got Unknown
				if (unavailable)
				{
					return new NetworkTotal(-1L, -1L, NetworkSource.None);
				}
				if (counters == null && !Install())
				{
					return new NetworkTotal(-1L, -1L, NetworkSource.None);
				}
				NetworkTotal result = meter.Sample(SteamBytes(), GameBytes());
				if (result.Source != announced)
				{
					announced = result.Source;
					if (result.Source != NetworkSource.None)
					{
						ManualLogSource logger = Plugin.Logger;
						bool flag = default(bool);
						BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(7, 1, ref flag);
						if (flag)
						{
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral("网络统计来源:");
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>((result.Source == NetworkSource.Steam) ? "Steam P2P 载荷" : "游戏传输载荷");
						}
						logger.LogInfo(val);
					}
				}
				return result;
			}

			public NetworkTotal HostTotals()
			{
				long tickCount = Environment.TickCount64;
				NetworkInterface[] array = interfaces;
				if (array == null || tickCount - interfacesAt >= 30000)
				{
					interfacesAt = tickCount;
					try
					{
						array = NetworkInterface.GetAllNetworkInterfaces();
					}
					catch (Exception)
					{
						array = Array.Empty<NetworkInterface>();
					}
					interfaces = array;
				}
				long num = 0L;
				long num2 = 0L;
				bool flag = false;
				List<string> list = new List<string>();
				NetworkInterface[] array2 = array;
				foreach (NetworkInterface networkInterface in array2)
				{
					try
					{
						NetworkInterfaceType networkInterfaceType = networkInterface.NetworkInterfaceType;
						bool flag2 = ((networkInterfaceType == NetworkInterfaceType.Loopback || networkInterfaceType == NetworkInterfaceType.Tunnel) ? true : false);
						if (!flag2 && networkInterface.OperationalStatus == OperationalStatus.Up)
						{
							IPInterfaceStatistics iPStatistics = networkInterface.GetIPStatistics();
							long bytesReceived = iPStatistics.BytesReceived;
							long bytesSent = iPStatistics.BytesSent;
							if (bytesReceived >= 0 && bytesSent >= 0)
							{
								list.Add(networkInterface.Id);
								num += bytesReceived;
								num2 += bytesSent;
								flag = true;
							}
						}
					}
					catch (Exception)
					{
					}
				}
				list.Sort(StringComparer.Ordinal);
				string text = string.Join(";", list);
				if (interfaceSet != text)
				{
					interfaceSet = text;
					return new NetworkTotal(-1L, -1L, flag ? NetworkSource.Host : NetworkSource.None);
				}
				if (!flag)
				{
					return new NetworkTotal(-1L, -1L, NetworkSource.None);
				}
				if (!hostAnnounced)
				{
					hostAnnounced = true;
					Plugin.Logger.LogInfo((object)"网络统计来源:主机网卡(非 P2P,整机全部进程)");
				}
				return new NetworkTotal(num, num2, NetworkSource.Host);
			}

			private bool Install()
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				Harmony harmony = new Harmony("hawchow.conflictmodlist.network.bytes");
				bool any = false;
				Try(AccessTools.Method(typeof(SteamNetworking), "ReadP2PPacket", (Type[])null, (Type[])null), "AfterRead");
				Try(AccessTools.Method(typeof(SteamNetworking), "SendP2PPacket", (Type[])null, (Type[])null), "AfterSend");
				foreach (MethodInfo item in from m in AccessTools.GetDeclaredMethods(typeof(SNet_Core_STEAM))
					where m.Name == "SendBytes"
					select m)
				{
					Try(item, "AfterGameSend");
				}
				Try(AccessTools.Method(typeof(SNet_Replication), "RecieveBytes", (Type[])null, (Type[])null), "AfterGameReceive");
				counters = harmony;
				unavailable = !any;
				return any;
				void Try(MethodInfo? target, string method)
				{
					//IL_0027: Unknown result type (might be due to invalid IL or missing references)
					//IL_002d: Expected O, but got Unknown
					try
					{
						any |= Count(harmony, target, method);
					}
					catch (Exception ex)
					{
						ManualLogSource logger = Plugin.Logger;
						bool flag = default(bool);
						BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(10, 2, ref flag);
						if (flag)
						{
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral("流量计数 ");
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(method);
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" 不可用:");
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.GetType().Name);
						}
						logger.LogWarning(val);
					}
				}
			}

			private static bool Count(Harmony harmony, MethodInfo? game, string after)
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: Expected O, but got Unknown
				if (game == null)
				{
					return false;
				}
				MethodInfo methodInfo = AccessTools.Method(typeof(SteamIO), after, (Type[])null, (Type[])null);
				if (methodInfo != null)
				{
					return harmony.Patch((MethodBase)game, (HarmonyMethod)null, new HarmonyMethod(methodInfo), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null) != null;
				}
				return false;
			}

			private static void AfterRead(bool __result, uint pcubMsgSize, int nChannel)
			{
				if (__result && nChannel != 1414354433 && pcubMsgSize != 0)
				{
					Interlocked.Add(ref steamRx, pcubMsgSize);
				}
			}

			private static void AfterSend(bool __result, uint cubData, int nChannel)
			{
				if (__result && nChannel != 1414354433 && cubData != 0)
				{
					Interlocked.Add(ref steamTx, cubData);
				}
			}

			private static void AfterGameSend(Il2CppStructArray<byte>? bytes)
			{
				if (bytes != null && ((Il2CppArrayBase<byte>)(object)bytes).Length > 0)
				{
					Interlocked.Add(ref gameTx, ((Il2CppArrayBase<byte>)(object)bytes).Length);
				}
			}

			private static void AfterGameReceive(uint size)
			{
				if (size != 0)
				{
					Interlocked.Add(ref gameRx, size);
				}
			}

			internal void Release()
			{
				if (counters != null)
				{
					try
					{
						counters.UnpatchSelf();
					}
					finally
					{
						counters = null;
					}
				}
				meterScope = default(NetworkScope);
				announced = NetworkSource.None;
				estimates.Clear();
				buffer = null;
			}
		}

		private readonly SteamIO io = new SteamIO();

		private readonly NetworkService service;

		private float retryAt;

		internal TeamNetwork()
		{
			service = new NetworkService(io);
		}

		internal void Tick(float now, bool panelOpen)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			if (now < retryAt)
			{
				return;
			}
			try
			{
				service.Tick(now, panelOpen);
			}
			catch (Exception ex)
			{
				retryAt = now + 5f;
				Reset();
				ManualLogSource logger = Plugin.Logger;
				bool flag = default(bool);
				BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(9, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("网络采样暂不可用:");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.GetType().Name);
				}
				logger.LogDebug(val);
			}
		}

		internal void Reset()
		{
			try
			{
				service.Reset();
			}
			catch (Exception)
			{
			}
			io.Release();
		}

		internal string[] Lines(ulong selected, Func<ulong, string> name)
		{
			return service.Lines(selected, name);
		}

		internal string SlotText(ulong id, bool local, bool bot)
		{
			return service.SlotText(id, local, bot);
		}
	}
	public sealed class TeamVersionsDriver : MonoBehaviour
	{
		private readonly LobbyInventory inventory = new LobbyInventory();

		private readonly DriverLifetime lifetime = new DriverLifetime();

		private CM_PageLoadout? page;

		private readonly LobbyButtons buttons = new LobbyButtons();

		private readonly TeamNetwork network = new TeamNetwork();

		private readonly LobbyNetworkHud hud = new LobbyNetworkHud();

		private Action<ulong>? choose;

		private CM_PageLoadout? popupPage;

		private ulong selected;

		private bool networkError;

		private Camera? fallbackCamera;

		private bool cameraChecked;

		private PressSource pressSource;

		private PressOwnership ownedPress;

		private bool nameError;

		private float next;

		private float nextHud;

		private bool active;

		private bool open;

		private bool syncError;

		private bool uiError;

		private bool matches;

		private bool confirmed;

		private bool? sessionMatches;

		private Vector2 scroll;

		private Font? font;

		private bool fontTried;

		private GUIStyle? text;

		private GUIStyle? heading;

		private GUIStyle? nameRun;

		private GUIStyle? green;

		private GUIStyle? red;

		private GUIStyle? gray;

		private GUIStyle? close;

		private PlayerColumn[] columns = Array.Empty<PlayerColumn>();

		private PanelModel model = PanelModel.Blank;

		private Dictionary<ulong, NameRun[]> headerNames = new Dictionary<ulong, NameRun[]>();

		private NameRun[][] headerRuns = Array.Empty<NameRun[]>();

		private ulong headerLocalId;

		private readonly ClosePressGate closePress = new ClosePressGate();

		private readonly WheelRouter wheel = new WheelRouter();

		private readonly RailDrag railDrag = new RailDrag();

		private readonly ClosePressGate panelPress = new ClosePressGate();

		private bool panelHeld;

		private bool frameDown;

		private int inputFrame = -1;

		private int wheelFrame = -1;

		private CursorSample cursor = CursorSample.Invalid("未采样");

		private double inputLogAt;

		private int inputLogs;

		private bool cursorError;

		private bool buttonError;

		private bool scrollError;

		private bool inputError;

		private const float CloseWidth = 64f;

		private const float CloseHeight = 29f;

		private const float CloseMarginRight = 18f;

		private const float CloseMarginTop = 13f;

		private static readonly string[] ReadableFonts = new string[6] { "Microsoft YaHei UI", "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", "DengXian", "SimHei" };

		internal static readonly Color Accent = new Color(0.98f, 0.8f, 0.25f);

		public TeamVersionsDriver(IntPtr pointer)
			: base(pointer)
		{
		}

		[HideFromIl2Cpp]
		internal void EnableMouseActions()
		{
			lifetime.EnableMouseActions();
		}

		[HideFromIl2Cpp]
		internal void SetPage(CM_PageLoadout target, bool value)
		{
			if (lifetime.Running && (value || !((Object)(object)page != (Object)(object)target)) && (!((Object)(object)page == (Object)(object)target) || active != value))
			{
				if ((Object)(object)page != (Object)(object)target || !value)
				{
					Close();
					ownedPress.Clear();
					RemoveButton();
					hud.Clear();
					fallbackCamera = null;
					cameraChecked = false;
					selected = 0uL;
				}
				page = target;
				active = value;
				ResetInput();
				nextHud = 0f;
				next = 0f;
			}
		}

		[HideFromIl2Cpp]
		internal void SetPopupVisible(CM_PageLoadout target, bool visible)
		{
			if (!lifetime.Running)
			{
				return;
			}
			if (visible)
			{
				popupPage = target;
			}
			else if ((Object)(object)popupPage == (Object)(object)target)
			{
				popupPage = null;
			}
			if (!((Object)(object)page != (Object)(object)target))
			{
				nextHud = 0f;
				if (visible)
				{
					Close();
					ownedPress.Clear();
					RemoveButton();
					hud.Clear();
				}
				next = 0f;
			}
		}

		[HideFromIl2Cpp]
		internal void Shutdown()
		{
			if (lifetime.BeginShutdown())
			{
				((Behaviour)this).enabled = false;
				active = false;
				try
				{
					inventory.Withdraw();
				}
				catch (Exception ex)
				{
					Plugin.Logger.LogDebug((object)ex.Message);
				}
				inventory.Reset();
				try
				{
					network.Reset();
				}
				catch (Exception ex2)
				{
					Plugin.Logger.LogDebug((object)ex2.Message);
				}
				hud.Clear();
				Close();
				ownedPress.Clear();
				RemoveButton();
				if ((Object)(object)font != (Object)null)
				{
					Object.Destroy((Object)(object)font);
				}
			}
		}

		[HideFromIl2Cpp]
		private void RemoveButton()
		{
			buttons.Clear();
		}

		[HideFromIl2Cpp]
		private void Close()
		{
			if (panelHeld || railDrag.Held)
			{
				ownedPress.Arm(Time.realtimeSinceStartup);
			}
			open = false;
			ResetInput();
		}

		private void Update()
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Expected O, but got Unknown
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Expected O, but got Unknown
			if (!lifetime.Running)
			{
				return;
			}
			bool flag = default(bool);
			if (active && (Object)(object)page != (Object)null)
			{
				try
				{
					HandleMouse(page);
					inputError = false;
				}
				catch (Exception ex)
				{
					ResetInput();
					ownedPress.Clear();
					if (!inputError)
					{
						ManualLogSource logger = Plugin.Logger;
						BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(36, 1, ref flag);
						if (flag)
						{
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral("读取大厅光标 / 主按键失败,鼠标点「关闭」暂不可用(Esc 仍可关):");
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
						}
						logger.LogWarning(val);
					}
					inputError = true;
				}
			}
			float realtimeSinceStartup = Time.realtimeSinceStartup;
			bool flag2 = LoadoutVisible();
			network.Tick(realtimeSinceStartup, flag2);
			if (realtimeSinceStartup < next)
			{
				return;
			}
			next = realtimeSinceStartup + 1f;
			try
			{
				PlayerColumn[] second = inventory.Sample(realtimeSinceStartup);
				bool flag3 = sessionMatches ?? Plugin.ShowMatches.Value;
				bool rosterConfirmed = inventory.RosterConfirmed;
				if (syncError || flag3 != matches || rosterConfirmed != confirmed || !columns.SequenceEqual(second))
				{
					model = PanelModel.Create(second, flag3, rosterConfirmed, inventory.Notice, syncError: false);
					columns = second;
					matches = flag3;
					confirmed = rosterConfirmed;
				}
				syncError = false;
			}
			catch (Exception ex2)
			{
				if (!syncError)
				{
					ManualLogSource logger2 = Plugin.Logger;
					BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(11, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("刷新大厅模组清单失败:");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex2);
					}
					logger2.LogWarning(val);
				}
				syncError = true;
				columns = Array.Empty<PlayerColumn>();
				model = PanelModel.Failure();
			}
			if (!flag2 || !((Object)(object)page != (Object)null) || !open)
			{
				return;
			}
			try
			{
				ResolveNames(page);
				nameError = false;
			}
			catch (Exception ex3)
			{
				if (!nameError)
				{
					ManualLogSource logger3 = Plugin.Logger;
					BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(20, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("读取大厅玩家名失败,表头回退到昵称原文:");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex3);
					}
					logger3.LogWarning(val);
				}
				nameError = true;
				headerNames = new Dictionary<ulong, NameRun[]>();
				headerRuns = Array.Empty<NameRun[]>();
			}
		}

		private void LateUpdate()
		{
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Expected O, but got Unknown
			if (!lifetime.Running || (Object)(object)page == (Object)null || !LoadoutVisible())
			{
				return;
			}
			float realtimeSinceStartup = Time.realtimeSinceStartup;
			bool flag = realtimeSinceStartup >= nextHud;
			if (flag)
			{
				nextHud = realtimeSinceStartup + 0.5f;
			}
			bool flag2;
			bool flag3 = default(bool);
			try
			{
				flag2 = hud.Refresh(page, network, flag);
				networkError = false;
			}
			catch (Exception ex)
			{
				hud.Clear();
				if (!networkError)
				{
					ManualLogSource logger = Plugin.Logger;
					BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(12, 1, ref flag3);
					if (flag3)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("刷新装备栏网络状态失败:");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
					}
					logger.LogWarning(val);
				}
				networkError = true;
				return;
			}
			if (flag || flag2)
			{
				try
				{
					PlaceButton(page);
					uiError = false;
				}
				catch (Exception ex2)
				{
					RemoveButton();
					if (!uiError)
					{
						ManualLogSource logger2 = Plugin.Logger;
						BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(9, 1, ref flag3);
						if (flag3)
						{
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral("创建大厅按钮失败:");
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex2);
						}
						logger2.LogWarning(val);
					}
					uiError = true;
				}
			}
			hud.Present(buttons, PointerCamera(page));
		}

		[HideFromIl2Cpp]
		private void PlaceButton(CM_PageLoadout current)
		{
			buttons.Update(current, Toggle);
		}

		[HideFromIl2Cpp]
		private void ResolveNames(CM_PageLoadout current)
		{
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Expected O, but got Unknown
			Dictionary<ulong, NameRun[]> dictionary = new Dictionary<ulong, NameRun[]>();
			ulong num = LocalId();
			Il2CppReferenceArray<CM_PlayerLobbyBar> playerLobbyBars = current.m_playerLobbyBars;
			if (playerLobbyBars != null)
			{
				bool flag = default(bool);
				for (int i = 0; i < ((Il2CppArrayBase<CM_PlayerLobbyBar>)(object)playerLobbyBars).Length && dictionary.Count < 16; i++)
				{
					CM_PlayerLobbyBar val = ((Il2CppArrayBase<CM_PlayerLobbyBar>)(object)playerLobbyBars)[i];
					if ((Object)(object)val == (Object)null)
					{
						continue;
					}
					SNet_Player player;
					try
					{
						player = val.m_player;
					}
					catch (Exception ex)
					{
						Plugin.Logger.LogDebug((object)ex.Message);
						continue;
					}
					if (player == null || player.IsBot)
					{
						continue;
					}
					ulong num2 = (player.IsLocal ? num : player.Lookup);
					if (num2 == 0L)
					{
						continue;
					}
					NameRun[] array;
					try
					{
						array = ReadNativeName((TMP_Text?)(object)val.m_nickText);
					}
					catch (Exception ex2)
					{
						ManualLogSource logger = Plugin.Logger;
						BepInExDebugLogInterpolatedStringHandler val2 = new BepInExDebugLogInterpolatedStringHandler(8, 1, ref flag);
						if (flag)
						{
							((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("读大厅名字失败:");
							((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex2.Message);
						}
						logger.LogDebug(val2);
						continue;
					}
					if (array != null && array.Length > 0)
					{
						dictionary[num2] = array;
					}
				}
			}
			headerNames = dictionary;
			headerLocalId = num;
			NameRun[][] array2 = new NameRun[columns.Length][];
			for (int j = 0; j < columns.Length; j++)
			{
				PlayerColumn playerColumn = columns[j];
				array2[j] = NameMarkup.Resolve(playerColumn.Id, num, dictionary, playerColumn.Name);
			}
			headerRuns = array2;
		}

		private static NameRun[]? ReadNativeName(TMP_Text? label)
		{
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Expected O, but got Unknown
			//IL_008e: 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_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)label == (Object)null)
			{
				return null;
			}
			string text = null;
			try
			{
				text = label.text;
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogDebug((object)ex.Message);
			}
			try
			{
				if (!string.IsNullOrEmpty(text))
				{
					TMP_TextInfo textInfo = label.textInfo;
					int num = ((textInfo != null) ? textInfo.characterCount : 0);
					Il2CppReferenceArray<TMP_CharacterInfo> val = ((textInfo != null) ? textInfo.characterInfo : null);
					if (num > 0 && val != null && num <= ((Il2CppArrayBase<TMP_CharacterInfo>)(object)val).Length)
					{
						List<NameChar> list = new List<NameChar>(num);
						bool flag = true;
						for (int i = 0; i < num && flag; i++)
						{
							TMP_CharacterInfo val2 = ((Il2CppArrayBase<TMP_CharacterInfo>)(object)val)[i];
							if ((int)val2.elementType == 0 && val2.isVisible)
							{
								int index = val2.index;
								int num2 = val2.stringLength;
								if (num2 <= 0)
								{
									num2 = 1;
								}
								if (index < 0 || index + num2 > text.Length)
								{
									flag = false;
									break;
								}
								string text2 = text.Substring(index, num2);
								if (num2 == 1 && val2.character != 0 && val2.character != text2[0])
								{
									text2 = val2.character.ToString();
								}
								list.Add(new NameChar(text2, new Rgb(val2.color.r, val2.color.g, val2.color.b)));
							}
						}
						if (flag && list.Count > 0)
						{
							NameRun[] array = NameMarkup.FromRendered(list);
							string text3 = label.GetParsedText() ?? string.Empty;
							if (text3.Length == 0 || string.Equals(NameMarkup.Plain(array), text3, StringComparison.OrdinalIgnoreCase))
							{
								return array;
							}
						}
					}
				}
			}
			catch (Exception ex2)
			{
				ManualLogSource logger = Plugin.Logger;
				bool flag2 = default(bool);
				BepInExDebugLogInterpolatedStringHandler val3 = new BepInExDebugLogInterpolatedStringHandler(17, 1, ref flag2);
				if (flag2)
				{
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("读大厅名字排版结果失败,改用原文:");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex2.Message);
				}
				logger.LogDebug(val3);
			}
			if (!string.IsNullOrEmpty(text))
			{
				return NameMarkup.Parse(text);
			}
			return null;
		}

		private static ulong LocalId()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				ulong steamID = SteamUser.GetSteamID().m_SteamID;
				if (steamID != 0L)
				{
					return steamID;
				}
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogDebug((object)ex.Message);
			}
			try
			{
				SNet_Player localPlayer = SNet.LocalPlayer;
				return (localPlayer != null) ? localPlayer.Lookup : 0;
			}
			catch (Exception ex2)
			{
				Plugin.Logger.LogDebug((object)ex2.Message);
				return 0uL;
			}
		}

		[HideFromIl2Cpp]
		private void Toggle(ulong player)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			if (LoadoutVisibl