1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-22 13:10:12 +08:00

Add source grouping mode

This commit is contained in:
Salman Alshamrani
2025-06-26 09:59:12 +03:00
Unverified
parent e06e74d84e
commit b4833d80d1
2 changed files with 17 additions and 2 deletions
+5 -2
View File
@@ -34,6 +34,9 @@ namespace osu.Game.Screens.Select.Filter
// [Description("Favourites")]
// Favourites,
[Description("Last Played")]
LastPlayed,
[Description("Length")]
Length,
@@ -46,8 +49,8 @@ namespace osu.Game.Screens.Select.Filter
[Description("Ranked Status")]
RankedStatus,
[Description("Last Played")]
LastPlayed,
[Description("Source")]
Source,
[Description("Title")]
Title,
@@ -202,6 +202,9 @@ namespace osu.Game.Screens.SelectV2
return defineGroupByLength(length);
}, items);
case GroupMode.Source:
return getGroupsBy(b => defineGroupBySource(b.BeatmapSet!.Metadata.Source), items);
// TODO: need implementation
//
// case GroupMode.Collections:
@@ -225,6 +228,7 @@ namespace osu.Game.Screens.SelectV2
{
return items.GroupBy(i => getGroup((BeatmapInfo)i.Model))
.OrderBy(s => s.Key.Order)
.ThenBy(s => s.Key.Title)
.Select(g => new GroupMapping(g.Key, g.ToList()))
.ToList();
}
@@ -354,6 +358,14 @@ namespace osu.Game.Screens.SelectV2
return new GroupDefinition(11, "Over 10 minutes");
}
private GroupDefinition defineGroupBySource(string source)
{
if (string.IsNullOrEmpty(source))
return new GroupDefinition(1, "Unsourced");
return new GroupDefinition(0, source);
}
private static T? aggregateMax<T>(BeatmapInfo b, Func<BeatmapInfo, T> func)
{
var beatmaps = b.BeatmapSet!.Beatmaps.Where(bb => !bb.Hidden);