mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 10:02:59 +08:00
Result counts displaying
This commit is contained in:
parent
a4be5c8a78
commit
add08e65ff
@ -23,6 +23,8 @@ namespace osu.Game.Database
|
|||||||
public string Author { get; set; }
|
public string Author { get; set; }
|
||||||
|
|
||||||
public string Source { get; set; }
|
public string Source { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty(@"tags")]
|
||||||
public string Tags { get; set; }
|
public string Tags { get; set; }
|
||||||
public int PreviewTime { get; set; }
|
public int PreviewTime { get; set; }
|
||||||
public string AudioFile { get; set; }
|
public string AudioFile { get; set; }
|
||||||
|
@ -165,6 +165,7 @@ namespace osu.Game.Overlays
|
|||||||
if (!IsLoaded) return;
|
if (!IsLoaded) return;
|
||||||
|
|
||||||
BeatmapSets = null;
|
BeatmapSets = null;
|
||||||
|
ResultAmounts = null;
|
||||||
getSetsRequest?.Cancel();
|
getSetsRequest?.Cancel();
|
||||||
|
|
||||||
if (api == null || Filter.Search.Text == string.Empty) return;
|
if (api == null || Filter.Search.Text == string.Empty) return;
|
||||||
@ -174,10 +175,29 @@ namespace osu.Game.Overlays
|
|||||||
Filter.DisplayStyleControl.Dropdown.Current.Value,
|
Filter.DisplayStyleControl.Dropdown.Current.Value,
|
||||||
Filter.Tabs.Current.Value); //todo: sort direction
|
Filter.Tabs.Current.Value); //todo: sort direction
|
||||||
|
|
||||||
getSetsRequest.Success += r => BeatmapSets = r?.Select(response => response.ToSetInfo(rulesets));
|
getSetsRequest.Success += r =>
|
||||||
|
{
|
||||||
|
BeatmapSets = r?.Select(response => response.ToSetInfo(rulesets));
|
||||||
|
|
||||||
|
var artists = new List<string>();
|
||||||
|
var songs = new List<string>();
|
||||||
|
var tags = new List<string>();
|
||||||
|
foreach (var s in BeatmapSets)
|
||||||
|
{
|
||||||
|
artists.Add(s.Metadata.Artist);
|
||||||
|
songs.Add(s.Metadata.Title);
|
||||||
|
tags.AddRange(s.Metadata.Tags.Split(' '));
|
||||||
|
}
|
||||||
|
|
||||||
|
ResultAmounts = new ResultCounts(distinctCount(artists),
|
||||||
|
distinctCount(songs),
|
||||||
|
distinctCount(tags));
|
||||||
|
};
|
||||||
api.Queue(getSetsRequest);
|
api.Queue(getSetsRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int distinctCount(List<string> list) => list.Distinct().ToArray().Length;
|
||||||
|
|
||||||
public class ResultCounts
|
public class ResultCounts
|
||||||
{
|
{
|
||||||
public readonly int Artists;
|
public readonly int Artists;
|
||||||
|
Loading…
Reference in New Issue
Block a user