Decompiled source of CubeX v1.3.2

plugins/CubeX.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Logging;
using CubeX.Core;
using CubeX.Features.Actions;
using CubeX.Features.Game;
using CubeX.Features.Host;
using CubeX.Features.Inventory;
using CubeX.Features.Misc;
using CubeX.Features.Misc.PauseMenuFeatures;
using CubeX.Features.Network;
using CubeX.Features.Player;
using CubeX.Features.Player.PlayerActions;
using CubeX.Features.Search;
using CubeX.Features.Self;
using CubeX.Features.Settings;
using CubeX.Features.Spawn;
using CubeX.Features.Teleport;
using CubeX.Features.Visuals;
using CubeX.Features.World;
using CubeX.Runtime.Diagnostics;
using CubeX.Runtime.Network;
using CubeX.Runtime.Player;
using CubeX.UI;
using CubeX.UI.Features;
using ExitGames.Client.Photon;
using HarmonyLib;
using JetBrains.Annotations;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Peak.Network;
using Photon.Pun;
using Photon.Realtime;
using Photon.Voice;
using Photon.Voice.PUN;
using Photon.Voice.Unity;
using TMPro;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.Playables;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
using UnityEngine.Serialization;
using UnityEngine.UI;
using Zorro.Core;
using Zorro.Core.Serizalization;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CubeX")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.3.2.0")]
[assembly: AssemblyInformationalVersion("1.3.2+0b937d626c053269000f652cd3c66364b965afb2")]
[assembly: AssemblyProduct("Cube-X mod menu for PEAK")]
[assembly: AssemblyTitle("CubeX")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.2.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[CompilerGenerated]
internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
	int ICollection.Count => _items.Length;

	bool ICollection.IsSynchronized => false;

	object ICollection.SyncRoot => this;

	object IList.this[int index]
	{
		get
		{
			return _items[index];
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	bool IList.IsFixedSize => true;

	bool IList.IsReadOnly => true;

	int IReadOnlyCollection<T>.Count => _items.Length;

	T IReadOnlyList<T>.this[int index] => _items[index];

	int ICollection<T>.Count => _items.Length;

	bool ICollection<T>.IsReadOnly => true;

	T IList<T>.this[int index]
	{
		get
		{
			return _items[index];
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	public <>z__ReadOnlyArray(T[] items)
	{
		_items = items;
	}

	IEnumerator IEnumerable.GetEnumerator()
	{
		return ((IEnumerable)_items).GetEnumerator();
	}

	void ICollection.CopyTo(Array array, int index)
	{
		((ICollection)_items).CopyTo(array, index);
	}

	int IList.Add(object value)
	{
		throw new NotSupportedException();
	}

	void IList.Clear()
	{
		throw new NotSupportedException();
	}

	bool IList.Contains(object value)
	{
		return ((IList)_items).Contains(value);
	}

	int IList.IndexOf(object value)
	{
		return ((IList)_items).IndexOf(value);
	}

	void IList.Insert(int index, object value)
	{
		throw new NotSupportedException();
	}

	void IList.Remove(object value)
	{
		throw new NotSupportedException();
	}

	void IList.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}

	IEnumerator<T> IEnumerable<T>.GetEnumerator()
	{
		return ((IEnumerable<T>)_items).GetEnumerator();
	}

	void ICollection<T>.Add(T item)
	{
		throw new NotSupportedException();
	}

	void ICollection<T>.Clear()
	{
		throw new NotSupportedException();
	}

	bool ICollection<T>.Contains(T item)
	{
		return ((ICollection<T>)_items).Contains(item);
	}

	void ICollection<T>.CopyTo(T[] array, int arrayIndex)
	{
		((ICollection<T>)_items).CopyTo(array, arrayIndex);
	}

	bool ICollection<T>.Remove(T item)
	{
		throw new NotSupportedException();
	}

	int IList<T>.IndexOf(T item)
	{
		return ((IList<T>)_items).IndexOf(item);
	}

	void IList<T>.Insert(int index, T item)
	{
		throw new NotSupportedException();
	}

	void IList<T>.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}
}
[CompilerGenerated]
internal sealed class <>z__ReadOnlySingleElementList<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
	private sealed class Enumerator : IDisposable, IEnumerator, IEnumerator<T>
	{
		object IEnumerator.Current => _item;

		T IEnumerator<T>.Current => _item;

		public Enumerator(T item)
		{
			_item = item;
		}

		bool IEnumerator.MoveNext()
		{
			if (!_moveNextCalled)
			{
				return _moveNextCalled = true;
			}
			return false;
		}

		void IEnumerator.Reset()
		{
			_moveNextCalled = false;
		}

		void IDisposable.Dispose()
		{
		}
	}

	int ICollection.Count => 1;

	bool ICollection.IsSynchronized => false;

	object ICollection.SyncRoot => this;

	object IList.this[int index]
	{
		get
		{
			if (index != 0)
			{
				throw new IndexOutOfRangeException();
			}
			return _item;
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	bool IList.IsFixedSize => true;

	bool IList.IsReadOnly => true;

	int IReadOnlyCollection<T>.Count => 1;

	T IReadOnlyList<T>.this[int index]
	{
		get
		{
			if (index != 0)
			{
				throw new IndexOutOfRangeException();
			}
			return _item;
		}
	}

	int ICollection<T>.Count => 1;

	bool ICollection<T>.IsReadOnly => true;

	T IList<T>.this[int index]
	{
		get
		{
			if (index != 0)
			{
				throw new IndexOutOfRangeException();
			}
			return _item;
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	public <>z__ReadOnlySingleElementList(T item)
	{
		_item = item;
	}

	IEnumerator IEnumerable.GetEnumerator()
	{
		return new Enumerator(_item);
	}

	void ICollection.CopyTo(Array array, int index)
	{
		array.SetValue(_item, index);
	}

	int IList.Add(object value)
	{
		throw new NotSupportedException();
	}

	void IList.Clear()
	{
		throw new NotSupportedException();
	}

	bool IList.Contains(object value)
	{
		return EqualityComparer<T>.Default.Equals(_item, (T)value);
	}

	int IList.IndexOf(object value)
	{
		if (!EqualityComparer<T>.Default.Equals(_item, (T)value))
		{
			return -1;
		}
		return 0;
	}

	void IList.Insert(int index, object value)
	{
		throw new NotSupportedException();
	}

	void IList.Remove(object value)
	{
		throw new NotSupportedException();
	}

	void IList.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}

	IEnumerator<T> IEnumerable<T>.GetEnumerator()
	{
		return new Enumerator(_item);
	}

	void ICollection<T>.Add(T item)
	{
		throw new NotSupportedException();
	}

	void ICollection<T>.Clear()
	{
		throw new NotSupportedException();
	}

	bool ICollection<T>.Contains(T item)
	{
		return EqualityComparer<T>.Default.Equals(_item, item);
	}

	void ICollection<T>.CopyTo(T[] array, int arrayIndex)
	{
		array[arrayIndex] = _item;
	}

	bool ICollection<T>.Remove(T item)
	{
		throw new NotSupportedException();
	}

	int IList<T>.IndexOf(T item)
	{
		if (!EqualityComparer<T>.Default.Equals(_item, item))
		{
			return -1;
		}
		return 0;
	}

	void IList<T>.Insert(int index, T item)
	{
		throw new NotSupportedException();
	}

	void IList<T>.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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 CubeX
{
	[BepInPlugin("com.mister9982.cubex", "Cube-X", "1.3.2")]
	public class Plugin : BaseUnityPlugin
	{
		private Harmony _harmony;

		private bool _updateFailureLogged;

		private const string ModGuid = "com.mister9982.cubex";

		private const string ModName = "Cube-X";

		public const string ModVersion = "1.3.2";

		public static Plugin Instance { get; private set; }

		public static ManualLogSource Log { get; private set; }

		private static FeatureManager FeatureManager { get; set; }

		private static MenuUI Menu { get; set; }

		private void Awake()
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			try
			{
				FeatureManager = new FeatureManager();
				FeatureManager.RegisterAllFromAssembly();
				ConfigService.Initialize(FeatureManager);
				Menu = ((Component)this).gameObject.AddComponent<MenuUI>();
				Menu.Bind(FeatureManager);
				((Component)this).gameObject.AddComponent<GameEventNotifier>();
				NotificationSystem.MarkReady();
				_harmony = new Harmony("com.mister9982.cubex");
				PatchAllSafely();
				Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
				KeyCode menuBind = RuntimeKeybinds.MenuBind;
				CubeXDiagnostics.Info("Cube-X", "v1.3.2 loaded - press " + ((object)(KeyCode)(ref menuBind)).ToString() + " to open.", notify: true);
			}
			catch (Exception exception)
			{
				CubeXDiagnostics.Error("Cube-X", "Startup failed.", exception);
			}
		}

		private void PatchAllSafely()
		{
			int num = 0;
			int num2 = 0;
			Type[] typesSafely = GetTypesSafely(Assembly.GetExecutingAssembly());
			foreach (Type type in typesSafely)
			{
				if (!(type == null) && HasHarmonyPatch(type))
				{
					try
					{
						_harmony.CreateClassProcessor(type).Patch();
						num++;
					}
					catch (Exception ex)
					{
						num2++;
						CubeXDiagnostics.Warning("Harmony", "Skipped patch " + type.FullName + ": " + ex.GetBaseException().Message);
					}
				}
			}
			CubeXDiagnostics.Info("Harmony", "Patches applied: " + num + ", skipped: " + num2 + ".", num2 > 0);
		}

		private static Type[] GetTypesSafely(Assembly assembly)
		{
			try
			{
				return assembly.GetTypes();
			}
			catch (ReflectionTypeLoadException ex)
			{
				return ex.Types.Where((Type t) => t != null).ToArray();
			}
		}

		private static bool HasHarmonyPatch(Type type)
		{
			if (type.GetCustomAttributes(typeof(HarmonyPatch), inherit: false).Length != 0)
			{
				return true;
			}
			return type.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).Any((MethodInfo t) => t.GetCustomAttributes(typeof(HarmonyPatch), inherit: false).Length != 0);
		}

		private void Update()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (!RuntimeKeybinds.IsCapturing && (Object)(object)Menu != (Object)null)
				{
					bool keyDown = Input.GetKeyDown(RuntimeKeybinds.MenuBind);
					bool flag = MenuControllerInput.ToggleMenuPressed();
					if (keyDown || flag)
					{
						Menu.IsOpen = !Menu.IsOpen;
					}
				}
				RuntimeKeybinds.TickFeatureBinds(FeatureManager);
				FeatureManager?.Tick();
				ConfigService.Tick();
			}
			catch (Exception exception)
			{
				if (!_updateFailureLogged)
				{
					_updateFailureLogged = true;
					CubeXDiagnostics.Error("Cube-X", "Update loop failed. Further update-loop errors will be logged only.", exception);
				}
				else
				{
					CubeXDiagnostics.Error("Cube-X", "Update loop failed.", exception, notify: false);
				}
			}
		}

		private void OnDestroy()
		{
			CubeXDiagnostics.Try("Cube-X", "Unpatch Harmony", delegate
			{
				Harmony harmony = _harmony;
				if (harmony != null)
				{
					harmony.UnpatchSelf();
				}
			}, notifyErrors: false);
			CubeXDiagnostics.Try("Cube-X", "Shutdown config", ConfigService.Shutdown, notifyErrors: false);
			CubeXDiagnostics.Try("Cube-X", "Disable features", delegate
			{
				FeatureManager?.DisableAll();
			}, notifyErrors: false);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "CubeX";

		public const string PLUGIN_NAME = "Cube-X mod menu for PEAK";

		public const string PLUGIN_VERSION = "1.3.2";
	}
}
namespace CubeX.UI
{
	internal static class DiscordCommunityPrompt
	{
		private const string InviteUrl = "https://discord.gg/cHmp58MqPf";

		private static bool _dismissedThisSession;

		private static bool? _dismissedPersisted;

		private static GUIStyle _titleStyle;

		private static GUIStyle _bodyStyle;

		private static GUIStyle _buttonStyle;

		private const string StateFolderName = "State";

		private static string StatePath => AppDataPaths.FilePath("State", "discord_prompt_seen");

		public static bool ShouldRender
		{
			get
			{
				if (!_dismissedThisSession)
				{
					return !IsDismissedPersisted();
				}
				return false;
			}
		}

		public static void OpenInvite()
		{
			Application.OpenURL("https://discord.gg/cHmp58MqPf");
		}

		public static void Render()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: 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_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			if (ShouldRender)
			{
				EnsureStyles();
				float num = Mathf.Min(420f, Mathf.Max(280f, (float)Screen.width - 36f));
				float num2 = 168f;
				Rect val = default(Rect);
				((Rect)(ref val))..ctor(((float)Screen.width - num) * 0.5f, Mathf.Max(24f, (float)Screen.height * 0.18f), num, num2);
				Theme.Fill(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), new Color(0f, 0f, 0f, 0.42f));
				Theme.Fill(val, new Color(0.035f, 0.035f, 0.04f, 0.96f));
				Theme.Fill(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y, 4f, ((Rect)(ref val)).height), MenuConfig.AccentColor);
				DrawOutline(val, new Color(1f, 1f, 1f, 0.14f), 1f);
				GUI.Label(new Rect(((Rect)(ref val)).x + 20f, ((Rect)(ref val)).y + 18f, ((Rect)(ref val)).width - 40f, 28f), "Join the Cube-X Discord?", _titleStyle);
				GUI.Label(new Rect(((Rect)(ref val)).x + 20f, ((Rect)(ref val)).y + 52f, ((Rect)(ref val)).width - 40f, 46f), "Get updates, support, and community help from the Discord server.", _bodyStyle);
				Rect val2 = new Rect(((Rect)(ref val)).x + ((Rect)(ref val)).width - 220f, ((Rect)(ref val)).yMax - 52f, 96f, 32f);
				Rect val3 = default(Rect);
				((Rect)(ref val3))..ctor(((Rect)(ref val)).x + ((Rect)(ref val)).width - 114f, ((Rect)(ref val)).yMax - 52f, 94f, 32f);
				if (GUI.Button(val2, "Join", _buttonStyle))
				{
					Dismiss();
					OpenInvite();
					Event.current.Use();
				}
				if (GUI.Button(val3, "Not Now", _buttonStyle))
				{
					Dismiss();
					Event.current.Use();
				}
			}
		}

		private static void Dismiss()
		{
			_dismissedThisSession = true;
			_dismissedPersisted = true;
			try
			{
				Directory.CreateDirectory(AppDataPaths.DirectoryPath("State"));
				File.WriteAllText(StatePath, "1");
			}
			catch (Exception ex)
			{
				ManualLogSource log = Plugin.Log;
				if (log != null)
				{
					log.LogWarning((object)("[Discord Prompt] Failed to persist dismissal: " + ex.Message));
				}
			}
		}

		private static bool IsDismissedPersisted()
		{
			if (_dismissedPersisted.HasValue)
			{
				return _dismissedPersisted.Value;
			}
			try
			{
				AppDataPaths.MigrateFileToDirectory("discord_prompt_seen", "State");
				_dismissedPersisted = File.Exists(StatePath);
			}
			catch
			{
				_dismissedPersisted = false;
			}
			return _dismissedPersisted.Value;
		}

		private static void EnsureStyles()
		{
			//IL_0012: 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_001f: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Expected O, but got Unknown
			if (_titleStyle == null)
			{
				GUIStyle val = new GUIStyle(GUI.skin.label)
				{
					fontSize = 18,
					fontStyle = (FontStyle)1
				};
				val.normal.textColor = Color.white;
				val.clipping = (TextClipping)1;
				_titleStyle = val;
				GUIStyle val2 = new GUIStyle(GUI.skin.label)
				{
					fontSize = 13
				};
				val2.normal.textColor = new Color(0.9f, 0.9f, 0.9f, 1f);
				val2.wordWrap = true;
				_bodyStyle = val2;
				_buttonStyle = new GUIStyle(GUI.skin.button)
				{
					fontSize = 13,
					fontStyle = (FontStyle)1
				};
			}
		}

		private static void DrawOutline(Rect rect, Color color, float thickness)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			Theme.Fill(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width, thickness), color);
			Theme.Fill(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).yMax - thickness, ((Rect)(ref rect)).width, thickness), color);
			Theme.Fill(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, thickness, ((Rect)(ref rect)).height), color);
			Theme.Fill(new Rect(((Rect)(ref rect)).xMax - thickness, ((Rect)(ref rect)).y, thickness, ((Rect)(ref rect)).height), color);
		}
	}
	[HarmonyPatch(typeof(Character), "RPCA_Die")]
	internal static class CharacterDiedNotificationPatch
	{
		private static void Postfix(Character __instance)
		{
			CharacterEventNotifications.NotifyDied(__instance);
		}
	}
	internal static class CharacterEventNotifications
	{
		private const float Cooldown = 1.2f;

		private static readonly Dictionary<string, float> LastEvents = new Dictionary<string, float>();

		public static void NotifyDied(Character character)
		{
			NotifyCharacterEvent(character, "Player Died", NotificationKind.Error, "died");
		}

		public static void NotifyPassedOut(Character character)
		{
			NotifyCharacterEvent(character, "Player Passed Out", NotificationKind.Warning, "passed-out");
		}

		public static void NotifyRevived(Character character)
		{
			NotifyCharacterEvent(character, "Player Revived", NotificationKind.Success, "revived");
		}

		private static void NotifyCharacterEvent(Character character, string title, NotificationKind kind, string key)
		{
			if (NotificationSettings.PlayerLife && IsPlayerCharacter(character) && !IsCoolingDown(key + ":" + ((Object)character).GetInstanceID().ToString(CultureInfo.InvariantCulture)))
			{
				NotificationSystem.Push(title, GetCharacterNameForNotifications(character), kind);
			}
		}

		private static bool IsCoolingDown(string key)
		{
			float unscaledTime = Time.unscaledTime;
			if (LastEvents.TryGetValue(key, out var value) && unscaledTime - value < 1.2f)
			{
				return true;
			}
			LastEvents[key] = unscaledTime;
			return false;
		}

		private static bool IsPlayerCharacter(Character character)
		{
			if (!Object.op_Implicit((Object)(object)character))
			{
				return false;
			}
			if (character.isBot || character.isZombie || character.isScoutmaster)
			{
				return false;
			}
			PhotonView photonView = GetPhotonView((Component)(object)character);
			if (Object.op_Implicit((Object)(object)photonView))
			{
				return photonView.Owner != null;
			}
			return false;
		}

		public static string GetCharacterNameForNotifications(Character character)
		{
			PhotonView photonView = GetPhotonView((Component)(object)character);
			if (Object.op_Implicit((Object)(object)photonView) && photonView.Owner != null)
			{
				string nickName = photonView.Owner.NickName;
				if (!string.IsNullOrWhiteSpace(nickName))
				{
					return nickName + " #" + photonView.Owner.ActorNumber.ToString(CultureInfo.InvariantCulture);
				}
			}
			return "Player " + ((Object)character).GetInstanceID().ToString(CultureInfo.InvariantCulture);
		}

		private static PhotonView GetPhotonView(Component component)
		{
			if (!Object.op_Implicit((Object)(object)component))
			{
				return null;
			}
			return component.GetComponent<PhotonView>() ?? component.GetComponentInChildren<PhotonView>();
		}
	}
	[HarmonyPatch(typeof(Character), "RPCA_PassOut")]
	internal static class CharacterPassedOutNotificationPatch
	{
		private static void Postfix(Character __instance)
		{
			CharacterEventNotifications.NotifyPassedOut(__instance);
		}
	}
	[HarmonyPatch(typeof(Character), "RPCA_ReviveAtPosition")]
	internal static class CharacterRevivedAtPositionNotificationPatch
	{
		private static void Postfix(Character __instance)
		{
			CharacterEventNotifications.NotifyRevived(__instance);
		}
	}
	[HarmonyPatch(typeof(Character), "RPCA_Revive")]
	internal static class CharacterRevivedNotificationPatch
	{
		private static void Postfix(Character __instance)
		{
			CharacterEventNotifications.NotifyRevived(__instance);
		}
	}
	public class GameEventNotifier : MonoBehaviour, IInRoomCallbacks
	{
		private void OnEnable()
		{
			PhotonNetwork.AddCallbackTarget((object)this);
		}

		private void OnDisable()
		{
			PhotonNetwork.RemoveCallbackTarget((object)this);
		}

		public void OnPlayerEnteredRoom(Player newPlayer)
		{
			RecentPlayersStore.Record(newPlayer);
			if (!PlayerBlacklistStore.TryBlock(newPlayer) && NotificationSettings.JoinLeave && newPlayer != null && !newPlayer.IsLocal)
			{
				NotificationSystem.Push("Player Joined", GetPlayerName(newPlayer), NotificationKind.Success);
			}
		}

		public void OnPlayerLeftRoom(Player otherPlayer)
		{
			RecentPlayersStore.Record(otherPlayer);
			if (NotificationSettings.JoinLeave && otherPlayer != null && !otherPlayer.IsLocal)
			{
				NotificationSystem.Push("Player Left", GetPlayerName(otherPlayer), NotificationKind.Warning);
			}
		}

		public void OnRoomPropertiesUpdate(Hashtable propertiesThatChanged)
		{
		}

		public void OnPlayerPropertiesUpdate(Player targetPlayer, Hashtable changedProps)
		{
		}

		public void OnMasterClientSwitched(Player newMasterClient)
		{
			if (newMasterClient != null && newMasterClient.IsLocal)
			{
				PlayerBlacklistStore.EnforceCurrentRoomBlacklist();
			}
		}

		private static string GetPlayerName(Player player)
		{
			if (player == null)
			{
				return "Unknown";
			}
			return (string.IsNullOrWhiteSpace(player.NickName) ? "Player" : player.NickName) + " #" + player.ActorNumber.ToString(CultureInfo.InvariantCulture);
		}
	}
	public static class NotificationSettings
	{
		public static bool JoinLeave = true;

		public static bool PlayerLife = true;

		public static bool RpcEvents = true;

		public static bool KeybindToggles = true;
	}
	public static class RpcEventNotifications
	{
		private const float Cooldown = 0.7f;

		private static readonly Dictionary<string, float> LastEvents = new Dictionary<string, float>();

		public static void NotifyExecuted(string methodName, Player sender, PhotonView view)
		{
			if (NotificationSettings.RpcEvents && !string.IsNullOrEmpty(methodName) && !IsCoolingDown("rpc:" + methodName + ":" + GetSenderKey(sender) + ":" + (Object.op_Implicit((Object)(object)view) ? view.ViewID.ToString(CultureInfo.InvariantCulture) : "0")))
			{
				string text = ((sender != null && sender.IsLocal) ? "You" : GetPlayerName(sender));
				string targetText = GetTargetText(view);
				string description = (string.IsNullOrEmpty(targetText) ? text : (text + " -> " + targetText));
				NotificationSystem.Push("RPC " + methodName, description);
			}
		}

		public static void NotifyBlocked(string methodName, Player sender)
		{
			if (NotificationSettings.RpcEvents && !string.IsNullOrEmpty(methodName) && !IsCoolingDown("blocked:" + methodName + ":" + GetSenderKey(sender)))
			{
				NotificationSystem.Push("RPC Blocked", methodName + " from " + GetPlayerName(sender), NotificationKind.Warning);
			}
		}

		public static void NotifyProtectionDetected(string eventName, Player sender, PhotonView view)
		{
			if (NotificationSettings.RpcEvents && !string.IsNullOrEmpty(eventName) && !IsCoolingDown("protection:" + eventName + ":" + GetSenderKey(sender) + ":" + (Object.op_Implicit((Object)(object)view) ? view.ViewID.ToString(CultureInfo.InvariantCulture) : "0")))
			{
				string targetText = GetTargetText(view);
				string text = eventName + " from " + GetPlayerName(sender);
				if (!string.IsNullOrEmpty(targetText))
				{
					text = text + " -> " + targetText;
				}
				NotificationSystem.Push("Modder Detection", text, NotificationKind.Warning);
			}
		}

		public static void NotifyProtectionBlocked(string eventName, Player sender)
		{
			if (NotificationSettings.RpcEvents && !string.IsNullOrEmpty(eventName) && !IsCoolingDown("protection-blocked:" + eventName + ":" + GetSenderKey(sender)))
			{
				NotificationSystem.Push("Protection Blocked", eventName + " from " + GetPlayerName(sender), NotificationKind.Warning);
			}
		}

		private static bool IsCoolingDown(string key)
		{
			float unscaledTime = Time.unscaledTime;
			if (LastEvents.TryGetValue(key, out var value) && unscaledTime - value < 0.7f)
			{
				return true;
			}
			LastEvents[key] = unscaledTime;
			return false;
		}

		private static string GetSenderKey(Player sender)
		{
			if (sender != null)
			{
				return sender.ActorNumber.ToString(CultureInfo.InvariantCulture);
			}
			return "unknown";
		}

		private static string GetPlayerName(Player player)
		{
			if (player == null)
			{
				return "Unknown";
			}
			return (string.IsNullOrWhiteSpace(player.NickName) ? "Player" : player.NickName) + " #" + player.ActorNumber.ToString(CultureInfo.InvariantCulture);
		}

		private static string GetTargetText(PhotonView view)
		{
			if (!Object.op_Implicit((Object)(object)view))
			{
				return string.Empty;
			}
			Character val = ((Component)view).GetComponent<Character>() ?? ((Component)view).GetComponentInParent<Character>() ?? ((Component)view).GetComponentInChildren<Character>();
			if (Object.op_Implicit((Object)(object)val))
			{
				return CharacterEventNotifications.GetCharacterNameForNotifications(val);
			}
			return "View " + view.ViewID.ToString(CultureInfo.InvariantCulture);
		}
	}
	public struct ColorPreset
	{
		public readonly string Name;

		public readonly Color Color;

		public ColorPreset(string name, Color color)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			Name = name;
			Color = color;
		}
	}
	public static class MenuConfig
	{
		public static readonly ColorPreset[] Presets = new ColorPreset[8]
		{
			new ColorPreset("Teal", new Color(0.243f, 0.706f, 0.537f, 1f)),
			new ColorPreset("Purple", new Color(0.486f, 0.361f, 1f, 1f)),
			new ColorPreset("Crimson", new Color(0.937f, 0.267f, 0.267f, 1f)),
			new ColorPreset("Sky", new Color(0.231f, 0.62f, 0.965f, 1f)),
			new ColorPreset("Lime", new Color(0.486f, 0.831f, 0.267f, 1f)),
			new ColorPreset("Amber", new Color(0.976f, 0.69f, 0.086f, 1f)),
			new ColorPreset("Pink", new Color(0.945f, 0.345f, 0.62f, 1f)),
			new ColorPreset("Cyan", new Color(0.063f, 0.808f, 0.851f, 1f))
		};

		public static int PresetIndex = 0;

		public static Color AccentColor = Presets[0].Color;

		private const float ReferenceWidth = 1920f;

		private const float ReferenceHeight = 1080f;

		private const float MinUIScale = 0.5f;

		private const float MaxConfiguredUIScale = 4f;

		private const float DefaultMenuWidth = 480f;

		private const float DefaultUIScale = 1f;

		private const float DefaultHighlightLerpSpeed = 18f;

		private const int DefaultMaxVisibleRows = 12;

		public static float MenuWidth = 480f;

		public static float UIScale = 1f;

		public static float HighlightLerpSpeed = 18f;

		public static int MaxVisibleRows = 12;

		public static bool ShowBreadcrumb = true;

		public static bool ShowDescription = true;

		public static bool ShowFooter = true;

		public static bool ShowScrollbar = true;

		public static bool AutoSave = false;

		public static bool AutoLoadOnStart = true;

		public static void ApplyPreset(int index)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			int num = Presets.Length;
			PresetIndex = (index % num + num) % num;
			AccentColor = Presets[PresetIndex].Color;
		}

		public static void SetAccentColor(Color color)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: 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_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			AccentColor = new Color(Mathf.Clamp01(color.r), Mathf.Clamp01(color.g), Mathf.Clamp01(color.b), 1f);
			for (int i = 0; i < Presets.Length; i++)
			{
				Color color2 = Presets[i].Color;
				if (Mathf.Abs(color2.r - AccentColor.r) <= 0.001f && Mathf.Abs(color2.g - AccentColor.g) <= 0.001f && Mathf.Abs(color2.b - AccentColor.b) <= 0.001f)
				{
					PresetIndex = i;
					break;
				}
			}
		}

		public static float GetMaxUIScale()
		{
			if (Screen.width <= 0 || Screen.height <= 0)
			{
				return 4f;
			}
			float num = (float)Screen.width / 1920f;
			float num2 = (float)Screen.height / 1080f;
			return Mathf.Max(1f, Mathf.Min(num, num2));
		}

		public static float GetResolvedUIScale()
		{
			return Mathf.Clamp(UIScale, 0.5f, GetMaxUIScale());
		}

		public static void SetUIScale(float scale)
		{
			UIScale = Mathf.Clamp(scale, 0.5f, GetMaxUIScale());
		}

		public static void ResetToDefaults()
		{
			//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)
			PresetIndex = 0;
			AccentColor = Presets[0].Color;
			MenuWidth = 480f;
			UIScale = 1f;
			HighlightLerpSpeed = 18f;
			MaxVisibleRows = 12;
			ShowBreadcrumb = true;
			ShowDescription = true;
			ShowFooter = true;
			ShowScrollbar = true;
			AutoSave = false;
			AutoLoadOnStart = true;
		}
	}
	internal static class MenuControllerInput
	{
		private sealed class DirectionRepeater
		{
			private int _heldDirection;

			private float _nextRepeatAt;

			public int Consume(int direction)
			{
				if (direction == 0)
				{
					Reset();
					return 0;
				}
				float unscaledTime = Time.unscaledTime;
				if (direction != _heldDirection)
				{
					_heldDirection = direction;
					_nextRepeatAt = unscaledTime + 0.32f;
					return direction;
				}
				if (unscaledTime < _nextRepeatAt)
				{
					return 0;
				}
				_nextRepeatAt = unscaledTime + 0.09f;
				return direction;
			}

			public void Reset()
			{
				_heldDirection = 0;
				_nextRepeatAt = 0f;
			}
		}

		private const float RepeatDelay = 0.32f;

		private const float RepeatInterval = 0.09f;

		private static readonly DirectionRepeater VerticalRepeat = new DirectionRepeater();

		private static readonly DirectionRepeater HorizontalRepeat = new DirectionRepeater();

		private static bool _confirmHeld;

		private static bool _backHeld;

		private static bool _toggleChordHeld;

		public static bool ToggleMenuPressed()
		{
			bool flag = ToggleMenuChordHeld();
			bool result = flag && !_toggleChordHeld;
			_toggleChordHeld = flag;
			return result;
		}

		public static bool ToggleMenuChordHeld()
		{
			Gamepad val = CurrentGamepad();
			if (val != null && val.dpad.right.isPressed)
			{
				return val.rightShoulder.isPressed;
			}
			return false;
		}

		public static bool ConfirmPressed()
		{
			Gamepad obj = CurrentGamepad();
			return ConsumePress(obj != null && obj.buttonSouth.isPressed, ref _confirmHeld);
		}

		public static bool BackPressed()
		{
			Gamepad obj = CurrentGamepad();
			return ConsumePress(obj != null && obj.buttonEast.isPressed, ref _backHeld);
		}

		public static int ConsumeVerticalDirection()
		{
			Gamepad val = CurrentGamepad();
			int direction = 0;
			if (val != null)
			{
				if (val.dpad.up.isPressed)
				{
					direction = -1;
				}
				else if (val.dpad.down.isPressed)
				{
					direction = 1;
				}
			}
			return VerticalRepeat.Consume(direction);
		}

		public static int ConsumeHorizontalDirection()
		{
			Gamepad val = CurrentGamepad();
			int direction = 0;
			if (val != null)
			{
				if (val.dpad.left.isPressed)
				{
					direction = -1;
				}
				else if (val.dpad.right.isPressed && !val.rightShoulder.isPressed)
				{
					direction = 1;
				}
			}
			return HorizontalRepeat.Consume(direction);
		}

		public static void Reset()
		{
			VerticalRepeat.Reset();
			HorizontalRepeat.Reset();
			_confirmHeld = false;
			_backHeld = false;
		}

		private static Gamepad CurrentGamepad()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			Gamepad current = Gamepad.current;
			if (current != null)
			{
				return current;
			}
			if (Gamepad.all.Count <= 0)
			{
				return null;
			}
			return Gamepad.all[0];
		}

		private static bool ConsumePress(bool pressed, ref bool held)
		{
			bool result = pressed && !held;
			held = pressed;
			return result;
		}
	}
	internal static class MenuInputCapture
	{
		private static bool _active;

		private static bool _menuOpen;

		private static bool _savedCursorVisible;

		private static CursorLockMode _savedLockState;

		public static bool BlocksPlayerInput => _active;

		public static bool SuppressesMenuEmoteInput => _menuOpen;

		public static void SetMenuOpen(bool open)
		{
			_menuOpen = open;
		}

		public static void Begin()
		{
			//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)
			if (!_active)
			{
				_savedCursorVisible = Cursor.visible;
				_savedLockState = Cursor.lockState;
				_active = true;
			}
			ApplyCursor();
		}

		public static void Tick()
		{
			if (_active)
			{
				ApplyCursor();
			}
		}

		public static void End()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			if (_active)
			{
				_active = false;
				Cursor.visible = _savedCursorVisible;
				Cursor.lockState = _savedLockState;
			}
		}

		private static void ApplyCursor()
		{
			Cursor.visible = true;
			Cursor.lockState = (CursorLockMode)0;
		}
	}
	public class MenuUI : MonoBehaviour
	{
		private readonly struct MenuNavigationState
		{
			public string Category { get; }

			public int SelectedIndex { get; }

			public float ScrollY { get; }

			public float ScrollYTarget { get; }

			public MenuNavigationState(string category, int selectedIndex, float scrollY, float scrollYTarget)
			{
				Category = category;
				SelectedIndex = selectedIndex;
				ScrollY = scrollY;
				ScrollYTarget = scrollYTarget;
			}
		}

		private FeatureManager _features;

		private bool _isOpen;

		private string _category;

		private int _selected;

		private readonly List<object> _rows = new List<object>();

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

		private readonly Stack<MenuNavigationState> _navigationStack = new Stack<MenuNavigationState>();

		private float _highlightY;

		private float _highlightYTarget;

		private float _scrollY;

		private float _scrollYTarget;

		private bool _animationsInited;

		private bool _editingNumber;

		private NumberFeature _editingNumberFeature;

		private int _editingNumberIndex = -1;

		private string _editingText = string.Empty;

		private bool _focusNumberInputNext;

		private const string NumberInputControl = "CubeX_NumberInput";

		private bool _editingTextFeatureActive;

		private TextFeature _editingTextFeature;

		private int _editingTextIndex = -1;

		private string _editingTextOriginal = string.Empty;

		private bool _focusTextInputNext;

		private const string TextInputControl = "CubeX_TextInput";

		private bool _editingColor;

		private ColorFeature _editingColorFeature;

		private int _editingColorIndex = -1;

		private float _colorHue;

		private float _colorSaturation;

		private float _colorValue;

		private Color _editingColorPreview = Color.white;

		private int _colorDragTarget;

		private Texture2D _colorHueTexture;

		private Texture2D _colorSatValTexture;

		private Texture2D _staminaStripeTexture;

		private float _colorSatValTextureHue = -1f;

		private GUIStyle _descriptionTextStyle;

		private float _descriptionTextStyleScale = -1f;

		private readonly StringBuilder _descriptionWrapBuilder = new StringBuilder();

		private readonly Dictionary<string, float> _smoothPlayerMetrics = new Dictionary<string, float>();

		private readonly SelectedPlayerPreviewPanel _selectedPlayerPreviewPanel = new SelectedPlayerPreviewPanel();

		private Rect _window = new Rect(-1f, -1f, 480f, 720f);

		private bool _hasPositionedWindow;

		private bool _dragging;

		private Vector2 _dragOffset;

		private float _scale = 1f;

		private bool _themeInitialized;

		private bool _rowsDirty = true;

		private int _lastMenuRefreshFrame = -1;

		private int _lastRowsRefreshFrame = -1;

		private int _lastOverlayRenderFrame = -1;

		private float _nextRowsRefreshAt;

		private float _heroH;

		private float _titleH;

		private float _rowsH;

		private float _pickerH;

		private float _footerGapH;

		private float _footerH;

		private float _descriptionGapH;

		private float _descriptionH;

		private float _toggleTextWidth = -1f;

		private float _toggleTextWidthScale = -1f;

		private float _layoutScale = -1f;

		private float _layoutMenuWidth = -1f;

		private int _layoutRowsCount = -1;

		private int _layoutSelected = -1;

		private int _layoutMaxVisibleRows = -1;

		private bool _layoutEditingColor;

		private bool _layoutShowFooter;

		private bool _layoutShowDescription;

		private string _layoutDescription = string.Empty;

		private const float HeroH = 96f;

		private const float TitleBarH = 34f;

		private const float RowH = 38f;

		private const float Gap = 8f;

		private const float DescMinH = 54f;

		private const float DescMaxH = 320f;

		private const float FooterH = 38f;

		private const float FooterGapH = 8f;

		private const float DiamondSize = 56f;

		private const float NumberBoolValueW = 72f;

		private const float ToggleGapW = 2f;

		private const float ColorPickerH = 224f;

		private const float ColorSwatchSize = 20f;

		private const float ColorHueStripW = 22f;

		private const float DescPadX = 16f;

		private const float DescPadTop = 12f;

		private const float DescPadBottom = 12f;

		private const float SidePanelW = 430f;

		private const float SidePanelGap = 10f;

		private const float SidePanelTitleH = 38f;

		private const float PlayerPreviewPanelW = 300f;

		private const float ScrollbarW = 8f;

		private const float ScrollbarGap = 9f;

		private const float InitialWindowInsetX = 88f;

		private const float InitialWindowInsetY = 48f;

		private const int OverlayGuiDepth = 2000;

		private const int MenuGuiDepth = 0;

		private const int NotificationGuiDepth = -2000;

		private const int ColorTextureSize = 128;

		private const int ColorDragNone = 0;

		private const int ColorDragSaturationValue = 1;

		private const int ColorDragHue = 2;

		private const float RowsRefreshInterval = 0.12f;

		private static int _lastNotificationRenderFrame = -1;

		public bool IsOpen
		{
			get
			{
				return _isOpen;
			}
			set
			{
				if (_isOpen != value)
				{
					_isOpen = value;
					MenuInputCapture.SetMenuOpen(value);
					MenuControllerInput.Reset();
				}
			}
		}

		private float RowHeight => S(38f);

		public MenuUI()
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			IsOpen = true;
		}

		private float S(float value)
		{
			return value * _scale;
		}

		private void Awake()
		{
			EnsureThemeInitialized();
		}

		public void Bind(FeatureManager fm)
		{
			_features = fm;
			RefreshRows(force: true);
			RecalculateMenuLayout();
		}

		private void Update()
		{
			if (IsOpen && _features != null)
			{
				HandleController();
			}
			if (_animationsInited)
			{
				float unscaledDeltaTime = Time.unscaledDeltaTime;
				float num = Mathf.Max(1f, MenuConfig.HighlightLerpSpeed);
				float num2 = 1f - Mathf.Exp((0f - num) * unscaledDeltaTime);
				_highlightY = Mathf.Lerp(_highlightY, _highlightYTarget, num2);
				_scrollY = Mathf.Lerp(_scrollY, _scrollYTarget, num2);
			}
		}

		private void OnGUI()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Invalid comparison between Unknown and I4
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			EnsureThemeInitialized();
			EventType type = Event.current.type;
			if (((int)type == 8 || (int)type == 11) ? true : false)
			{
				return;
			}
			RenderFeatureOverlays();
			if (!IsOpen || _features == null)
			{
				_selectedPlayerPreviewPanel.SetVisible(visible: false);
				if (_editingColor)
				{
					CancelColorPicker();
				}
				RenderDiscordPrompt();
				RenderNotifications();
				return;
			}
			GUI.depth = 0;
			HandleNumberEditorCommitKeys();
			HandleTextEditorCommitKeys();
			RefreshMenuForFrame();
			float y = ((Rect)(ref _window)).y;
			DrawShadow();
			DrawHero(new Rect(((Rect)(ref _window)).x, y, ((Rect)(ref _window)).width, _heroH));
			y += _heroH;
			DrawTitleBar(new Rect(((Rect)(ref _window)).x, y, ((Rect)(ref _window)).width, _titleH), _titleH);
			y += _titleH;
			DrawRows(new Rect(((Rect)(ref _window)).x, y, ((Rect)(ref _window)).width, _rowsH));
			y += _rowsH;
			if (_editingColor && _editingColorFeature != null)
			{
				MenuInputCapture.Tick();
				DrawColorPicker(new Rect(((Rect)(ref _window)).x, y, ((Rect)(ref _window)).width, _pickerH), _editingColorFeature);
				y += _pickerH;
			}
			if (MenuConfig.ShowFooter)
			{
				DrawFooterSpacer(new Rect(((Rect)(ref _window)).x, y, ((Rect)(ref _window)).width, _footerGapH));
				y += _footerGapH;
				DrawFooter(new Rect(((Rect)(ref _window)).x, y, ((Rect)(ref _window)).width, _footerH));
				y += _footerH;
			}
			if (MenuConfig.ShowDescription)
			{
				if (_descriptionGapH > 0f)
				{
					DrawGap(new Rect(((Rect)(ref _window)).x, y, ((Rect)(ref _window)).width, _descriptionGapH));
					y += _descriptionGapH;
				}
				DrawDescription(new Rect(((Rect)(ref _window)).x, y, ((Rect)(ref _window)).width, _descriptionH));
			}
			DrawSidePanelIfNeeded();
			HandleKeyboard();
			HandleDrag();
			RenderDiscordPrompt();
			RenderNotifications();
		}

		private void OnDestroy()
		{
			MenuInputCapture.SetMenuOpen(open: false);
			MenuControllerInput.Reset();
			_selectedPlayerPreviewPanel.Dispose();
		}

		private void EnsureThemeInitialized()
		{
			if (!_themeInitialized)
			{
				Theme.Init();
				_themeInitialized = true;
			}
		}

		private void RefreshMenuForFrame()
		{
			int frameCount = Time.frameCount;
			if (_lastMenuRefreshFrame != frameCount)
			{
				_lastMenuRefreshFrame = frameCount;
				_scale = MenuConfig.GetResolvedUIScale();
				Theme.ApplyScale(_scale);
				RefreshRows();
				RecalculateMenuLayout();
			}
		}

		private void RecalculateMenuLayout()
		{
			string text = (MenuConfig.ShowDescription ? DescriptionFor(SelectedRow()) : string.Empty);
			if (!NeedsLayoutRecalculation(text))
			{
				EnsureInitialWindowPosition();
				ClampWindowToScreen();
				return;
			}
			((Rect)(ref _window)).width = MenuConfig.MenuWidth * _scale;
			_heroH = S(96f);
			_titleH = S(34f);
			_footerH = (MenuConfig.ShowFooter ? S(38f) : 0f);
			_footerGapH = (MenuConfig.ShowFooter ? S(8f) : 0f);
			_descriptionGapH = ((MenuConfig.ShowDescription && !MenuConfig.ShowFooter) ? S(8f) : 0f);
			_descriptionH = (MenuConfig.ShowDescription ? CalculateDescriptionHeight(((Rect)(ref _window)).width, text) : 0f);
			_pickerH = (_editingColor ? S(224f) : 0f);
			int num = Mathf.Min(_rows.Count, Mathf.Max(1, MenuConfig.MaxVisibleRows));
			_rowsH = (float)num * RowHeight;
			_highlightYTarget = (float)_selected * RowHeight;
			EnsureSelectedVisible();
			((Rect)(ref _window)).height = _heroH + _titleH + _rowsH + _pickerH + _footerGapH + _footerH + _descriptionGapH + _descriptionH;
			EnsureInitialWindowPosition();
			ClampWindowToScreen();
			CacheLayoutState(text);
			if (!_animationsInited)
			{
				_highlightY = (float)_selected * RowHeight;
				_highlightYTarget = _highlightY;
				_animationsInited = true;
			}
		}

		private bool NeedsLayoutRecalculation(string selectedDescription)
		{
			if (Mathf.Approximately(_layoutScale, _scale) && Mathf.Approximately(_layoutMenuWidth, MenuConfig.MenuWidth) && _layoutRowsCount == _rows.Count && _layoutSelected == _selected && _layoutMaxVisibleRows == MenuConfig.MaxVisibleRows && _layoutEditingColor == _editingColor && _layoutShowFooter == MenuConfig.ShowFooter && _layoutShowDescription == MenuConfig.ShowDescription)
			{
				return !string.Equals(_layoutDescription, selectedDescription, StringComparison.Ordinal);
			}
			return true;
		}

		private void CacheLayoutState(string selectedDescription)
		{
			_layoutScale = _scale;
			_layoutMenuWidth = MenuConfig.MenuWidth;
			_layoutRowsCount = _rows.Count;
			_layoutSelected = _selected;
			_layoutMaxVisibleRows = MenuConfig.MaxVisibleRows;
			_layoutEditingColor = _editingColor;
			_layoutShowFooter = MenuConfig.ShowFooter;
			_layoutShowDescription = MenuConfig.ShowDescription;
			_layoutDescription = selectedDescription ?? string.Empty;
		}

		private void RenderFeatureOverlays()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Invalid comparison between Unknown and I4
			if ((int)Event.current.type != 7)
			{
				return;
			}
			int frameCount = Time.frameCount;
			if (_lastOverlayRenderFrame == frameCount)
			{
				return;
			}
			_lastOverlayRenderFrame = frameCount;
			int depth = GUI.depth;
			GUI.depth = 2000;
			try
			{
				_features?.Render();
			}
			finally
			{
				GUI.depth = depth;
			}
		}

		private static void RenderNotifications()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Invalid comparison between Unknown and I4
			if ((int)Event.current.type != 7)
			{
				return;
			}
			int frameCount = Time.frameCount;
			if (_lastNotificationRenderFrame == frameCount)
			{
				return;
			}
			_lastNotificationRenderFrame = frameCount;
			int depth = GUI.depth;
			GUI.depth = -2000;
			try
			{
				NotificationSystem.Render();
			}
			finally
			{
				GUI.depth = depth;
			}
		}

		private static void RenderDiscordPrompt()
		{
			int depth = GUI.depth;
			GUI.depth = -2100;
			try
			{
				DiscordCommunityPrompt.Render();
			}
			finally
			{
				GUI.depth = depth;
			}
		}

		private void RefreshRows(bool force = false)
		{
			int frameCount = Time.frameCount;
			if ((!force && (_editingNumber || _editingColor)) || (!force && _editingTextFeatureActive && !CanRefreshRowsWhileEditingText()) || (!force && !_rowsDirty && _lastRowsRefreshFrame == frameCount) || (!force && !_rowsDirty && Time.unscaledTime < _nextRowsRefreshAt))
			{
				return;
			}
			_rowsDirty = false;
			_lastRowsRefreshFrame = frameCount;
			_nextRowsRefreshAt = Time.unscaledTime + 0.12f;
			_rows.Clear();
			if (_features == null)
			{
				return;
			}
			if (_category == null)
			{
				foreach (string category in _features.Categories)
				{
					_rows.Add(category);
				}
			}
			else
			{
				foreach (Feature item in _features.InCategory(_category))
				{
					_rows.Add(item);
				}
				foreach (IMenuRowProvider rowProvider in _features.RowProviders)
				{
					foreach (object row in rowProvider.GetRows(_category))
					{
						if (row != null)
						{
							_rows.Add(row);
						}
					}
				}
			}
			_selected = Mathf.Clamp(_selected, 0, Mathf.Max(0, _rows.Count - 1));
			NormalizeSelected();
			_highlightYTarget = (float)_selected * RowHeight;
			EnsureSelectedVisible();
		}

		private void RefreshRowsNow()
		{
			_rowsDirty = true;
			RefreshRows(force: true);
			RecalculateMenuLayout();
		}

		private void EnsureSelectedVisible()
		{
			float rowHeight = RowHeight;
			float num = (float)Mathf.Max(1, MenuConfig.MaxVisibleRows) * rowHeight;
			float num2 = (float)_selected * rowHeight;
			float num3 = num2 + rowHeight;
			if (num2 < _scrollYTarget)
			{
				_scrollYTarget = num2;
			}
			if (num3 > _scrollYTarget + num)
			{
				_scrollYTarget = num3 - num;
			}
			float num4 = Mathf.Max(0f, (float)_rows.Count * rowHeight - num);
			_scrollYTarget = Mathf.Clamp(_scrollYTarget, 0f, num4);
		}

		private void DrawShadow()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			Theme.Fill(new Rect(((Rect)(ref _window)).x + S(4f), ((Rect)(ref _window)).y + S(8f), ((Rect)(ref _window)).width, ((Rect)(ref _window)).height), new Color(0f, 0f, 0f, 0.55f));
		}

		private void DrawHero(Rect rect)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			Theme.Fill(rect, Theme.Accent);
			Theme.DrawDiamond(((Rect)(ref rect)).center, S(56f));
		}

		private void DrawTitleBar(Rect rect, float h)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			Theme.Fill(rect, Theme.BarBg);
			Theme.Fill(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).yMax - Mathf.Max(1f, S(2f)), ((Rect)(ref rect)).width, Mathf.Max(1f, S(2f))), Theme.Accent);
			string text = ((!MenuConfig.ShowBreadcrumb) ? ((_category == null) ? "Main Menu" : GetCategoryTitle(_category)) : ((_category == null) ? "Home" : ("Home › " + FormatCategoryPath(_category))));
			string counterText = GetCounterText();
			GUI.Label(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width - S(92f), h), text, Theme.Breadcrumb);
			GUI.Label(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width, h), counterText, Theme.Counter);
		}

		private void DrawRows(Rect rect)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: 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_00b9: 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_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			Theme.Fill(rect, Theme.MenuBg);
			float rowHeight = RowHeight;
			GUI.BeginGroup(rect);
			int num = 0;
			int num2 = -1;
			if (_rows.Count > 0)
			{
				num = ((rowHeight > 0f) ? Mathf.Clamp(Mathf.FloorToInt(_scrollY / rowHeight), 0, _rows.Count - 1) : 0);
				num2 = ((rowHeight > 0f) ? Mathf.Clamp(Mathf.CeilToInt((_scrollY + ((Rect)(ref rect)).height) / rowHeight), 0, _rows.Count - 1) : (_rows.Count - 1));
			}
			for (int i = num; i <= num2; i++)
			{
				Theme.Fill(new Rect(0f, (float)i * rowHeight - _scrollY, ((Rect)(ref rect)).width, rowHeight), Theme.RowBg);
			}
			if (_rows.Count > 0)
			{
				Rect r = default(Rect);
				((Rect)(ref r))..ctor(0f, _highlightY - _scrollY, ((Rect)(ref rect)).width, rowHeight);
				if (IsSelectable(SelectedRow()))
				{
					Theme.Fill(r, Theme.SelectedBg);
				}
			}
			int num3 = ((rowHeight > 0f) ? Mathf.Clamp(Mathf.RoundToInt(_highlightY / rowHeight), 0, Mathf.Max(0, _rows.Count - 1)) : 0);
			Rect rowRect = default(Rect);
			for (int j = num; j <= num2; j++)
			{
				((Rect)(ref rowRect))..ctor(0f, (float)j * rowHeight - _scrollY, ((Rect)(ref rect)).width, rowHeight);
				DrawRowContent(rowRect, _rows[j], j, j == num3);
			}
			GUI.EndGroup();
			DrawRowsScrollbar(rect);
			HandleRowMouse(rect);
		}

		private void DrawRowContent(Rect rowRect, object row, int index, bool highlighted)
		{
			//IL_0013: 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_0009: Unknown result type (might be due to invalid IL or missing references)
			if (row is SeparatorFeature)
			{
				DrawSeparator(rowRect, highlighted);
				return;
			}
			DrawRowLabel(rowRect, row, highlighted);
			DrawRowRight(rowRect, row, index, highlighted);
		}

		private void DrawRowLabel(Rect rowRect, object row, bool highlighted)
		{
			//IL_0060: 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)
			string text = RowLabel(row);
			GUIStyle val = (highlighted ? Theme.RowSelected : Theme.Row);
			List<MenuTag> tags = GetTags(row);
			float rowRightReserve = GetRowRightReserve(row);
			Rect val2 = default(Rect);
			((Rect)(ref val2))..ctor(((Rect)(ref rowRect)).x, ((Rect)(ref rowRect)).y, Mathf.Max(1f, ((Rect)(ref rowRect)).width - rowRightReserve), ((Rect)(ref rowRect)).height);
			if (tags == null || tags.Count == 0)
			{
				GUI.Label(val2, text, val);
			}
			else
			{
				DrawLabelWithTags(val2, text, val, Mathf.Max(8, Mathf.RoundToInt(10f * _scale)), tags, highlighted, alignTagsRight: true);
			}
		}

		private float GetRowRightReserve(object row)
		{
			if (row is string || row is SubmenuFeature)
			{
				return S(48f);
			}
			if (row is ButtonFeature)
			{
				return S(96f);
			}
			if (row is InfoFeature)
			{
				return S(120f);
			}
			if (row is ColorFeature)
			{
				return S(118f);
			}
			if (row is TextFeature)
			{
				return S(132f);
			}
			if (row is NumberBoolFeature)
			{
				return S(142f);
			}
			if (row is NumberFeature)
			{
				return S(118f);
			}
			if (row is Feature)
			{
				return S(52f);
			}
			return 0f;
		}

		private static string RowLabel(object row)
		{
			if (row is string result)
			{
				return result;
			}
			if (row is Feature feature)
			{
				return feature.Name;
			}
			if (row == null)
			{
				return "?";
			}
			return row.ToString();
		}

		private static List<MenuTag> GetTags(object row)
		{
			if (!(row is IMenuTagProvider menuTagProvider))
			{
				return null;
			}
			return menuTagProvider.Tags;
		}

		private void DrawRowRight(Rect rowRect, object row, int index, bool highlighted)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			if (row is string || row is SubmenuFeature)
			{
				DrawChevron(rowRect, highlighted);
			}
			else if (row is InfoFeature infoFeature)
			{
				GUI.Label(rowRect, infoFeature.ValueText, highlighted ? Theme.RowRightSelected : Theme.RowRight);
			}
			else if (row is ButtonFeature buttonFeature)
			{
				GUI.Label(rowRect, buttonFeature.ButtonLabel.ToUpperInvariant(), highlighted ? Theme.RowRightSelected : Theme.RowRight);
			}
			else if (row is ColorFeature color)
			{
				DrawColorRight(rowRect, color, index, highlighted);
			}
			else if (row is TextFeature text)
			{
				DrawTextRight(rowRect, text, index, highlighted);
			}
			else if (row is NumberBoolFeature number)
			{
				DrawNumberBoolRight(rowRect, number, index, highlighted);
			}
			else if (row is NumberFeature number2)
			{
				DrawNumberRight(rowRect, number2, index, highlighted);
			}
			else if (row is Feature feature)
			{
				DrawToggleState(rowRect, feature.Enabled, highlighted);
			}
		}

		private void DrawChevron(Rect rowRect, bool highlighted)
		{
			//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_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			GUIStyle val = new GUIStyle(highlighted ? Theme.RowRightSelected : Theme.RowRight)
			{
				fontSize = Mathf.Max(1, Mathf.RoundToInt(20f * _scale)),
				fontStyle = (FontStyle)1
			};
			GUI.Label(rowRect, "›", val);
		}

		private void DrawNumberRight(Rect rowRect, NumberFeature number, int index, bool highlighted)
		{
			//IL_0014: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			if (IsEditing(number, index) && number.AllowTextInput)
			{
				DrawNumberTextInput(GetNumberValueRect(rowRect, reserveToggleSlot: false));
				return;
			}
			string displayValue = number.GetDisplayValue();
			string text = ((highlighted && number.AllowTextInput) ? ("‹  " + displayValue + "  ›") : displayValue);
			GUI.Label(rowRect, text, highlighted ? Theme.RowRightSelected : Theme.RowRight);
		}

		private void DrawNumberBoolRight(Rect rowRect, NumberBoolFeature number, int index, bool highlighted)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_008c: Expected O, but got Unknown
			//IL_008e: Expected O, but got Unknown
			//IL_008e: 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)
			Rect numberValueRect = GetNumberValueRect(rowRect, reserveToggleSlot: true);
			Rect numberBoolToggleRect = GetNumberBoolToggleRect(rowRect);
			if (IsEditing(number, index) && number.AllowTextInput)
			{
				DrawNumberTextInput(numberValueRect);
				DrawNumberBoolToggle(numberBoolToggleRect, number.Enabled, highlighted);
				return;
			}
			string displayValue = number.GetDisplayValue();
			string text = ((highlighted && number.AllowTextInput) ? ("‹  " + displayValue + "  ›") : displayValue);
			GUIStyle val = new GUIStyle(highlighted ? Theme.RowRightSelected : Theme.RowRight)
			{
				alignment = (TextAnchor)5,
				padding = new RectOffset(0, 0, 0, 0)
			};
			GUI.Label(numberValueRect, text, val);
			DrawNumberBoolToggle(numberBoolToggleRect, number.Enabled, highlighted);
		}

		private void DrawTextRight(Rect rowRect, TextFeature text, int index, bool highlighted)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//IL_0047: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			Rect numberValueRect = GetNumberValueRect(rowRect, reserveToggleSlot: false);
			if (IsEditing(text, index))
			{
				DrawTextInput(numberValueRect);
				return;
			}
			GUIStyle val = new GUIStyle(highlighted ? Theme.RowRightSelected : Theme.RowRight)
			{
				alignment = (TextAnchor)5,
				padding = new RectOffset(0, 0, 0, 0)
			};
			string displayValue = text.GetDisplayValue();
			GUI.Label(numberValueRect, highlighted ? ("‹  " + displayValue + "  ›") : displayValue, val);
		}

		private void DrawColorRight(Rect rowRect, ColorFeature color, int index, bool highlighted)
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			//IL_007b: Expected O, but got Unknown
			//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_008b: Unknown result type (might be due to invalid IL or missing references)
			float num = S(20f);
			float num2 = S(16f);
			Rect rect = default(Rect);
			((Rect)(ref rect))..ctor(((Rect)(ref rowRect)).xMax - num2 - num, ((Rect)(ref rowRect)).y + (((Rect)(ref rowRect)).height - num) * 0.5f, num, num);
			GUIStyle val = new GUIStyle(highlighted ? Theme.RowRightSelected : Theme.RowRight)
			{
				padding = new RectOffset(0, Mathf.RoundToInt(num2 + num + S(10f)), 0, 0)
			};
			GUI.Label(rowRect, color.GetDisplayValue(), val);
			DrawColorSwatch(rect, color.Value, highlighted, IsEditing(color, index));
		}

		private bool IsEditing(NumberFeature number, int index)
		{
			if (_editingNumber && _editingNumberFeature == number)
			{
				return _editingNumberIndex == index;
			}
			return false;
		}

		private bool IsEditing(TextFeature text, int index)
		{
			if (_editingTextFeatureActive && _editingTextFeature == text)
			{
				return _editingTextIndex == index;
			}
			return false;
		}

		private bool IsEditing(ColorFeature color, int index)
		{
			if (_editingColor && _editingColorFeature == color)
			{
				return _editingColorIndex == index;
			}
			return false;
		}

		private bool CanRefreshRowsWhileEditingText()
		{
			if (_editingTextFeatureActive && _editingTextFeature != null)
			{
				return _editingTextFeature.RefreshRowsWhileEditing;
			}
			return false;
		}

		private Rect GetNumberValueRect(Rect rowRect, bool reserveToggleSlot)
		{
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_003c: Unknown result type (might be due to invalid IL or missing references)
			if (reserveToggleSlot)
			{
				float num = S(72f);
				Rect numberBoolToggleRect = GetNumberBoolToggleRect(rowRect);
				return new Rect(((Rect)(ref numberBoolToggleRect)).x - S(2f) - num, ((Rect)(ref rowRect)).y, num, ((Rect)(ref rowRect)).height);
			}
			float num2 = ((Rect)(ref rowRect)).x + ((Rect)(ref rowRect)).width * 0.55f;
			float num3 = S(16f);
			float num4 = Mathf.Max(S(96f), ((Rect)(ref rowRect)).xMax - num3 - num2);
			return new Rect(num2, ((Rect)(ref rowRect)).y, num4, ((Rect)(ref rowRect)).height);
		}

		private Rect GetNumberBoolToggleRect(Rect rowRect)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			float num = S(16f);
			float toggleTextWidth = GetToggleTextWidth();
			return new Rect(((Rect)(ref rowRect)).xMax - num - toggleTextWidth, ((Rect)(ref rowRect)).y, toggleTextWidth, ((Rect)(ref rowRect)).height);
		}

		private void DrawNumberTextInput(Rect valueRect)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref valueRect)).x, ((Rect)(ref valueRect)).y + S(5f), ((Rect)(ref valueRect)).width, ((Rect)(ref valueRect)).height - S(10f));
			GUI.SetNextControlName("CubeX_NumberInput");
			_editingText = GUI.TextField(val, _editingText, Theme.NumberInput);
			if (_focusNumberInputNext)
			{
				GUI.FocusControl("CubeX_NumberInput");
				_focusNumberInputNext = false;
			}
		}

		private void DrawTextInput(Rect valueRect)
		{
			//IL_003b: 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_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Expected O, but got Unknown
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Expected O, but got Unknown
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Invalid comparison between Unknown and I4
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: 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_018d: Expected O, but got Unknown
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref valueRect)).x, ((Rect)(ref valueRect)).y + S(5f), ((Rect)(ref valueRect)).width, ((Rect)(ref valueRect)).height - S(10f));
			Theme.Fill(val, new Color(0f, 0f, 0f, 0.72f));
			DrawRectOutline(val, Theme.Accent, Mathf.Max(1f, S(1f)));
			GUIStyle val2 = new GUIStyle(Theme.NumberInput)
			{
				alignment = (TextAnchor)3,
				padding = new RectOffset(Mathf.RoundToInt(S(8f)), Mathf.RoundToInt(S(8f)), 0, 0),
				clipping = (TextClipping)1
			};
			val2.normal.textColor = Theme.Text;
			val2.focused.textColor = Theme.Text;
			val2.active.textColor = Theme.Text;
			val2.hover.textColor = Theme.Text;
			GUIStyle val3 = val2;
			if (string.IsNullOrEmpty(_editingText) && (int)Event.current.type == 7)
			{
				GUIStyle val4 = new GUIStyle(val3);
				val4.normal.textColor = new Color(Theme.TextDim.r, Theme.TextDim.g, Theme.TextDim.b, 0.78f);
				val4.focused.textColor = new Color(Theme.TextDim.r, Theme.TextDim.g, Theme.TextDim.b, 0.78f);
				GUIStyle val5 = val4;
				GUI.Label(val, _editingTextFeature?.EmptyDisplayText ?? "Text", val5);
			}
			GUI.SetNextControlName("CubeX_TextInput");
			string text = GUI.TextField(val, _editingText, Mathf.Max(1, _editingTextFeature?.MaxLength ?? 64), val3);
			if (text != _editingText)
			{
				_editingText = text;
				_editingTextFeature?.SetText(_editingText);
				if (CanRefreshRowsWhileEditingText())
				{
					_rowsDirty = true;
				}
			}
			if (_focusTextInputNext)
			{
				GUI.FocusControl("CubeX_TextInput");
				_focusTextInputNext = false;
			}
		}

		private void DrawToggleState(Rect rowRect, bool on, bool highlighted)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			GUIStyle val = CreateToggleStyle(highlighted);
			GUI.Label(rowRect, on ? "✓" : "X", val);
		}

		private void DrawNumberBoolToggle(Rect rowRect, bool on, bool highlighted)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			GUIStyle val = CreateToggleStyle(highlighted);
			val.alignment = (TextAnchor)5;
			val.padding = new RectOffset(0, 0, 0, 0);
			GUI.Label(rowRect, on ? "✓" : "X", val);
		}

		private void DrawColorSwatch(Rect rect, Color color, bool highlighted, bool active)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			Color c = ((!active) ? (highlighted ? Theme.SelectedFg : Theme.TextDim) : (highlighted ? Theme.SelectedFg : Theme.Text));
			Theme.Fill(rect, c);
			Theme.Fill(Inset(rect, Mathf.Max(1f, S(2f))), color);
		}

		private GUIStyle CreateToggleStyle(bool highlighted)
		{
			//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_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			return new GUIStyle(highlighted ? Theme.RowRightSelected : Theme.RowRight)
			{
				fontStyle = (FontStyle)1,
				fontSize = Mathf.Max(1, Mathf.RoundToInt(15f * _scale))
			};
		}

		private float GetToggleTextWidth()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			if (_toggleTextWidth > 0f && Mathf.Approximately(_toggleTextWidthScale, _scale))
			{
				return _toggleTextWidth;
			}
			GUIStyle obj = CreateToggleStyle(highlighted: false);
			obj.padding = new RectOffset(0, 0, 0, 0);
			float x = obj.CalcSize(new GUIContent("X")).x;
			float x2 = obj.CalcSize(new GUIContent("✓")).x;
			_toggleTextWidthScale = _scale;
			_toggleTextWidth = Mathf.Max(x, x2);
			return _toggleTextWidth;
		}

		private void HandleRowMouse(Rect rowsArea)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Invalid comparison between Unknown and I4
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Invalid comparison between Unknown and I4
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Invalid comparison between Unknown and I4
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Invalid comparison between Unknown and I4
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			if (!ShouldAcceptMenuMouseInput())
			{
				return;
			}
			Event current = Event.current;
			if (((int)current.type != 0 && (int)current.type != 7 && (int)current.type != 6) || !((Rect)(ref rowsArea)).Contains(current.mousePosition))
			{
				return;
			}
			if ((int)current.type == 6)
			{
				int num = Mathf.Min(_rows.Count, Mathf.Max(1, MenuConfig.MaxVisibleRows));
				if (_rows.Count > num)
				{
					int direction = ((current.delta.y > 0f) ? 1 : (-1));
					int steps = Mathf.Max(1, Mathf.RoundToInt(Mathf.Abs(current.delta.y) / 3f));
					MoveSelectionClamped(direction, steps);
					current.Use();
				}
				return;
			}
			float num2 = current.mousePosition.y - ((Rect)(ref rowsArea)).y + _scrollY;
			float rowHeight = RowHeight;
			int num3 = ((rowHeight > 0f) ? Mathf.FloorToInt(num2 / rowHeight) : 0);
			if (num3 < 0 || num3 >= _rows.Count || !IsSelectable(_rows[num3]))
			{
				return;
			}
			if ((int)current.type == 0)
			{
				if (_selected != num3)
				{
					SetSelected(num3);
					current.Use();
					return;
				}
				object obj = _rows[num3];
				NumberFeature numberFeature = obj as NumberFeature;
				TextFeature textFeature = obj as TextFeature;
				bool flag = current.mousePosition.x > ((Rect)(ref rowsArea)).x + ((Rect)(ref rowsArea)).width * 0.55f;
				if ((numberFeature?.AllowTextInput ?? false) && flag)
				{
					BeginNumberTextInput(numberFeature);
				}
				else if (textFeature != null && flag)
				{
					BeginTextInput(textFeature);
				}
				else
				{
					Activate(obj);
				}
				current.Use();
			}
			else if ((int)current.type == 7 && _selected != num3 && !_dragging && !_editingNumber && !_editingColor && !_editingTextFeatureActive)
			{
				SetSelected(num3);
			}
		}

		private void DrawRowsScrollbar(Rect rowsArea)
		{
			//IL_009e: 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_00d7: 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_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			if (MenuConfig.ShowScrollbar)
			{
				int num = Mathf.Min(_rows.Count, Mathf.Max(1, MenuConfig.MaxVisibleRows));
				if (_rows.Count > num && num > 0 && !(((Rect)(ref rowsArea)).height <= 0f))
				{
					float num2 = S(8f);
					float num3 = S(9f);
					float num4 = ((((Rect)(ref rowsArea)).x >= num2 + num3) ? (((Rect)(ref rowsArea)).x - num3 - num2) : (((Rect)(ref rowsArea)).xMax - num3 - num2));
					Rect r = default(Rect);
					((Rect)(ref r))..ctor(num4, ((Rect)(ref rowsArea)).y, num2, ((Rect)(ref rowsArea)).height);
					Theme.Fill(r, new Color(0.05f, 0.05f, 0.05f, 0.72f));
					float num5 = Mathf.Max(1f, S(1f));
					Theme.Fill(new Rect(((Rect)(ref r)).center.x - num5 * 0.5f, ((Rect)(ref r)).y, num5, ((Rect)(ref r)).height), new Color(0.18f, 0.18f, 0.18f, 0.9f));
					float num6 = (float)_rows.Count * RowHeight;
					float height = ((Rect)(ref rowsArea)).height;
					float num7 = Mathf.Max(num2 * 2f, height * (height / Mathf.Max(height, num6)));
					float num8 = Mathf.Max(1f, num6 - height);
					float num9 = Mathf.Clamp01(_scrollY / num8);
					float num10 = ((Rect)(ref r)).y + (((Rect)(ref r)).height - num7) * num9;
					float num11 = Mathf.Max(1f, S(1f));
					Theme.Fill(new Rect(((Rect)(ref r)).x + num11, num10, Mathf.Max(1f, ((Rect)(ref r)).width - num11 * 2f), num7), new Color(0.93f, 0.93f, 0.93f, 0.96f));
				}
			}
		}

		private void DrawGap(Rect rect)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			Theme.Fill(rect, Theme.MenuBg);
		}

		private void DrawSeparator(Rect rowRect, bool highlighted)
		{
			//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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			float num = S(16f);
			float num2 = ((Rect)(ref rowRect)).y + ((Rect)(ref rowRect)).height * 0.5f;
			float num3 = Mathf.Max(1f, S(1f));
			Theme.Fill(new Rect(((Rect)(ref rowRect)).x + num, num2 - num3, ((Rect)(ref rowRect)).width - num * 2f, num3), Theme.Separator);
			Theme.Fill(new Rect(((Rect)(ref rowRect)).x + num, num2, ((Rect)(ref rowRect)).width - num * 2f, num3), new Color(Theme.TextDim.r, Theme.TextDim.g, Theme.TextDim.b, 0.45f));
		}

		private void DrawDescription(Rect rect)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			Theme.Fill(rect, Theme.DescBg);
			Theme.Fill(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width, 1f), Theme.Separator);
			GUIStyle descriptionTextStyle = GetDescriptionTextStyle();
			Rect descriptionTextRect = GetDescriptionTextRect(rect);
			string text = WrapDescriptionText(DescriptionFor(SelectedRow()), descriptionTextStyle, ((Rect)(ref descriptionTextRect)).width);
			GUI.Label(descriptionTextRect, text, descriptionTextStyle);
		}

		private void DrawSidePanelIfNeeded()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: 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_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			if (!TryGetSidePanel(out var panel) || panel == null)
			{
				_selectedPlayerPreviewPanel.SetVisible(visible: false);
				return;
			}
			Rect sidePanelRect = GetSidePanelRect(panel);
			bool flag = IsPlayerPanel(panel);
			bool flag2 = IsItemPanel(panel);
			Theme.Fill(new Rect(((Rect)(ref sidePanelRect)).x + S(4f), ((Rect)(ref sidePanelRect)).y + S(8f), ((Rect)(ref sidePanelRect)).width, ((Rect)(ref sidePanelRect)).height), new Color(0f, 0f, 0f, 0.55f));
			Theme.Fill(sidePanelRect, flag ? new Color(0.015f, 0.018f, 0.016f, 0.9f) : new Color(0f, 0f, 0f, 0.82f));
			if (flag)
			{
				DrawPlayerPanelBackdrop(sidePanelRect);
			}
			Theme.Fill(new Rect(((Rect)(ref sidePanelRect)).x, ((Rect)(ref sidePanelRect)).y, ((Rect)(ref sidePanelRect)).width, Mathf.Max(1f, S(2f))), Theme.Accent);
			DrawRectOutline(sidePanelRect, new Color(Theme.TextDim.r, Theme.TextDim.g, Theme.TextDim.b, 0.48f), Mathf.Max(1f, S(1f)));
			float amount = S(14f);
			Rect val = Inset(sidePanelRect, amount);
			float num = (flag ? S(116f) : (flag2 ? S(92f) : S(72f)));
			Rect rect = default(Rect);
			((Rect)(ref rect))..ctor(((Rect)(ref val)).x, ((Rect)(ref val)).y, ((Rect)(ref val)).width, num);
			DrawSidePanelHeader(rect, panel);
			float num2 = ((Rect)(ref rect)).yMax + S(flag ? 8f : (flag2 ? 6f : 2f));
			Theme.Fill(new Rect(((Rect)(ref val)).x, num2, ((Rect)(ref val)).width, Mathf.Max(1f, S(1f))), Theme.Separator);
			Rect rect2 = default(Rect);
			((Rect)(ref rect2))..ctor(((Rect)(ref val)).x, num2 + S(10f), ((Rect)(ref val)).width, Mathf.Max(0f, ((Rect)(ref val)).yMax - num2 - S(10f)));
			DrawSidePanelRows(rect2, panel);
			if (flag)
			{
				DrawSelectedPlayerPreviewPanel(sidePanelRect);
			}
			else
			{
				_selectedPlayerPreviewPanel.SetVisible(visible: false);
			}
		}

		private void DrawSelectedPlayerPreviewPanel(Rect playerPanelRect)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: 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_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Invalid comparison between Unknown and I4
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			Rect selectedPlayerPreviewRect = GetSelectedPlayerPreviewRect(playerPanelRect);
			if (((Rect)(ref selectedPlayerPreviewRect)).width <= 0f || ((Rect)(ref selectedPlayerPreviewRect)).height <= 0f)
			{
				_selectedPlayerPreviewPanel.SetVisible(visible: false);
				return;
			}
			Theme.Fill(new Rect(((Rect)(ref selectedPlayerPreviewRect)).x + S(4f), ((Rect)(ref selectedPlayerPreviewRect)).y + S(8f), ((Rect)(ref selectedPlayerPreviewRect)).width, ((Rect)(ref selectedPlayerPreviewRect)).height), new Color(0f, 0f, 0f, 0.5f));
			Theme.Fill(selectedPlayerPreviewRect, new Color(0.01f, 0.011f, 0.013f, 0.95f));
			Theme.Fill(new Rect(((Rect)(ref selectedPlayerPreviewRect)).x, ((Rect)(ref selectedPlayerPreviewRect)).y, ((Rect)(ref selectedPlayerPreviewRect)).width, Mathf.Max(1f, S(2f))), Theme.Accent);
			DrawRectOutline(selectedPlayerPreviewRect, new Color(Theme.TextDim.r, Theme.TextDim.g, Theme.TextDim.b, 0.46f), Mathf.Max(1f, S(1f)));
			Rect val = Inset(selectedPlayerPreviewRect, S(8f));
			Theme.Fill(val, new Color(0.018f, 0.019f, 0.022f, 1f));
			if ((int)Event.current.type == 7)
			{
				Texture texture = _selectedPlayerPreviewPanel.GetTexture();
				if (Object.op_Implicit((Object)(object)texture))
				{
					GUI.DrawTexture(val, texture, (ScaleMode)1, false);
				}
			}
			DrawPortraitCorners(Inset(selectedPlayerPreviewRect, S(4f)));
		}

		private Rect GetSelectedPlayerPreviewRect(Rect playerPanelRect)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: 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_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			if (!PlayerDirectory.TryGetSelectedCharacter(out var character) || !Object.op_Implicit((Object)(object)character))
			{
				return Rect.zero;
			}
			float num = S(10f);
			float minWidth = S(190f);
			float num2 = Mathf.Clamp(S(300f), S(220f), Mathf.Max(S(220f), (float)Screen.width * 0.22f));
			float height = ((Rect)(ref playerPanelRect)).height;
			float num3 = Mathf.Max(0f, (float)Screen.width - ((Rect)(ref playerPanelRect)).xMax - num);
			float num4 = Mathf.Max(0f, ((Rect)(ref playerPanelRect)).x - num);
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref playerPanelRect)).xMax + num, ((Rect)(ref playerPanelRect)).y, Mathf.Min(num2, num3), height);
			Rect val2 = default(Rect);
			((Rect)(ref val2))..ctor(((Rect)(ref playerPanelRect)).x - num - Mathf.Min(num2, num4), ((Rect)(ref playerPanelRect)).y, Mathf.Min(num2, num4), height);
			if (((Rect)(ref playerPanelRect)).center.x >= ((Rect)(ref _window)).center.x)
			{
				if (CanUsePlayerPreviewRect(val, minWidth))
				{
					return val;
				}
				if (CanUsePlayerPreviewRect(val2, minWidth))
				{
					return val2;
				}
			}
			else
			{
				if (CanUsePlayerPreviewRect(val2, minWidth))
				{
					return val2;
				}
				if (CanUsePlayerPreviewRect(val, minWidth))
				{
					return val;
				}
			}
			return Rect.zero;
		}

		private bool CanUsePlayerPreviewRect(Rect rect, float minWidth)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			if (((Rect)(ref rect)).width >= minWidth && ((Rect)(ref rect)).height > 0f)
			{
				return !((Rect)(ref rect)).Overlaps(_window);
			}
			return false;
		}

		private void DrawSidePanelHeader(Rect rect, MenuSidePanel panel)
		{
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_0331: Expected O, but got Unknown
			//IL_0331: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0346: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Unknown result type (might be due to invalid IL or missing references)
			//IL_036c: Expected O, but got Unknown
			//IL_0371: Unknown result type (might be due to invalid IL or missing references)
			//IL_0376: Unknown result type (might be due to invalid IL or missing references)
			//IL_037b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0385: Expected O, but got Unknown
			//IL_0385: Unknown result type (might be due to invalid IL or missing references)
			//IL_038c: 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: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c0: Expected O, but got Unknown
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_043f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0483: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
			bool flag = IsPlayerPanel(panel);
			bool flag2 = IsItemPanel(panel);
			float num = (flag ? S(78f) : (flag2 ? S(72f) : S(54f)));
			float num2 = (flag ? S(16f) : (flag2 ? S(14f) : S(12f)));
			float num3 = ((Rect)(ref rect)).x;
			float num4 = ((Rect)(ref rect)).width;
			if (flag)
			{
				Theme.Fill(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width, ((Rect)(ref rect)).height), new Color(0f, 0f, 0f, 0.28f));
				DrawRectOutline(rect, new Color(Theme.Accent.r, Theme.Accent.g, Theme.Accent.b, 0.32f), Mathf.Max(1f, S(1f)));
				Theme.Fill(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, Mathf.Max(2f, S(3f)), ((Rect)(ref rect)).height), Theme.Accent);
				Theme.Fill(new Rect(((Rect)(ref rect)).x + S(10f), ((Rect)(ref rect)).yMax - S(10f), Mathf.Min(((Rect)(ref rect)).width * 0.42f, S(150f)), Mathf.Max(1f, S(1f))), Theme.Accent);
			}
			if ((Object)(object)panel.PreviewTexture != (Object)null)
			{
				Rect val = default(Rect);
				((Rect)(ref val))..ctor(((Rect)(ref rect)).x + (flag ? S(14f) : 0f), ((Rect)(ref rect)).y + (flag ? S(18f) : (flag2 ? S(8f) : S(2f))), num, num);
				Rect r = Inset(val, 0f - S(4f));
				Rect val2 = Inset(val, Mathf.Max(1f, flag ? S(3f) : S(2f)));
				if (flag || flag2)
				{
					Theme.Fill(r, new Color(Theme.Accent.r, Theme.Accent.g, Theme.Accent.b, 0.18f));
				}
				Theme.Fill(val, (Color)((flag || flag2) ? Theme.Accent : new Color(Theme.TextDim.r, Theme.TextDim.g, Theme.TextDim.b, 0.45f)));
				Theme.Fill(val2, new Color(0f, 0f, 0f, 0.28f));
				GUI.DrawTexture(val2, panel.PreviewTexture, (ScaleMode)((!flag2) ? 1 : 2), true);
				if (flag)
				{
					DrawPortraitCorners(val);
				}
				num3 = ((Rect)(ref val)).xMax + num2;
				num4 = Mathf.Max(1f, ((Rect)(ref rect)).xMax - num3);
			}
			GUIStyle baseStyle = new GUIStyle(Theme.DescTitle)
			{
				padding = new RectOffset(0, 0, 0, 0),
				alignment = (TextAnchor)0,
				wordWrap = false,
				clipping = (TextClipping)1,
				fontStyle = (FontStyle)1,
				fontSize = Mathf.Max(1, Mathf.RoundToInt(18f * _scale))
			};
			GUIStyle baseStyle2 = new GUIStyle(Theme.DescBody)
			{
				padding = new RectOffset(0, 0, 0, 0),
				alignment = (TextAnchor)0,
				wordWrap = false,
				clipping = (TextClipping)1,
				fontStyle = (FontStyle)1,
				fontSize = Mathf.Max(1, Mathf.RoundToInt(12f * _scale))
			};
			string text = (string.IsNullOrEmpty(panel.Title) ? "PLAYER INFORMATION" : panel.Title);
			string text2 = (string.IsNullOrEmpty(panel.Subtitle) ? string.Empty : panel.Subtitle);
			float num5 = ((Rect)(ref rect)).y + (flag ? S(20f) : (flag2 ? S(10f) : S(3f)));
			DrawFittingLabel(new Rect(num3, num5, num4, S(26f)), text, baseStyle, Mathf.Max(10, Mathf.RoundToInt(13f * _scale)));
			DrawLabelWithTags(new Rect(num3, num5 + S(32f), num4, S(20f)), text2, baseStyle2, Mathf.Max(8, Mathf.RoundToInt(10f * _scale)), panel.Tags, highlighted: false);
			Theme.Fill(new Rect(num3, num5 + S(58f), Mathf.Min(num4, S(190f)), Mathf.Max(1f, S(1f))), Theme.Accent);
		}

		private void DrawSidePanelRows(Rect rect, MenuSidePanel panel)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be