Files
OldThink/Content.Client/Medical/CrewMonitoring/CrewMonitoringBoundUserInterface.cs

54 lines
1.4 KiB
C#
Raw Normal View History

using Content.Shared.Medical.CrewMonitoring;
using Robust.Client.GameObjects;
namespace Content.Client.Medical.CrewMonitoring
{
public sealed class CrewMonitoringBoundUserInterface : BoundUserInterface
{
2023-07-08 09:02:17 -07:00
[ViewVariables]
private CrewMonitoringWindow? _menu;
2023-07-08 09:02:17 -07:00
public CrewMonitoringBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}
protected override void Open()
{
2023-04-13 16:21:24 +10:00
EntityUid? gridUid = null;
2023-07-08 09:02:17 -07:00
if (EntMan.TryGetComponent<TransformComponent>(Owner, out var xform))
2023-04-13 16:21:24 +10:00
{
gridUid = xform.GridUid;
}
_menu = new CrewMonitoringWindow(gridUid);
_menu.OpenCentered();
_menu.OnClose += Close;
}
protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);
switch (state)
{
case CrewMonitoringState st:
2023-07-08 09:02:17 -07:00
EntMan.TryGetComponent<TransformComponent>(Owner, out var xform);
2023-04-13 16:21:24 +10:00
_menu?.ShowSensors(st.Sensors, xform?.Coordinates, st.Snap, st.Precision);
break;
}
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (!disposing)
return;
_menu?.Dispose();
}
}
}