mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 06:23:21 +08:00
Use a method to apply a beatmap, its ruleset and the mods.
This commit is contained in:
parent
01553fc9ef
commit
526ee107b8
@ -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()
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user