mirror of
https://github.com/ppy/osu
synced 2025-01-04 21:30:08 +00:00
Simplify recommended beatmap presenting
This commit is contained in:
parent
58e122a7cb
commit
47187ec14c
@ -346,19 +346,18 @@ namespace osu.Game
|
||||
|
||||
// Find beatmaps that match our predicate.
|
||||
var beatmaps = databasedSet.Beatmaps.Where(b => difficultyCriteria?.Invoke(b) ?? true);
|
||||
|
||||
// Use all beatmaps if predicate matched nothing
|
||||
if (!beatmaps.Any())
|
||||
beatmaps = databasedSet.Beatmaps;
|
||||
|
||||
var selection = DifficultyRecommender.GetRecommendedBeatmap(beatmaps);
|
||||
|
||||
// fallback if a difficulty can't be recommended, maybe we are offline
|
||||
if (selection == null)
|
||||
{
|
||||
if (difficultyCriteria != null)
|
||||
selection = beatmaps.First();
|
||||
else
|
||||
selection = databasedSet.Beatmaps.Find(b => b.Ruleset.Equals(Ruleset.Value)) ?? databasedSet.Beatmaps.First();
|
||||
}
|
||||
// Try to select recommended beatmap
|
||||
// This should give us a beatmap from current ruleset if there are any in our matched beatmaps
|
||||
var selection = DifficultyRecommender.GetRecommendedBeatmap(beatmaps) ?? (
|
||||
// Fallback if a difficulty can't be recommended, maybe we are offline
|
||||
// First try to find a beatmap in current ruleset, otherwise use first beatmap
|
||||
beatmaps.FirstOrDefault(b => b.Ruleset.Equals(Ruleset.Value)) ?? beatmaps.First()
|
||||
);
|
||||
|
||||
Ruleset.Value = selection.Ruleset;
|
||||
Beatmap.Value = BeatmapManager.GetWorkingBeatmap(selection);
|
||||
|
Loading…
Reference in New Issue
Block a user