DisposalUnitWindow.xaml.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using Content.Shared.Disposal.Components;
  2. using Robust.Client.AutoGenerated;
  3. using Robust.Client.UserInterface.CustomControls;
  4. using Robust.Client.UserInterface.XAML;
  5. using Robust.Shared.Timing;
  6. using static Content.Shared.Disposal.Components.SharedDisposalUnitComponent;
  7. namespace Content.Client.Disposal.UI
  8. {
  9. /// <summary>
  10. /// Client-side UI used to control a <see cref="SharedDisposalUnitComponent"/>
  11. /// </summary>
  12. [GenerateTypedNameReferences]
  13. public sealed partial class DisposalUnitWindow : DefaultWindow
  14. {
  15. public TimeSpan FullPressure;
  16. public DisposalUnitWindow()
  17. {
  18. IoCManager.InjectDependencies(this);
  19. RobustXamlLoader.Load(this);
  20. }
  21. /// <summary>
  22. /// Update the interface state for the disposals window.
  23. /// </summary>
  24. /// <returns>true if we should stop updating every frame.</returns>
  25. public void UpdateState(DisposalUnitBoundUserInterfaceState state)
  26. {
  27. Title = state.UnitName;
  28. UnitState.Text = state.UnitState;
  29. Power.Pressed = state.Powered;
  30. Engage.Pressed = state.Engaged;
  31. FullPressure = state.FullPressureTime;
  32. }
  33. protected override void FrameUpdate(FrameEventArgs args)
  34. {
  35. base.FrameUpdate(args);
  36. PressureBar.UpdatePressure(FullPressure);
  37. }
  38. }
  39. }