mirror of
https://github.com/ppy/osu.git
synced 2025-02-14 01:33:20 +08:00
Merge pull request #19904 from novialriptide/add-date-created-sort
Add date submitted sorting
This commit is contained in:
commit
2af8c4a2ea
@ -55,8 +55,6 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
match &= !criteria.Artist.HasFilter || criteria.Artist.Matches(BeatmapInfo.Metadata.Artist) ||
|
||||
criteria.Artist.Matches(BeatmapInfo.Metadata.ArtistUnicode);
|
||||
|
||||
match &= criteria.Sort != SortMode.DateRanked || BeatmapInfo.BeatmapSet?.DateRanked != null;
|
||||
|
||||
match &= !criteria.UserStarDifficulty.HasFilter || criteria.UserStarDifficulty.IsInRange(BeatmapInfo.StarRating);
|
||||
|
||||
if (match && criteria.SearchTerms.Length > 0)
|
||||
|
@ -99,6 +99,13 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
|
||||
case SortMode.Difficulty:
|
||||
return compareUsingAggregateMax(otherSet, b => b.StarRating);
|
||||
|
||||
case SortMode.DateSubmitted:
|
||||
// Beatmaps which have no submitted date should already be filtered away in this mode.
|
||||
if (BeatmapSet.DateSubmitted == null || otherSet.BeatmapSet.DateSubmitted == null)
|
||||
return 0;
|
||||
|
||||
return otherSet.BeatmapSet.DateSubmitted.Value.CompareTo(BeatmapSet.DateSubmitted.Value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -122,7 +129,12 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
public override void Filter(FilterCriteria criteria)
|
||||
{
|
||||
base.Filter(criteria);
|
||||
Filtered.Value = Items.All(i => i.Filtered.Value);
|
||||
bool match = Items.All(i => i.Filtered.Value);
|
||||
|
||||
match &= criteria.Sort != SortMode.DateRanked || BeatmapSet?.DateRanked != null;
|
||||
match &= criteria.Sort != SortMode.DateSubmitted || BeatmapSet?.DateSubmitted != null;
|
||||
|
||||
Filtered.Value = match;
|
||||
}
|
||||
|
||||
public override string ToString() => BeatmapSet.ToString();
|
||||
|
@ -20,6 +20,9 @@ namespace osu.Game.Screens.Select.Filter
|
||||
[LocalisableDescription(typeof(SortStrings), nameof(SortStrings.ArtistTracksBpm))]
|
||||
BPM,
|
||||
|
||||
[Description("Date Submitted")]
|
||||
DateSubmitted,
|
||||
|
||||
[Description("Date Added")]
|
||||
DateAdded,
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user