1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 06:47:24 +08:00

Result counts displaying

This commit is contained in:
DrabWeb 2017-06-07 11:30:52 -03:00
parent a4be5c8a78
commit add08e65ff
2 changed files with 23 additions and 1 deletions

View File

@ -23,6 +23,8 @@ namespace osu.Game.Database
public string Author { get; set; }
public string Source { get; set; }
[JsonProperty(@"tags")]
public string Tags { get; set; }
public int PreviewTime { get; set; }
public string AudioFile { get; set; }

View File

@ -165,6 +165,7 @@ namespace osu.Game.Overlays
if (!IsLoaded) return;
BeatmapSets = null;
ResultAmounts = null;
getSetsRequest?.Cancel();
if (api == null || Filter.Search.Text == string.Empty) return;
@ -174,10 +175,29 @@ namespace osu.Game.Overlays
Filter.DisplayStyleControl.Dropdown.Current.Value,
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);
}
private int distinctCount(List<string> list) => list.Distinct().ToArray().Length;
public class ResultCounts
{
public readonly int Artists;