Minor UI refactor (#11212)

This commit is contained in:
wrexbe
2022-09-11 20:42:12 -07:00
committed by GitHub
parent 56c2ad6a16
commit 35b90736b7
63 changed files with 93 additions and 147 deletions

View File

@@ -0,0 +1,51 @@
using Content.Shared.Atmos.Components;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
namespace Content.Client.UserInterface.Systems.Atmos.GasTank
{
[UsedImplicitly]
public sealed class GasTankBoundUserInterface
: BoundUserInterface
{
public GasTankBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) :
base(owner, uiKey)
{
}
private GasTankWindow? _window;
public void SetOutputPressure(in float value)
{
SendMessage(new GasTankSetPressureMessage {Pressure = value});
}
public void ToggleInternals()
{
SendMessage(new GasTankToggleInternalsMessage());
}
protected override void Open()
{
base.Open();
_window = new GasTankWindow(this);
_window.OnClose += Close;
_window.OpenCentered();
}
protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);
if (state is GasTankBoundUserInterfaceState cast)
_window?.UpdateState(cast);
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
_window?.Close();
}
}
}