1
0

CryostorageBoundUserInterface.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using Content.Shared.Bed.Cryostorage;
  2. using JetBrains.Annotations;
  3. using Robust.Client.UserInterface;
  4. namespace Content.Client.Bed.Cryostorage;
  5. [UsedImplicitly]
  6. public sealed class CryostorageBoundUserInterface : BoundUserInterface
  7. {
  8. [ViewVariables]
  9. private CryostorageMenu? _menu;
  10. public CryostorageBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
  11. {
  12. }
  13. protected override void Open()
  14. {
  15. base.Open();
  16. _menu = this.CreateWindow<CryostorageMenu>();
  17. _menu.SlotRemoveButtonPressed += (ent, slot) =>
  18. {
  19. SendMessage(new CryostorageRemoveItemBuiMessage(ent, slot, CryostorageRemoveItemBuiMessage.RemovalType.Inventory));
  20. };
  21. _menu.HandRemoveButtonPressed += (ent, hand) =>
  22. {
  23. SendMessage(new CryostorageRemoveItemBuiMessage(ent, hand, CryostorageRemoveItemBuiMessage.RemovalType.Hand));
  24. };
  25. }
  26. protected override void UpdateState(BoundUserInterfaceState state)
  27. {
  28. base.UpdateState(state);
  29. switch (state)
  30. {
  31. case CryostorageBuiState msg:
  32. _menu?.UpdateState(msg);
  33. break;
  34. }
  35. }
  36. }