Revert "Storage UI V2 (#33045)"

This reverts commit fd25dac720.
This commit is contained in:
Errant
2025-02-05 14:13:06 +01:00
parent d6a9ddd9e0
commit fc80a18c35
11 changed files with 422 additions and 816 deletions

View File

@@ -1,80 +1,39 @@
using Content.Client.UserInterface.Systems.Storage;
using Content.Client.UserInterface.Systems.Storage.Controls;
using Content.Client.Storage.Systems;
using Content.Shared.Storage;
using JetBrains.Annotations;
using Robust.Client.UserInterface;
namespace Content.Client.Storage;
[UsedImplicitly]
public sealed class StorageBoundUserInterface : BoundUserInterface
{
private StorageWindow? _window;
[Dependency] private readonly IEntityManager _entManager = default!;
private readonly StorageSystem _storage;
[Obsolete] public override bool DeferredClose => false;
public StorageBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
IoCManager.InjectDependencies(this);
_storage = _entManager.System<StorageSystem>();
}
protected override void Open()
{
base.Open();
_window = IoCManager.Resolve<IUserInterfaceManager>()
.GetUIController<StorageUIController>()
.CreateStorageWindow(Owner);
if (EntMan.TryGetComponent(Owner, out StorageComponent? storage))
{
_window.UpdateContainer((Owner, storage));
}
_window.OnClose += Close;
_window.FlagDirty();
}
public void Refresh()
{
_window?.FlagDirty();
}
public void Reclaim()
{
if (_window == null)
return;
_window.OnClose -= Close;
_window.Orphan();
_window = null;
if (_entManager.TryGetComponent<StorageComponent>(Owner, out var comp))
_storage.OpenStorageWindow((Owner, comp));
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
Reclaim();
}
public void Hide()
{
if (_window == null)
if (!disposing)
return;
_window.Visible = false;
}
public void Show()
{
if (_window == null)
return;
_window.Visible = true;
}
public void ReOpen()
{
_window?.Orphan();
_window = null;
Open();
_storage.CloseStorageWindow(Owner);
}
}