mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-08-05 10:50:10 +08:00
refactor: register static-state resets on game end
This commit is contained in:
@@ -4,6 +4,7 @@ using UnityEngine.UI;
|
||||
using UXAssist.Common;
|
||||
using UXAssist.Common.GameConstants;
|
||||
using UXAssist.Common.ModFeatures;
|
||||
using GameLogicProc = UXAssist.Common.GameLogic;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace UniverseGenTweaks;
|
||||
@@ -29,14 +30,21 @@ public static class GalaxySelectUIPatch
|
||||
{
|
||||
MoreSettings.Enabled.SettingChanged += OnEnabledChanged;
|
||||
Enable(MoreSettings.Enabled.Value);
|
||||
GameLogicProc.OnGameEnd += ResetState;
|
||||
}
|
||||
|
||||
public static void Uninit()
|
||||
{
|
||||
GameLogicProc.OnGameEnd -= ResetState;
|
||||
MoreSettings.Enabled.SettingChanged -= OnEnabledChanged;
|
||||
Enable(false);
|
||||
}
|
||||
|
||||
private static void ResetState()
|
||||
{
|
||||
// No per-game mutable fields in this file; UI references are lifecycle-safe.
|
||||
}
|
||||
|
||||
private static void OnEnabledChanged(object sender, System.EventArgs e)
|
||||
{
|
||||
Enable(MoreSettings.Enabled.Value);
|
||||
|
||||
Reference in New Issue
Block a user