mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:27:29 +08:00
Repurpose Flat{File -> }WorkingBeatmap
This commit is contained in:
parent
896cbb0ba0
commit
37361cd683
@ -75,7 +75,7 @@ namespace osu.Desktop.LegacyIpc
|
||||
case LegacyIpcDifficultyCalculationRequest req:
|
||||
try
|
||||
{
|
||||
WorkingBeatmap beatmap = new FlatFileWorkingBeatmap(req.BeatmapFile);
|
||||
WorkingBeatmap beatmap = new FlatWorkingBeatmap(req.BeatmapFile);
|
||||
var ruleset = beatmap.BeatmapInfo.Ruleset.CreateInstance();
|
||||
Mod[] mods = ruleset.ConvertFromLegacyMods((LegacyMods)req.Mods).ToArray();
|
||||
|
||||
|
@ -12,25 +12,26 @@ using osu.Game.Skinning;
|
||||
namespace osu.Game.Beatmaps
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see cref="WorkingBeatmap"/> which can be constructed directly from a .osu file, providing an implementation for
|
||||
/// A <see cref="WorkingBeatmap"/> which can be constructed directly from an .osu file (via <see cref="FlatWorkingBeatmap(string, int?)"/>)
|
||||
/// or an <see cref="IBeatmap"/> instance (via <see cref="FlatWorkingBeatmap(IBeatmap)"/>,
|
||||
/// providing an implementation for
|
||||
/// <see cref="WorkingBeatmap.GetPlayableBeatmap(osu.Game.Rulesets.IRulesetInfo,System.Collections.Generic.IReadOnlyList{osu.Game.Rulesets.Mods.Mod})"/>.
|
||||
/// </summary>
|
||||
public class FlatFileWorkingBeatmap : WorkingBeatmap
|
||||
public class FlatWorkingBeatmap : WorkingBeatmap
|
||||
{
|
||||
private readonly Beatmap beatmap;
|
||||
private readonly IBeatmap beatmap;
|
||||
|
||||
public FlatFileWorkingBeatmap(string file, int? beatmapId = null)
|
||||
: this(readFromFile(file), beatmapId)
|
||||
public FlatWorkingBeatmap(string file, int? beatmapId = null)
|
||||
: this(readFromFile(file))
|
||||
{
|
||||
if (beatmapId.HasValue)
|
||||
beatmap.BeatmapInfo.OnlineID = beatmapId.Value;
|
||||
}
|
||||
|
||||
private FlatFileWorkingBeatmap(Beatmap beatmap, int? beatmapId = null)
|
||||
public FlatWorkingBeatmap(IBeatmap beatmap)
|
||||
: base(beatmap.BeatmapInfo, null)
|
||||
{
|
||||
this.beatmap = beatmap;
|
||||
|
||||
if (beatmapId.HasValue)
|
||||
beatmap.BeatmapInfo.OnlineID = beatmapId.Value;
|
||||
}
|
||||
|
||||
private static Beatmap readFromFile(string filename)
|
Loading…
Reference in New Issue
Block a user