Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of PauseMenu Lobby Name v1.1.0
QuickMenuLobbyName.dll
Decompiled 2 years agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("QuickMenuLobbyName")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("QuickMenuLobbyName")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("7402d9bf-e957-42b4-9407-032eecaae77d")] [assembly: AssemblyFileVersion("1.1.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.1.0.0")] namespace QuickMenuLobbyName; [BepInPlugin("command.QuickMenuLobbyName", "PauseMenu Lobby Name", "1.1.0")] public class Plugin : BaseUnityPlugin { private static GameObject lobbyNameObj; private static GameObject QuickMenuObj; private static TextMeshProUGUI nameObj; private static string lobbyName; private readonly Harmony lobbyHarmony = new Harmony("command.QuickMenuLobbyName"); public const string VERSION = "1.1.0"; public const string GUID = "command.QuickMenuLobbyName"; public const string NAME = "PauseMenu Lobby Name"; public static ConfigEntry<bool> CopyNameOnDisconnect; public static ConfigEntry<float> lobbyNameFont; private void Awake() { CopyNameOnDisconnect = ((BaseUnityPlugin)this).Config.Bind<bool>("Mod Settings", "Copy on disconnect", false, "Should the mod copy the name of the lobby you were in before you disconnect?"); lobbyNameFont = ((BaseUnityPlugin)this).Config.Bind<float>("Mod Settings", "Font size", 16.5f, "The font of the lobby name text"); lobbyHarmony.PatchAll(typeof(Plugin)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"QuickMenu patched to add the lobby name!"); } [HarmonyPatch(typeof(QuickMenuManager), "Start")] [HarmonyPostfix] private static void GetLobbyNameAndPatch(ref QuickMenuManager __instance) { lobbyName = GameNetworkManager.Instance.steamLobbyName; if ((Object)(object)QuickMenuObj == (Object)null) { QuickMenuObj = GameObject.Find("/Systems/UI/Canvas/QuickMenu/"); } if ((Object)(object)GameObject.Find("LobbyName") == (Object)null) { MakeObj(__instance); } } [HarmonyPatch(typeof(QuickMenuManager), "OpenQuickMenu")] [HarmonyPostfix] public static void MenuChecks(ref QuickMenuManager __instance) { if (__instance.isMenuOpen) { if (!Object.op_Implicit((Object)(object)lobbyNameObj)) { MakeObj(__instance); } lobbyNameObj.SetActive(true); ((Component)nameObj).gameObject.SetActive(true); } } [HarmonyPatch(typeof(GameNetworkManager), "Disconnect")] [HarmonyPostfix] public static void CopyLobbyName() { if (CopyNameOnDisconnect.Value) { CopyName(); } } [HarmonyPatch(typeof(QuickMenuManager), "Update")] [HarmonyPostfix] public static void NameDisplay(ref QuickMenuManager __instance) { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) if (__instance.mainButtonsPanel.activeSelf) { ((Graphic)nameObj).color = new Color(1f, 0.43921f, 0.0039f, 1f); lobbyNameObj.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, -200f); ((TMP_Text)nameObj).text = $"Lobby Name:\n{lobbyName}"; } else { lobbyNameObj.GetComponent<RectTransform>().anchoredPosition = new Vector2(-100f, -20f); if (CopyNameOnDisconnect.Value) { ((TMP_Text)nameObj).text = $"(The lobby's name will be copied)\nLobby Name:\n{lobbyName}"; } if (!CopyNameOnDisconnect.Value) { ((TMP_Text)nameObj).text = $"! Lobby Name:\n{lobbyName}"; ((Graphic)nameObj).color = new Color(1f, 14f / 85f, 0f, 1f); } } if (__instance.settingsPanel.activeSelf) { lobbyNameObj.SetActive(false); } else { lobbyNameObj.SetActive(true); } } private static void CopyName() { string text2 = (GUIUtility.systemCopyBuffer = lobbyName).ToString(); } private static void MakeObj(QuickMenuManager menuManager) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) lobbyNameObj = new GameObject("LobbyName"); lobbyNameObj.transform.SetParent(QuickMenuObj.transform, false); lobbyNameObj.AddComponent<RectTransform>(); lobbyNameObj.GetComponent<RectTransform>().sizeDelta = new Vector2(400f, 50f); lobbyNameObj.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, -200f); lobbyNameObj.transform.localScale = new Vector3(1f, 1f, 1f); nameObj = lobbyNameObj.AddComponent<TextMeshProUGUI>(); ((TMP_Text)nameObj).transform.SetParent(lobbyNameObj.transform, false); ((TMP_Text)nameObj).overflowMode = (TextOverflowModes)0; ((Behaviour)nameObj).enabled = true; ((TMP_Text)nameObj).fontSize = lobbyNameFont.Value; ((TMP_Text)nameObj).alignment = (TextAlignmentOptions)514; ((TMP_Text)nameObj).font = ((TMP_Text)menuManager.settingsBackButton).font; } }