Merge pull request #657 from peppy/api-updates

Update score to read statistics from server.
This commit is contained in:
Dean Herbert 2017-04-20 20:03:16 +09:00 committed by GitHub
commit 1af2cf3a58
3 changed files with 46 additions and 12 deletions

View File

@ -13,18 +13,16 @@ namespace osu.Game.Rulesets.Scoring
{
public class Score
{
[JsonProperty(@"rank")]
public ScoreRank Rank { get; set; }
[JsonProperty(@"score")]
public double TotalScore { get; set; }
[JsonProperty(@"accuracy")]
public double Accuracy { get; set; }
public double Health { get; set; } = 1;
[JsonProperty(@"combo")]
[JsonProperty(@"max_combo")]
public int MaxCombo { get; set; }
public int Combo { get; set; }
@ -50,6 +48,37 @@ namespace osu.Game.Rulesets.Scoring
[JsonProperty(@"created_at")]
public DateTime Date;
[JsonProperty(@"statistics")]
private Dictionary<string, dynamic> jsonStats
{
set
{
foreach (var kvp in value)
{
string key = kvp.Key;
switch (key)
{
case @"count_300":
key = @"300";
break;
case @"count_100":
key = @"100";
break;
case @"count_50":
key = @"50";
break;
case @"count_miss":
key = @"x";
break;
default:
continue;
}
Statistics.Add(key, kvp.Value);
}
}
}
public Dictionary<string, dynamic> Statistics = new Dictionary<string, dynamic>();
}
}

View File

@ -371,8 +371,8 @@ namespace osu.Game.Screens.Ranking
[BackgroundDependencyLoader]
private void load(TextureStore textures)
{
if (user.Cover?.Url != null)
cover.Texture = textures.Get(user.Cover?.Url);
if (!string.IsNullOrEmpty(user.CoverUrl))
cover.Texture = textures.Get(user.CoverUrl);
}
}

View File

@ -13,24 +13,29 @@ namespace osu.Game.Users
[JsonProperty(@"username")]
public string Username;
//[JsonProperty(@"country")]
[JsonIgnore]
[JsonProperty(@"country_code")]
public string CountryCode;
[JsonProperty(@"country")]
public Country Country;
//public Team Team;
[JsonProperty(@"colour")]
[JsonProperty(@"profile_colour")]
public string Colour;
[JsonProperty(@"avatarUrl")]
[JsonProperty(@"avatar_url")]
public string AvatarUrl;
[JsonProperty(@"cover")]
public UserCover Cover;
[JsonProperty(@"cover_url")]
public string CoverUrl;
//[JsonProperty(@"cover")]
//public UserCover Cover;
public class UserCover
{
[JsonProperty(@"customUrl")]
[JsonProperty(@"custom_url")]
public string CustomUrl;
[JsonProperty(@"url")]