Files
crystall-punk-14/Content.Client/Pinpointer/UI/StationMapBoundUserInterface.cs

40 lines
1.1 KiB
C#
Raw Permalink Normal View History

using Content.Shared.Pinpointer;
using Robust.Client.UserInterface;
2023-04-13 16:21:24 +10:00
namespace Content.Client.Pinpointer.UI;
public sealed class StationMapBoundUserInterface : BoundUserInterface
{
2023-07-08 09:02:17 -07:00
[ViewVariables]
2023-04-13 16:21:24 +10:00
private StationMapWindow? _window;
2023-07-08 09:02:17 -07:00
public StationMapBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
2023-04-13 16:21:24 +10:00
{
}
protected override void Open()
{
base.Open();
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;
}
_window = this.CreateWindow<StationMapWindow>();
_window.Title = EntMan.GetComponent<MetaDataComponent>(Owner).EntityName;
string stationName = string.Empty;
if(EntMan.TryGetComponent<MetaDataComponent>(gridUid, out var gridMetaData))
{
stationName = gridMetaData.EntityName;
}
if (EntMan.TryGetComponent<StationMapComponent>(Owner, out var comp) && comp.ShowLocation)
_window.Set(stationName, gridUid, Owner);
else
_window.Set(stationName, gridUid, null);
2023-04-13 16:21:24 +10:00
}
}