Files
tbd-station-14/Content.Client/Gateway/UI/GatewayBoundUserInterface.cs
2023-08-02 20:39:27 +10:00

46 lines
1.0 KiB
C#

using Content.Shared.Gateway;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
namespace Content.Client.Gateway.UI;
[UsedImplicitly]
public sealed class GatewayBoundUserInterface : BoundUserInterface
{
private GatewayWindow? _window;
public GatewayBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}
protected override void Open()
{
base.Open();
_window = new GatewayWindow();
_window.OpenPortal += destination =>
{
SendMessage(new GatewayOpenPortalMessage(destination));
};
_window.OnClose += Close;
_window?.OpenCentered();
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
_window?.Dispose();
_window = null;
}
protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);
if (state is not GatewayBoundUserInterfaceState current)
return;
_window?.UpdateState(current);
}
}