mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 21:43:22 +08:00
Add a way to adjust the conversion process with mods
This commit is contained in:
parent
bd171926d6
commit
6d253fd33c
22
osu.Game/Rulesets/Mods/IApplicableToBeatmapConverter.cs
Normal file
22
osu.Game/Rulesets/Mods/IApplicableToBeatmapConverter.cs
Normal file
@ -0,0 +1,22 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
|
||||
namespace osu.Game.Rulesets.Mods
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface for a <see cref="Mod"/> that applies changes to a <see cref="BeatmapConverter{TObject}"/>.
|
||||
/// </summary>
|
||||
/// <typeparam name="TObject">The type of converted <see cref="HitObject"/>.</typeparam>
|
||||
public interface IApplicableToBeatmapConverter<TObject>
|
||||
where TObject : HitObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Applies this <see cref="Mod"/> to a <see cref="BeatmapConverter{TObject}"/>.
|
||||
/// </summary>
|
||||
/// <param name="beatmapConverter">The <see cref="BeatmapConverter{TObject}"/> to apply to.</param>
|
||||
void ApplyToBeatmapConverter(BeatmapConverter<TObject> beatmapConverter);
|
||||
}
|
||||
}
|
@ -176,6 +176,10 @@ namespace osu.Game.Rulesets.UI
|
||||
if (!converter.CanConvert(workingBeatmap.Beatmap))
|
||||
throw new BeatmapInvalidForRulesetException($"{nameof(Beatmap)} can not be converted for the current ruleset (converter: {converter}).");
|
||||
|
||||
// Apply conversion adjustments before converting
|
||||
foreach (var mod in Mods.OfType<IApplicableToBeatmapConverter<TObject>>())
|
||||
mod.ApplyToBeatmapConverter(converter);
|
||||
|
||||
// Convert the beatmap
|
||||
Beatmap = converter.Convert(workingBeatmap.Beatmap);
|
||||
|
||||
|
@ -313,6 +313,7 @@
|
||||
<Compile Include="Overlays\Settings\Sections\Maintenance\DeleteAllBeatmapsDialog.cs" />
|
||||
<Compile Include="Rulesets\Mods\IApplicableFailOverride.cs" />
|
||||
<Compile Include="Rulesets\Mods\IApplicableMod.cs" />
|
||||
<Compile Include="Rulesets\Mods\IApplicableToBeatmapConverter.cs" />
|
||||
<Compile Include="Rulesets\Mods\IApplicableToDrawableHitObject.cs" />
|
||||
<Compile Include="Screens\Select\ImportFromStablePopup.cs" />
|
||||
<Compile Include="Overlays\Settings\SettingsButton.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user