mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 22:56:36 +09:00
Merge remote-tracking branch 'upstream/master' into ingame_options
This commit is contained in:
@ -9,6 +9,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Game.Beatmaps.Drawables;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Framework.Input;
|
||||
using OpenTK.Input;
|
||||
using System.Collections;
|
||||
@ -17,6 +18,7 @@ using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Framework.Configuration;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
{
|
||||
@ -70,6 +72,9 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private readonly List<BeatmapGroup> groups = new List<BeatmapGroup>();
|
||||
|
||||
private Bindable<SelectionRandomType> randomType;
|
||||
private readonly List<BeatmapGroup> seenGroups = new List<BeatmapGroup>();
|
||||
|
||||
private readonly List<Panel> panels = new List<Panel>();
|
||||
|
||||
private BeatmapGroup selectedGroup;
|
||||
@ -167,11 +172,26 @@ 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 = visibleGroups[RNG.Next(visibleGroups.Count)];
|
||||
BeatmapGroup group;
|
||||
if (randomType == SelectionRandomType.RandomPermutation)
|
||||
{
|
||||
IEnumerable<BeatmapGroup> notSeenGroups = visibleGroups.Except(seenGroups);
|
||||
if (!notSeenGroups.Any())
|
||||
{
|
||||
seenGroups.Clear();
|
||||
notSeenGroups = visibleGroups;
|
||||
}
|
||||
|
||||
group = notSeenGroups.ElementAt(RNG.Next(notSeenGroups.Count()));
|
||||
seenGroups.Add(group);
|
||||
}
|
||||
else
|
||||
group = visibleGroups.ElementAt(RNG.Next(visibleGroups.Count()));
|
||||
|
||||
BeatmapPanel panel = group.BeatmapPanels[RNG.Next(group.BeatmapPanels.Count)];
|
||||
|
||||
selectGroup(group, panel);
|
||||
@ -239,9 +259,10 @@ namespace osu.Game.Screens.Select
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(permitNulls: true)]
|
||||
private void load(BeatmapDatabase database)
|
||||
private void load(BeatmapDatabase database, OsuConfigManager config)
|
||||
{
|
||||
this.database = database;
|
||||
randomType = config.GetBindable<SelectionRandomType>(OsuSetting.SelectionRandomType);
|
||||
}
|
||||
|
||||
private void addGroup(BeatmapGroup group)
|
||||
|
Reference in New Issue
Block a user