Select recommended difficulty

This commit is contained in:
Endrik Tombak
2020-03-26 00:19:54 +02:00
parent 1587d4b26f
commit 2f5dc93d61
3 changed files with 42 additions and 6 deletions

View File

@ -90,11 +90,15 @@ namespace osu.Game.Screens.Select.Carousel
PerformSelection();
}
protected virtual CarouselItem GetNextToSelect()
{
return Children.Skip(lastSelectedIndex).FirstOrDefault(i => !i.Filtered.Value) ??
Children.Reverse().Skip(InternalChildren.Count - lastSelectedIndex).FirstOrDefault(i => !i.Filtered.Value);
}
protected virtual void PerformSelection()
{
CarouselItem nextToSelect =
Children.Skip(lastSelectedIndex).FirstOrDefault(i => !i.Filtered.Value) ??
Children.Reverse().Skip(InternalChildren.Count - lastSelectedIndex).FirstOrDefault(i => !i.Filtered.Value);
CarouselItem nextToSelect = GetNextToSelect();
if (nextToSelect != null)
nextToSelect.State.Value = CarouselItemState.Selected;