mirror of
https://github.com/osukey/osukey.git
synced 2025-07-31 07:05:35 +09:00
Use a method to apply a beatmap, its ruleset and the mods.
This commit is contained in:
@ -23,12 +23,7 @@ namespace osu.Game.Online.API.Requests
|
|||||||
private void onSuccess(GetScoresResponse r)
|
private void onSuccess(GetScoresResponse r)
|
||||||
{
|
{
|
||||||
foreach (OnlineScore score in r.Scores)
|
foreach (OnlineScore score in r.Scores)
|
||||||
{
|
score.ApplyBeatmap(beatmap);
|
||||||
score.Beatmap = beatmap;
|
|
||||||
score.Ruleset = beatmap.Ruleset;
|
|
||||||
|
|
||||||
score.ResolveModString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override WebRequest CreateWebRequest()
|
protected override WebRequest CreateWebRequest()
|
||||||
|
@ -5,6 +5,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
using osu.Game.Rulesets.Replays;
|
using osu.Game.Rulesets.Replays;
|
||||||
|
|
||||||
@ -82,8 +83,12 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
[JsonProperty(@"mods")]
|
[JsonProperty(@"mods")]
|
||||||
private string[] modStrings { get; set; }
|
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();
|
Mods = Ruleset.CreateInstance().GetAllMods().Where(mod => modStrings.Contains(mod.ShortenedName)).ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user