mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 17:37:23 +09:00
Fix showing outdated data for non-online beatmaps
This commit is contained in:
parent
192c257aac
commit
8e5816805c
@ -175,21 +175,21 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
private void updateStatistics()
|
private void updateStatistics()
|
||||||
{
|
{
|
||||||
|
advanced.Beatmap = Beatmap;
|
||||||
|
description.Text = Beatmap?.Version;
|
||||||
|
source.Text = Beatmap?.Metadata?.Source;
|
||||||
|
tags.Text = Beatmap?.Metadata?.Tags;
|
||||||
|
|
||||||
if (Beatmap == null)
|
if (Beatmap == null)
|
||||||
{
|
{
|
||||||
clearStats();
|
ratingsContainer.FadeOut(transition_duration);
|
||||||
|
failRetryContainer.FadeOut(transition_duration);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ratingsContainer.FadeIn(transition_duration);
|
if (Beatmap.Metrics == null && Beatmap.OnlineBeatmapID != null)
|
||||||
advanced.Beatmap = Beatmap;
|
|
||||||
description.Text = Beatmap.Version;
|
|
||||||
source.Text = Beatmap.Metadata.Source;
|
|
||||||
tags.Text = Beatmap.Metadata.Tags;
|
|
||||||
|
|
||||||
var requestedBeatmap = Beatmap;
|
|
||||||
if (requestedBeatmap.Metrics == null && requestedBeatmap.OnlineBeatmapID != null)
|
|
||||||
{
|
{
|
||||||
|
var requestedBeatmap = Beatmap;
|
||||||
var lookup = new GetBeatmapDetailsRequest(requestedBeatmap);
|
var lookup = new GetBeatmapDetailsRequest(requestedBeatmap);
|
||||||
lookup.Success += res =>
|
lookup.Success += res =>
|
||||||
{
|
{
|
||||||
@ -198,39 +198,35 @@ namespace osu.Game.Screens.Select
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
requestedBeatmap.Metrics = res;
|
requestedBeatmap.Metrics = res;
|
||||||
Schedule(() => displayMetrics(res));
|
Schedule(() => updateMetrics(res));
|
||||||
};
|
};
|
||||||
lookup.Failure += e => Schedule(() => displayMetrics(null));
|
lookup.Failure += e => Schedule(() => updateMetrics(null));
|
||||||
|
|
||||||
api.Queue(lookup);
|
api.Queue(lookup);
|
||||||
loading.Show();
|
loading.Show();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
displayMetrics(requestedBeatmap.Metrics, false);
|
{
|
||||||
|
updateMetrics(Beatmap.Metrics);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayMetrics(BeatmapMetrics metrics, bool failOnMissing = true)
|
private void updateMetrics(BeatmapMetrics metrics)
|
||||||
{
|
{
|
||||||
var hasRatings = metrics?.Ratings?.Any() ?? false;
|
var hasRatings = metrics?.Ratings?.Any() ?? false;
|
||||||
var hasRetriesFails = (metrics?.Retries?.Any() ?? false) && (metrics.Fails?.Any() ?? false);
|
var hasRetriesFails = (metrics?.Retries?.Any() ?? false) && (metrics.Fails?.Any() ?? false);
|
||||||
|
|
||||||
if (failOnMissing) loading.Hide();
|
|
||||||
|
|
||||||
if (hasRatings)
|
if (hasRatings)
|
||||||
{
|
{
|
||||||
ratings.Metrics = metrics;
|
ratings.Metrics = metrics;
|
||||||
ratings.FadeIn(transition_duration);
|
ratingsContainer.FadeIn(transition_duration);
|
||||||
}
|
}
|
||||||
else if (failOnMissing)
|
else
|
||||||
{
|
{
|
||||||
ratings.Metrics = new BeatmapMetrics
|
ratings.Metrics = new BeatmapMetrics
|
||||||
{
|
{
|
||||||
Ratings = new int[10],
|
Ratings = new int[10],
|
||||||
};
|
};
|
||||||
}
|
ratingsContainer.FadeTo(0.25f, transition_duration);
|
||||||
else
|
|
||||||
{
|
|
||||||
ratings.FadeTo(0.25f, transition_duration);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasRetriesFails)
|
if (hasRetriesFails)
|
||||||
@ -238,41 +234,17 @@ namespace osu.Game.Screens.Select
|
|||||||
failRetryGraph.Metrics = metrics;
|
failRetryGraph.Metrics = metrics;
|
||||||
failRetryContainer.FadeIn(transition_duration);
|
failRetryContainer.FadeIn(transition_duration);
|
||||||
}
|
}
|
||||||
else if (failOnMissing)
|
else
|
||||||
{
|
{
|
||||||
failRetryGraph.Metrics = new BeatmapMetrics
|
failRetryGraph.Metrics = new BeatmapMetrics
|
||||||
{
|
{
|
||||||
Fails = new int[100],
|
Fails = new int[100],
|
||||||
Retries = new int[100],
|
Retries = new int[100],
|
||||||
};
|
};
|
||||||
|
failRetryContainer.FadeOut(transition_duration);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
failRetryContainer.FadeTo(0.25f, transition_duration);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void clearStats()
|
|
||||||
{
|
|
||||||
description.Text = null;
|
|
||||||
source.Text = null;
|
|
||||||
tags.Text = null;
|
|
||||||
|
|
||||||
advanced.Beatmap = new BeatmapInfo
|
|
||||||
{
|
|
||||||
StarDifficulty = 0,
|
|
||||||
BaseDifficulty = new BeatmapDifficulty
|
|
||||||
{
|
|
||||||
CircleSize = 0,
|
|
||||||
DrainRate = 0,
|
|
||||||
OverallDifficulty = 0,
|
|
||||||
ApproachRate = 0,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
loading.Hide();
|
loading.Hide();
|
||||||
ratingsContainer.FadeOut(transition_duration);
|
|
||||||
failRetryContainer.FadeOut(transition_duration);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DetailBox : Container
|
private class DetailBox : Container
|
||||||
|
Loading…
x
Reference in New Issue
Block a user