1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-27 00:23:01 +08:00

Changed default selection type and added suggestions from PR feedback

This commit is contained in:
Patrick Andersson 2017-06-01 08:54:48 +02:00
parent a3945bb11d
commit 94294e4b45
3 changed files with 11 additions and 11 deletions

View File

@ -20,7 +20,7 @@ namespace osu.Game.Configuration
Set(OsuSetting.DisplayStarsMinimum, 0.0, 0, 10);
Set(OsuSetting.DisplayStarsMaximum, 10.0, 0, 10);
Set(OsuSetting.SelectionRandomType, SelectionRandomType.Random);
Set(OsuSetting.SelectionRandomType, SelectionRandomType.RandomPermutation);
Set(OsuSetting.ChatDisplayHeight, ChatOverlay.DEFAULT_HEIGHT, 0.2, 1);

View File

@ -7,9 +7,9 @@ namespace osu.Game.Configuration
{
public enum SelectionRandomType
{
[Description("Random")]
Random,
[Description("Never repeat")]
RandomPermutation
RandomPermutation,
[Description("Random")]
Random
}
}
}

View File

@ -73,7 +73,7 @@ namespace osu.Game.Screens.Select
private readonly List<BeatmapGroup> groups = new List<BeatmapGroup>();
private Bindable<SelectionRandomType> randomType;
private readonly HashSet<BeatmapGroup> seenGroups = new HashSet<BeatmapGroup>();
private readonly List<BeatmapGroup> seenGroups = new List<BeatmapGroup>();
private readonly List<Panel> panels = new List<Panel>();
@ -172,25 +172,25 @@ namespace osu.Game.Screens.Select
public void SelectRandom()
{
List<BeatmapGroup> visibleGroups = groups.Where(selectGroup => selectGroup.State != BeatmapGroupState.Hidden).ToList();
if (visibleGroups.Count < 1)
IEnumerable<BeatmapGroup> visibleGroups = groups.Where(selectGroup => selectGroup.State != BeatmapGroupState.Hidden);
if (!visibleGroups.Any())
return;
BeatmapGroup group;
if (randomType == SelectionRandomType.RandomPermutation)
{
List<BeatmapGroup> notSeenGroups = visibleGroups.Except(seenGroups).ToList();
IEnumerable<BeatmapGroup> notSeenGroups = visibleGroups.Except(seenGroups);
if (!notSeenGroups.Any())
{
seenGroups.Clear();
notSeenGroups = visibleGroups;
}
group = notSeenGroups[RNG.Next(notSeenGroups.Count)];
group = notSeenGroups.ElementAt(RNG.Next(notSeenGroups.Count()));
seenGroups.Add(group);
}
else
group = visibleGroups[RNG.Next(visibleGroups.Count)];
group = visibleGroups.ElementAt(RNG.Next(visibleGroups.Count()));
BeatmapPanel panel = group.BeatmapPanels[RNG.Next(group.BeatmapPanels.Count)];