1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 11:42:56 +08:00

load placeholder page when failed

This commit is contained in:
Gagah Pangeran Rosfatiputra 2021-06-03 19:40:54 +07:00
parent d1110d00a0
commit 490ce0bbc5
No known key found for this signature in database
GPG Key ID: 25F6F17FD29031E2

View File

@ -92,7 +92,7 @@ namespace osu.Game.Overlays
Loading.Show();
request.Success += response => Schedule(() => onSuccess(response));
request.Failure += _ => Schedule(() => LoadDisplay(Empty()));
request.Failure += _ => Schedule(onFail);
api.PerformAsync(request);
}
@ -132,6 +132,24 @@ namespace osu.Game.Overlays
}
}
private void onFail()
{
LoadDisplay(new WikiMarkdownContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
CurrentPath = $@"{api.WebsiteRootUrl}/wiki/",
Text = "There is something wrong when fetching this page. [Back to main page.](Main_Page)",
DocumentMargin = new MarginPadding(0),
DocumentPadding = new MarginPadding
{
Vertical = 20,
Left = 30,
Right = 50,
},
});
}
private void showParentPage()
{
var parentPath = string.Join("/", path.Value.Split('/').SkipLast(1));