AnomalyGeneratorBoundUserInterface.cs 936 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. using Content.Shared.Anomaly;
  2. using JetBrains.Annotations;
  3. using Robust.Client.UserInterface;
  4. namespace Content.Client.Anomaly.Ui;
  5. [UsedImplicitly]
  6. public sealed class AnomalyGeneratorBoundUserInterface : BoundUserInterface
  7. {
  8. private AnomalyGeneratorWindow? _window;
  9. public AnomalyGeneratorBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
  10. {
  11. }
  12. protected override void Open()
  13. {
  14. base.Open();
  15. _window = this.CreateWindow<AnomalyGeneratorWindow>();
  16. _window.SetEntity(Owner);
  17. _window.OnGenerateButtonPressed += () =>
  18. {
  19. SendMessage(new AnomalyGeneratorGenerateButtonPressedEvent());
  20. };
  21. }
  22. protected override void UpdateState(BoundUserInterfaceState state)
  23. {
  24. base.UpdateState(state);
  25. if (state is not AnomalyGeneratorUserInterfaceState msg)
  26. return;
  27. _window?.UpdateState(msg);
  28. }
  29. }