mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 14:32:55 +08:00
Fix test scene not correctly building a playable beatmap
This commit is contained in:
parent
d04cc0123d
commit
09273d1da9
@ -13,7 +13,6 @@ using osu.Framework.Timing;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Objects;
|
|
||||||
using osu.Game.Screens.Edit;
|
using osu.Game.Screens.Edit;
|
||||||
using osu.Game.Screens.Edit.Compose.Components.Timeline;
|
using osu.Game.Screens.Edit.Compose.Components.Timeline;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -38,7 +37,9 @@ namespace osu.Game.Tests.Visual.Editor
|
|||||||
{
|
{
|
||||||
Beatmap.Value = new WaveformTestBeatmap(audio);
|
Beatmap.Value = new WaveformTestBeatmap(audio);
|
||||||
|
|
||||||
var editorBeatmap = new EditorBeatmap((Beatmap<HitObject>)Beatmap.Value.Beatmap);
|
var playable = Beatmap.Value.GetPlayableBeatmap(Beatmap.Value.BeatmapInfo.Ruleset);
|
||||||
|
|
||||||
|
var editorBeatmap = new EditorBeatmap(playable);
|
||||||
|
|
||||||
Dependencies.Cache(editorBeatmap);
|
Dependencies.Cache(editorBeatmap);
|
||||||
Dependencies.CacheAs<IBeatSnapProvider>(editorBeatmap);
|
Dependencies.CacheAs<IBeatSnapProvider>(editorBeatmap);
|
||||||
|
@ -11,6 +11,8 @@ using osu.Game.Beatmaps;
|
|||||||
using osu.Game.Beatmaps.Formats;
|
using osu.Game.Beatmaps.Formats;
|
||||||
using osu.Game.IO;
|
using osu.Game.IO;
|
||||||
using osu.Game.IO.Archives;
|
using osu.Game.IO.Archives;
|
||||||
|
using osu.Game.Rulesets.Catch;
|
||||||
|
using osu.Game.Tests.Beatmaps;
|
||||||
using osu.Game.Tests.Resources;
|
using osu.Game.Tests.Resources;
|
||||||
|
|
||||||
namespace osu.Game.Tests
|
namespace osu.Game.Tests
|
||||||
@ -20,11 +22,18 @@ namespace osu.Game.Tests
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class WaveformTestBeatmap : WorkingBeatmap
|
public class WaveformTestBeatmap : WorkingBeatmap
|
||||||
{
|
{
|
||||||
|
private readonly Beatmap beatmap;
|
||||||
private readonly ITrackStore trackStore;
|
private readonly ITrackStore trackStore;
|
||||||
|
|
||||||
public WaveformTestBeatmap(AudioManager audioManager)
|
public WaveformTestBeatmap(AudioManager audioManager)
|
||||||
: base(new BeatmapInfo(), audioManager)
|
: this(audioManager, new WaveformBeatmap())
|
||||||
{
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public WaveformTestBeatmap(AudioManager audioManager, Beatmap beatmap)
|
||||||
|
: base(beatmap.BeatmapInfo, audioManager)
|
||||||
|
{
|
||||||
|
this.beatmap = beatmap;
|
||||||
trackStore = audioManager.GetTrackStore(getZipReader());
|
trackStore = audioManager.GetTrackStore(getZipReader());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,11 +43,11 @@ namespace osu.Game.Tests
|
|||||||
trackStore?.Dispose();
|
trackStore?.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Stream getStream() => TestResources.GetTestBeatmapStream();
|
private static Stream getStream() => TestResources.GetTestBeatmapStream();
|
||||||
|
|
||||||
private ZipArchiveReader getZipReader() => new ZipArchiveReader(getStream());
|
private static ZipArchiveReader getZipReader() => new ZipArchiveReader(getStream());
|
||||||
|
|
||||||
protected override IBeatmap GetBeatmap() => createTestBeatmap();
|
protected override IBeatmap GetBeatmap() => beatmap;
|
||||||
|
|
||||||
protected override Texture GetBackground() => null;
|
protected override Texture GetBackground() => null;
|
||||||
|
|
||||||
@ -57,10 +66,16 @@ namespace osu.Game.Tests
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Beatmap createTestBeatmap()
|
private class WaveformBeatmap : TestBeatmap
|
||||||
{
|
{
|
||||||
using (var reader = getZipReader())
|
public WaveformBeatmap()
|
||||||
|
: base(new CatchRuleset().RulesetInfo)
|
||||||
{
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Beatmap CreateBeatmap()
|
||||||
|
{
|
||||||
|
using (var reader = getZipReader())
|
||||||
using (var beatmapStream = reader.GetStream(reader.Filenames.First(f => f.EndsWith(".osu"))))
|
using (var beatmapStream = reader.GetStream(reader.Filenames.First(f => f.EndsWith(".osu"))))
|
||||||
using (var beatmapReader = new LineBufferedReader(beatmapStream))
|
using (var beatmapReader = new LineBufferedReader(beatmapStream))
|
||||||
return Decoder.GetDecoder<Beatmap>(beatmapReader).Decode(beatmapReader);
|
return Decoder.GetDecoder<Beatmap>(beatmapReader).Decode(beatmapReader);
|
||||||
|
@ -15,7 +15,7 @@ namespace osu.Game.Tests.Beatmaps
|
|||||||
{
|
{
|
||||||
public TestBeatmap(RulesetInfo ruleset)
|
public TestBeatmap(RulesetInfo ruleset)
|
||||||
{
|
{
|
||||||
var baseBeatmap = createTestBeatmap();
|
var baseBeatmap = CreateBeatmap();
|
||||||
|
|
||||||
BeatmapInfo = baseBeatmap.BeatmapInfo;
|
BeatmapInfo = baseBeatmap.BeatmapInfo;
|
||||||
ControlPointInfo = baseBeatmap.ControlPointInfo;
|
ControlPointInfo = baseBeatmap.ControlPointInfo;
|
||||||
@ -37,6 +37,8 @@ namespace osu.Game.Tests.Beatmaps
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected virtual Beatmap CreateBeatmap() => createTestBeatmap();
|
||||||
|
|
||||||
private static Beatmap createTestBeatmap()
|
private static Beatmap createTestBeatmap()
|
||||||
{
|
{
|
||||||
using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(test_beatmap_data)))
|
using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(test_beatmap_data)))
|
||||||
|
Loading…
Reference in New Issue
Block a user