* Reapply "Remove some BUI boilerplate" (#30214)
This reverts commit cb0ba66be3.
* Fix gas tank
* Fix PA
* Fix microwave
* Comms console underwrap
* Fix rcd
* log wehs
47 lines
1.3 KiB
C#
47 lines
1.3 KiB
C#
using Content.Shared.Medical.CrewMonitoring;
|
|
using Robust.Client.UserInterface;
|
|
|
|
namespace Content.Client.Medical.CrewMonitoring;
|
|
|
|
public sealed class CrewMonitoringBoundUserInterface : BoundUserInterface
|
|
{
|
|
[ViewVariables]
|
|
private CrewMonitoringWindow? _menu;
|
|
|
|
public CrewMonitoringBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
|
{
|
|
}
|
|
|
|
protected override void Open()
|
|
{
|
|
EntityUid? gridUid = null;
|
|
var stationName = string.Empty;
|
|
|
|
if (EntMan.TryGetComponent<TransformComponent>(Owner, out var xform))
|
|
{
|
|
gridUid = xform.GridUid;
|
|
|
|
if (EntMan.TryGetComponent<MetaDataComponent>(gridUid, out var metaData))
|
|
{
|
|
stationName = metaData.EntityName;
|
|
}
|
|
}
|
|
|
|
_menu = this.CreateWindow<CrewMonitoringWindow>();
|
|
_menu.Set(stationName, gridUid);
|
|
}
|
|
|
|
protected override void UpdateState(BoundUserInterfaceState state)
|
|
{
|
|
base.UpdateState(state);
|
|
|
|
switch (state)
|
|
{
|
|
case CrewMonitoringState st:
|
|
EntMan.TryGetComponent<TransformComponent>(Owner, out var xform);
|
|
_menu?.ShowSensors(st.Sensors, Owner, xform?.Coordinates);
|
|
break;
|
|
}
|
|
}
|
|
}
|