Files
tbd-station-14/Content.Client/Gateway/UI/GatewayBoundUserInterface.cs
Nemanja cb0ba66be3 Revert "Remove some BUI boilerplate" (#30214)
Revert "Remove some BUI boilerplate (#28399)"

This reverts commit cbf329a82d.
2024-07-20 20:42:27 -04:00

50 lines
1.1 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(EntMan.GetNetEntity(Owner));
_window.OpenPortal += destination =>
{
SendMessage(new GatewayOpenPortalMessage(destination));
};
_window.OnClose += Close;
_window?.OpenCentered();
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (disposing)
{
_window?.Dispose();
_window = null;
}
}
protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);
if (state is not GatewayBoundUserInterfaceState current)
return;
_window?.UpdateState(current);
}
}