Dispose storage windows on state change (#20095)
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
|
using Content.Client.Gameplay;
|
||||||
using Content.Client.Storage.Systems;
|
using Content.Client.Storage.Systems;
|
||||||
using Content.Shared.Storage;
|
using Content.Shared.Storage;
|
||||||
using Robust.Client.UserInterface.Controllers;
|
using Robust.Client.UserInterface.Controllers;
|
||||||
|
|
||||||
namespace Content.Client.Storage.UI;
|
namespace Content.Client.Storage.UI;
|
||||||
|
|
||||||
public sealed class StorageUIController : UIController, IOnSystemChanged<StorageSystem>
|
public sealed class StorageUIController : UIController, IOnSystemChanged<StorageSystem>, IOnStateExited<GameplayState>
|
||||||
{
|
{
|
||||||
// This is mainly to keep legacy functionality for now.
|
// This is mainly to keep legacy functionality for now.
|
||||||
private readonly Dictionary<EntityUid, StorageWindow> _storageWindows = new();
|
private readonly Dictionary<EntityUid, StorageWindow> _storageWindows = new();
|
||||||
@@ -57,4 +58,14 @@ public sealed class StorageUIController : UIController, IOnSystemChanged<Storage
|
|||||||
{
|
{
|
||||||
system.StorageUpdated -= OnStorageUpdate;
|
system.StorageUpdated -= OnStorageUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnStateExited(GameplayState state)
|
||||||
|
{
|
||||||
|
foreach (var window in _storageWindows.Values)
|
||||||
|
{
|
||||||
|
window.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
_storageWindows.Clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user