mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 14:53:01 +08:00
Change difficulty sort to be based on MaxStarDifficulty.
This commit is contained in:
parent
360340c61d
commit
4d84bf7350
@ -2,6 +2,7 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using SQLite.Net.Attributes;
|
using SQLite.Net.Attributes;
|
||||||
using SQLiteNetExtensions.Attributes;
|
using SQLiteNetExtensions.Attributes;
|
||||||
|
|
||||||
@ -23,6 +24,8 @@ namespace osu.Game.Database
|
|||||||
[OneToMany(CascadeOperations = CascadeOperation.All)]
|
[OneToMany(CascadeOperations = CascadeOperation.All)]
|
||||||
public List<BeatmapInfo> Beatmaps { get; set; }
|
public List<BeatmapInfo> Beatmaps { get; set; }
|
||||||
|
|
||||||
|
public float MaxStarDifficulty => Beatmaps.Max(b => b.StarDifficulty);
|
||||||
|
|
||||||
public bool DeletePending { get; set; }
|
public bool DeletePending { get; set; }
|
||||||
|
|
||||||
public string Hash { get; set; }
|
public string Hash { get; set; }
|
||||||
|
@ -173,28 +173,7 @@ namespace osu.Game.Screens.Select
|
|||||||
sortedGroups.Sort((x, y) => string.Compare(x.BeatmapSet.Metadata.Author, y.BeatmapSet.Metadata.Author, StringComparison.InvariantCultureIgnoreCase));
|
sortedGroups.Sort((x, y) => string.Compare(x.BeatmapSet.Metadata.Author, y.BeatmapSet.Metadata.Author, StringComparison.InvariantCultureIgnoreCase));
|
||||||
break;
|
break;
|
||||||
case SortMode.Difficulty:
|
case SortMode.Difficulty:
|
||||||
sortedGroups.Sort((x, y) =>
|
sortedGroups.Sort((x, y) => x.BeatmapSet.MaxStarDifficulty.CompareTo(y.BeatmapSet.MaxStarDifficulty));
|
||||||
{
|
|
||||||
float xAverage = 0, yAverage = 0;
|
|
||||||
int counter = 0;
|
|
||||||
foreach (BeatmapInfo set in x.BeatmapSet.Beatmaps)
|
|
||||||
{
|
|
||||||
xAverage += set.StarDifficulty;
|
|
||||||
counter++;
|
|
||||||
}
|
|
||||||
xAverage /= counter;
|
|
||||||
counter = 0;
|
|
||||||
foreach (BeatmapInfo set in y.BeatmapSet.Beatmaps)
|
|
||||||
{
|
|
||||||
yAverage += set.StarDifficulty;
|
|
||||||
counter++;
|
|
||||||
}
|
|
||||||
yAverage /= counter;
|
|
||||||
if (xAverage > yAverage)
|
|
||||||
return 1;
|
|
||||||
else
|
|
||||||
return -1;
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Sort(SortMode.Artist); // Temporary
|
Sort(SortMode.Artist); // Temporary
|
||||||
|
Loading…
Reference in New Issue
Block a user