From a2c239d5e3ffc4e1603e048fb24824f4a8e2295f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 2 Mar 2018 20:19:47 +0900 Subject: [PATCH] Rename to IBeatmapConverter, move to separate file --- .../Tests/CatchBeatmapConversionTest.cs | 2 +- .../Tests/ManiaBeatmapConversionTest.cs | 2 +- .../Tests/OsuBeatmapConversionTest.cs | 2 +- .../Tests/TaikoBeatmapConversionTest.cs | 2 +- osu.Game/Beatmaps/BeatmapConverter.cs | 22 +++------------- osu.Game/Beatmaps/IBeatmapConverter.cs | 25 +++++++++++++++++++ .../Tests/Beatmaps/BeatmapConversionTest.cs | 2 +- osu.Game/osu.Game.csproj | 1 + 8 files changed, 34 insertions(+), 24 deletions(-) create mode 100644 osu.Game/Beatmaps/IBeatmapConverter.cs diff --git a/osu.Game.Rulesets.Catch/Tests/CatchBeatmapConversionTest.cs b/osu.Game.Rulesets.Catch/Tests/CatchBeatmapConversionTest.cs index 31d1e9768f..a660545765 100644 --- a/osu.Game.Rulesets.Catch/Tests/CatchBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Catch/Tests/CatchBeatmapConversionTest.cs @@ -47,7 +47,7 @@ namespace osu.Game.Rulesets.Catch.Tests } } - protected override ITestableBeatmapConverter CreateConverter(Beatmap beatmap) => new CatchBeatmapConverter(); + protected override IBeatmapConverter CreateConverter(Beatmap beatmap) => new CatchBeatmapConverter(); } public struct ConvertValue : IEquatable diff --git a/osu.Game.Rulesets.Mania/Tests/ManiaBeatmapConversionTest.cs b/osu.Game.Rulesets.Mania/Tests/ManiaBeatmapConversionTest.cs index 8d2280c853..2095addc72 100644 --- a/osu.Game.Rulesets.Mania/Tests/ManiaBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Mania/Tests/ManiaBeatmapConversionTest.cs @@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Mania.Tests }; } - protected override ITestableBeatmapConverter CreateConverter(Beatmap beatmap) => new ManiaBeatmapConverter(isForCurrentRuleset, beatmap); + protected override IBeatmapConverter CreateConverter(Beatmap beatmap) => new ManiaBeatmapConverter(isForCurrentRuleset, beatmap); } public struct ConvertValue : IEquatable diff --git a/osu.Game.Rulesets.Osu/Tests/OsuBeatmapConversionTest.cs b/osu.Game.Rulesets.Osu/Tests/OsuBeatmapConversionTest.cs index 8f7a486569..18b87b715b 100644 --- a/osu.Game.Rulesets.Osu/Tests/OsuBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Osu/Tests/OsuBeatmapConversionTest.cs @@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Osu.Tests }; } - protected override ITestableBeatmapConverter CreateConverter(Beatmap beatmap) => new OsuBeatmapConverter(); + protected override ITestableBeatmapConverter CreateConverter(BeaIBeatmapConvertereatmapConverter(); } public struct ConvertValue : IEquatable diff --git a/osu.Game.Rulesets.Taiko/Tests/TaikoBeatmapConversionTest.cs b/osu.Game.Rulesets.Taiko/Tests/TaikoBeatmapConversionTest.cs index dc7d9dd98c..64f728a018 100644 --- a/osu.Game.Rulesets.Taiko/Tests/TaikoBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Taiko/Tests/TaikoBeatmapConversionTest.cs @@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Taiko.Tests }; } - protected override ITestableBeatmapConverter CreateConverter(Beatmap beatmap) => new TaikoBeatmapConverter(isForCurrentRuleset); + protected override IBeatmapConverter CreateConverter(Beatmap beatmap) => new TaikoBeatmapConverter(isForCurrentRuleset); } public struct ConvertValue : IEquatable diff --git a/osu.Game/Beatmaps/BeatmapConverter.cs b/osu.Game/Beatmaps/BeatmapConverter.cs index 0094bd9116..711e220b88 100644 --- a/osu.Game/Beatmaps/BeatmapConverter.cs +++ b/osu.Game/Beatmaps/BeatmapConverter.cs @@ -8,31 +8,15 @@ using osu.Game.Rulesets.Objects; namespace osu.Game.Beatmaps { - public interface ITestableBeatmapConverter - { - /// - /// Invoked when a has been converted. - /// The first argument contains the that was converted. - /// The second argument contains the s that were output from the conversion process. - /// - event Action> ObjectConverted; - - /// - /// Converts a Beatmap using this Beatmap Converter. - /// - /// The un-converted Beatmap. - void Convert(Beatmap beatmap); - } - /// /// Converts a Beatmap for another mode. /// /// The type of HitObject stored in the Beatmap. - public abstract class BeatmapConverter : ITestableBeatmapConverter + public abstract class BeatmapConverter : IBeatmapConverter where T : HitObject { private event Action> ObjectConverted; - event Action> ITestableBeatmapConverter.ObjectConverted + event Action> IBeatmapConverter.ObjectConverted { add => ObjectConverted += value; remove => ObjectConverted -= value; @@ -56,7 +40,7 @@ namespace osu.Game.Beatmaps return ConvertBeatmap(new Beatmap(original)); } - void ITestableBeatmapConverter.Convert(Beatmap original) => Convert(original); + void IBeatmapConverter.Convert(Beatmap original) => Convert(original); /// /// Performs the conversion of a Beatmap using this Beatmap Converter. diff --git a/osu.Game/Beatmaps/IBeatmapConverter.cs b/osu.Game/Beatmaps/IBeatmapConverter.cs new file mode 100644 index 0000000000..ebd900b97e --- /dev/null +++ b/osu.Game/Beatmaps/IBeatmapConverter.cs @@ -0,0 +1,25 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Collections.Generic; +using osu.Game.Rulesets.Objects; + +namespace osu.Game.Beatmaps +{ + public interface IBeatmapConverter + { + /// + /// Invoked when a has been converted. + /// The first argument contains the that was converted. + /// The second argument contains the s that were output from the conversion process. + /// + event Action> ObjectConverted; + + /// + /// Converts a Beatmap using this Beatmap Converter. + /// + /// The un-converted Beatmap. + void Convert(Beatmap beatmap); + } +} diff --git a/osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs b/osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs index 66d6a0b951..596dbe84ba 100644 --- a/osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs +++ b/osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs @@ -122,7 +122,7 @@ namespace osu.Game.Tests.Beatmaps } protected abstract IEnumerable CreateConvertValue(HitObject hitObject); - protected abstract ITestableBeatmapConverter CreateConverter(Beatmap beatmap); + protected abstract IBeatmapConverter CreateConverter(Beatmap beatmap); private class ConvertMapping { diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 2ed8e3a9a5..ff365ad93e 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -270,6 +270,7 @@ +