Fixed LAN UI error after game end

This commit is contained in:
kmyuhkyuk
2026-03-22 22:33:04 +08:00
parent fb4fc9fa93
commit 7aab2e08bd
3 changed files with 14 additions and 19 deletions
@@ -15,15 +15,10 @@ namespace SlayTheSpire2.LAN.Multiplayer.Components
{ {
private static readonly string ScenePath = SceneHelper.GetScenePath("screens/multiplayer_host_submenu"); private static readonly string ScenePath = SceneHelper.GetScenePath("screens/multiplayer_host_submenu");
public static LanMultiplayerHostSubmenu? Instance { get; private set; }
private Control? _loadingOverlay; private Control? _loadingOverlay;
public new static NMultiplayerHostSubmenu? Create() public new static LanMultiplayerHostSubmenu? Create()
{ {
if (IsInstanceValid(Instance))
return Instance;
if (TestMode.IsOn) if (TestMode.IsOn)
return null; return null;
@@ -41,8 +36,6 @@ namespace SlayTheSpire2.LAN.Multiplayer.Components
multiplayerHostSubmenu.QueueFree(); multiplayerHostSubmenu.QueueFree();
Instance = lanMultiplayerHostSubmenu;
return lanMultiplayerHostSubmenu; return lanMultiplayerHostSubmenu;
} }
@@ -1,5 +1,4 @@
using Godot; using HarmonyLib;
using HarmonyLib;
using MegaCrit.Sts2.Core.Helpers; using MegaCrit.Sts2.Core.Helpers;
using MegaCrit.Sts2.Core.Nodes.Screens.MainMenu; using MegaCrit.Sts2.Core.Nodes.Screens.MainMenu;
using SlayTheSpire2.LAN.Multiplayer.Components; using SlayTheSpire2.LAN.Multiplayer.Components;
@@ -16,9 +15,12 @@ namespace SlayTheSpire2.LAN.Multiplayer.Patchs.Screens
{ {
if (type == typeof(LanMultiplayerHostSubmenu)) if (type == typeof(LanMultiplayerHostSubmenu))
{ {
if (!GodotObject.IsInstanceValid(LanMultiplayerHostSubmenu.Instance)) var lanMultiplayerHostSubmenu =
__instance.GetNodeOrNull<LanMultiplayerHostSubmenu>("LANMultiplayerHostSubmenu");
if (lanMultiplayerHostSubmenu == null)
{ {
var lanMultiplayerHostSubmenu = LanMultiplayerHostSubmenu.Create(); lanMultiplayerHostSubmenu = LanMultiplayerHostSubmenu.Create();
if (lanMultiplayerHostSubmenu != null) if (lanMultiplayerHostSubmenu != null)
{ {
@@ -30,7 +32,7 @@ namespace SlayTheSpire2.LAN.Multiplayer.Patchs.Screens
} }
else else
{ {
__result = LanMultiplayerHostSubmenu.Instance; __result = lanMultiplayerHostSubmenu;
} }
return false; return false;
@@ -4,8 +4,8 @@
<TargetFramework>net9.0</TargetFramework> <TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<AssemblyVersion>1.6.0.0</AssemblyVersion> <AssemblyVersion>1.6.1.0</AssemblyVersion>
<FileVersion>1.6.0.0</FileVersion> <FileVersion>1.6.1.0</FileVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@@ -14,16 +14,16 @@
<ItemGroup> <ItemGroup>
<Reference Include="0Harmony"> <Reference Include="0Harmony">
<HintPath>V:\Slay.the.Spire.2\data_sts2_windows_x86_64\0Harmony.dll</HintPath> <HintPath>V:\SteamLibrary\steamapps\common\Slay the Spire 2\data_sts2_windows_x86_64\0Harmony.dll</HintPath>
</Reference> </Reference>
<Reference Include="GodotSharp"> <Reference Include="GodotSharp">
<HintPath>V:\Slay.the.Spire.2\data_sts2_windows_x86_64\GodotSharp.dll</HintPath> <HintPath>V:\SteamLibrary\steamapps\common\Slay the Spire 2\data_sts2_windows_x86_64\GodotSharp.dll</HintPath>
</Reference> </Reference>
<Reference Include="Steamworks.NET"> <Reference Include="Steamworks.NET">
<HintPath>V:\Slay.the.Spire.2\data_sts2_windows_x86_64\Steamworks.NET.dll</HintPath> <HintPath>V:\SteamLibrary\steamapps\common\Slay the Spire 2\data_sts2_windows_x86_64\Steamworks.NET.dll</HintPath>
</Reference> </Reference>
<Reference Include="sts2"> <Reference Include="sts2">
<HintPath>V:\Slay.the.Spire.2\data_sts2_windows_x86_64\sts2.dll</HintPath> <HintPath>V:\SteamLibrary\steamapps\common\Slay the Spire 2\data_sts2_windows_x86_64\sts2.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>