mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Add sorting support
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Screens.Select.Filter;
|
||||
|
||||
namespace osu.Game.Screens.Select.Carousel
|
||||
{
|
||||
@ -32,5 +33,21 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
|
||||
Filtered.Value = !match;
|
||||
}
|
||||
|
||||
public override int CompareTo(FilterCriteria criteria, CarouselItem other)
|
||||
{
|
||||
if (!(other is CarouselBeatmap otherBeatmap))
|
||||
return base.CompareTo(criteria, other);
|
||||
|
||||
switch (criteria.Sort)
|
||||
{
|
||||
default:
|
||||
case SortMode.Difficulty:
|
||||
var ruleset = Beatmap.RulesetID.CompareTo(otherBeatmap.Beatmap.RulesetID);
|
||||
if (ruleset != 0) return ruleset;
|
||||
|
||||
return Beatmap.StarDifficulty.CompareTo(otherBeatmap.Beatmap.StarDifficulty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user