1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 08:07:24 +08:00

Use a method to apply a beatmap, its ruleset and the mods.

This commit is contained in:
MrTheMake 2017-09-08 12:17:16 +02:00
parent 01553fc9ef
commit 526ee107b8
2 changed files with 7 additions and 7 deletions

View File

@ -23,12 +23,7 @@ namespace osu.Game.Online.API.Requests
private void onSuccess(GetScoresResponse r)
{
foreach (OnlineScore score in r.Scores)
{
score.Beatmap = beatmap;
score.Ruleset = beatmap.Ruleset;
score.ResolveModString();
}
score.ApplyBeatmap(beatmap);
}
protected override WebRequest CreateWebRequest()

View File

@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using osu.Game.Beatmaps;
using osu.Game.Users;
using osu.Game.Rulesets.Replays;
@ -82,8 +83,12 @@ namespace osu.Game.Rulesets.Scoring
[JsonProperty(@"mods")]
private string[] modStrings { get; set; }
public void ResolveModString()
public void ApplyBeatmap(BeatmapInfo beatmap)
{
Beatmap = beatmap;
Ruleset = beatmap.Ruleset;
// Evaluate the mod string
Mods = Ruleset.CreateInstance().GetAllMods().Where(mod => modStrings.Contains(mod.ShortenedName)).ToArray();
}
}