1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-17 22:17:25 +08:00

Fix dummy beatmap selection not propagating to song select components

This commit is contained in:
Dean Herbert 2017-12-31 12:55:53 +09:00
parent 02514d4228
commit dfee8e911f
2 changed files with 15 additions and 3 deletions

View File

@ -229,11 +229,15 @@ namespace osu.Game.Screens.Select
}
}
public void SelectNextRandom()
/// <summary>
/// Select the next beatmap in the random sequence.
/// </summary>
/// <returns>True if a selection could be made, else False.</returns>
public bool SelectNextRandom()
{
var visible = beatmapSets.Where(s => !s.Filtered).ToList();
if (!visible.Any())
return;
return false;
if (selectedBeatmap != null)
{
@ -263,6 +267,7 @@ namespace osu.Game.Screens.Select
set = visible.ElementAt(RNG.Next(visible.Count));
select(set.Beatmaps.Skip(RNG.Next(set.Beatmaps.Count())).FirstOrDefault());
return true;
}
public void SelectPreviousRandom()

View File

@ -449,9 +449,16 @@ namespace osu.Game.Screens.Select
private void carouselBeatmapsLoaded()
{
if (!Beatmap.IsDefault && Beatmap.Value.BeatmapSetInfo?.DeletePending == false)
{
Carousel.SelectBeatmap(Beatmap.Value.BeatmapInfo);
}
else if (Carousel.SelectedBeatmapSet == null)
Carousel.SelectNextRandom();
{
if (!Carousel.SelectNextRandom())
// in the case random selection failed, we want to trigger selectionChanged
// to show the dummy beatmap (we have nothing else to display).
carouselSelectionChanged(null);
}
}
private void delete(BeatmapSetInfo beatmap)