1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 14:53:01 +08:00

Made modString private and moved the beatmap assignment inside GetScoresRequest

This commit is contained in:
MrTheMake 2017-08-15 15:30:53 +02:00
parent 2c287e1348
commit 105048500a
3 changed files with 14 additions and 6 deletions

View File

@ -16,6 +16,17 @@ namespace osu.Game.Online.API.Requests
public GetScoresRequest(BeatmapInfo beatmap) public GetScoresRequest(BeatmapInfo beatmap)
{ {
this.beatmap = 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() protected override WebRequest CreateWebRequest()

View File

@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Scoring
public int Combo { get; set; } public int Combo { get; set; }
[JsonProperty(@"mods")] [JsonProperty(@"mods")]
protected string[] ModStrings { get; set; } private string[] modStrings { get; set; }
private RulesetInfo ruleset; private RulesetInfo ruleset;
public RulesetInfo Ruleset public RulesetInfo Ruleset
@ -40,8 +40,8 @@ namespace osu.Game.Rulesets.Scoring
ruleset = value; ruleset = value;
// Handle the mod strings if they are assigned // Handle the mod strings if they are assigned
if (ModStrings != null) if (modStrings != null)
Mods = Ruleset.CreateInstance().GetAllMods().Where(mod => ModStrings.Contains(mod.ShortenedName)).ToArray(); Mods = ruleset.CreateInstance().GetAllMods().Where(mod => modStrings.Contains(mod.ShortenedName)).ToArray();
} }
} }

View File

@ -55,9 +55,6 @@ namespace osu.Game.Screens.Select.Leaderboards
i = 0; i = 0;
foreach (var s in scores) foreach (var s in scores)
{ {
s.Beatmap = beatmap;
s.Ruleset = beatmap?.Ruleset;
var ls = new LeaderboardScore(s, 1 + i) var ls = new LeaderboardScore(s, 1 + i)
{ {
AlwaysPresent = true, AlwaysPresent = true,