mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 07:32:58 +08:00
Merge remote-tracking branch 'upstream/master' into separate-slider-body
This commit is contained in:
commit
113f80570b
@ -5,13 +5,11 @@ 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.Mania.Objects;
|
||||||
using osu.Game.Rulesets.Mania.UI;
|
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.UI;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Mods
|
namespace osu.Game.Rulesets.Mania.Mods
|
||||||
{
|
{
|
||||||
public class ManiaModDualStages : Mod, IPlayfieldTypeMod, IApplicableToBeatmapConverter, IApplicableToRulesetContainer<ManiaHitObject>
|
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";
|
||||||
@ -34,22 +32,21 @@ namespace osu.Game.Rulesets.Mania.Mods
|
|||||||
mbc.TargetColumns *= 2;
|
mbc.TargetColumns *= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ApplyToRulesetContainer(RulesetContainer<ManiaHitObject> rulesetContainer)
|
public void ApplyToBeatmap(Beatmap<ManiaHitObject> beatmap)
|
||||||
{
|
{
|
||||||
var mrc = (ManiaRulesetContainer)rulesetContainer;
|
|
||||||
|
|
||||||
// Although this can work, for now let's not allow keymods for mania-specific beatmaps
|
|
||||||
if (isForCurrentRuleset)
|
if (isForCurrentRuleset)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
var maniaBeatmap = (ManiaBeatmap)beatmap;
|
||||||
|
|
||||||
var newDefinitions = new List<StageDefinition>();
|
var newDefinitions = new List<StageDefinition>();
|
||||||
foreach (var existing in mrc.Beatmap.Stages)
|
foreach (var existing in maniaBeatmap.Stages)
|
||||||
{
|
{
|
||||||
newDefinitions.Add(new StageDefinition { Columns = existing.Columns / 2 });
|
newDefinitions.Add(new StageDefinition { Columns = existing.Columns / 2 });
|
||||||
newDefinitions.Add(new StageDefinition { Columns = existing.Columns / 2 });
|
newDefinitions.Add(new StageDefinition { Columns = existing.Columns / 2 });
|
||||||
}
|
}
|
||||||
|
|
||||||
mrc.Beatmap.Stages = newDefinitions;
|
maniaBeatmap.Stages = newDefinitions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayfieldType PlayfieldType => PlayfieldType.Dual;
|
public PlayfieldType PlayfieldType => PlayfieldType.Dual;
|
||||||
|
22
osu.Game/Rulesets/Mods/IApplicableToBeatmap.cs
Normal file
22
osu.Game/Rulesets/Mods/IApplicableToBeatmap.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// 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;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mods
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interface for a <see cref="Mod"/> that applies changes to a <see cref="Beatmap"/>
|
||||||
|
/// after conversion and post-processing has completed.
|
||||||
|
/// </summary>
|
||||||
|
public interface IApplicableToBeatmap<TObject> : IApplicableMod
|
||||||
|
where TObject : HitObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Applies this <see cref="IApplicableToBeatmap{TObject}"/> to a <see cref="Beatmap{TObject}"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="beatmap">The <see cref="Beatmap{TObject}"/> to apply to.</param>
|
||||||
|
void ApplyToBeatmap(Beatmap<TObject> 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<TObject>>())
|
||||||
|
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