From 7aab2e08bd8e26c3dc32a3cf3493446fe35bf7d7 Mon Sep 17 00:00:00 2001 From: kmyuhkyuk <72241714+kmyuhkyuk@users.noreply.github.com> Date: Sun, 22 Mar 2026 22:33:04 +0800 Subject: [PATCH] Fixed LAN UI error after game end --- .../Components/LanMultiplayerHostSubmenu.cs | 9 +-------- .../Patchs/Screens/NMainMenuSubmenuStackPatch.cs | 12 +++++++----- .../SlayTheSpire2.LAN.Multiplayer.csproj | 12 ++++++------ 3 files changed, 14 insertions(+), 19 deletions(-) diff --git a/SlayTheSpire2.LAN.Multiplayer/Components/LanMultiplayerHostSubmenu.cs b/SlayTheSpire2.LAN.Multiplayer/Components/LanMultiplayerHostSubmenu.cs index 5994b64..1a891c5 100644 --- a/SlayTheSpire2.LAN.Multiplayer/Components/LanMultiplayerHostSubmenu.cs +++ b/SlayTheSpire2.LAN.Multiplayer/Components/LanMultiplayerHostSubmenu.cs @@ -15,15 +15,10 @@ namespace SlayTheSpire2.LAN.Multiplayer.Components { private static readonly string ScenePath = SceneHelper.GetScenePath("screens/multiplayer_host_submenu"); - public static LanMultiplayerHostSubmenu? Instance { get; private set; } - private Control? _loadingOverlay; - public new static NMultiplayerHostSubmenu? Create() + public new static LanMultiplayerHostSubmenu? Create() { - if (IsInstanceValid(Instance)) - return Instance; - if (TestMode.IsOn) return null; @@ -41,8 +36,6 @@ namespace SlayTheSpire2.LAN.Multiplayer.Components multiplayerHostSubmenu.QueueFree(); - Instance = lanMultiplayerHostSubmenu; - return lanMultiplayerHostSubmenu; } diff --git a/SlayTheSpire2.LAN.Multiplayer/Patchs/Screens/NMainMenuSubmenuStackPatch.cs b/SlayTheSpire2.LAN.Multiplayer/Patchs/Screens/NMainMenuSubmenuStackPatch.cs index 8431200..94dd4c7 100644 --- a/SlayTheSpire2.LAN.Multiplayer/Patchs/Screens/NMainMenuSubmenuStackPatch.cs +++ b/SlayTheSpire2.LAN.Multiplayer/Patchs/Screens/NMainMenuSubmenuStackPatch.cs @@ -1,5 +1,4 @@ -using Godot; -using HarmonyLib; +using HarmonyLib; using MegaCrit.Sts2.Core.Helpers; using MegaCrit.Sts2.Core.Nodes.Screens.MainMenu; using SlayTheSpire2.LAN.Multiplayer.Components; @@ -16,9 +15,12 @@ namespace SlayTheSpire2.LAN.Multiplayer.Patchs.Screens { if (type == typeof(LanMultiplayerHostSubmenu)) { - if (!GodotObject.IsInstanceValid(LanMultiplayerHostSubmenu.Instance)) + var lanMultiplayerHostSubmenu = + __instance.GetNodeOrNull("LANMultiplayerHostSubmenu"); + + if (lanMultiplayerHostSubmenu == null) { - var lanMultiplayerHostSubmenu = LanMultiplayerHostSubmenu.Create(); + lanMultiplayerHostSubmenu = LanMultiplayerHostSubmenu.Create(); if (lanMultiplayerHostSubmenu != null) { @@ -30,7 +32,7 @@ namespace SlayTheSpire2.LAN.Multiplayer.Patchs.Screens } else { - __result = LanMultiplayerHostSubmenu.Instance; + __result = lanMultiplayerHostSubmenu; } return false; diff --git a/SlayTheSpire2.LAN.Multiplayer/SlayTheSpire2.LAN.Multiplayer.csproj b/SlayTheSpire2.LAN.Multiplayer/SlayTheSpire2.LAN.Multiplayer.csproj index fc69e9c..a669dda 100644 --- a/SlayTheSpire2.LAN.Multiplayer/SlayTheSpire2.LAN.Multiplayer.csproj +++ b/SlayTheSpire2.LAN.Multiplayer/SlayTheSpire2.LAN.Multiplayer.csproj @@ -4,8 +4,8 @@ net9.0 enable enable - 1.6.0.0 - 1.6.0.0 + 1.6.1.0 + 1.6.1.0 @@ -14,16 +14,16 @@ - V:\Slay.the.Spire.2\data_sts2_windows_x86_64\0Harmony.dll + V:\SteamLibrary\steamapps\common\Slay the Spire 2\data_sts2_windows_x86_64\0Harmony.dll - V:\Slay.the.Spire.2\data_sts2_windows_x86_64\GodotSharp.dll + V:\SteamLibrary\steamapps\common\Slay the Spire 2\data_sts2_windows_x86_64\GodotSharp.dll - V:\Slay.the.Spire.2\data_sts2_windows_x86_64\Steamworks.NET.dll + V:\SteamLibrary\steamapps\common\Slay the Spire 2\data_sts2_windows_x86_64\Steamworks.NET.dll - V:\Slay.the.Spire.2\data_sts2_windows_x86_64\sts2.dll + V:\SteamLibrary\steamapps\common\Slay the Spire 2\data_sts2_windows_x86_64\sts2.dll