1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-27 17:53:15 +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.DisplayStarsMinimum, 0.0, 0, 10);
Set(OsuSetting.DisplayStarsMaximum, 10.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); Set(OsuSetting.ChatDisplayHeight, ChatOverlay.DEFAULT_HEIGHT, 0.2, 1);

View File

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