1
0

CargoBountyConsoleBoundUserInterface.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using Content.Client.Cargo.UI;
  2. using Content.Shared.Cargo.Components;
  3. using JetBrains.Annotations;
  4. using Robust.Client.UserInterface;
  5. namespace Content.Client.Cargo.BUI;
  6. [UsedImplicitly]
  7. public sealed class CargoBountyConsoleBoundUserInterface : BoundUserInterface
  8. {
  9. [ViewVariables]
  10. private CargoBountyMenu? _menu;
  11. public CargoBountyConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
  12. {
  13. }
  14. protected override void Open()
  15. {
  16. base.Open();
  17. _menu = this.CreateWindow<CargoBountyMenu>();
  18. _menu.OnLabelButtonPressed += id =>
  19. {
  20. SendMessage(new BountyPrintLabelMessage(id));
  21. };
  22. _menu.OnSkipButtonPressed += id =>
  23. {
  24. SendMessage(new BountySkipMessage(id));
  25. };
  26. }
  27. protected override void UpdateState(BoundUserInterfaceState message)
  28. {
  29. base.UpdateState(message);
  30. if (message is not CargoBountyConsoleState state)
  31. return;
  32. _menu?.UpdateEntries(state.Bounties, state.History, state.UntilNextSkip);
  33. }
  34. }