GatewayBoundUserInterface.cs 947 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. using Content.Shared.Gateway;
  2. using JetBrains.Annotations;
  3. using Robust.Client.GameObjects;
  4. using Robust.Client.UserInterface;
  5. namespace Content.Client.Gateway.UI;
  6. [UsedImplicitly]
  7. public sealed class GatewayBoundUserInterface : BoundUserInterface
  8. {
  9. private GatewayWindow? _window;
  10. public GatewayBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
  11. {
  12. }
  13. protected override void Open()
  14. {
  15. base.Open();
  16. _window = this.CreateWindow<GatewayWindow>();
  17. _window.SetEntity(EntMan.GetNetEntity(Owner));
  18. _window.OpenPortal += destination =>
  19. {
  20. SendMessage(new GatewayOpenPortalMessage(destination));
  21. };
  22. }
  23. protected override void UpdateState(BoundUserInterfaceState state)
  24. {
  25. base.UpdateState(state);
  26. if (state is not GatewayBoundUserInterfaceState current)
  27. return;
  28. _window?.UpdateState(current);
  29. }
  30. }