Files
tbd-station-14/Content.Client/Replay/UI/Loading/ReplayLoadingFailed.cs
Pieter-Jan Briers b6ca604a66 Fix replay load error screens (#32115)
If an error occurs while loading a replay, it's *supposed* to show a popup "hey do you wanna continue with error tolerance", and it does do this. But because of spaghetti in the replay state code, it also immediately tries to reload the replay without input, as a consequence of trying to reset to the game's default state.

Now the replay load system has a proper game state for "replay load failed", with nice presentation and explicit formatting and 10% less italian cuisine.
2024-09-13 23:58:02 +10:00

37 lines
1.1 KiB
C#

using Content.Client.Stylesheets;
using Robust.Client.State;
using Robust.Client.UserInterface;
using Robust.Shared.Utility;
namespace Content.Client.Replay.UI.Loading;
/// <summary>
/// State used to display an error message if a replay failed to load.
/// </summary>
/// <seealso cref="ReplayLoadingFailedControl"/>
/// <seealso cref="ContentReplayPlaybackManager"/>
public sealed class ReplayLoadingFailed : State
{
[Dependency] private readonly IStylesheetManager _stylesheetManager = default!;
[Dependency] private readonly IUserInterfaceManager _userInterface = default!;
private ReplayLoadingFailedControl? _control;
public void SetData(Exception exception, Action? cancelPressed, Action? retryPressed)
{
DebugTools.Assert(_control != null);
_control.SetData(exception, cancelPressed, retryPressed);
}
protected override void Startup()
{
_control = new ReplayLoadingFailedControl(_stylesheetManager);
_userInterface.StateRoot.AddChild(_control);
}
protected override void Shutdown()
{
_control?.Orphan();
}
}