Fix current selection not being correctly maintained when `BeatmapPicker` updates its display

This commit is contained in:
Dean Herbert 2022-02-22 17:14:00 +09:00
parent 5efffa208a
commit 6de4e05e49
1 changed files with 8 additions and 1 deletions

View File

@ -183,7 +183,14 @@ private void updateDisplay()
}
starRatingContainer.FadeOut(100);
Beatmap.Value = Difficulties.FirstOrDefault()?.Beatmap;
// If a selection is already made, try and maintain it.
if (Beatmap.Value != null)
Beatmap.Value = Difficulties.FirstOrDefault(b => b.Beatmap.OnlineID == Beatmap.Value.OnlineID)?.Beatmap;
// Else just choose the first available difficulty for now.
Beatmap.Value ??= Difficulties.FirstOrDefault()?.Beatmap;
plays.Value = BeatmapSet?.PlayCount ?? 0;
favourites.Value = BeatmapSet?.FavouriteCount ?? 0;