Decompiled source of BetterJoiner v1.2.0

BetterJoiner.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BetterJoiner.Core;
using BetterJoiner.Core.Config;
using BetterJoiner.Core.Features;
using HarmonyLib;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using ReluProtocol;
using Steamworks;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Loader), "BetterJoiner", "1.2.0", "notfishvr", null)]
[assembly: MelonGame("ReLUGames", "MIMESIS")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("BetterJoiner")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+d3887375b38d0d761c1d07d76f93f3a345dfe71a")]
[assembly: AssemblyProduct("BetterJoiner")]
[assembly: AssemblyTitle("BetterJoiner")]
[assembly: AssemblyVersion("1.0.0.0")]
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;
		}
	}
}
namespace BetterJoiner.Core
{
	public class Loader : MelonMod
	{
		private GameObject gui;

		private MainGUI mainGUI;

		public override void OnInitializeMelon()
		{
		}

		public override void OnSceneWasLoaded(int buildIndex, string sceneName)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			if ((Object)(object)gui == (Object)null)
			{
				gui = new GameObject("MainGUI");
				Object.DontDestroyOnLoad((Object)(object)gui);
				mainGUI = gui.AddComponent<MainGUI>();
			}
		}
	}
	public class MainGUI : MonoBehaviour
	{
		private ConfigManager configManager;

		private void Start()
		{
			configManager = new ConfigManager();
			Patches.ApplyPatches(configManager);
		}
	}
	public static class Patches
	{
		public static bool Enabled = true;

		public static ConfigManager Config;

		public static void ApplyPatches(ConfigManager config)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			try
			{
				Config = config;
				Enabled = Config.GetValue("Enabled", defaultValue: true);
				Harmony val = new Harmony("com.Mimesis.BetterJoiner");
				val.PatchAll(typeof(Patches).Assembly);
				MelonLogger.Msg("Harmony patches applied successfully");
				Config.SetValue("Enabled", Enabled);
			}
			catch (Exception ex)
			{
				MelonLogger.Error("Error applying patches: " + ex.Message);
			}
		}
	}
	[HarmonyPatch(typeof(SteamMatchmaking), "JoinLobby")]
	internal static class LobbyJoinLoggingPatch
	{
		private static void Prefix(CSteamID steamIDLobby)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			MelonLogger.Msg($"[PATCH] Attempting to join lobby: {steamIDLobby.m_SteamID}");
		}
	}
	[HarmonyPatch(typeof(SteamMatchmaking), "GetNumLobbyMembers")]
	internal static class GetLobbyMemberCountPatch
	{
		private static void Postfix(CSteamID steamIDLobby, ref int __result)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			MelonLogger.Msg($"[PATCH] Room member count for {steamIDLobby.m_SteamID}: {__result}");
		}
	}
	[HarmonyPatch(typeof(SteamMatchmaking), "GetLobbyData")]
	internal static class GetLobbyDataPatch
	{
		private static void Postfix(CSteamID steamIDLobby, string pchKey, ref string __result)
		{
			if (!string.IsNullOrEmpty(__result))
			{
				MelonLogger.Msg("[PATCH] Lobby data - Key: " + pchKey + ", Value: " + __result);
			}
		}
	}
	[HarmonyPatch(typeof(SteamMatchmaking), "CreateLobby")]
	internal static class CreateLobbyPatch
	{
		private static void Prefix(ELobbyType eLobbyType, int cMaxMembers)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			MelonLogger.Msg($"[PATCH] Creating lobby - Type: {eLobbyType}, Max Members: {cMaxMembers}");
		}
	}
	[HarmonyPatch(typeof(UIPrefab_LoadTram), "InitSaveInfoList")]
	internal static class LoadTramEnhancedUIPatch
	{
		private static void Postfix(UIPrefab_LoadTram __instance)
		{
			if (!Patches.Enabled)
			{
				return;
			}
			try
			{
				GameManager component = ((Component)__instance).gameObject.GetComponent<GameManager>();
				if ((Object)(object)component == (Object)null)
				{
					component = ((Component)__instance).gameObject.AddComponent<GameManager>();
					component.Config = Patches.Config;
					component.InitializeLoadUI(__instance);
				}
				else
				{
					component.RefreshUI();
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("Error enhancing load tram UI: " + ex.Message);
			}
		}
	}
	[HarmonyPatch(typeof(UIPrefab_NewTram), "InitSaveInfoList")]
	internal static class NewTramEnhancedUIPatch
	{
		private static void Postfix(UIPrefab_NewTram __instance)
		{
			if (!Patches.Enabled)
			{
				return;
			}
			try
			{
				GameManager component = ((Component)__instance).gameObject.GetComponent<GameManager>();
				if ((Object)(object)component == (Object)null)
				{
					component = ((Component)__instance).gameObject.AddComponent<GameManager>();
					component.Config = Patches.Config;
					component.InitializeNewTramUI(__instance);
				}
				else
				{
					component.RefreshUI();
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("Error enhancing new tram UI: " + ex.Message);
			}
		}
	}
	[HarmonyPatch(typeof(UIPrefab_NewTramPopUp), "OnShow")]
	internal static class SaveConfirmationUIEnhancePatch
	{
		private static void Postfix(UIPrefab_NewTramPopUp __instance)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			if (!Patches.Enabled)
			{
				return;
			}
			try
			{
				Image component = ((Component)__instance).GetComponent<Image>();
				if ((Object)(object)component != (Object)null)
				{
					((Graphic)component).color = new Color(0.1f, 0.1f, 0.15f, 0.95f);
				}
				Button[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<Button>();
				Button[] array = componentsInChildren;
				foreach (Button val in array)
				{
					if (((Object)val).name == "OK")
					{
						ColorBlock colors = ((Selectable)val).colors;
						((ColorBlock)(ref colors)).normalColor = new Color(0.2f, 0.4f, 0.2f, 0.9f);
						((ColorBlock)(ref colors)).highlightedColor = new Color(0.3f, 0.6f, 0.3f, 1f);
						((Selectable)val).colors = colors;
					}
					else if (((Object)val).name == "Cancel")
					{
						ColorBlock colors2 = ((Selectable)val).colors;
						((ColorBlock)(ref colors2)).normalColor = new Color(0.4f, 0.2f, 0.2f, 0.9f);
						((ColorBlock)(ref colors2)).highlightedColor = new Color(0.6f, 0.3f, 0.3f, 1f);
						((Selectable)val).colors = colors2;
					}
				}
				MelonLogger.Msg("[PATCH] Enhanced confirmation popup UI applied");
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("Could not enhance confirmation popup: " + ex.Message);
			}
		}
	}
	[HarmonyPatch(typeof(UIPrefab_MainMenu), "Start")]
	internal static class MainMenuUIEnhancePatch
	{
		private static void Postfix(UIPrefab_MainMenu __instance)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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)
			if (!Patches.Enabled)
			{
				return;
			}
			try
			{
				Button uE_HostButton = __instance.UE_HostButton;
				Button uE_LoadButton = __instance.UE_LoadButton;
				Button uE_JoinButton = __instance.UE_JoinButton;
				if ((Object)(object)uE_HostButton != (Object)null)
				{
					ApplyButtonStyle(uE_HostButton, new Color(0.2f, 0.35f, 0.5f, 0.9f), new Color(0.3f, 0.5f, 0.7f, 1f));
				}
				if ((Object)(object)uE_LoadButton != (Object)null)
				{
					ApplyButtonStyle(uE_LoadButton, new Color(0.35f, 0.2f, 0.5f, 0.9f), new Color(0.5f, 0.3f, 0.7f, 1f));
				}
				if ((Object)(object)uE_JoinButton != (Object)null)
				{
					ApplyButtonStyle(uE_JoinButton, new Color(0.5f, 0.35f, 0.2f, 0.9f), new Color(0.7f, 0.5f, 0.3f, 1f));
				}
				MelonLogger.Msg("[PATCH] Enhanced main menu UI applied");
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("Could not enhance main menu: " + ex.Message);
			}
		}

		private static void ApplyButtonStyle(Button button, Color normalColor, Color highlightColor)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: 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_0019: 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_0031: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				ColorBlock colors = ((Selectable)button).colors;
				((ColorBlock)(ref colors)).normalColor = normalColor;
				((ColorBlock)(ref colors)).highlightedColor = highlightColor;
				((ColorBlock)(ref colors)).pressedColor = new Color(highlightColor.r * 0.7f, highlightColor.g * 0.7f, highlightColor.b * 0.7f, 1f);
				((Selectable)button).colors = colors;
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("Error applying button style: " + ex.Message);
			}
		}
	}
	[HarmonyPatch(typeof(MainMenu), "Start")]
	internal static class MainMenuStartPatch
	{
		private static GameManager currentManager;

		private static void Postfix(MainMenu __instance)
		{
			if (!Patches.Enabled)
			{
				return;
			}
			try
			{
				PropertyInfo property = typeof(MainMenu).GetProperty("uiman", BindingFlags.Instance | BindingFlags.NonPublic);
				if (property == null)
				{
					return;
				}
				UIManager uiman = default(UIManager);
				ref UIManager reference = ref uiman;
				object? value = property.GetValue(__instance);
				reference = (UIManager)((value is UIManager) ? value : null);
				if ((Object)(object)uiman == (Object)null)
				{
					return;
				}
				FieldInfo field = typeof(MainMenu).GetField("ui_mainmenu", BindingFlags.Instance | BindingFlags.NonPublic);
				FieldInfo field2 = typeof(MainMenu).GetField("uiprefab_loadtram", BindingFlags.Instance | BindingFlags.NonPublic);
				FieldInfo field3 = typeof(MainMenu).GetField("uiprefab_newtram", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field == null || field2 == null || field3 == null)
				{
					return;
				}
				object? value2 = field.GetValue(__instance);
				UIPrefab_MainMenu val = (UIPrefab_MainMenu)((value2 is UIPrefab_MainMenu) ? value2 : null);
				object? value3 = field2.GetValue(__instance);
				GameObject val2 = (GameObject)((value3 is GameObject) ? value3 : null);
				object? value4 = field3.GetValue(__instance);
				GameObject val3 = (GameObject)((value4 is GameObject) ? value4 : null);
				if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null || (Object)(object)val3 == (Object)null)
				{
					return;
				}
				UIPrefab_LoadTram loadtram = uiman.InstatiateUIPrefab<UIPrefab_LoadTram>(val2, (eUIHeight)1);
				UIPrefab_NewTram newtram = uiman.InstatiateUIPrefab<UIPrefab_NewTram>(val3, (eUIHeight)1);
				((UIPrefabScript)loadtram).Hide();
				((UIPrefabScript)newtram).Hide();
				val.OnLoadButton = delegate
				{
					try
					{
						EventSystem current2 = EventSystem.current;
						if ((Object)(object)current2 != (Object)null)
						{
							current2.SetSelectedGameObject((GameObject)null);
						}
						GameManager gameManager2 = ((Component)loadtram).gameObject.GetComponent<GameManager>();
						if ((Object)(object)gameManager2 == (Object)null)
						{
							gameManager2 = ((Component)loadtram).gameObject.AddComponent<GameManager>();
							gameManager2.Config = Patches.Config;
							gameManager2.InitializeLoadUI(loadtram);
						}
						else
						{
							gameManager2.RefreshUI();
						}
						currentManager = gameManager2;
						if ((Object)(object)loadtram.UE_rootNode != (Object)null)
						{
							((Component)loadtram.UE_rootNode).gameObject.SetActive(false);
						}
						uiman.ui_escapeStack.Add((UIPrefabScript)(object)loadtram);
						((UIPrefabScript)loadtram).Show();
						MelonLogger.Msg("[PATCH] Infinite Save UI opened for loading");
					}
					catch (Exception ex3)
					{
						MelonLogger.Error("Error opening load UI: " + ex3.Message);
					}
				};
				val.OnHostButton = delegate
				{
					try
					{
						EventSystem current = EventSystem.current;
						if ((Object)(object)current != (Object)null)
						{
							current.SetSelectedGameObject((GameObject)null);
						}
						GameManager gameManager = ((Component)newtram).gameObject.GetComponent<GameManager>();
						if ((Object)(object)gameManager == (Object)null)
						{
							gameManager = ((Component)newtram).gameObject.AddComponent<GameManager>();
							gameManager.Config = Patches.Config;
							gameManager.InitializeNewTramUI(newtram);
						}
						else
						{
							gameManager.RefreshUI();
						}
						currentManager = gameManager;
						if ((Object)(object)newtram.UE_rootNode != (Object)null)
						{
							((Component)newtram.UE_rootNode).gameObject.SetActive(false);
						}
						uiman.ui_escapeStack.Add((UIPrefabScript)(object)newtram);
						((UIPrefabScript)newtram).Show();
						MelonLogger.Msg("[PATCH] Infinite Save UI opened for new game");
					}
					catch (Exception ex2)
					{
						MelonLogger.Error("Error opening new game UI: " + ex2.Message);
					}
				};
				MelonLogger.Msg("[PATCH] MainMenu Start patched successfully");
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("Could not patch MainMenu Start: " + ex.Message);
			}
		}
	}
}
namespace BetterJoiner.Core.Features
{
	public class GameManager : MonoBehaviour
	{
		public class SaveSlotData
		{
			public int SlotId { get; set; }

			public string FileName { get; set; }

			public MMSaveGameData SaveData { get; set; }

			public DateTime LastModified { get; set; }
		}

		private int currentPage;

		private int itemsPerPage = 4;

		private List<SaveSlotData> allSaves = new List<SaveSlotData>();

		private List<RoomInfo> roomList = new List<RoomInfo>();

		private UIPrefab_LoadTram loadTramUI;

		private UIPrefab_NewTram newTramUI;

		private bool isSaveMode;

		private MainMenu mainMenuInstance;

		private GameObject mainPanel;

		private Transform savesContentTransform;

		private Transform roomsContentTransform;

		private TextMeshProUGUI pageText;

		private TextMeshProUGUI statusText;

		private TextMeshProUGUI titleText;

		private List<GameObject> displayCards = new List<GameObject>();

		private float lastRefreshTime;

		private CallResult<LobbyMatchList_t> lobbySearchResult;

		private bool isSearching;

		private Dictionary<string, RoomInfo> cachedRooms = new Dictionary<string, RoomInfo>();

		private int nextAvailableSlot;

		private int currentTab;

		private GameObject savesContainer;

		private GameObject roomsContainer;

		private List<Button> tabButtons = new List<Button>();

		private ScrollRect savesScrollRect;

		private ScrollRect roomsScrollRect;

		private int searchAttempts;

		private const int MAX_SEARCH_ATTEMPTS = 100;

		public ConfigManager Config { get; set; }

		public float RefreshInterval { get; set; } = 5f;


		public void Initialize()
		{
			InitializeSteamCallbacks();
			MelonLogger.Msg("[GameManager] Initialized");
		}

		private void InitializeSteamCallbacks()
		{
			try
			{
				if (SteamManager.Initialized)
				{
					if (lobbySearchResult == null)
					{
						lobbySearchResult = CallResult<LobbyMatchList_t>.Create((APIDispatchDelegate<LobbyMatchList_t>)OnLobbySearchComplete);
						MelonLogger.Msg("[GameManager] Steam callbacks initialized");
					}
					else
					{
						MelonLogger.Msg("[GameManager] Steam callbacks already initialized");
					}
				}
				else
				{
					MelonLogger.Error("[GameManager] Steam not initialized!");
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("[GameManager] Failed to initialize Steam callbacks: " + ex.Message);
			}
		}

		public void InitializeLoadUI(UIPrefab_LoadTram ui)
		{
			Initialize();
			loadTramUI = ui;
			isSaveMode = true;
			mainMenuInstance = Object.FindObjectOfType<MainMenu>();
			currentPage = 0;
			LoadAllSaves();
			if ((Object)(object)mainPanel == (Object)null)
			{
				CreateUI();
				MelonLogger.Msg("[GameManager] InitializeLoadUI - UI Created");
			}
			else
			{
				mainPanel.SetActive(true);
				currentPage = 0;
				currentTab = 0;
				SwitchTab(0);
				MelonLogger.Msg("[GameManager] InitializeLoadUI - UI Shown");
			}
			MelonLogger.Msg($"[GameManager] InitializeLoadUI - Found {allSaves.Count} saves");
		}

		public void InitializeNewTramUI(UIPrefab_NewTram ui)
		{
			Initialize();
			newTramUI = ui;
			isSaveMode = false;
			mainMenuInstance = Object.FindObjectOfType<MainMenu>();
			currentPage = 0;
			LoadAllSaves();
			if ((Object)(object)mainPanel == (Object)null)
			{
				CreateUI();
				MelonLogger.Msg("[GameManager] InitializeNewTramUI - UI Created");
			}
			else
			{
				mainPanel.SetActive(true);
				currentPage = 0;
				currentTab = 0;
				SwitchTab(0);
				MelonLogger.Msg("[GameManager] InitializeNewTramUI - UI Shown");
			}
			MelonLogger.Msg($"[GameManager] InitializeNewTramUI - Found {allSaves.Count} saves");
		}

		private void CreateUI()
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			//IL_00af: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Expected O, but got Unknown
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Expected O, but got Unknown
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0336: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_037a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0389: Unknown result type (might be due to invalid IL or missing references)
			//IL_0390: Expected O, but got Unknown
			//IL_03b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0411: Unknown result type (might be due to invalid IL or missing references)
			//IL_0440: Unknown result type (might be due to invalid IL or missing references)
			//IL_0445: Unknown result type (might be due to invalid IL or missing references)
			//IL_0475: Unknown result type (might be due to invalid IL or missing references)
			//IL_047f: Expected O, but got Unknown
			//IL_04b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b7: Expected O, but got Unknown
			//IL_04e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_050c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0522: Unknown result type (might be due to invalid IL or missing references)
			//IL_0538: Unknown result type (might be due to invalid IL or missing references)
			//IL_0567: Unknown result type (might be due to invalid IL or missing references)
			//IL_056c: Unknown result type (might be due to invalid IL or missing references)
			//IL_057b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0582: Expected O, but got Unknown
			//IL_05a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_062c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0631: Unknown result type (might be due to invalid IL or missing references)
			//IL_064c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0653: Expected O, but got Unknown
			//IL_067c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0692: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06be: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0715: Unknown result type (might be due to invalid IL or missing references)
			//IL_071f: Expected O, but got Unknown
			//IL_0746: Unknown result type (might be due to invalid IL or missing references)
			//IL_0752: Unknown result type (might be due to invalid IL or missing references)
			//IL_075e: Unknown result type (might be due to invalid IL or missing references)
			//IL_076a: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c9: Expected O, but got Unknown
			//IL_07ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0804: Unknown result type (might be due to invalid IL or missing references)
			//IL_0810: Unknown result type (might be due to invalid IL or missing references)
			//IL_083f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0844: Unknown result type (might be due to invalid IL or missing references)
			//IL_0864: Unknown result type (might be due to invalid IL or missing references)
			//IL_086b: Expected O, but got Unknown
			//IL_08a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_08cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0918: Unknown result type (might be due to invalid IL or missing references)
			//IL_0922: Expected O, but got Unknown
			//IL_0997: Unknown result type (might be due to invalid IL or missing references)
			//IL_09a1: Expected O, but got Unknown
			//IL_09c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_09d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_09f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a48: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a4d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a5c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a63: Expected O, but got Unknown
			//IL_0a86: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a92: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a9e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aaa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ad9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ade: Unknown result type (might be due to invalid IL or missing references)
			//IL_0afe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b05: Expected O, but got Unknown
			//IL_0b3b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b51: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b67: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b73: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b89: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bb2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bbc: Expected O, but got Unknown
			//IL_0c14: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c1b: Expected O, but got Unknown
			//IL_0c44: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c5a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c70: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c86: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c9c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cc3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ccd: Expected O, but got Unknown
			//IL_0cfb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d05: Expected O, but got Unknown
			//IL_0d0a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d11: Expected O, but got Unknown
			//IL_0da4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0da9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dd1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ddb: Expected O, but got Unknown
			//IL_0df9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e03: Expected O, but got Unknown
			try
			{
				Canvas val = null;
				Canvas[] array = Object.FindObjectsOfType<Canvas>();
				Canvas[] array2 = array;
				foreach (Canvas val2 in array2)
				{
					if ((Object)(object)((Component)val2).transform.parent == (Object)null)
					{
						val = val2;
						break;
					}
				}
				if ((Object)(object)val == (Object)null && array.Length != 0)
				{
					val = array[^1];
				}
				if ((Object)(object)val == (Object)null)
				{
					MelonLogger.Error("[GameManager] No Canvas found!");
					return;
				}
				mainPanel = new GameObject("GameManagerPanel");
				mainPanel.transform.SetParent(((Component)val).transform, false);
				mainPanel.transform.SetAsLastSibling();
				RectTransform val3 = mainPanel.AddComponent<RectTransform>();
				val3.anchorMin = Vector2.zero;
				val3.anchorMax = Vector2.one;
				val3.offsetMin = Vector2.zero;
				val3.offsetMax = Vector2.zero;
				Image val4 = mainPanel.AddComponent<Image>();
				((Graphic)val4).color = GetColorFromConfig("UI_BackgroundColor", new Color(0.1f, 0.1f, 0.15f, 0.98f));
				CanvasGroup val5 = mainPanel.AddComponent<CanvasGroup>();
				val5.alpha = 1f;
				val5.interactable = true;
				val5.blocksRaycasts = true;
				GraphicRaycaster val6 = mainPanel.AddComponent<GraphicRaycaster>();
				GameObject val7 = new GameObject("Container");
				val7.transform.SetParent(mainPanel.transform, false);
				RectTransform val8 = val7.AddComponent<RectTransform>();
				val8.anchorMin = new Vector2(0.5f, 0.5f);
				val8.anchorMax = new Vector2(0.5f, 0.5f);
				val8.pivot = new Vector2(0.5f, 0.5f);
				val8.anchoredPosition = Vector2.zero;
				val8.sizeDelta = new Vector2(800f, 750f);
				Image val9 = val7.AddComponent<Image>();
				((Graphic)val9).color = GetColorFromConfig("UI_ContainerColor", new Color(0.1f, 0.1f, 0.15f, 0.98f));
				Outline val10 = val7.AddComponent<Outline>();
				((Shadow)val10).effectColor = new Color(1f, 1f, 1f, 0.1f);
				((Shadow)val10).effectDistance = new Vector2(1f, -1f);
				GameObject val11 = new GameObject("Title");
				val11.transform.SetParent(val7.transform, false);
				RectTransform val12 = val11.AddComponent<RectTransform>();
				val12.anchorMin = new Vector2(0.5f, 1f);
				val12.anchorMax = new Vector2(0.5f, 1f);
				val12.pivot = new Vector2(0.5f, 1f);
				val12.anchoredPosition = new Vector2(0f, -20f);
				val12.sizeDelta = new Vector2(760f, 50f);
				titleText = val11.AddComponent<TextMeshProUGUI>();
				((TMP_Text)titleText).text = "GAME MANAGER";
				((TMP_Text)titleText).fontSize = 48f;
				((TMP_Text)titleText).fontStyle = (FontStyles)1;
				((TMP_Text)titleText).alignment = (TextAlignmentOptions)514;
				((Graphic)titleText).color = GetColorFromConfig("UI_TextColor", Color.white);
				Shadow val13 = val11.AddComponent<Shadow>();
				val13.effectColor = new Color(0f, 0f, 0f, 0.5f);
				val13.effectDistance = new Vector2(2f, -2f);
				GameObject val14 = new GameObject("TabButtons");
				val14.transform.SetParent(val7.transform, false);
				RectTransform val15 = val14.AddComponent<RectTransform>();
				val15.anchorMin = new Vector2(0.5f, 1f);
				val15.anchorMax = new Vector2(0.5f, 1f);
				val15.pivot = new Vector2(0.5f, 1f);
				val15.anchoredPosition = new Vector2(0f, -80f);
				val15.sizeDelta = new Vector2(760f, 50f);
				Image val16 = val14.AddComponent<Image>();
				((Graphic)val16).color = GetColorFromConfig("UI_TabBackgroundColor", new Color(0.1f, 0.1f, 0.15f, 0.99f));
				GraphicRaycaster val17 = val14.AddComponent<GraphicRaycaster>();
				HorizontalLayoutGroup val18 = val14.AddComponent<HorizontalLayoutGroup>();
				((HorizontalOrVerticalLayoutGroup)val18).spacing = 10f;
				((LayoutGroup)val18).padding = new RectOffset(10, 10, 5, 5);
				((HorizontalOrVerticalLayoutGroup)val18).childForceExpandWidth = true;
				((HorizontalOrVerticalLayoutGroup)val18).childForceExpandHeight = true;
				CreateTabButton(val14, "SAVES", 0);
				CreateTabButton(val14, "ROOMS", 1);
				GameObject val19 = new GameObject("Status");
				val19.transform.SetParent(val7.transform, false);
				RectTransform val20 = val19.AddComponent<RectTransform>();
				val20.anchorMin = new Vector2(0.5f, 1f);
				val20.anchorMax = new Vector2(0.5f, 1f);
				val20.pivot = new Vector2(0.5f, 1f);
				val20.anchoredPosition = new Vector2(0f, -135f);
				val20.sizeDelta = new Vector2(760f, 35f);
				Image val21 = val19.AddComponent<Image>();
				((Graphic)val21).color = GetColorFromConfig("UI_StatusBarColor", new Color(0.15f, 0.15f, 0.2f, 1f));
				GameObject val22 = new GameObject("Text");
				val22.transform.SetParent(val19.transform, false);
				RectTransform val23 = val22.AddComponent<RectTransform>();
				val23.anchorMin = Vector2.zero;
				val23.anchorMax = Vector2.one;
				val23.offsetMin = Vector2.zero;
				val23.offsetMax = Vector2.zero;
				statusText = val22.AddComponent<TextMeshProUGUI>();
				((TMP_Text)statusText).text = "Ready";
				((TMP_Text)statusText).fontSize = 18f;
				((TMP_Text)statusText).alignment = (TextAlignmentOptions)514;
				((Graphic)statusText).color = GetColorFromConfig("UI_SubTextColor", new Color(0.8f, 0.8f, 0.85f, 1f));
				((Graphic)statusText).raycastTarget = false;
				GameObject val24 = new GameObject("ContentContainer");
				val24.transform.SetParent(val7.transform, false);
				RectTransform val25 = val24.AddComponent<RectTransform>();
				val25.anchorMin = new Vector2(0.5f, 0.5f);
				val25.anchorMax = new Vector2(0.5f, 0.5f);
				val25.pivot = new Vector2(0.5f, 0.5f);
				val25.anchoredPosition = new Vector2(0f, 10f);
				val25.sizeDelta = new Vector2(760f, 450f);
				Image val26 = val24.AddComponent<Image>();
				((Graphic)val26).color = new Color(0f, 0f, 0f, 0f);
				((Graphic)val26).raycastTarget = false;
				savesContainer = new GameObject("SavesContainer");
				savesContainer.transform.SetParent(val24.transform, false);
				RectTransform val27 = savesContainer.AddComponent<RectTransform>();
				val27.anchorMin = Vector2.zero;
				val27.anchorMax = Vector2.one;
				val27.offsetMin = Vector2.zero;
				val27.offsetMax = Vector2.zero;
				savesScrollRect = savesContainer.AddComponent<ScrollRect>();
				Image val28 = savesContainer.AddComponent<Image>();
				((Graphic)val28).color = GetColorFromConfig("UI_ListBackgroundColor", new Color(0.08f, 0.08f, 0.12f, 0.9f));
				GameObject val29 = new GameObject("Viewport");
				val29.transform.SetParent(savesContainer.transform, false);
				RectTransform val30 = val29.AddComponent<RectTransform>();
				val30.anchorMin = Vector2.zero;
				val30.anchorMax = Vector2.one;
				val30.offsetMin = Vector2.zero;
				val30.offsetMax = Vector2.zero;
				Image val31 = val29.AddComponent<Image>();
				((Graphic)val31).color = GetColorFromConfig("UI_ListBackgroundColor", new Color(0.08f, 0.08f, 0.12f, 1f));
				Mask val32 = val29.AddComponent<Mask>();
				val32.showMaskGraphic = false;
				GameObject val33 = new GameObject("Content");
				val33.transform.SetParent(val29.transform, false);
				RectTransform val34 = val33.AddComponent<RectTransform>();
				savesContentTransform = val33.transform;
				val34.anchorMin = new Vector2(0.5f, 1f);
				val34.anchorMax = new Vector2(0.5f, 1f);
				val34.pivot = new Vector2(0.5f, 1f);
				val34.anchoredPosition = Vector2.zero;
				val34.sizeDelta = new Vector2(740f, 0f);
				VerticalLayoutGroup val35 = val33.AddComponent<VerticalLayoutGroup>();
				((HorizontalOrVerticalLayoutGroup)val35).spacing = 12f;
				((LayoutGroup)val35).padding = new RectOffset(10, 10, 10, 10);
				((HorizontalOrVerticalLayoutGroup)val35).childForceExpandHeight = false;
				((HorizontalOrVerticalLayoutGroup)val35).childForceExpandWidth = true;
				ContentSizeFitter val36 = val33.AddComponent<ContentSizeFitter>();
				val36.verticalFit = (FitMode)2;
				savesScrollRect.content = val34;
				savesScrollRect.viewport = val30;
				savesScrollRect.vertical = true;
				savesScrollRect.horizontal = false;
				savesScrollRect.movementType = (MovementType)1;
				savesScrollRect.elasticity = 0.1f;
				roomsContainer = new GameObject("RoomsContainer");
				roomsContainer.transform.SetParent(val24.transform, false);
				RectTransform val37 = roomsContainer.AddComponent<RectTransform>();
				val37.anchorMin = Vector2.zero;
				val37.anchorMax = Vector2.one;
				val37.offsetMin = Vector2.zero;
				val37.offsetMax = Vector2.zero;
				val37.offsetMax = Vector2.zero;
				roomsContainer.SetActive(false);
				roomsScrollRect = roomsContainer.AddComponent<ScrollRect>();
				Image val38 = roomsContainer.AddComponent<Image>();
				((Graphic)val38).color = GetColorFromConfig("UI_ListBackgroundColor", new Color(0.08f, 0.08f, 0.12f, 0.9f));
				GameObject val39 = new GameObject("Viewport");
				val39.transform.SetParent(roomsContainer.transform, false);
				RectTransform val40 = val39.AddComponent<RectTransform>();
				val40.anchorMin = Vector2.zero;
				val40.anchorMax = Vector2.one;
				val40.offsetMin = Vector2.zero;
				val40.offsetMax = Vector2.zero;
				Image val41 = val39.AddComponent<Image>();
				((Graphic)val41).color = GetColorFromConfig("UI_ListBackgroundColor", new Color(0.08f, 0.08f, 0.12f, 1f));
				Mask val42 = val39.AddComponent<Mask>();
				val42.showMaskGraphic = false;
				GameObject val43 = new GameObject("Content");
				val43.transform.SetParent(val39.transform, false);
				RectTransform val44 = val43.AddComponent<RectTransform>();
				roomsContentTransform = val43.transform;
				val44.anchorMin = new Vector2(0.5f, 1f);
				val44.anchorMax = new Vector2(0.5f, 1f);
				val44.pivot = new Vector2(0.5f, 1f);
				val44.anchoredPosition = Vector2.zero;
				val44.sizeDelta = new Vector2(740f, 0f);
				VerticalLayoutGroup val45 = val43.AddComponent<VerticalLayoutGroup>();
				((HorizontalOrVerticalLayoutGroup)val45).spacing = 12f;
				((LayoutGroup)val45).padding = new RectOffset(10, 10, 10, 10);
				((HorizontalOrVerticalLayoutGroup)val45).childForceExpandHeight = false;
				((HorizontalOrVerticalLayoutGroup)val45).childForceExpandWidth = true;
				ContentSizeFitter val46 = val43.AddComponent<ContentSizeFitter>();
				val46.verticalFit = (FitMode)2;
				roomsScrollRect.content = val44;
				roomsScrollRect.viewport = val40;
				roomsScrollRect.vertical = true;
				roomsScrollRect.horizontal = false;
				GameObject val47 = new GameObject("Navigation");
				val47.transform.SetParent(val7.transform, false);
				RectTransform val48 = val47.AddComponent<RectTransform>();
				val48.anchorMin = new Vector2(0.5f, 0f);
				val48.anchorMax = new Vector2(0.5f, 0f);
				val48.pivot = new Vector2(0.5f, 0f);
				val48.anchoredPosition = new Vector2(0f, 15f);
				val48.sizeDelta = new Vector2(760f, 60f);
				HorizontalLayoutGroup val49 = val47.AddComponent<HorizontalLayoutGroup>();
				((HorizontalOrVerticalLayoutGroup)val49).spacing = 15f;
				((LayoutGroup)val49).padding = new RectOffset(15, 15, 5, 5);
				((HorizontalOrVerticalLayoutGroup)val49).childForceExpandHeight = true;
				((HorizontalOrVerticalLayoutGroup)val49).childForceExpandWidth = true;
				Button val50 = CreateButton(val47, "Prev", ButtonType.Secondary);
				((UnityEvent)val50.onClick).AddListener((UnityAction)delegate
				{
					PreviousPage();
				});
				GameObject val51 = new GameObject("PageText");
				val51.transform.SetParent(val47.transform, false);
				RectTransform val52 = val51.AddComponent<RectTransform>();
				LayoutElement val53 = val51.AddComponent<LayoutElement>();
				val53.preferredWidth = 150f;
				val53.flexibleWidth = 0f;
				pageText = val51.AddComponent<TextMeshProUGUI>();
				((TMP_Text)pageText).text = "Page 1 / 1";
				((TMP_Text)pageText).alignment = (TextAlignmentOptions)514;
				((TMP_Text)pageText).fontSize = 26f;
				((TMP_Text)pageText).fontStyle = (FontStyles)1;
				((Graphic)pageText).color = GetColorFromConfig("UI_TextColor", Color.white);
				Button val54 = CreateButton(val47, "Next", ButtonType.Secondary);
				((UnityEvent)val54.onClick).AddListener((UnityAction)delegate
				{
					NextPage();
				});
				Button val55 = CreateButton(val47, "Close", ButtonType.Destructive);
				((UnityEvent)val55.onClick).AddListener((UnityAction)delegate
				{
					CloseUI();
				});
				RefreshDisplay();
				MelonLogger.Msg("[GameManager] UI Created successfully");
			}
			catch (Exception ex)
			{
				MelonLogger.Error("[GameManager] Fatal error creating UI: " + ex.Message);
			}
		}

		private void CreateTabButton(GameObject parent, string text, int tabIndex)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			//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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Expected O, but got Unknown
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Expected O, but got Unknown
			//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_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Tab_" + text);
			val.transform.SetParent(parent.transform, false);
			LayoutElement val2 = val.AddComponent<LayoutElement>();
			val2.preferredHeight = 50f;
			val2.preferredWidth = 150f;
			Button val3 = val.AddComponent<Button>();
			Image val4 = val.AddComponent<Image>();
			((Graphic)val4).color = GetColorFromConfig("UI_TabButtonColor", new Color(0.25f, 0.25f, 0.3f, 1f));
			GameObject val5 = new GameObject("Text");
			val5.transform.SetParent(val.transform, false);
			RectTransform val6 = val5.AddComponent<RectTransform>();
			val6.anchorMin = Vector2.zero;
			val6.anchorMax = Vector2.one;
			val6.offsetMin = Vector2.zero;
			val6.offsetMax = Vector2.zero;
			TextMeshProUGUI val7 = val5.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val7).text = text;
			((TMP_Text)val7).fontSize = 20f;
			((TMP_Text)val7).fontStyle = (FontStyles)1;
			((TMP_Text)val7).alignment = (TextAlignmentOptions)514;
			((Graphic)val7).color = GetColorFromConfig("UI_TextColor", Color.white);
			((Graphic)val7).raycastTarget = false;
			((UnityEvent)val3.onClick).AddListener((UnityAction)delegate
			{
				SwitchTab(tabIndex);
			});
			tabButtons.Add(val3);
			ColorBlock colors = ((Selectable)val3).colors;
			((ColorBlock)(ref colors)).normalColor = ((Graphic)val4).color;
			((ColorBlock)(ref colors)).highlightedColor = ((Graphic)val4).color * 1.2f;
			((Selectable)val3).colors = colors;
			val.AddComponent<ButtonHoverAnimation>();
		}

		private void SwitchTab(int tab)
		{
			try
			{
				currentTab = tab;
				currentPage = 0;
				if ((Object)(object)savesContainer == (Object)null || (Object)(object)roomsContainer == (Object)null)
				{
					MelonLogger.Error("[GameManager] Containers not initialized in SwitchTab");
					return;
				}
				switch (tab)
				{
				case 0:
					savesContainer.SetActive(true);
					roomsContainer.SetActive(false);
					if ((Object)(object)titleText != (Object)null)
					{
						((TMP_Text)titleText).text = (isSaveMode ? "LOAD GAME" : "CREATE NEW GAME");
					}
					LoadAllSaves();
					break;
				case 1:
					savesContainer.SetActive(false);
					roomsContainer.SetActive(true);
					if ((Object)(object)titleText != (Object)null)
					{
						((TMP_Text)titleText).text = "FIND ROOMS";
					}
					searchAttempts = 0;
					isSearching = false;
					MelonLogger.Msg("[GameManager] Switched to Rooms tab, starting search");
					SearchForRooms();
					break;
				}
				RefreshDisplay();
			}
			catch (Exception ex)
			{
				MelonLogger.Error("[GameManager] Error switching tab: " + ex.Message);
			}
		}

		private Button CreateButton(GameObject parent, string text, ButtonType type)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Expected O, but got Unknown
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: 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)
			GameObject val = new GameObject("Button_" + text);
			val.transform.SetParent(parent.transform, false);
			RectTransform val2 = val.AddComponent<RectTransform>();
			val2.sizeDelta = new Vector2(120f, 50f);
			Button val3 = val.AddComponent<Button>();
			Image val4 = val.AddComponent<Image>();
			((Graphic)val4).raycastTarget = true;
			Outline val5 = val.AddComponent<Outline>();
			((Shadow)val5).effectColor = new Color(1f, 1f, 1f, 0.1f);
			((Shadow)val5).effectDistance = new Vector2(1f, -1f);
			switch (type)
			{
			case ButtonType.Primary:
				((Graphic)val4).color = GetColorFromConfig("UI_PrimaryColor", new Color(0.2f, 0.5f, 0.8f, 1f));
				break;
			case ButtonType.Secondary:
				((Graphic)val4).color = GetColorFromConfig("UI_SecondaryColor", new Color(0.35f, 0.35f, 0.4f, 1f));
				break;
			case ButtonType.Destructive:
				((Graphic)val4).color = GetColorFromConfig("UI_DestructiveColor", new Color(0.75f, 0.2f, 0.2f, 1f));
				break;
			}
			GameObject val6 = new GameObject("Text");
			val6.transform.SetParent(val.transform, false);
			RectTransform val7 = val6.AddComponent<RectTransform>();
			val7.anchorMin = Vector2.zero;
			val7.anchorMax = Vector2.one;
			val7.offsetMin = Vector2.zero;
			val7.offsetMax = Vector2.zero;
			TextMeshProUGUI val8 = val6.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val8).text = text;
			((TMP_Text)val8).fontSize = 22f;
			((TMP_Text)val8).alignment = (TextAlignmentOptions)514;
			((Graphic)val8).color = GetColorFromConfig("UI_TextColor", Color.white);
			((Graphic)val8).raycastTarget = false;
			ColorBlock colors = ((Selectable)val3).colors;
			((ColorBlock)(ref colors)).normalColor = ((Graphic)val4).color;
			((ColorBlock)(ref colors)).highlightedColor = ((Graphic)val4).color * 1.15f;
			((ColorBlock)(ref colors)).pressedColor = ((Graphic)val4).color * 0.9f;
			((Selectable)val3).colors = colors;
			val.AddComponent<ButtonHoverAnimation>();
			return val3;
		}

		private void RefreshDisplay()
		{
			try
			{
				displayCards.Clear();
				if (currentTab == 0)
				{
					RefreshSavesDisplay();
				}
				else
				{
					RefreshRoomsDisplay();
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("[GameManager] Error in RefreshDisplay: " + ex.Message);
			}
		}

		private void RefreshSavesDisplay()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			if ((Object)(object)savesContentTransform == (Object)null)
			{
				MelonLogger.Error("[GameManager] savesContentTransform is NULL!");
				return;
			}
			foreach (Transform item in savesContentTransform)
			{
				Transform val = item;
				Object.Destroy((Object)(object)((Component)val).gameObject);
			}
			if (!isSaveMode)
			{
				CreateNewSaveCard();
			}
			int num = currentPage * itemsPerPage;
			int num2 = Mathf.Min(num + itemsPerPage - 1, allSaves.Count);
			for (int i = num; i < num2; i++)
			{
				if (i >= 0 && i < allSaves.Count)
				{
					CreateSaveCard(allSaves[i]);
				}
			}
			int num3 = Mathf.Max(1, Mathf.CeilToInt((float)(allSaves.Count + ((!isSaveMode) ? 1 : 0)) / (float)itemsPerPage));
			((TMP_Text)pageText).text = $"Page {currentPage + 1} / {num3}";
			if ((Object)(object)savesScrollRect != (Object)null)
			{
				savesScrollRect.verticalNormalizedPosition = 1f;
			}
		}

		private void RefreshRoomsDisplay()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Expected O, but got Unknown
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)roomsContentTransform == (Object)null)
			{
				return;
			}
			foreach (Transform item in roomsContentTransform)
			{
				Transform val = item;
				Object.Destroy((Object)(object)((Component)val).gameObject);
			}
			int num = currentPage * itemsPerPage;
			int num2 = Mathf.Min(num + itemsPerPage, roomList.Count);
			if (roomList.Count == 0)
			{
				GameObject val2 = new GameObject("EmptyMessage");
				val2.transform.SetParent(roomsContentTransform, false);
				LayoutElement val3 = val2.AddComponent<LayoutElement>();
				val3.preferredHeight = 100f;
				TextMeshProUGUI val4 = val2.AddComponent<TextMeshProUGUI>();
				((TMP_Text)val4).text = (isSearching ? "Searching for rooms..." : "No rooms found");
				((TMP_Text)val4).fontSize = 24f;
				((TMP_Text)val4).alignment = (TextAlignmentOptions)514;
				((Graphic)val4).color = GetColorFromConfig("UI_SubTextColor", new Color(0.6f, 0.6f, 0.65f, 0.8f));
				displayCards.Add(val2);
			}
			else
			{
				for (int i = num; i < num2; i++)
				{
					if (i >= 0 && i < roomList.Count)
					{
						CreateRoomCard(roomList[i]);
						MelonLogger.Msg($"[GameManager] Created room card {i}: {roomList[i].DungeonName} - {roomList[i].PlayerCount}/{roomList[i].MaxPlayers}");
					}
				}
			}
			int num3 = Mathf.Max(1, Mathf.CeilToInt((float)roomList.Count / (float)itemsPerPage));
			((TMP_Text)pageText).text = $"Page {currentPage + 1} / {num3}";
			if ((Object)(object)roomsScrollRect != (Object)null)
			{
				roomsScrollRect.verticalNormalizedPosition = 1f;
			}
			MelonLogger.Msg($"[GameManager] RefreshRoomsDisplay complete - showing rooms {num} to {num2} of {roomList.Count}");
		}

		private void CreateNewSaveCard()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: 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_00e1: Expected O, but got Unknown
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Expected O, but got Unknown
			//IL_0115: 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_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				GameObject val = new GameObject("SaveCard_Create");
				val.transform.SetParent(savesContentTransform, false);
				RectTransform val2 = val.AddComponent<RectTransform>();
				val2.sizeDelta = new Vector2(720f, 60f);
				LayoutElement val3 = val.AddComponent<LayoutElement>();
				val3.preferredHeight = 60f;
				Image val4 = val.AddComponent<Image>();
				((Graphic)val4).color = GetColorFromConfig("UI_CardColor", new Color(0.25f, 0.35f, 0.25f, 1f));
				((Graphic)val4).raycastTarget = true;
				Outline val5 = val.AddComponent<Outline>();
				((Shadow)val5).effectColor = new Color(1f, 1f, 1f, 0.1f);
				((Shadow)val5).effectDistance = new Vector2(1f, -1f);
				Button val6 = val.AddComponent<Button>();
				((UnityEvent)val6.onClick).AddListener((UnityAction)delegate
				{
					OnCreateNewSave();
				});
				GameObject val7 = new GameObject("Title");
				val7.transform.SetParent(val.transform, false);
				RectTransform val8 = val7.AddComponent<RectTransform>();
				val8.anchorMin = new Vector2(0.5f, 0.5f);
				val8.anchorMax = new Vector2(0.5f, 0.5f);
				val8.pivot = new Vector2(0.5f, 0.5f);
				val8.anchoredPosition = Vector2.zero;
				val8.sizeDelta = new Vector2(680f, 50f);
				TextMeshProUGUI val9 = val7.AddComponent<TextMeshProUGUI>();
				((TMP_Text)val9).text = "CREATE NEW SAVE";
				((TMP_Text)val9).fontSize = 18f;
				((TMP_Text)val9).fontStyle = (FontStyles)1;
				((TMP_Text)val9).alignment = (TextAlignmentOptions)514;
				((Graphic)val9).color = GetColorFromConfig("UI_TextColor", Color.white);
				((Graphic)val9).raycastTarget = false;
				ColorBlock colors = ((Selectable)val6).colors;
				((ColorBlock)(ref colors)).normalColor = ((Graphic)val4).color;
				((ColorBlock)(ref colors)).highlightedColor = new Color(0.35f, 0.45f, 0.35f, 1f);
				((ColorBlock)(ref colors)).pressedColor = new Color(0.2f, 0.3f, 0.2f, 1f);
				((Selectable)val6).colors = colors;
				val.AddComponent<ButtonHoverAnimation>();
				displayCards.Add(val);
			}
			catch (Exception ex)
			{
				MelonLogger.Error("[GameManager] Error creating new save card: " + ex.Message);
			}
		}

		private void CreateSaveCard(SaveSlotData save)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: 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_00c1: 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_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Expected O, but got Unknown
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: 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)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: 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_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Expected O, but got Unknown
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Expected O, but got Unknown
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0307: 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_038d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0392: 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_03a8: Expected O, but got Unknown
			//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0412: Unknown result type (might be due to invalid IL or missing references)
			//IL_0428: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04df: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e6: Expected O, but got Unknown
			//IL_050e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0524: Unknown result type (might be due to invalid IL or missing references)
			//IL_053a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0550: Unknown result type (might be due to invalid IL or missing references)
			//IL_0566: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05de: Expected O, but got Unknown
			//IL_0606: Unknown result type (might be due to invalid IL or missing references)
			//IL_061c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0632: Unknown result type (might be due to invalid IL or missing references)
			//IL_0648: Unknown result type (might be due to invalid IL or missing references)
			//IL_065e: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_06fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0712: Unknown result type (might be due to invalid IL or missing references)
			//IL_0728: Unknown result type (might be due to invalid IL or missing references)
			//IL_073e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0754: Unknown result type (might be due to invalid IL or missing references)
			//IL_0797: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a1: Expected O, but got Unknown
			try
			{
				GameObject val = new GameObject($"SaveCard_{save.SlotId}");
				val.transform.SetParent(savesContentTransform, false);
				RectTransform val2 = val.AddComponent<RectTransform>();
				val2.sizeDelta = new Vector2(720f, 130f);
				LayoutElement val3 = val.AddComponent<LayoutElement>();
				val3.preferredHeight = 130f;
				Image val4 = val.AddComponent<Image>();
				((Graphic)val4).color = GetColorFromConfig("UI_CardColor", new Color(0.18f, 0.18f, 0.22f, 1f));
				((Graphic)val4).raycastTarget = true;
				Outline val5 = val.AddComponent<Outline>();
				((Shadow)val5).effectColor = new Color(1f, 1f, 1f, 0.05f);
				((Shadow)val5).effectDistance = new Vector2(1f, -1f);
				Button val6 = val.AddComponent<Button>();
				int slotId = save.SlotId;
				((UnityEvent)val6.onClick).AddListener((UnityAction)delegate
				{
					OnSaveSelected(slotId);
				});
				ColorBlock colors = ((Selectable)val6).colors;
				((ColorBlock)(ref colors)).normalColor = ((Graphic)val4).color;
				((ColorBlock)(ref colors)).highlightedColor = ((Graphic)val4).color * 1.2f;
				((ColorBlock)(ref colors)).pressedColor = ((Graphic)val4).color * 0.85f;
				((Selectable)val6).colors = colors;
				val.AddComponent<ButtonHoverAnimation>();
				GameObject val7 = new GameObject("Title");
				val7.transform.SetParent(val.transform, false);
				RectTransform val8 = val7.AddComponent<RectTransform>();
				val8.anchorMin = new Vector2(0f, 1f);
				val8.anchorMax = new Vector2(0.7f, 1f);
				val8.pivot = new Vector2(0f, 1f);
				val8.anchoredPosition = new Vector2(10f, -10f);
				val8.sizeDelta = new Vector2(0f, 30f);
				TextMeshProUGUI val9 = val7.AddComponent<TextMeshProUGUI>();
				string text = $"<b>Slot {save.SlotId}</b> - Cycle {save.SaveData.CycleCount}";
				if (save.SlotId == 0)
				{
					text = $"<b>Auto Save #{save.SlotId}</b> - Cycle {save.SaveData.CycleCount}";
				}
				((TMP_Text)val9).text = text;
				((TMP_Text)val9).fontSize = 24f;
				((TMP_Text)val9).alignment = (TextAlignmentOptions)257;
				((Graphic)val9).color = GetColorFromConfig("UI_TextColor", Color.white);
				GameObject val10 = new GameObject("Date");
				val10.transform.SetParent(val.transform, false);
				RectTransform val11 = val10.AddComponent<RectTransform>();
				val11.anchorMin = new Vector2(0f, 1f);
				val11.anchorMax = new Vector2(0.7f, 1f);
				val11.pivot = new Vector2(0f, 1f);
				val11.anchoredPosition = new Vector2(10f, -45f);
				val11.sizeDelta = new Vector2(0f, 22f);
				TextMeshProUGUI val12 = val10.AddComponent<TextMeshProUGUI>();
				((TMP_Text)val12).text = save.SaveData.RegDateTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss");
				((TMP_Text)val12).fontSize = 18f;
				((TMP_Text)val12).alignment = (TextAlignmentOptions)257;
				((Graphic)val12).color = GetColorFromConfig("UI_SubTextColor", new Color(0.75f, 0.75f, 0.78f, 1f));
				GameObject val13 = new GameObject("Players");
				val13.transform.SetParent(val.transform, false);
				RectTransform val14 = val13.AddComponent<RectTransform>();
				val14.anchorMin = new Vector2(0f, 1f);
				val14.anchorMax = new Vector2(0.7f, 1f);
				val14.pivot = new Vector2(0f, 1f);
				val14.anchoredPosition = new Vector2(10f, -72f);
				val14.sizeDelta = new Vector2(0f, 22f);
				string text2 = ((save.SaveData.PlayerNames != null && save.SaveData.PlayerNames.Count > 0) ? string.Join(", ", save.SaveData.PlayerNames.Take(3)) : "No players");
				TextMeshProUGUI val15 = val13.AddComponent<TextMeshProUGUI>();
				((TMP_Text)val15).text = "<i>Players: " + text2 + "</i>";
				((TMP_Text)val15).fontSize = 16f;
				((TMP_Text)val15).alignment = (TextAlignmentOptions)257;
				((Graphic)val15).color = GetColorFromConfig("UI_SubTextColor", new Color(0.65f, 0.68f, 0.7f, 1f));
				GameObject val16 = new GameObject("Currency");
				val16.transform.SetParent(val.transform, false);
				RectTransform val17 = val16.AddComponent<RectTransform>();
				val17.anchorMin = new Vector2(0.7f, 1f);
				val17.anchorMax = new Vector2(1f, 1f);
				val17.pivot = new Vector2(1f, 1f);
				val17.anchoredPosition = new Vector2(-10f, -10f);
				val17.sizeDelta = new Vector2(0f, 30f);
				TextMeshProUGUI val18 = val16.AddComponent<TextMeshProUGUI>();
				((TMP_Text)val18).text = $"${save.SaveData.Currency}";
				((TMP_Text)val18).fontSize = 24f;
				((TMP_Text)val18).alignment = (TextAlignmentOptions)260;
				((Graphic)val18).color = new Color(0.4f, 0.8f, 0.4f, 1f);
				GameObject val19 = new GameObject("Status");
				val19.transform.SetParent(val.transform, false);
				RectTransform val20 = val19.AddComponent<RectTransform>();
				val20.anchorMin = new Vector2(0.7f, 1f);
				val20.anchorMax = new Vector2(1f, 1f);
				val20.pivot = new Vector2(1f, 1f);
				val20.anchoredPosition = new Vector2(-10f, -45f);
				val20.sizeDelta = new Vector2(0f, 22f);
				string text3 = (save.SaveData.TramRepaired ? "Repaired" : "Not Repaired");
				TextMeshProUGUI val21 = val19.AddComponent<TextMeshProUGUI>();
				((TMP_Text)val21).text = text3;
				((TMP_Text)val21).fontSize = 16f;
				((TMP_Text)val21).alignment = (TextAlignmentOptions)260;
				((Graphic)val21).color = GetColorFromConfig("UI_SubTextColor", new Color(0.75f, 0.75f, 0.78f, 1f));
				Button val22 = CreateButton(val, "Delete", ButtonType.Destructive);
				RectTransform component = ((Component)val22).GetComponent<RectTransform>();
				component.anchorMin = new Vector2(1f, 0f);
				component.anchorMax = new Vector2(1f, 0f);
				component.pivot = new Vector2(1f, 0f);
				component.anchoredPosition = new Vector2(-10f, 10f);
				component.sizeDelta = new Vector2(80f, 30f);
				TextMeshProUGUI componentInChildren = ((Component)val22).GetComponentInChildren<TextMeshProUGUI>();
				if ((Object)(object)componentInChildren != (Object)null)
				{
					((TMP_Text)componentInChildren).fontSize = 16f;
				}
				((UnityEventBase)val22.onClick).RemoveAllListeners();
				((UnityEvent)val22.onClick).AddListener((UnityAction)delegate
				{
					DeleteSave(slotId);
				});
				displayCards.Add(val);
			}
			catch (Exception ex)
			{
				MelonLogger.Error("[GameManager] Error creating save card: " + ex.Message);
			}
		}

		private void DeleteSave(int slotId)
		{
			try
			{
				string saveFileName = MMSaveGameData.GetSaveFileName(slotId);
				if (MonoSingleton<PlatformMgr>.Instance.IsSaveFileExist(saveFileName))
				{
					MonoSingleton<PlatformMgr>.Instance.Delete(saveFileName);
					MelonLogger.Msg($"[GameManager] Deleted save slot {slotId}");
					RefreshUI();
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("Error deleting save: " + ex.Message);
			}
		}

		private void CreateRoomCard(RoomInfo room)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Expected O, but got Unknown
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Expected O, but got Unknown
			//IL_0116: 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_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: 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_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Expected O, but got Unknown
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: 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_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: Expected O, but got Unknown
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0353: Unknown result type (might be due to invalid IL or missing references)
			//IL_0369: Unknown result type (might be due to invalid IL or missing references)
			//IL_037f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_0419: Unknown result type (might be due to invalid IL or missing references)
			//IL_041e: Unknown result type (might be due to invalid IL or missing references)
			//IL_042a: Unknown result type (might be due to invalid IL or missing references)
			//IL_042f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0434: Unknown result type (might be due to invalid IL or missing references)
			//IL_0441: Unknown result type (might be due to invalid IL or missing references)
			//IL_044b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0458: Unknown result type (might be due to invalid IL or missing references)
			//IL_0462: Unknown result type (might be due to invalid IL or missing references)
			//IL_046e: Unknown result type (might be due to invalid IL or missing references)
			RoomInfo room2 = room;
			try
			{
				GameObject val = new GameObject("RoomCard_" + room2.RoomId);
				val.transform.SetParent(roomsContentTransform, false);
				LayoutElement val2 = val.AddComponent<LayoutElement>();
				val2.preferredHeight = 120f;
				Image val3 = val.AddComponent<Image>();
				((Graphic)val3).color = GetColorFromConfig("UI_CardColor", new Color(0.18f, 0.18f, 0.22f, 1f));
				Outline val4 = val.AddComponent<Outline>();
				((Shadow)val4).effectColor = new Color(1f, 1f, 1f, 0.05f);
				((Shadow)val4).effectDistance = new Vector2(1f, -1f);
				Button val5 = val.AddComponent<Button>();
				((UnityEvent)val5.onClick).AddListener((UnityAction)delegate
				{
					JoinRoom(room2);
				});
				GameObject val6 = new GameObject("Title");
				val6.transform.SetParent(val.transform, false);
				RectTransform val7 = val6.AddComponent<RectTransform>();
				val7.anchorMin = new Vector2(0f, 1f);
				val7.anchorMax = new Vector2(1f, 1f);
				val7.pivot = new Vector2(0f, 1f);
				val7.anchoredPosition = new Vector2(10f, -10f);
				val7.sizeDelta = new Vector2(-20f, 30f);
				TextMeshProUGUI val8 = val6.AddComponent<TextMeshProUGUI>();
				((TMP_Text)val8).text = "<b>" + room2.DungeonName + "</b> (" + room2.Status + ")";
				((TMP_Text)val8).fontSize = 22f;
				((TMP_Text)val8).alignment = (TextAlignmentOptions)257;
				((Graphic)val8).color = GetColorFromConfig("UI_TextColor", Color.white);
				GameObject val9 = new GameObject("Players");
				val9.transform.SetParent(val.transform, false);
				RectTransform val10 = val9.AddComponent<RectTransform>();
				val10.anchorMin = new Vector2(0f, 1f);
				val10.anchorMax = new Vector2(1f, 1f);
				val10.pivot = new Vector2(0f, 1f);
				val10.anchoredPosition = new Vector2(10f, -45f);
				val10.sizeDelta = new Vector2(-20f, 25f);
				TextMeshProUGUI val11 = val9.AddComponent<TextMeshProUGUI>();
				((TMP_Text)val11).text = $"Players: <color=#7FD8FF>{room2.PlayerCount}</color>/{room2.MaxPlayers}";
				((TMP_Text)val11).fontSize = 18f;
				((TMP_Text)val11).alignment = (TextAlignmentOptions)257;
				((Graphic)val11).color = GetColorFromConfig("UI_SubTextColor", new Color(0.75f, 0.75f, 0.78f, 1f));
				GameObject val12 = new GameObject("RoomID");
				val12.transform.SetParent(val.transform, false);
				RectTransform val13 = val12.AddComponent<RectTransform>();
				val13.anchorMin = new Vector2(0f, 1f);
				val13.anchorMax = new Vector2(1f, 1f);
				val13.pivot = new Vector2(0f, 1f);
				val13.anchoredPosition = new Vector2(10f, -70f);
				val13.sizeDelta = new Vector2(-20f, 20f);
				TextMeshProUGUI val14 = val12.AddComponent<TextMeshProUGUI>();
				((TMP_Text)val14).text = "<size=14>ID: " + room2.RoomId.Substring(0, Mathf.Min(8, room2.RoomId.Length)) + "</size>";
				((TMP_Text)val14).fontSize = 16f;
				((TMP_Text)val14).alignment = (TextAlignmentOptions)257;
				((Graphic)val14).color = GetColorFromConfig("UI_SubTextColor", new Color(0.65f, 0.68f, 0.7f, 1f));
				ColorBlock colors = ((Selectable)val5).colors;
				((ColorBlock)(ref colors)).normalColor = ((Graphic)val3).color;
				((ColorBlock)(ref colors)).highlightedColor = ((Graphic)val3).color * 1.2f;
				((ColorBlock)(ref colors)).pressedColor = ((Graphic)val3).color * 0.85f;
				((Selectable)val5).colors = colors;
				val.AddComponent<ButtonHoverAnimation>();
				displayCards.Add(val);
				MelonLogger.Msg($"[GameManager] Room card created: {room2.DungeonName} ({room2.PlayerCount}/{room2.MaxPlayers})");
			}
			catch (Exception ex)
			{
				MelonLogger.Error("[GameManager] Error creating room card: " + ex.Message);
			}
		}

		private void OnCreateNewSave()
		{
			try
			{
				MelonLogger.Msg($"[GameManager] Creating new save in slot {nextAvailableSlot}");
				OnSaveSelected(nextAvailableSlot);
			}
			catch (Exception ex)
			{
				MelonLogger.Error("Error creating new save: " + ex.Message);
			}
		}

		private void OnSaveSelected(int slotId)
		{
			SaveSlotData saveSlotData = allSaves.FirstOrDefault((SaveSlotData s) => s.SlotId == slotId);
			try
			{
				if (isSaveMode && (Object)(object)loadTramUI != (Object)null)
				{
					if (saveSlotData == null)
					{
						MelonLogger.Warning($"[GameManager] Attempted to load non-existent save slot {slotId}");
						return;
					}
					MelonLogger.Msg($"[GameManager] Loading save slot {slotId}");
					MethodInfo method = typeof(MainMenu).GetMethod("LoadSaveAndCreateRoom", BindingFlags.Instance | BindingFlags.NonPublic);
					if (method != null && (Object)(object)mainMenuInstance != (Object)null)
					{
						method.Invoke(mainMenuInstance, new object[2] { loadTramUI, slotId });
						MelonLogger.Msg($"[GameManager] Invoked LoadSaveAndCreateRoom for slot {slotId}");
					}
					CloseUI();
				}
				else if (!isSaveMode && (Object)(object)newTramUI != (Object)null)
				{
					MelonLogger.Msg($"[GameManager] Creating new game in slot {slotId}");
					MethodInfo method2 = typeof(MainMenu).GetMethod("CreateNewGameInSlot", BindingFlags.Instance | BindingFlags.NonPublic, null, new Type[2]
					{
						typeof(UIPrefab_NewTram),
						typeof(int)
					}, null);
					if (method2 != null && (Object)(object)mainMenuInstance != (Object)null)
					{
						method2.Invoke(mainMenuInstance, new object[2] { newTramUI, slotId });
						MelonLogger.Msg($"[GameManager] Invoked CreateNewGameInSlot for slot {slotId}");
					}
					CloseUI();
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("Error selecting save slot: " + ex.Message);
			}
		}

		private void JoinRoom(RoomInfo room)
		{
			//IL_00dc: 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)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				MelonLogger.Msg("[GameManager] JoinRoom called for: " + room.DungeonName + " (ID: " + room.RoomId + ")");
				ulong result;
				if (string.IsNullOrEmpty(room.RoomId))
				{
					MelonLogger.Error("[GameManager] Room ID is empty!");
					((TMP_Text)statusText).text = "Error: Invalid room ID";
				}
				else if (ulong.TryParse(room.RoomId, out result))
				{
					MelonLogger.Msg($"[GameManager] Parsed lobby ID: {result}");
					CSteamID val = default(CSteamID);
					((CSteamID)(ref val))..ctor(result);
					if (((CSteamID)(ref val)).IsValid())
					{
						MelonLogger.Msg("[GameManager] Steam lobby ID is valid, joining...");
						SteamMatchmaking.JoinLobby(val);
						((TMP_Text)statusText).text = "Joining " + room.DungeonName + "...";
						CloseUI();
					}
					else
					{
						MelonLogger.Error($"[GameManager] Invalid Steam lobby ID: {val}");
						((TMP_Text)statusText).text = "Error: Invalid lobby ID";
					}
				}
				else
				{
					MelonLogger.Error("[GameManager] Failed to parse room ID as ulong: " + room.RoomId);
					((TMP_Text)statusText).text = "Error: Invalid room ID format";
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("[GameManager] Error joining room: " + ex.Message);
				((TMP_Text)statusText).text = "Error joining room";
			}
		}

		private void PreviousPage()
		{
			if (currentPage > 0)
			{
				currentPage--;
				RefreshDisplay();
			}
		}

		private void NextPage()
		{
			int num = ((currentTab == 0) ? (allSaves.Count + ((!isSaveMode) ? 1 : 0)) : roomList.Count);
			int num2 = Mathf.Max(1, Mathf.CeilToInt((float)num / (float)itemsPerPage));
			if (currentPage < num2 - 1)
			{
				currentPage++;
				RefreshDisplay();
			}
		}

		private void CloseUI()
		{
			try
			{
				UIManager val = Object.FindObjectOfType<UIManager>();
				if ((Object)(object)mainPanel != (Object)null)
				{
					mainPanel.SetActive(false);
				}
				if (isSaveMode && (Object)(object)loadTramUI != (Object)null)
				{
					if ((Object)(object)val != (Object)null)
					{
						val.ui_escapeStack.Remove((UIPrefabScript)(object)loadTramUI);
					}
				}
				else if (!isSaveMode && (Object)(object)newTramUI != (Object)null && (Object)(object)val != (Object)null)
				{
					val.ui_escapeStack.Remove((UIPrefabScript)(object)newTramUI);
				}
				MelonLogger.Msg("[GameManager] UI Hidden");
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("Error closing UI: " + ex.Message);
			}
		}

		public void Update()
		{
			if ((Object)(object)mainPanel != (Object)null && mainPanel.activeSelf)
			{
				CanvasGroup component = mainPanel.GetComponent<CanvasGroup>();
				if ((Object)(object)component != (Object)null && component.alpha < 1f)
				{
					component.alpha = Mathf.MoveTowards(component.alpha, 1f, Time.unscaledDeltaTime * 5f);
				}
			}
			if (currentTab == 1 && Time.time - lastRefreshTime > RefreshInterval && !isSearching)
			{
				SearchForRooms();
				lastRefreshTime = Time.time;
			}
		}

		private void SearchForRooms()
		{
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (!SteamManager.Initialized)
				{
					MelonLogger.Warning("[GameManager] Steam not initialized");
					if ((Object)(object)statusText != (Object)null)
					{
						((TMP_Text)statusText).text = "Steam not initialized";
					}
					return;
				}
				if (isSearching)
				{
					MelonLogger.Msg("[GameManager] Already searching, skipping request");
					return;
				}
				if ((Object)(object)statusText == (Object)null)
				{
					MelonLogger.Warning("[GameManager] statusText is null, UI may be closed");
					return;
				}
				isSearching = true;
				searchAttempts++;
				if (searchAttempts > 100)
				{
					searchAttempts = 0;
				}
				MelonLogger.Msg($"[GameManager] Starting room search (attempt {searchAttempts})");
				((TMP_Text)statusText).text = "Searching for rooms...";
				SteamMatchmaking.AddRequestLobbyListFilterSlotsAvailable(1);
				SteamMatchmaking.AddRequestLobbyListDistanceFilter((ELobbyDistanceFilter)0);
				SteamMatchmaking.AddRequestLobbyListResultCountFilter(50);
				SteamAPICall_t val = SteamMatchmaking.RequestLobbyList();
				MelonLogger.Msg($"[GameManager] RequestLobbyList returned handle: {val}");
				if (lobbySearchResult != null)
				{
					lobbySearchResult.Set(val, (APIDispatchDelegate<LobbyMatchList_t>)OnLobbySearchComplete);
					MelonLogger.Msg("[GameManager] Callback registered");
				}
				else
				{
					MelonLogger.Error("[GameManager] lobbySearchResult is NULL!");
					isSearching = false;
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("[GameManager] Room search error: " + ex.Message);
				isSearching = false;
			}
		}

		private void OnLobbySearchComplete(LobbyMatchList_t result, bool bIOFailure)
		{
			//IL_000b: 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_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: 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)
			try
			{
				MelonLogger.Msg($"[GameManager] OnLobbySearchComplete called - IOFailure: {bIOFailure}, Lobbies: {result.m_nLobbiesMatching}");
				if (bIOFailure)
				{
					MelonLogger.Error("[GameManager] Lobby search IO failure!");
					((TMP_Text)statusText).text = "Search failed - retrying...";
					isSearching = false;
					return;
				}
				cachedRooms.Clear();
				roomList.Clear();
				MelonLogger.Msg($"[GameManager] Processing {result.m_nLobbiesMatching} lobbies");
				for (int i = 0; i < result.m_nLobbiesMatching; i++)
				{
					CSteamID lobbyByIndex = SteamMatchmaking.GetLobbyByIndex(i);
					MelonLogger.Msg($"[GameManager] Processing lobby {i}: {lobbyByIndex}");
					RoomInfo roomInfo = ExtractRoomInfo(lobbyByIndex);
					if (roomInfo != null)
					{
						cachedRooms[roomInfo.RoomId] = roomInfo;
						roomList.Add(roomInfo);
						MelonLogger.Msg($"[GameManager] Added room: {roomInfo.DungeonName} ({roomInfo.PlayerCount}/{roomInfo.MaxPlayers})");
					}
					else
					{
						MelonLogger.Warning($"[GameManager] Failed to extract room info for lobby {i}");
					}
				}
				roomList = roomList.OrderByDescending((RoomInfo r) => r.PlayerCount).ToList();
				if (roomList.Count > 0)
				{
					((TMP_Text)statusText).text = "Ready";
					MelonLogger.Msg($"[GameManager] Found {roomList.Count} available rooms");
				}
				else
				{
					((TMP_Text)statusText).text = "No rooms found - searching again...";
					MelonLogger.Msg("[GameManager] No rooms found, will retry on next refresh");
				}
				RefreshRoomsDisplay();
				isSearching = false;
			}
			catch (Exception ex)
			{
				MelonLogger.Error("[GameManager] Lobby search completion error: " + ex.Message);
				isSearching = false;
			}
		}

		private RoomInfo ExtractRoomInfo(CSteamID lobbyId)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				string text = SteamMatchmaking.GetLobbyData(lobbyId, "DungeonName");
				string text2 = SteamMatchmaking.GetLobbyData(lobbyId, "Status");
				int numLobbyMembers = SteamMatchmaking.GetNumLobbyMembers(lobbyId);
				if (string.IsNullOrEmpty(text))
				{
					text = "Room " + ((object)(CSteamID)(ref lobbyId)).ToString().Substring(0, 8);
				}
				if (string.IsNullOrEmpty(text2))
				{
					text2 = "Waiting";
				}
				RoomInfo obj = new RoomInfo
				{
					RoomId = lobbyId.m_SteamID.ToString()
				};
				CSteamID lobbyOwner = SteamMatchmaking.GetLobbyOwner(lobbyId);
				obj.HostSteamId = ((object)(CSteamID)(ref lobbyOwner)).ToString();
				obj.PlayerCount = numLobbyMembers;
				obj.MaxPlayers = 4;
				obj.Status = text2;
				obj.DungeonName = text;
				obj.CreatedTime = Time.time;
				RoomInfo roomInfo = obj;
				MelonLogger.Msg($"[GameManager] Extracted room: {text} | ID: {roomInfo.RoomId} | Players: {numLobbyMembers}/4 | Status: {text2}");
				return roomInfo;
			}
			catch (Exception ex)
			{
				MelonLogger.Error("[GameManager] Error extracting room info: " + ex.Message);
				return null;
			}
		}

		private void LoadAllSaves()
		{
			allSaves.Clear();
			try
			{
				for (int i = 0; i < 10000; i++)
				{
					string saveFileName = MMSaveGameData.GetSaveFileName(i);
					try
					{
						if (MonoSingleton<PlatformMgr>.Instance.IsSaveFileExist(saveFileName))
						{
							MMSaveGameData val = MonoSingleton<PlatformMgr>.Instance.Load<MMSaveGameData>(saveFileName);
							if (val != null)
							{
								allSaves.Add(new SaveSlotData
								{
									SlotId = i,
									FileName = saveFileName,
									SaveData = val,
									LastModified = DateTime.Now
								});
								MelonLogger.Msg($"[GameManager] Loaded save from slot {i}");
							}
						}
					}
					catch (Exception ex)
					{
						MelonLogger.Warning($"Error loading save slot {i}: {ex.Message}");
					}
				}
				allSaves = allSaves.OrderByDescending((SaveSlotData s) => s.LastModified).ToList();
				nextAvailableSlot = 0;
				foreach (SaveSlotData allSafe in allSaves)
				{
					if (allSafe.SlotId >= nextAvailableSlot)
					{
						nextAvailableSlot = allSafe.SlotId + 1;
					}
				}
				MelonLogger.Msg($"[GameManager] Loaded {allSaves.Count} saves. Next available slot: {nextAvailableSlot}");
			}
			catch (Exception ex2)
			{
				MelonLogger.Warning("Error loading saves: " + ex2.Message);
			}
		}

		public void RefreshUI()
		{
			try
			{
				MelonLogger.Msg("[GameManager] RefreshUI called");
				if ((Object)(object)mainPanel == (Object)null)
				{
					MelonLogger.Error("[GameManager] mainPanel is null, cannot refresh");
					return;
				}
				currentPage = 0;
				currentTab = 0;
				isSearching = false;
				LoadAllSaves();
				mainPanel.SetActive(true);
				CanvasGroup component = mainPanel.GetComponent<CanvasGroup>();
				if ((Object)(object)component != (Object)null)
				{
					component.alpha = 0f;
				}
				RefreshDisplay();
				MelonLogger.Msg("[GameManager] RefreshUI completed - UI shown");
			}
			catch (Exception ex)
			{
				MelonLogger.Error("[GameManager] Error in RefreshUI: " + ex.Message);
			}
		}

		public void Cleanup()
		{
			try
			{
				allSaves.Clear();
				roomList.Clear();
				cachedRooms.Clear();
				if (lobbySearchResult != null)
				{
					lobbySearchResult = null;
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[GameManager] Cleanup error: " + ex.Message);
			}
		}

		private Color GetColorFromConfig(string key, Color defaultColor)
		{
			//IL_0016: 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_0038: 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)
			if (Config == null)
			{
				return defaultColor;
			}
			string value = Config.GetValue(key, "#" + ColorUtility.ToHtmlStringRGBA(defaultColor));
			Color result = default(Color);
			if (ColorUtility.TryParseHtmlString(value, ref result))
			{
				return result;
			}
			return defaultColor;
		}
	}
	public class RoomInfo
	{
		public string RoomId { get; set; } = "";


		public int PlayerCount { get; set; }

		public int MaxPlayers { get; set; }

		public string HostSteamId { get; set; } = "";


		public string Status { get; set; } = "Unknown";


		public string DungeonName { get; set; } = "Unknown";


		public float CreatedTime { get; set; }
	}
	public enum ButtonType
	{
		Primary,
		Secondary,
		Destructive
	}
	public static class ColorExtensions
	{
		public static Color ToColor(this string color)
		{
			//IL_000c: 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)
			Color result = default(Color);
			if (ColorUtility.TryParseHtmlString(color, ref result))
			{
				return result;
			}
			return Color.white;
		}
	}
	public class ButtonHoverAnimation : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler
	{
		private Vector3 originalScale;

		private bool isHovered;

		private const float HOVER_SCALE = 1.05f;

		private const float ANIMATION_SPEED = 10f;

		private void Start()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			originalScale = ((Component)this).transform.localScale;
		}

		private void OnEnable()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			originalScale = Vector3.one;
			((Component)this).transform.localScale = Vector3.one;
			isHovered = false;
		}

		public void OnPointerEnter(PointerEventData eventData)
		{
			isHovered = true;
		}

		public void OnPointerExit(PointerEventData eventData)
		{
			isHovered = false;
		}

		private void Update()
		{
			//IL_0011: 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_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: 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_0032: 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)
			Vector3 val = (isHovered ? (originalScale * 1.05f) : originalScale);
			((Component)this).transform.localScale = Vector3.Lerp(((Component)this).transform.localScale, val, Time.unscaledDeltaTime * 10f);
		}
	}
}
namespace BetterJoiner.Core.Config
{
	public class ConfigManager
	{
		private const string MAIN_CATEGORY = "Better Joiner";

		private const string HOTKEYS_CATEGORY = "Better Joiner Hotkeys";

		private MelonPreferences_Category mainCategory;

		private MelonPreferences_Category hotkeysCategory;

		private Dictionary<string, MelonPreferences_Entry<string>> stringEntries = new Dictionary<string, MelonPreferences_Entry<string>>();

		private Dictionary<string, MelonPreferences_Entry<bool>> boolEntries = new Dictionary<string, MelonPreferences_Entry<bool>>();

		private Dictionary<string, MelonPreferences_Entry<float>> floatEntries = new Dictionary<string, MelonPreferences_Entry<float>>();

		private Dictionary<string, MelonPreferences_Entry<string>> hotkeyEntries = new Dictionary<string, MelonPreferences_Entry<string>>();

		public ConfigManager()
		{
			mainCategory = MelonPreferences.CreateCategory("Better Joiner", "Better Joiner Configuration");
			hotkeysCategory = MelonPreferences.CreateCategory("Better Joiner Hotkeys", "Better Joiner Hotkey Configuration");
		}

		public void LoadAllConfigs()
		{
		}

		public T GetValue<T>(string key, T defaultValue, string description = "")
		{
			try
			{
				if (typeof(T) == typeof(string))
				{
					if (!stringEntries.TryGetValue(key, out MelonPreferences_Entry<string> value))
					{
						value = mainCategory.CreateEntry<string>(key, (string)(object)defaultValue, key, description, false, false, (ValueValidator)null, (string)null);
						stringEntries[key] = value;
					}
					return (T)(object)value.Value;
				}
				if (typeof(T) == typeof(bool))
				{
					if (!boolEntries.TryGetValue(key, out MelonPreferences_Entry<bool> value2))
					{
						value2 = mainCategory.CreateEntry<bool>(key, (bool)(object)defaultValue, key, description, false, false, (ValueValidator)null, (string)null);
						boolEntries[key] = value2;
					}
					return (T)(object)value2.Value;
				}
				if (typeof(T) == typeof(float))
				{
					if (!floatEntries.TryGetValue(key, out MelonPreferences_Entry<float> value3))
					{
						value3 = mainCategory.CreateEntry<float>(key, (float)(object)defaultValue, key, description, false, false, (ValueValidator)null, (string)null);
						floatEntries[key] = value3;
					}
					return (T)(object)value3.Value;
				}
				MelonLogger.Warning("Unsupported type " + typeof(T).Name + " for key " + key);
				return defaultValue;
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("Error getting " + typeof(T).Name + " " + key + ": " + ex.Message);
				return defaultValue;
			}
		}

		public void SetValue<T>(string key, T value, string description = "")
		{
			try
			{
				if (typeof(T) == typeof(string))
				{
					if (!stringEntries.TryGetValue(key, out MelonPreferences_Entry<string> value2))
					{
						value2 = mainCategory.CreateEntry<string>(key, (string)(object)value, key, description, false, false, (ValueValidator)null, (string)null);
						stringEntries[key] = value2;
					}
					else
					{
						value2.Value = (string)(object)value;
					}
				}
				else if (typeof(T) == typeof(bool))
				{
					if (!boolEntries.TryGetValue(key, out MelonPreferences_Entry<bool> value3))
					{
						value3 = mainCategory.CreateEntry<bool>(key, (bool)(object)value, key, description, false, false, (ValueValidator)null, (string)null);
						boolEntries[key] = value3;
					}
					else
					{
						value3.Value = (bool)(object)value;
					}
				}
				else
				{
					if (!(typeof(T) == typeof(float)))
					{
						MelonLogger.Warning("Unsupported type " + typeof(T).Name + " for key " + key);
						return;
					}
					if (!floatEntries.TryGetValue(key, out MelonPreferences_Entry<float> value4))
					{
						value4 = mainCategory.CreateEntry<float>(key, (float)(object)value, key, description, false, false, (ValueValidator)null, (string)null);
						floatEntries[key] = value4;
					}
					else
					{
						value4.Value = (float)(object)value;
					}
				}
				MelonPreferences.Save();
			}
			catch (Exception ex)
			{
				MelonLogger.Error("Error setting " + typeof(T).Name + " " + key + ": " + ex.Message);
			}
		}

		public HotkeyConfig GetHotkey(string feature)
		{
			try
			{
				if (!hotkeyEntries.TryGetValue(feature, out MelonPreferences_Entry<string> value))
				{
					value = hotkeysCategory.CreateEntry<string>(feature, "None", feature, "", false, false, (ValueValidator)null, (string)null);
					hotkeyEntries[feature] = value;
				}
				if (value != null)
				{
					return HotkeyConfig.Parse(value.Value);
				}
				return new HotkeyConfig((KeyCode)0);
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("Error getting hotkey " + feature + ": " + ex.Message);
				return new HotkeyConfig((KeyCode)0);
			}
		}

		public void SetHotkey(string feature, HotkeyConfig hotkey)
		{
			try
			{
				if (!hotkeyEntries.TryGetValue(feature, out MelonPreferences_Entry<string> value))
				{
					value = hotkeysCategory.CreateEntry<string>(feature, hotkey.ToString(), feature, "", false, false, (ValueValidator)null, (string)null);
					hotkeyEntries[feature] = value;
				}
				else
				{
					value.Value = hotkey.ToString();
				}
				MelonPreferences.Save();
			}
			catch (Exception ex)
			{
				MelonLogger.Error("Error setting hotkey " + feature + ": " + ex.Message);
			}
		}

		public bool IsHotkeyPressed(string feature)
		{
			return GetHotkey(feature).IsPressed();
		}

		public Dictionary<string, HotkeyConfig> GetAllHotkeys()
		{
			Dictionary<string, HotkeyConfig> dictionary = new Dictionary<string, HotkeyConfig>();
			try
			{
				foreach (MelonPreferences_Entry entry in hotkeysCategory.Entries)
				{
					if (entry is MelonPreferences_Entry<string> val)
					{
						dictionary[entry.Identifier] = HotkeyConfig.Parse(val.Value);
						hotkeyEntries[entry.Identifier] = val;
					}
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("Error getting all hotkeys: " + ex.Message);
			}
			return dictionary;
		}
	}
	public class HotkeyConfig
	{
		public KeyCode Key { get; set; }

		public bool Shift { get; set; }

		public bool Ctrl { get; set; }

		public bool Alt { get; set; }

		public HotkeyConfig(KeyCode key = 0, bool shift = false, bool ctrl = false, bool alt = false)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			Key = key;
			Shift = shift;
			Ctrl = ctrl;
			Alt = alt;
		}

		public bool IsPressed()
		{
			//IL_0001: 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_0020: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if ((int)Key == 0)
				{
					return false;
				}
				Keyboard current = Keyboard.current;
				if (current == null)
				{
					return false;
				}
				KeyCode key = Key;
				KeyControl val = current.FindKeyOnCurrentKeyboardLayout(((object)(KeyCode)(ref key)).ToString());
				if (val == nu