Decompiled source of LobbyListFix v0.0.2

LobbyListFix.dll

Decompiled 7 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using LobbyListFix.Patches;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("0.0.0.0")]
namespace LobbyListFix
{
	[BepInPlugin("io.github.echoman-dev.LCLobbyListFix", "Lethal Company Lobby List Fix", "0.0.2")]
	[BepInProcess("Lethal Company.exe")]
	[BepInIncompatibility("Ryokune.CompatibilityChecker")]
	[BepInIncompatibility("Ryokune.BetterLobbies")]
	public class Plugin : BaseUnityPlugin
	{
		private const string modGUID = "io.github.echoman-dev.LCLobbyListFix";

		private const string modName = "Lethal Company Lobby List Fix";

		private const string modVersion = "0.0.2";

		private readonly Harmony harmony = new Harmony("io.github.echoman-dev.LCLobbyListFix");

		private static Plugin Instance;

		internal ManualLogSource logSource;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			logSource = Logger.CreateLogSource("io.github.echoman-dev.LCLobbyListFix");
			logSource.LogInfo((object)"Lobby List Fix Mod loaded.");
			harmony.PatchAll(typeof(Plugin));
			harmony.PatchAll(typeof(SteamLobbyManagerPatch));
		}
	}
}
namespace LobbyListFix.Patches
{
	[HarmonyPatch(typeof(SteamLobbyManager))]
	internal class SteamLobbyManagerPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		private static void lobbyListPatch(ref Transform ___levelListContainer)
		{
			((Component)___levelListContainer.GetChild(0)).gameObject.SetActive(false);
			ContentSizeFitter val = ((Component)___levelListContainer).gameObject.AddComponent<ContentSizeFitter>();
			val.verticalFit = (FitMode)2;
			val.horizontalFit = (FitMode)0;
			VerticalLayoutGroup val2 = ((Component)___levelListContainer).gameObject.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val2).spacing = 6f;
			((LayoutGroup)val2).childAlignment = (TextAnchor)0;
			((HorizontalOrVerticalLayoutGroup)val2).reverseArrangement = false;
			((HorizontalOrVerticalLayoutGroup)val2).childControlHeight = false;
			((HorizontalOrVerticalLayoutGroup)val2).childForceExpandHeight = true;
			((HorizontalOrVerticalLayoutGroup)val2).childForceExpandWidth = true;
		}
	}
}