-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v245.0.0 (and Storage UI V2) (#1799)
Contains: - Storage UI v2, required for removing DeferredClose. - Stock market refactor (mostly some basic changes to stock market, didn't want to make a whole other PR for it) - Make guidebook remember where you left off - Any other PRs are purely for fixing issues related to the above PRs or the engine update. :cl: - add: Ported Storage UI v2. - tweak: The guidebook will now remember where you left off. --------- Co-authored-by: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Co-authored-by: DrSmugleaf <10968691+DrSmugleaf@users.noreply.github.com> Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: deltanedas <39013340+deltanedas@users.noreply.github.com> Co-authored-by: 12rabbits <53499656+12rabbits@users.noreply.github.com> Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com> Co-authored-by: gluesniffler <159397573+gluesniffler@users.noreply.github.com> Co-authored-by: AJCM-git <60196617+AJCM-git@users.noreply.github.com>
- Loading branch information
1 parent
21567ac
commit 3c37ff1
Showing
34 changed files
with
960 additions
and
615 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,80 @@ | ||
using Content.Client.Storage.Systems; | ||
using Content.Client.UserInterface.Systems.Storage; | ||
using Content.Client.UserInterface.Systems.Storage.Controls; | ||
using Content.Shared.Storage; | ||
using JetBrains.Annotations; | ||
using Robust.Client.UserInterface; | ||
|
||
namespace Content.Client.Storage; | ||
|
||
[UsedImplicitly] | ||
public sealed class StorageBoundUserInterface : BoundUserInterface | ||
{ | ||
[Dependency] private readonly IEntityManager _entManager = default!; | ||
|
||
[Obsolete] public override bool DeferredClose => false; | ||
private readonly StorageSystem _storage; | ||
private StorageWindow? _window; | ||
|
||
public StorageBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) | ||
{ | ||
IoCManager.InjectDependencies(this); | ||
_storage = _entManager.System<StorageSystem>(); | ||
} | ||
|
||
protected override void Open() | ||
{ | ||
base.Open(); | ||
|
||
if (_entManager.TryGetComponent<StorageComponent>(Owner, out var comp)) | ||
_storage.OpenStorageWindow((Owner, comp)); | ||
_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; | ||
} | ||
|
||
protected override void Dispose(bool disposing) | ||
{ | ||
base.Dispose(disposing); | ||
if (!disposing) | ||
|
||
Reclaim(); | ||
} | ||
|
||
public void Hide() | ||
{ | ||
if (_window == null) | ||
return; | ||
|
||
_storage.CloseStorageWindow(Owner); | ||
_window.Visible = false; | ||
} | ||
|
||
public void Show() | ||
{ | ||
if (_window == null) | ||
return; | ||
|
||
_window.Visible = true; | ||
} | ||
|
||
public void ReOpen() | ||
{ | ||
_window?.Orphan(); | ||
_window = null; | ||
Open(); | ||
} | ||
} | ||
|
Oops, something went wrong.