1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 14:47:25 +08:00

Rename to IBeatmapConverter, move to separate file

This commit is contained in:
smoogipoo 2018-03-02 20:19:47 +09:00
parent 71755f5363
commit a2c239d5e3
8 changed files with 34 additions and 24 deletions

View File

@ -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<ConvertValue>

View File

@ -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<ConvertValue>

View File

@ -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<ConvertValue>

View File

@ -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<ConvertValue>

View File

@ -8,31 +8,15 @@ using osu.Game.Rulesets.Objects;
namespace osu.Game.Beatmaps
{
public interface ITestableBeatmapConverter
{
/// <summary>
/// Invoked when a <see cref="HitObject"/> has been converted.
/// The first argument contains the <see cref="HitObject"/> that was converted.
/// The second argument contains the <see cref="HitObject"/>s that were output from the conversion process.
/// </summary>
event Action<HitObject, IEnumerable<HitObject>> ObjectConverted;
/// <summary>
/// Converts a Beatmap using this Beatmap Converter.
/// </summary>
/// <param name="original">The un-converted Beatmap.</param>
void Convert(Beatmap beatmap);
}
/// <summary>
/// Converts a Beatmap for another mode.
/// </summary>
/// <typeparam name="T">The type of HitObject stored in the Beatmap.</typeparam>
public abstract class BeatmapConverter<T> : ITestableBeatmapConverter
public abstract class BeatmapConverter<T> : IBeatmapConverter
where T : HitObject
{
private event Action<HitObject, IEnumerable<HitObject>> ObjectConverted;
event Action<HitObject, IEnumerable<HitObject>> ITestableBeatmapConverter.ObjectConverted
event Action<HitObject, IEnumerable<HitObject>> 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);
/// <summary>
/// Performs the conversion of a Beatmap using this Beatmap Converter.

View File

@ -0,0 +1,25 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// 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
{
/// <summary>
/// Invoked when a <see cref="HitObject"/> has been converted.
/// The first argument contains the <see cref="HitObject"/> that was converted.
/// The second argument contains the <see cref="HitObject"/>s that were output from the conversion process.
/// </summary>
event Action<HitObject, IEnumerable<HitObject>> ObjectConverted;
/// <summary>
/// Converts a Beatmap using this Beatmap Converter.
/// </summary>
/// <param name="original">The un-converted Beatmap.</param>
void Convert(Beatmap beatmap);
}
}

View File

@ -122,7 +122,7 @@ namespace osu.Game.Tests.Beatmaps
}
protected abstract IEnumerable<TConvertValue> CreateConvertValue(HitObject hitObject);
protected abstract ITestableBeatmapConverter CreateConverter(Beatmap beatmap);
protected abstract IBeatmapConverter CreateConverter(Beatmap beatmap);
private class ConvertMapping
{

View File

@ -270,6 +270,7 @@
<Compile Include="Beatmaps\Formats\JsonBeatmapDecoder.cs" />
<Compile Include="Beatmaps\Formats\LegacyDecoder.cs" />
<Compile Include="Beatmaps\Formats\LegacyStoryboardDecoder.cs" />
<Compile Include="Beatmaps\IBeatmapConverter.cs" />
<Compile Include="Configuration\DatabasedSetting.cs" />
<Compile Include="Configuration\SettingsStore.cs" />
<Compile Include="Configuration\DatabasedConfigManager.cs" />