From 105048500ad9a30f173d04892c5dd56ec28e5cdc Mon Sep 17 00:00:00 2001 From: MrTheMake Date: Tue, 15 Aug 2017 15:30:53 +0200 Subject: [PATCH] Made modString private and moved the beatmap assignment inside GetScoresRequest --- osu.Game/Online/API/Requests/GetScoresRequest.cs | 11 +++++++++++ osu.Game/Rulesets/Scoring/Score.cs | 6 +++--- osu.Game/Screens/Select/Leaderboards/Leaderboard.cs | 3 --- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/osu.Game/Online/API/Requests/GetScoresRequest.cs b/osu.Game/Online/API/Requests/GetScoresRequest.cs index 966049429e..a902c8c807 100644 --- a/osu.Game/Online/API/Requests/GetScoresRequest.cs +++ b/osu.Game/Online/API/Requests/GetScoresRequest.cs @@ -16,6 +16,17 @@ namespace osu.Game.Online.API.Requests public GetScoresRequest(BeatmapInfo beatmap) { this.beatmap = beatmap; + + Success += onSuccess; + } + + private void onSuccess(GetScoresResponse r) + { + foreach (Score score in r.Scores) + { + score.Beatmap = beatmap; + score.Ruleset = beatmap.Ruleset; + } } protected override WebRequest CreateWebRequest() diff --git a/osu.Game/Rulesets/Scoring/Score.cs b/osu.Game/Rulesets/Scoring/Score.cs index 15217352d0..e42c3b2df0 100644 --- a/osu.Game/Rulesets/Scoring/Score.cs +++ b/osu.Game/Rulesets/Scoring/Score.cs @@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Scoring public int Combo { get; set; } [JsonProperty(@"mods")] - protected string[] ModStrings { get; set; } + private string[] modStrings { get; set; } private RulesetInfo ruleset; public RulesetInfo Ruleset @@ -40,8 +40,8 @@ namespace osu.Game.Rulesets.Scoring ruleset = value; // Handle the mod strings if they are assigned - if (ModStrings != null) - Mods = Ruleset.CreateInstance().GetAllMods().Where(mod => ModStrings.Contains(mod.ShortenedName)).ToArray(); + if (modStrings != null) + Mods = ruleset.CreateInstance().GetAllMods().Where(mod => modStrings.Contains(mod.ShortenedName)).ToArray(); } } diff --git a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs index 5ec76a59ac..0506784614 100644 --- a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs @@ -55,9 +55,6 @@ namespace osu.Game.Screens.Select.Leaderboards i = 0; foreach (var s in scores) { - s.Beatmap = beatmap; - s.Ruleset = beatmap?.Ruleset; - var ls = new LeaderboardScore(s, 1 + i) { AlwaysPresent = true,