Hide deprecated API storage variables and populate Score.User automatically.

This commit is contained in:
Dean Herbert 2017-04-11 13:47:30 +09:00
parent 24fea2809b
commit ecfe68d6fb
No known key found for this signature in database
GPG Key ID: 46D71BF4958ABB49
2 changed files with 22 additions and 5 deletions

View File

@ -27,7 +27,24 @@ public class Score
public int Combo { get; set; }
public Mod[] Mods { get; set; }
public User User { get; set; }
private User user;
public User User
{
get
{
return user ?? new User
{
Username = temporaryUsername,
Id = temporaryUserID
};
}
set
{
user = value;
}
}
[JsonProperty(@"replay_data")]
public Replay Replay;
@ -38,10 +55,10 @@ public class Score
public long OnlineScoreID;
[JsonProperty(@"username")]
public string Username;
private string temporaryUsername;
[JsonProperty(@"user_id")]
public long UserID;
private long temporaryUserID;
[JsonProperty(@"date")]
public DateTime Date;

View File

@ -142,7 +142,7 @@ public LeaderboardScore(Score score, int rank)
Children = new Drawable[]
{
avatar = new DelayedLoadWrapper(
new Avatar(Score.User ?? new User { Id = Score.UserID })
new Avatar(Score.User)
{
RelativeSizeAxes = Axes.Both,
CornerRadius = corner_radius,
@ -169,7 +169,7 @@ public LeaderboardScore(Score score, int rank)
{
nameLabel = new OsuSpriteText
{
Text = Score.User?.Username ?? Score.Username,
Text = Score.User.Username,
Font = @"Exo2.0-BoldItalic",
TextSize = 23,
},