1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 21:43:04 +08:00

DrawableErrorHandler -> NotFoundDrawable

This commit is contained in:
Andrei Zavatski 2020-02-20 02:43:13 +03:00
parent edef84d9c3
commit 7550685a61
2 changed files with 5 additions and 16 deletions

View File

@ -12,9 +12,6 @@ namespace osu.Game.Online.API.Requests
[JsonProperty("beatmapsets")]
public IEnumerable<APIBeatmapSet> BeatmapSets;
[JsonProperty("error")]
public string Error;
[JsonProperty("total")]
public int Total;
}

View File

@ -189,15 +189,11 @@ namespace osu.Game.Overlays
private void recreatePanels(SearchBeatmapSetsResponse response)
{
var hasError = !string.IsNullOrEmpty(response.Error);
if (response.Total == 0 || hasError)
if (response.Total == 0)
{
searchSection.BeatmapSet = null;
LoadComponentAsync(new DrawableErrorHandler(hasError ? response.Error : @"... nope, nothing found."),
addContentToPlaceholder,
(cancellationToken = new CancellationTokenSource()).Token);
LoadComponentAsync(new NotFoundDrawable(), addContentToPlaceholder, (cancellationToken = new CancellationTokenSource()).Token);
return;
}
@ -240,14 +236,10 @@ namespace osu.Game.Overlays
base.Dispose(isDisposing);
}
private class DrawableErrorHandler : CompositeDrawable
private class NotFoundDrawable : CompositeDrawable
{
private readonly string error;
public DrawableErrorHandler(string error)
public NotFoundDrawable()
{
this.error = error;
RelativeSizeAxes = Axes.X;
Height = 250;
Margin = new MarginPadding { Top = 15 };
@ -278,7 +270,7 @@ namespace osu.Game.Overlays
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Text = error,
Text = @"... nope, nothing found.",
}
}
});