Fix salvage magnet UI opening again when activating the console twice (#28010)

This commit is contained in:
ShadowCommander
2024-05-14 16:59:46 -07:00
committed by GitHub
parent f1260dae00
commit 9ea06f3a39

View File

@@ -20,10 +20,14 @@ public sealed class SalvageMagnetBoundUserInterface : BoundUserInterface
protected override void Open()
{
base.Open();
_window = new OfferingWindow();
_window.Title = Loc.GetString("salvage-magnet-window-title");
_window.OnClose += Close;
_window.OpenCenteredLeft();
if (_window is null)
{
_window = new OfferingWindow();
_window.Title = Loc.GetString("salvage-magnet-window-title");
_window.OnClose += Close;
_window.OpenCenteredLeft();
}
}
protected override void UpdateState(BoundUserInterfaceState state)
@@ -108,4 +112,15 @@ public sealed class SalvageMagnetBoundUserInterface : BoundUserInterface
_window.AddOption(option);
}
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (disposing)
{
_window?.Close();
_window?.Dispose();
}
}
}