1
0

RoboticsConsoleBoundUserInterface.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using Content.Shared.Robotics;
  2. using Robust.Client.GameObjects;
  3. using Robust.Client.UserInterface;
  4. namespace Content.Client.Robotics.UI;
  5. public sealed class RoboticsConsoleBoundUserInterface : BoundUserInterface
  6. {
  7. [ViewVariables]
  8. public RoboticsConsoleWindow _window = default!;
  9. public RoboticsConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
  10. {
  11. }
  12. protected override void Open()
  13. {
  14. base.Open();
  15. _window = this.CreateWindow<RoboticsConsoleWindow>();
  16. _window.SetEntity(Owner);
  17. _window.OnDisablePressed += address =>
  18. {
  19. SendMessage(new RoboticsConsoleDisableMessage(address));
  20. };
  21. _window.OnDestroyPressed += address =>
  22. {
  23. SendMessage(new RoboticsConsoleDestroyMessage(address));
  24. };
  25. }
  26. protected override void UpdateState(BoundUserInterfaceState state)
  27. {
  28. base.UpdateState(state);
  29. if (state is not RoboticsConsoleState cast)
  30. return;
  31. _window.UpdateState(cast);
  32. }
  33. }