refactor: register static-state resets on game end

This commit is contained in:
2026-06-23 22:20:04 +08:00
parent b74005282e
commit 647b130993
7 changed files with 105 additions and 1 deletions
+8
View File
@@ -25,6 +25,7 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
_totalNodeSpInfo = AccessTools.Field(typeof(DysonSphereLayer), "totalNodeSP");
_totalFrameSpInfo = AccessTools.Field(typeof(DysonSphereLayer), "totalFrameSP");
_totalCpInfo = AccessTools.Field(typeof(DysonSphereLayer), "totalCP");
GameLogicProc.OnGameEnd += StopEjectOnNodeComplete.ResetState;
}
public static void Start()
@@ -35,6 +36,7 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
public static void Uninit()
{
GameLogicProc.OnGameEnd -= StopEjectOnNodeComplete.ResetState;
StopEjectOnNodeComplete.Enable(false);
OnlyConstructNodes.Enable(false);
Enable(false);
@@ -346,6 +348,12 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
return comp is { Count: > 0 };
}
internal static void ResetState()
{
_initialized = false;
_nodeForAbsorb = null;
}
private static void OnGameBegin()
{
InitNodeForAbsorb();