mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 15:53:19 +08:00
Add interface to adjust Beatmaps
This commit is contained in:
parent
5b048d9a99
commit
df6fc4013a
19
osu.Game/Rulesets/Mods/IApplicableToBeatmap.cs
Normal file
19
osu.Game/Rulesets/Mods/IApplicableToBeatmap.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mods
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interface for a <see cref="Mod"/> that applies changes to a <see cref="Beatmap"/>.
|
||||||
|
/// </summary>
|
||||||
|
public interface IApplicableToBeatmap : IApplicableMod
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Applies this <see cref="Mod"/> to a <see cref="Beatmap"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="beatmap">The <see cref="Beatmap"/> to apply to.</param>
|
||||||
|
void ApplyToBeatmap(IBeatmap beatmap);
|
||||||
|
}
|
||||||
|
}
|
@ -238,6 +238,8 @@ namespace osu.Game.Rulesets.UI
|
|||||||
|
|
||||||
KeyBindingInputManager = CreateInputManager();
|
KeyBindingInputManager = CreateInputManager();
|
||||||
KeyBindingInputManager.RelativeSizeAxes = Axes.Both;
|
KeyBindingInputManager.RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
applyBeatmapMods(Mods);
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -255,16 +257,29 @@ namespace osu.Game.Rulesets.UI
|
|||||||
KeyBindingInputManager.Add(Cursor);
|
KeyBindingInputManager.Add(Cursor);
|
||||||
|
|
||||||
// Apply mods
|
// Apply mods
|
||||||
applyMods(Mods, config);
|
applyRulesetMods(Mods, config);
|
||||||
|
|
||||||
loadObjects();
|
loadObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Applies the active mods to the Beatmap.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mods"></param>
|
||||||
|
private void applyBeatmapMods(IEnumerable<Mod> mods)
|
||||||
|
{
|
||||||
|
if (mods == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
foreach (var mod in mods.OfType<IApplicableToBeatmap>())
|
||||||
|
mod.ApplyToBeatmap(Beatmap);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Applies the active mods to this RulesetContainer.
|
/// Applies the active mods to this RulesetContainer.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="mods"></param>
|
/// <param name="mods"></param>
|
||||||
private void applyMods(IEnumerable<Mod> mods, OsuConfigManager config)
|
private void applyRulesetMods(IEnumerable<Mod> mods, OsuConfigManager config)
|
||||||
{
|
{
|
||||||
if (mods == null)
|
if (mods == null)
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user