41 lines
1.0 KiB
C#
41 lines
1.0 KiB
C#
using Content.Shared.Atmos.Components;
|
|
|
|
namespace Content.Client.Atmos.Consoles;
|
|
|
|
public sealed class AtmosMonitoringConsoleBoundUserInterface : BoundUserInterface
|
|
{
|
|
[ViewVariables]
|
|
private AtmosMonitoringConsoleWindow? _menu;
|
|
|
|
public AtmosMonitoringConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) { }
|
|
|
|
protected override void Open()
|
|
{
|
|
base.Open();
|
|
|
|
_menu = new AtmosMonitoringConsoleWindow(this, Owner);
|
|
_menu.OpenCentered();
|
|
_menu.OnClose += Close;
|
|
}
|
|
|
|
protected override void UpdateState(BoundUserInterfaceState state)
|
|
{
|
|
base.UpdateState(state);
|
|
|
|
if (state is not AtmosMonitoringConsoleBoundInterfaceState castState)
|
|
return;
|
|
|
|
EntMan.TryGetComponent<TransformComponent>(Owner, out var xform);
|
|
_menu?.UpdateUI(xform?.Coordinates, castState.AtmosNetworks);
|
|
}
|
|
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
base.Dispose(disposing);
|
|
if (!disposing)
|
|
return;
|
|
|
|
_menu?.Dispose();
|
|
}
|
|
}
|