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 PlayerCount v1.0.0
PlayerCount.dll
Decompiled a year agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using MonoMod.RuntimeDetour; using Photon.Pun; using Photon.Realtime; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("PlayerCount")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("PlayerCount")] [assembly: AssemblyTitle("PlayerCount")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace PlayerCount { [BepInPlugin("nickklmao.playercount", "Player Count", "1.0.0")] internal sealed class Entry : BaseUnityPlugin { private const string MOD_NAME = "Player Count"; internal static readonly ManualLogSource logger = Logger.CreateLogSource("Player Count"); private static void MenuPageLobby_AwakeHook(Action<MenuPageLobby> orig, MenuPageLobby self) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) orig(self); Transform obj = Object.Instantiate<Transform>(((Component)self).transform.Find("Menu Button - Leave/ButtonText"), ((Component)self).transform.Find("Panel")); obj.localPosition = new Vector3(-154f, 10f); TextMeshProUGUI component = ((Component)obj).GetComponent<TextMeshProUGUI>(); ((TMP_Text)component).alignment = (TextAlignmentOptions)516; ((TMP_Text)component).fontSize = 20f; ((Graphic)component).color = Color.white; ((Component)obj).gameObject.AddComponent<PlayerCountBehavior>().tmp = component; } private static void MenuPageEsc_AwakeHook(Action<MenuPageEsc> orig, MenuPageEsc self) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) orig(self); Transform obj = Object.Instantiate<Transform>(((Component)self).transform.Find("Menu Button - Settings/ButtonText"), ((Component)self).transform.Find("Panel")); obj.localPosition = new Vector3(396f, -44.5f); TextMeshProUGUI component = ((Component)obj).GetComponent<TextMeshProUGUI>(); ((TMP_Text)component).alignment = (TextAlignmentOptions)513; ((TMP_Text)component).fontSize = 20f; ((Graphic)component).color = Color.white; ((Component)obj).gameObject.AddComponent<PlayerCountBehavior>().tmp = component; } private void Awake() { //IL_0040: 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) logger.LogDebug((object)"Hooking `MenuPageLobby.Awake`"); new Hook((MethodBase)AccessTools.Method(typeof(MenuPageLobby), "Awake", (Type[])null, (Type[])null), (Delegate)new Action<Action<MenuPageLobby>, MenuPageLobby>(MenuPageLobby_AwakeHook)); logger.LogDebug((object)"Hooking `MenuPageEsc.Start`"); new Hook((MethodBase)AccessTools.Method(typeof(MenuPageEsc), "Start", (Type[])null, (Type[])null), (Delegate)new Action<Action<MenuPageEsc>, MenuPageEsc>(MenuPageEsc_AwakeHook)); } } internal sealed class PlayerCountBehavior : MonoBehaviour { internal TextMeshProUGUI tmp; private void Update() { if (Object.op_Implicit((Object)(object)tmp)) { Room currentRoom = PhotonNetwork.CurrentRoom; ((TMP_Text)tmp).text = $"Players: {((currentRoom != null) ? currentRoom.PlayerCount : 0)}/{((currentRoom != null) ? currentRoom.MaxPlayers : 6)}"; } } } }