ReplayLoadingFailed.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. using Content.Client.Stylesheets;
  2. using Robust.Client.State;
  3. using Robust.Client.UserInterface;
  4. using Robust.Shared.Utility;
  5. namespace Content.Client.Replay.UI.Loading;
  6. /// <summary>
  7. /// State used to display an error message if a replay failed to load.
  8. /// </summary>
  9. /// <seealso cref="ReplayLoadingFailedControl"/>
  10. /// <seealso cref="ContentReplayPlaybackManager"/>
  11. public sealed class ReplayLoadingFailed : State
  12. {
  13. [Dependency] private readonly IStylesheetManager _stylesheetManager = default!;
  14. [Dependency] private readonly IUserInterfaceManager _userInterface = default!;
  15. private ReplayLoadingFailedControl? _control;
  16. public void SetData(Exception exception, Action? cancelPressed, Action? retryPressed)
  17. {
  18. DebugTools.Assert(_control != null);
  19. _control.SetData(exception, cancelPressed, retryPressed);
  20. }
  21. protected override void Startup()
  22. {
  23. _control = new ReplayLoadingFailedControl(_stylesheetManager);
  24. _userInterface.StateRoot.AddChild(_control);
  25. }
  26. protected override void Shutdown()
  27. {
  28. _control?.Orphan();
  29. }
  30. }