mirror of
https://github.com/ppy/osu.git
synced 2025-02-05 10:13:00 +08:00
Add type parameter to IApplicableToBeatmap
This commit is contained in:
parent
8f5e495585
commit
6d00aff9fd
@ -4,11 +4,12 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Mania.Beatmaps;
|
using osu.Game.Rulesets.Mania.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Mania.Objects;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Mods
|
namespace osu.Game.Rulesets.Mania.Mods
|
||||||
{
|
{
|
||||||
public class ManiaModDualStages : Mod, IPlayfieldTypeMod, IApplicableToBeatmapConverter, IApplicableToBeatmap
|
public class ManiaModDualStages : Mod, IPlayfieldTypeMod, IApplicableToBeatmapConverter, IApplicableToBeatmap<ManiaHitObject>
|
||||||
{
|
{
|
||||||
public override string Name => "Dual Stages";
|
public override string Name => "Dual Stages";
|
||||||
public override string ShortenedName => "DS";
|
public override string ShortenedName => "DS";
|
||||||
@ -31,12 +32,12 @@ namespace osu.Game.Rulesets.Mania.Mods
|
|||||||
mbc.TargetColumns *= 2;
|
mbc.TargetColumns *= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ApplyToBeatmap(IBeatmap beatmap)
|
public void ApplyToBeatmap(Beatmap<ManiaHitObject> beatmap)
|
||||||
{
|
{
|
||||||
if (isForCurrentRuleset)
|
if (isForCurrentRuleset)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var maniaBeatmap = (ManiaBeatmap) beatmap;
|
var maniaBeatmap = (ManiaBeatmap)beatmap;
|
||||||
|
|
||||||
var newDefinitions = new List<StageDefinition>();
|
var newDefinitions = new List<StageDefinition>();
|
||||||
foreach (var existing in maniaBeatmap.Stages)
|
foreach (var existing in maniaBeatmap.Stages)
|
||||||
|
@ -2,18 +2,21 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mods
|
namespace osu.Game.Rulesets.Mods
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interface for a <see cref="Mod"/> that applies changes to a <see cref="Beatmap"/>.
|
/// Interface for a <see cref="Mod"/> that applies changes to a <see cref="Beatmap"/>
|
||||||
|
/// after conversion and post-processing has completed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IApplicableToBeatmap : IApplicableMod
|
public interface IApplicableToBeatmap<TObject> : IApplicableMod
|
||||||
|
where TObject : HitObject
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Applies this <see cref="Mod"/> to a <see cref="Beatmap"/>.
|
/// Applies this <see cref="IApplicableToBeatmap{TObject}"/> to a <see cref="Beatmap{TObject}"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="beatmap">The <see cref="Beatmap"/> to apply to.</param>
|
/// <param name="beatmap">The <see cref="Beatmap{TObject}"/> to apply to.</param>
|
||||||
void ApplyToBeatmap(IBeatmap beatmap);
|
void ApplyToBeatmap(Beatmap<TObject> beatmap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -271,7 +271,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
if (mods == null)
|
if (mods == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (var mod in mods.OfType<IApplicableToBeatmap>())
|
foreach (var mod in mods.OfType<IApplicableToBeatmap<TObject>>())
|
||||||
mod.ApplyToBeatmap(Beatmap);
|
mod.ApplyToBeatmap(Beatmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user