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.
This commit is contained in:
committed by
GitHub
parent
1d997d6e46
commit
b6ca604a66
@@ -0,0 +1,44 @@
|
||||
using Content.Client.Stylesheets;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Client.Replay.UI.Loading;
|
||||
|
||||
[GenerateTypedNameReferences]
|
||||
public sealed partial class ReplayLoadingFailedControl : Control
|
||||
{
|
||||
public ReplayLoadingFailedControl(IStylesheetManager stylesheet)
|
||||
{
|
||||
RobustXamlLoader.Load(this);
|
||||
|
||||
Stylesheet = stylesheet.SheetSpace;
|
||||
LayoutContainer.SetAnchorPreset(this, LayoutContainer.LayoutPreset.Wide);
|
||||
}
|
||||
|
||||
public void SetData(Exception exception, Action? cancelPressed, Action? retryPressed)
|
||||
{
|
||||
ReasonLabel.SetMessage(
|
||||
FormattedMessage.FromUnformatted(Loc.GetString("replay-loading-failed", ("reason", exception))));
|
||||
|
||||
if (cancelPressed != null)
|
||||
{
|
||||
CancelButton.Visible = true;
|
||||
CancelButton.OnPressed += _ =>
|
||||
{
|
||||
cancelPressed();
|
||||
};
|
||||
}
|
||||
|
||||
if (retryPressed != null)
|
||||
{
|
||||
RetryButton.Visible = true;
|
||||
RetryButton.OnPressed += _ =>
|
||||
{
|
||||
retryPressed();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user