mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 06:23:21 +08:00
Use nullable comparison helper method instead of manual implementation
This commit is contained in:
parent
a14dede036
commit
87d0bef313
@ -87,7 +87,7 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
break;
|
||||
|
||||
case SortMode.DateRanked:
|
||||
comparison = compareNullableDateTimeOffset(BeatmapSet.DateRanked, otherSet.BeatmapSet.DateRanked);
|
||||
comparison = Nullable.Compare(otherSet.BeatmapSet.DateRanked, BeatmapSet.DateRanked);
|
||||
break;
|
||||
|
||||
case SortMode.LastPlayed:
|
||||
@ -107,7 +107,7 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
break;
|
||||
|
||||
case SortMode.DateSubmitted:
|
||||
comparison = compareNullableDateTimeOffset(BeatmapSet.DateSubmitted, otherSet.BeatmapSet.DateSubmitted);
|
||||
comparison = Nullable.Compare(otherSet.BeatmapSet.DateSubmitted, BeatmapSet.DateSubmitted);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -124,14 +124,6 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
return otherSet.BeatmapSet.ID.CompareTo(BeatmapSet.ID);
|
||||
}
|
||||
|
||||
private static int compareNullableDateTimeOffset(DateTimeOffset? x, DateTimeOffset? y)
|
||||
{
|
||||
if (x == null) return 1;
|
||||
if (y == null) return -1;
|
||||
|
||||
return y.Value.CompareTo(x.Value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// All beatmaps which are not filtered and valid for display.
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user