using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using MorePlayersSimple; using Photon.Realtime; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("MorePlayersSimpleLateJoinPatch")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MorePlayersSimpleLateJoinPatch")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("44576dbc-d7f3-47b6-9220-49db611727be")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace MorePlayersSimpleLateJoinPatch; [BepInPlugin("cnxc.MorePlayersSimpleLateJoinPatch", "MorePlayersSimple + LateJoinNow Patch", "0.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Log; private Harmony _harmony; private void Awake() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; _harmony = new Harmony("cnxc.MorePlayersSimpleLateJoinPatch"); _harmony.PatchAll(); Log.LogInfo((object)"========================================"); Log.LogInfo((object)"MorePlayersSimple + LateJoinNow 补丁已加载 (版本 0.1.0)"); Log.LogInfo((object)"功能: 将 PlayerTtl / EmptyRoomTtl 从 0 修正为 -1"); Log.LogInfo((object)"效果: 确保 LateJoinNow 中途加入机制正常工作"); Log.LogInfo((object)"========================================"); } } [HarmonyPatch(typeof(OpCreateRoomPatch), "Prefix")] public static class FixCreateRoomTtl { [HarmonyPostfix] public static void Postfix(EnterRoomParams enterRoomParams) { if (enterRoomParams?.RoomOptions != null) { int playerTtl = enterRoomParams.RoomOptions.PlayerTtl; int emptyRoomTtl = enterRoomParams.RoomOptions.EmptyRoomTtl; enterRoomParams.RoomOptions.PlayerTtl = -1; enterRoomParams.RoomOptions.EmptyRoomTtl = -1; Plugin.Log.LogInfo((object)$"[TTL修正] OpCreateRoom: PlayerTtl {playerTtl} -> -1, EmptyRoomTtl {emptyRoomTtl} -> -1"); } else { Plugin.Log.LogWarning((object)"[TTL修正] OpCreateRoom: enterRoomParams 或 RoomOptions 为 null,无法修正"); } } } [HarmonyPatch(typeof(OpJoinOrCreateRoomPatch), "Prefix")] public static class FixJoinOrCreateRoomTtl { [HarmonyPostfix] public static void Postfix(EnterRoomParams enterRoomParams) { if (enterRoomParams?.RoomOptions != null) { int playerTtl = enterRoomParams.RoomOptions.PlayerTtl; int emptyRoomTtl = enterRoomParams.RoomOptions.EmptyRoomTtl; enterRoomParams.RoomOptions.PlayerTtl = -1; enterRoomParams.RoomOptions.EmptyRoomTtl = -1; Plugin.Log.LogInfo((object)$"[TTL修正] OpJoinOrCreateRoom: PlayerTtl {playerTtl} -> -1, EmptyRoomTtl {emptyRoomTtl} -> -1"); } else { Plugin.Log.LogWarning((object)"[TTL修正] OpJoinOrCreateRoom: enterRoomParams 或 RoomOptions 为 null,无法修正"); } } }