1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 09:22:54 +08:00

Loop on distinct rulesets of beatmap instead of all

This commit is contained in:
iiSaLMaN 2019-08-24 01:30:33 +03:00
parent f6feef6b56
commit 8ccbe84f67
2 changed files with 8 additions and 18 deletions

View File

@ -34,7 +34,6 @@ namespace osu.Game.Overlays.Direct
private Container content; private Container content;
private BeatmapSetOverlay beatmapSetOverlay; private BeatmapSetOverlay beatmapSetOverlay;
private RulesetStore rulesets;
public PreviewTrack Preview => PlayButton.Preview; public PreviewTrack Preview => PlayButton.Preview;
public Bindable<bool> PreviewPlaying => PlayButton.Playing; public Bindable<bool> PreviewPlaying => PlayButton.Playing;
@ -70,10 +69,9 @@ namespace osu.Game.Overlays.Direct
}; };
[BackgroundDependencyLoader(permitNulls: true)] [BackgroundDependencyLoader(permitNulls: true)]
private void load(BeatmapManager beatmaps, OsuColour colours, BeatmapSetOverlay beatmapSetOverlay, RulesetStore rulesets) private void load(BeatmapManager beatmaps, OsuColour colours, BeatmapSetOverlay beatmapSetOverlay)
{ {
this.beatmapSetOverlay = beatmapSetOverlay; this.beatmapSetOverlay = beatmapSetOverlay;
this.rulesets = rulesets;
AddInternal(content = new Container AddInternal(content = new Container
{ {
@ -148,12 +146,8 @@ namespace osu.Game.Overlays.Direct
if (SetInfo.Beatmaps.Count > maximum_difficulty_icons) if (SetInfo.Beatmaps.Count > maximum_difficulty_icons)
{ {
foreach (var ruleset in rulesets.AvailableRulesets) foreach (var ruleset in SetInfo.Beatmaps.Select(b => b.Ruleset).Distinct())
{ icons.Add(new GroupedDifficultyIcon(SetInfo.Beatmaps.FindAll(b => b.Ruleset.Equals(ruleset)), ruleset, this is DirectListPanel ? Color4.White : Color4.Black));
List<BeatmapInfo> list;
if ((list = SetInfo.Beatmaps.FindAll(b => b.Ruleset.Equals(ruleset))).Count > 0)
icons.Add(new GroupedDifficultyIcon(list, ruleset, this is DirectListPanel ? Color4.White : Color4.Black));
}
} }
else else
foreach (var b in SetInfo.Beatmaps.OrderBy(beatmap => beatmap.StarDifficulty)) foreach (var b in SetInfo.Beatmaps.OrderBy(beatmap => beatmap.StarDifficulty))

View File

@ -40,7 +40,7 @@ namespace osu.Game.Screens.Select.Carousel
} }
[BackgroundDependencyLoader(true)] [BackgroundDependencyLoader(true)]
private void load(BeatmapManager manager, BeatmapSetOverlay beatmapOverlay, DialogOverlay overlay, RulesetStore rulesets) private void load(BeatmapManager manager, BeatmapSetOverlay beatmapOverlay, DialogOverlay overlay)
{ {
restoreHiddenRequested = s => s.Beatmaps.ForEach(manager.Restore); restoreHiddenRequested = s => s.Beatmaps.ForEach(manager.Restore);
dialogOverlay = overlay; dialogOverlay = overlay;
@ -100,7 +100,7 @@ namespace osu.Game.Screens.Select.Carousel
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Spacing = new Vector2(3), Spacing = new Vector2(3),
Children = getDifficultyIcons(rulesets), Children = getDifficultyIcons(),
}, },
} }
} }
@ -111,19 +111,15 @@ namespace osu.Game.Screens.Select.Carousel
private const int maximum_difficulty_icons = 18; private const int maximum_difficulty_icons = 18;
private List<DifficultyIcon> getDifficultyIcons(RulesetStore rulesets) private List<DifficultyIcon> getDifficultyIcons()
{ {
var beatmaps = ((CarouselBeatmapSet)Item).Beatmaps.ToList(); var beatmaps = ((CarouselBeatmapSet)Item).Beatmaps.ToList();
var icons = new List<DifficultyIcon>(); var icons = new List<DifficultyIcon>();
if (beatmaps.Count > maximum_difficulty_icons) if (beatmaps.Count > maximum_difficulty_icons)
{ {
foreach (var ruleset in rulesets.AvailableRulesets.OrderBy(r => r.ID)) foreach (var ruleset in beatmaps.Select(b => b.Beatmap.Ruleset).Distinct())
{ icons.Add(new FilterableGroupedDifficultyIcon(beatmaps.FindAll(b => b.Beatmap.Ruleset.Equals(ruleset)), ruleset));
List<CarouselBeatmap> list;
if ((list = beatmaps.FindAll(b => b.Beatmap.Ruleset.Equals(ruleset))).Count > 0)
icons.Add(new FilterableGroupedDifficultyIcon(list, ruleset));
}
} }
else beatmaps.ForEach(b => icons.Add(new FilterableDifficultyIcon(b))); else beatmaps.ForEach(b => icons.Add(new FilterableDifficultyIcon(b)));