From ecfe68d6fba14bf6915182e52e049e6639bf0a46 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Apr 2017 13:47:30 +0900 Subject: [PATCH] Hide deprecated API storage variables and populate Score.User automatically. --- osu.Game/Modes/Scoring/Score.cs | 23 ++++++++++++++++--- .../Select/Leaderboards/LeaderboardScore.cs | 4 ++-- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/osu.Game/Modes/Scoring/Score.cs b/osu.Game/Modes/Scoring/Score.cs index c998b11f77..e49907e7a8 100644 --- a/osu.Game/Modes/Scoring/Score.cs +++ b/osu.Game/Modes/Scoring/Score.cs @@ -27,7 +27,24 @@ namespace osu.Game.Modes.Scoring 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 @@ namespace osu.Game.Modes.Scoring 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; diff --git a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs index 2bac387c5c..493f351b75 100644 --- a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs @@ -142,7 +142,7 @@ namespace osu.Game.Screens.Select.Leaderboards 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 @@ namespace osu.Game.Screens.Select.Leaderboards { nameLabel = new OsuSpriteText { - Text = Score.User?.Username ?? Score.Username, + Text = Score.User.Username, Font = @"Exo2.0-BoldItalic", TextSize = 23, },