Decompiled source of CondensedPlayerList v0.1.0

CondensedPlayerList.dll

Decompiled 2 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[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("CondensedPlayerList")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0+15d106fd274393994222b46c0e6cbc69683fbbf6")]
[assembly: AssemblyProduct("CondensedPlayerList")]
[assembly: AssemblyTitle("CondensedPlayerList")]
[assembly: AssemblyVersion("0.1.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[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 CondensedPlayerList
{
	public static class CondensedLayout
	{
		public const float VanillaLobbySpacing = 32f;

		public const float VanillaEscSpacing = 22f;

		public const float LobbySpacing = 22f;

		public const float EscSpacing = 15f;

		public const float LobbyX = 0f;

		public const float EscX = -23f;

		public static (float X, float Y) CondensedPosition(int listSpot, bool isLobby)
		{
			float item = (isLobby ? 0f : (-23f));
			float num = (isLobby ? 22f : 15f);
			return (item, (float)(-listSpot) * num);
		}
	}
	[BepInPlugin("darkharasho.CondensedPlayerList", "CondensedPlayerList", "0.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Log;

		private void Awake()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			new Harmony("darkharasho.CondensedPlayerList").PatchAll();
			Log.LogInfo((object)"CondensedPlayerList v0.1.0 loaded.");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "darkharasho.CondensedPlayerList";

		public const string PLUGIN_NAME = "CondensedPlayerList";

		public const string PLUGIN_VERSION = "0.1.0";
	}
}
namespace CondensedPlayerList.Patches
{
	[HarmonyPatch(typeof(MenuPlayerListed), "Update")]
	internal static class MenuPlayerListed_Update_Postfix
	{
		private static readonly FieldRef<MenuPlayerListed, int> ListSpotRef = AccessTools.FieldRefAccess<MenuPlayerListed, int>("listSpot");

		private static bool _errorLogged;

		private static void Postfix(MenuPlayerListed __instance)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (!__instance.forceCrown)
				{
					int listSpot = ListSpotRef.Invoke(__instance);
					bool isLobby = SemiFunc.RunIsLobbyMenu();
					var (num, num2) = CondensedLayout.CondensedPosition(listSpot, isLobby);
					((Component)__instance).transform.localPosition = new Vector3(num, num2, 0f);
				}
			}
			catch (Exception arg)
			{
				if (!_errorLogged)
				{
					Plugin.Log.LogError((object)$"MenuPlayerListed Update postfix failed: {arg}");
					_errorLogged = true;
				}
			}
		}
	}
}