mirror of
https://github.com/ppy/osu.git
synced 2024-09-21 18:07:23 +08:00
Update FlatFileWorkingBeatmap
to not require a ruleset store
This commit is contained in:
parent
a029e418cf
commit
c869be87d1
@ -77,10 +77,9 @@ namespace osu.Desktop.LegacyIpc
|
|||||||
case LegacyIpcDifficultyCalculationRequest req:
|
case LegacyIpcDifficultyCalculationRequest req:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var ruleset = getLegacyRulesetFromID(req.RulesetId);
|
WorkingBeatmap beatmap = new FlatFileWorkingBeatmap(req.BeatmapFile);
|
||||||
|
var ruleset = beatmap.BeatmapInfo.Ruleset.CreateInstance();
|
||||||
Mod[] mods = ruleset.ConvertFromLegacyMods((LegacyMods)req.Mods).ToArray();
|
Mod[] mods = ruleset.ConvertFromLegacyMods((LegacyMods)req.Mods).ToArray();
|
||||||
WorkingBeatmap beatmap = new FlatFileWorkingBeatmap(req.BeatmapFile, _ => ruleset);
|
|
||||||
|
|
||||||
return new LegacyIpcDifficultyCalculationResponse
|
return new LegacyIpcDifficultyCalculationResponse
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,6 @@ using osu.Framework.Audio.Track;
|
|||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Game.Beatmaps.Formats;
|
using osu.Game.Beatmaps.Formats;
|
||||||
using osu.Game.IO;
|
using osu.Game.IO;
|
||||||
using osu.Game.Rulesets;
|
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps
|
namespace osu.Game.Beatmaps
|
||||||
@ -20,18 +19,16 @@ namespace osu.Game.Beatmaps
|
|||||||
{
|
{
|
||||||
private readonly Beatmap beatmap;
|
private readonly Beatmap beatmap;
|
||||||
|
|
||||||
public FlatFileWorkingBeatmap(string file, Func<int, Ruleset> rulesetProvider, int? beatmapId = null)
|
public FlatFileWorkingBeatmap(string file, int? beatmapId = null)
|
||||||
: this(readFromFile(file), rulesetProvider, beatmapId)
|
: this(readFromFile(file), beatmapId)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private FlatFileWorkingBeatmap(Beatmap beatmap, Func<int, Ruleset> rulesetProvider, int? beatmapId = null)
|
private FlatFileWorkingBeatmap(Beatmap beatmap, int? beatmapId = null)
|
||||||
: base(beatmap.BeatmapInfo, null)
|
: base(beatmap.BeatmapInfo, null)
|
||||||
{
|
{
|
||||||
this.beatmap = beatmap;
|
this.beatmap = beatmap;
|
||||||
|
|
||||||
beatmap.BeatmapInfo.Ruleset = rulesetProvider(beatmap.BeatmapInfo.Ruleset.OnlineID).RulesetInfo;
|
|
||||||
|
|
||||||
if (beatmapId.HasValue)
|
if (beatmapId.HasValue)
|
||||||
beatmap.BeatmapInfo.OnlineID = beatmapId.Value;
|
beatmap.BeatmapInfo.OnlineID = beatmapId.Value;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user