diff --git a/osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs b/osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs
index 38042a2c3d..dcb2a29556 100644
--- a/osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs
+++ b/osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs
@@ -14,7 +14,6 @@ using osu.Framework.Lists;
using osu.Framework.MathUtils;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
-using osu.Game.IO.Serialization;
using osu.Game.Rulesets.Beatmaps;
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mania.Judgements;
@@ -43,20 +42,20 @@ namespace osu.Game.Rulesets.Mania.UI
///
/// Per-column timing changes.
///
- private readonly List[] hitObjectTimingChanges;
+ private readonly List[] hitObjectSpeedAdjustments;
///
/// Bar line timing changes.
///
- private readonly List barlineTimingChanges = new List();
+ private readonly List barLineSpeedAdjustments = new List();
public ManiaHitRenderer(WorkingBeatmap beatmap, bool isForCurrentRuleset)
: base(beatmap, isForCurrentRuleset)
{
// Generate the speed adjustment container lists
- hitObjectTimingChanges = new List[PreferredColumns];
+ hitObjectSpeedAdjustments = new List[PreferredColumns];
for (int i = 0; i < PreferredColumns; i++)
- hitObjectTimingChanges[i] = new List();
+ hitObjectSpeedAdjustments[i] = new List();
// Generate the bar lines
double lastObjectTime = (Objects.LastOrDefault() as IHasEndTime)?.EndTime ?? Objects.LastOrDefault()?.StartTime ?? double.MaxValue;
@@ -93,7 +92,7 @@ namespace osu.Game.Rulesets.Mania.UI
foreach (var speedAdjustmentMod in Mods.OfType())
{
useDefaultSpeedAdjustments = false;
- speedAdjustmentMod.ApplyToHitRenderer(this, ref hitObjectTimingChanges, ref barlineTimingChanges);
+ speedAdjustmentMod.ApplyToHitRenderer(this, ref hitObjectSpeedAdjustments, ref barLineSpeedAdjustments);
}
}
@@ -105,23 +104,11 @@ namespace osu.Game.Rulesets.Mania.UI
[BackgroundDependencyLoader]
private void load()
{
- var maniaPlayfield = Playfield as ManiaPlayfield;
- if (maniaPlayfield == null)
- return;
+ var maniaPlayfield = (ManiaPlayfield)Playfield;
BarLines.ForEach(maniaPlayfield.Add);
}
- private void generateDefaultSpeedAdjustments()
- {
- DefaultControlPoints.ForEach(c =>
- {
- foreach (List t in hitObjectTimingChanges)
- t.Add(new ManiaSpeedAdjustmentContainer(c, ScrollingAlgorithm.Basic));
- barlineTimingChanges.Add(new ManiaSpeedAdjustmentContainer(c, ScrollingAlgorithm.Basic));
- });
- }
-
protected override void ApplyBeatmap()
{
base.ApplyBeatmap();
@@ -129,7 +116,29 @@ namespace osu.Game.Rulesets.Mania.UI
PreferredColumns = (int)Math.Round(Beatmap.BeatmapInfo.Difficulty.CircleSize);
}
- protected override Playfield CreatePlayfield() => new ManiaPlayfield(PreferredColumns)
+ protected override void ApplySpeedAdjustments()
+ {
+ var maniaPlayfield = (ManiaPlayfield)Playfield;
+
+ for (int i = 0; i < PreferredColumns; i++)
+ foreach (var change in hitObjectSpeedAdjustments[i])
+ maniaPlayfield.Columns.ElementAt(i).Add(change);
+
+ foreach (var change in barLineSpeedAdjustments)
+ maniaPlayfield.Add(change);
+ }
+
+ private void generateDefaultSpeedAdjustments()
+ {
+ DefaultControlPoints.ForEach(c =>
+ {
+ foreach (List t in hitObjectSpeedAdjustments)
+ t.Add(new ManiaSpeedAdjustmentContainer(c, ScrollingAlgorithm.Basic));
+ barLineSpeedAdjustments.Add(new ManiaSpeedAdjustmentContainer(c, ScrollingAlgorithm.Basic));
+ });
+ }
+
+ protected sealed override Playfield CreatePlayfield() => new ManiaPlayfield(PreferredColumns)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
@@ -143,9 +152,7 @@ namespace osu.Game.Rulesets.Mania.UI
protected override DrawableHitObject GetVisualRepresentation(ManiaHitObject h)
{
- var maniaPlayfield = Playfield as ManiaPlayfield;
- if (maniaPlayfield == null)
- return null;
+ var maniaPlayfield = (ManiaPlayfield)Playfield;
Bindable key = maniaPlayfield.Columns.ElementAt(h.Column).Key;
@@ -161,21 +168,5 @@ namespace osu.Game.Rulesets.Mania.UI
}
protected override Vector2 GetPlayfieldAspectAdjust() => new Vector2(1, 0.8f);
-
- protected override void ApplySpeedAdjustments()
- {
- var maniaPlayfield = Playfield as ManiaPlayfield;
- if (maniaPlayfield == null)
- return;
-
- for (int i = 0; i < PreferredColumns; i++)
- {
- foreach (var change in hitObjectTimingChanges[i])
- maniaPlayfield.Columns.ElementAt(i).Add(change);
- }
-
- foreach (var change in barlineTimingChanges)
- maniaPlayfield.Add(change);
- }
}
}
diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs
index 255cadbac3..ae235db5d5 100644
--- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs
+++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs
@@ -212,9 +212,8 @@ namespace osu.Game.Rulesets.Mania.UI
}
public override void Add(DrawableHitObject h) => Columns.ElementAt(h.HitObject.Column).Add(h);
-
- public void Add(SpeedAdjustmentContainer timingChange) => barLineContainer.Add(timingChange);
public void Add(DrawableBarLine barline) => barLineContainer.Add(barline);
+ public void Add(SpeedAdjustmentContainer speedAdjustment) => barLineContainer.Add(speedAdjustment);
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
{
diff --git a/osu.Game/Rulesets/Timing/SpeedAdjustmentCollection.cs b/osu.Game/Rulesets/Timing/SpeedAdjustmentCollection.cs
index d34d27e07d..4139965a27 100644
--- a/osu.Game/Rulesets/Timing/SpeedAdjustmentCollection.cs
+++ b/osu.Game/Rulesets/Timing/SpeedAdjustmentCollection.cs
@@ -6,7 +6,6 @@ using System.Collections.Generic;
using System.Linq;
using osu.Framework.Caching;
using osu.Framework.Configuration;
-using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Objects.Drawables;
@@ -37,7 +36,7 @@ namespace osu.Game.Rulesets.Timing
protected override IComparer DepthComparer => new SpeedAdjustmentContainerReverseStartTimeComparer();
- private readonly Cached layout = new Cached();
+ private Cached layout = new Cached();
///
/// Hit objects that are to be re-processed when is invalidated.
diff --git a/osu.Game/Rulesets/UI/SpeedAdjustedHitRenderer.cs b/osu.Game/Rulesets/UI/SpeedAdjustedHitRenderer.cs
index 3f6e393a86..05e79f6d7e 100644
--- a/osu.Game/Rulesets/UI/SpeedAdjustedHitRenderer.cs
+++ b/osu.Game/Rulesets/UI/SpeedAdjustedHitRenderer.cs
@@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.UI
{
protected readonly SortedList DefaultControlPoints = new SortedList(Comparer.Default);
- public SpeedAdjustedHitRenderer(WorkingBeatmap beatmap, bool isForCurrentRuleset)
+ protected SpeedAdjustedHitRenderer(WorkingBeatmap beatmap, bool isForCurrentRuleset)
: base(beatmap, isForCurrentRuleset)
{
}