mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 10:42:55 +08:00
A bit more cleanup.
This commit is contained in:
parent
ff84a11c37
commit
5d7336b235
@ -14,7 +14,6 @@ using osu.Framework.Lists;
|
|||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.IO.Serialization;
|
|
||||||
using osu.Game.Rulesets.Beatmaps;
|
using osu.Game.Rulesets.Beatmaps;
|
||||||
using osu.Game.Rulesets.Mania.Beatmaps;
|
using osu.Game.Rulesets.Mania.Beatmaps;
|
||||||
using osu.Game.Rulesets.Mania.Judgements;
|
using osu.Game.Rulesets.Mania.Judgements;
|
||||||
@ -43,20 +42,20 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Per-column timing changes.
|
/// Per-column timing changes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly List<SpeedAdjustmentContainer>[] hitObjectTimingChanges;
|
private readonly List<SpeedAdjustmentContainer>[] hitObjectSpeedAdjustments;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Bar line timing changes.
|
/// Bar line timing changes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly List<SpeedAdjustmentContainer> barlineTimingChanges = new List<SpeedAdjustmentContainer>();
|
private readonly List<SpeedAdjustmentContainer> barLineSpeedAdjustments = new List<SpeedAdjustmentContainer>();
|
||||||
|
|
||||||
public ManiaHitRenderer(WorkingBeatmap beatmap, bool isForCurrentRuleset)
|
public ManiaHitRenderer(WorkingBeatmap beatmap, bool isForCurrentRuleset)
|
||||||
: base(beatmap, isForCurrentRuleset)
|
: base(beatmap, isForCurrentRuleset)
|
||||||
{
|
{
|
||||||
// Generate the speed adjustment container lists
|
// Generate the speed adjustment container lists
|
||||||
hitObjectTimingChanges = new List<SpeedAdjustmentContainer>[PreferredColumns];
|
hitObjectSpeedAdjustments = new List<SpeedAdjustmentContainer>[PreferredColumns];
|
||||||
for (int i = 0; i < PreferredColumns; i++)
|
for (int i = 0; i < PreferredColumns; i++)
|
||||||
hitObjectTimingChanges[i] = new List<SpeedAdjustmentContainer>();
|
hitObjectSpeedAdjustments[i] = new List<SpeedAdjustmentContainer>();
|
||||||
|
|
||||||
// Generate the bar lines
|
// Generate the bar lines
|
||||||
double lastObjectTime = (Objects.LastOrDefault() as IHasEndTime)?.EndTime ?? Objects.LastOrDefault()?.StartTime ?? double.MaxValue;
|
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<IGenerateSpeedAdjustments>())
|
foreach (var speedAdjustmentMod in Mods.OfType<IGenerateSpeedAdjustments>())
|
||||||
{
|
{
|
||||||
useDefaultSpeedAdjustments = false;
|
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]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
var maniaPlayfield = Playfield as ManiaPlayfield;
|
var maniaPlayfield = (ManiaPlayfield)Playfield;
|
||||||
if (maniaPlayfield == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
BarLines.ForEach(maniaPlayfield.Add);
|
BarLines.ForEach(maniaPlayfield.Add);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateDefaultSpeedAdjustments()
|
|
||||||
{
|
|
||||||
DefaultControlPoints.ForEach(c =>
|
|
||||||
{
|
|
||||||
foreach (List<SpeedAdjustmentContainer> t in hitObjectTimingChanges)
|
|
||||||
t.Add(new ManiaSpeedAdjustmentContainer(c, ScrollingAlgorithm.Basic));
|
|
||||||
barlineTimingChanges.Add(new ManiaSpeedAdjustmentContainer(c, ScrollingAlgorithm.Basic));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void ApplyBeatmap()
|
protected override void ApplyBeatmap()
|
||||||
{
|
{
|
||||||
base.ApplyBeatmap();
|
base.ApplyBeatmap();
|
||||||
@ -129,7 +116,29 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
PreferredColumns = (int)Math.Round(Beatmap.BeatmapInfo.Difficulty.CircleSize);
|
PreferredColumns = (int)Math.Round(Beatmap.BeatmapInfo.Difficulty.CircleSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Playfield<ManiaHitObject, ManiaJudgement> 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<SpeedAdjustmentContainer> t in hitObjectSpeedAdjustments)
|
||||||
|
t.Add(new ManiaSpeedAdjustmentContainer(c, ScrollingAlgorithm.Basic));
|
||||||
|
barLineSpeedAdjustments.Add(new ManiaSpeedAdjustmentContainer(c, ScrollingAlgorithm.Basic));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected sealed override Playfield<ManiaHitObject, ManiaJudgement> CreatePlayfield() => new ManiaPlayfield(PreferredColumns)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
@ -143,9 +152,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
|
|
||||||
protected override DrawableHitObject<ManiaHitObject, ManiaJudgement> GetVisualRepresentation(ManiaHitObject h)
|
protected override DrawableHitObject<ManiaHitObject, ManiaJudgement> GetVisualRepresentation(ManiaHitObject h)
|
||||||
{
|
{
|
||||||
var maniaPlayfield = Playfield as ManiaPlayfield;
|
var maniaPlayfield = (ManiaPlayfield)Playfield;
|
||||||
if (maniaPlayfield == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
Bindable<Key> key = maniaPlayfield.Columns.ElementAt(h.Column).Key;
|
Bindable<Key> 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 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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -212,9 +212,8 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override void Add(DrawableHitObject<ManiaHitObject, ManiaJudgement> h) => Columns.ElementAt(h.HitObject.Column).Add(h);
|
public override void Add(DrawableHitObject<ManiaHitObject, ManiaJudgement> 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(DrawableBarLine barline) => barLineContainer.Add(barline);
|
||||||
|
public void Add(SpeedAdjustmentContainer speedAdjustment) => barLineContainer.Add(speedAdjustment);
|
||||||
|
|
||||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,6 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Caching;
|
using osu.Framework.Caching;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
@ -37,7 +36,7 @@ namespace osu.Game.Rulesets.Timing
|
|||||||
|
|
||||||
protected override IComparer<Drawable> DepthComparer => new SpeedAdjustmentContainerReverseStartTimeComparer();
|
protected override IComparer<Drawable> DepthComparer => new SpeedAdjustmentContainerReverseStartTimeComparer();
|
||||||
|
|
||||||
private readonly Cached layout = new Cached();
|
private Cached layout = new Cached();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Hit objects that are to be re-processed when <see cref="layout"/> is invalidated.
|
/// Hit objects that are to be re-processed when <see cref="layout"/> is invalidated.
|
||||||
|
@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
{
|
{
|
||||||
protected readonly SortedList<MultiplierControlPoint> DefaultControlPoints = new SortedList<MultiplierControlPoint>(Comparer<MultiplierControlPoint>.Default);
|
protected readonly SortedList<MultiplierControlPoint> DefaultControlPoints = new SortedList<MultiplierControlPoint>(Comparer<MultiplierControlPoint>.Default);
|
||||||
|
|
||||||
public SpeedAdjustedHitRenderer(WorkingBeatmap beatmap, bool isForCurrentRuleset)
|
protected SpeedAdjustedHitRenderer(WorkingBeatmap beatmap, bool isForCurrentRuleset)
|
||||||
: base(beatmap, isForCurrentRuleset)
|
: base(beatmap, isForCurrentRuleset)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user