mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 08:22:56 +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;
|
break;
|
||||||
|
|
||||||
case SortMode.DateRanked:
|
case SortMode.DateRanked:
|
||||||
comparison = compareNullableDateTimeOffset(BeatmapSet.DateRanked, otherSet.BeatmapSet.DateRanked);
|
comparison = Nullable.Compare(otherSet.BeatmapSet.DateRanked, BeatmapSet.DateRanked);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SortMode.LastPlayed:
|
case SortMode.LastPlayed:
|
||||||
@ -107,7 +107,7 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SortMode.DateSubmitted:
|
case SortMode.DateSubmitted:
|
||||||
comparison = compareNullableDateTimeOffset(BeatmapSet.DateSubmitted, otherSet.BeatmapSet.DateSubmitted);
|
comparison = Nullable.Compare(otherSet.BeatmapSet.DateSubmitted, BeatmapSet.DateSubmitted);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,14 +124,6 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
return otherSet.BeatmapSet.ID.CompareTo(BeatmapSet.ID);
|
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>
|
/// <summary>
|
||||||
/// All beatmaps which are not filtered and valid for display.
|
/// All beatmaps which are not filtered and valid for display.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user