mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-08-05 22:40:16 +08:00
refactor: register static-state resets on game end
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user