From cc2b4c5c5b4cf2c15687ea942c16334a733c91a7 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 22 Mar 2017 05:54:07 -0400 Subject: [PATCH 1/5] Refactor WorkingBeatmap Gets ArchiveReader out of WorkingBeatmap and delegates extracting stuff from it to subclasses. Should enable us to make an OnlineWorkingBeatmap or so. --- .../Beatmaps/TestWorkingBeatmap.cs | 32 +++++ .../Tests/TestCaseGamefield.cs | 13 +- .../Tests/TestCasePlayer.cs | 12 +- .../osu.Desktop.VisualTests.csproj | 4 + osu.Game/Beatmaps/WorkingBeatmap.cs | 124 ++--------------- osu.Game/Database/BeatmapDatabase.cs | 15 +-- osu.Game/Database/DatabaseWorkingBeatmap.cs | 127 ++++++++++++++++++ osu.Game/osu.Game.csproj | 1 + 8 files changed, 176 insertions(+), 152 deletions(-) create mode 100644 osu.Desktop.VisualTests/Beatmaps/TestWorkingBeatmap.cs create mode 100644 osu.Game/Database/DatabaseWorkingBeatmap.cs diff --git a/osu.Desktop.VisualTests/Beatmaps/TestWorkingBeatmap.cs b/osu.Desktop.VisualTests/Beatmaps/TestWorkingBeatmap.cs new file mode 100644 index 0000000000..e6236b041f --- /dev/null +++ b/osu.Desktop.VisualTests/Beatmaps/TestWorkingBeatmap.cs @@ -0,0 +1,32 @@ +using System; +using osu.Framework.Audio.Track; +using osu.Framework.Graphics.Textures; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.IO; + +namespace osu.Desktop.VisualTests.Beatmaps +{ + public class TestWorkingBeatmap : WorkingBeatmap + { + public TestWorkingBeatmap(Beatmap beatmap) + : base(beatmap.BeatmapInfo, beatmap.BeatmapInfo.BeatmapSet) + { + this.beatmap = beatmap; + } + + private Beatmap beatmap; + public override Beatmap Beatmap => beatmap; + public override Texture Background => null; + public override Track Track => null; + + public override void Dispose() + { + // This space intentionally left blank + } + + public override void TransferTo(WorkingBeatmap other) + { + // This space intentionally left blank + } + } +} diff --git a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs index c2e33f7f32..6de2b36cd0 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs @@ -17,6 +17,8 @@ using osu.Game.Modes.Osu.Objects; using osu.Game.Modes.Osu.UI; using osu.Game.Modes.Taiko.UI; using System.Collections.Generic; +using osu.Framework.Graphics.Textures; +using osu.Desktop.VisualTests.Beatmaps; namespace osu.Desktop.VisualTests.Tests { @@ -95,16 +97,5 @@ namespace osu.Desktop.VisualTests.Tests } }); } - - private class TestWorkingBeatmap : WorkingBeatmap - { - public TestWorkingBeatmap(Beatmap beatmap) - : base(beatmap.BeatmapInfo, beatmap.BeatmapInfo.BeatmapSet) - { - Beatmap = beatmap; - } - - protected override ArchiveReader GetReader() => null; - } } } diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs index 41bd24b900..21a00ebdf6 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs @@ -15,6 +15,7 @@ using osu.Game.Modes.Objects; using osu.Game.Modes.Osu.Objects; using osu.Game.Screens.Play; using OpenTK.Graphics; +using osu.Desktop.VisualTests.Beatmaps; namespace osu.Desktop.VisualTests.Tests { @@ -97,16 +98,5 @@ namespace osu.Desktop.VisualTests.Tests Beatmap = beatmap }; } - - private class TestWorkingBeatmap : WorkingBeatmap - { - public TestWorkingBeatmap(Beatmap beatmap) - : base(beatmap.BeatmapInfo, beatmap.BeatmapInfo.BeatmapSet) - { - Beatmap = beatmap; - } - - protected override ArchiveReader GetReader() => null; - } } } diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index 6eb9e5e648..b67b4c4bb3 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -205,9 +205,13 @@ + + + +