1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 16:03:01 +08:00

Rename IScrollChangeVisualiser -> IScrollAlgorithm

This commit is contained in:
smoogipoo 2018-11-02 19:51:34 +09:00
parent 2f87f267a3
commit f66a9f4f1e
9 changed files with 29 additions and 29 deletions

View File

@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Catch.UI
protected override bool UserScrollSpeedAdjustment => false; protected override bool UserScrollSpeedAdjustment => false;
protected override SpeedChangeVisualisationMethod VisualisationMethod => SpeedChangeVisualisationMethod.Constant; protected override ScrollAlgorithm ScrollAlgorithm => ScrollAlgorithm.Constant;
public CatchPlayfield(BeatmapDifficulty difficulty, Func<CatchHitObject, DrawableHitObject<CatchHitObject>> getVisualRepresentation) public CatchPlayfield(BeatmapDifficulty difficulty, Func<CatchHitObject, DrawableHitObject<CatchHitObject>> getVisualRepresentation)
{ {

View File

@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Taiko.UI
protected override bool UserScrollSpeedAdjustment => false; protected override bool UserScrollSpeedAdjustment => false;
protected override SpeedChangeVisualisationMethod VisualisationMethod => SpeedChangeVisualisationMethod.Overlapping; protected override ScrollAlgorithm ScrollAlgorithm => ScrollAlgorithm.Overlapping;
private readonly Container<HitExplosion> hitExplosionContainer; private readonly Container<HitExplosion> hitExplosionContainer;
private readonly Container<KiaiHitExplosion> kiaiExplosionContainer; private readonly Container<KiaiHitExplosion> kiaiExplosionContainer;

View File

@ -5,7 +5,7 @@ using System.ComponentModel;
namespace osu.Game.Configuration namespace osu.Game.Configuration
{ {
public enum SpeedChangeVisualisationMethod public enum ScrollAlgorithm
{ {
[Description("Sequential")] [Description("Sequential")]
Sequential, Sequential,

View File

@ -31,27 +31,27 @@ namespace osu.Game.Rulesets.UI.Scrolling
public readonly Bindable<ScrollingDirection> Direction = new Bindable<ScrollingDirection>(); public readonly Bindable<ScrollingDirection> Direction = new Bindable<ScrollingDirection>();
private readonly ISpeedChangeVisualiser visualiser; private readonly IScrollAlgorithm algorithm;
private Cached initialStateCache = new Cached(); private Cached initialStateCache = new Cached();
public ScrollingHitObjectContainer(SpeedChangeVisualisationMethod visualisationMethod) public ScrollingHitObjectContainer(ScrollAlgorithm scrollAlgorithm)
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
TimeRange.ValueChanged += _ => initialStateCache.Invalidate(); TimeRange.ValueChanged += _ => initialStateCache.Invalidate();
Direction.ValueChanged += _ => initialStateCache.Invalidate(); Direction.ValueChanged += _ => initialStateCache.Invalidate();
switch (visualisationMethod) switch (scrollAlgorithm)
{ {
case SpeedChangeVisualisationMethod.Sequential: case ScrollAlgorithm.Sequential:
visualiser = new SequentialSpeedChangeVisualiser(ControlPoints); algorithm = new SequentialScrollAlgorithm(ControlPoints);
break; break;
case SpeedChangeVisualisationMethod.Overlapping: case ScrollAlgorithm.Overlapping:
visualiser = new OverlappingSpeedChangeVisualiser(ControlPoints); algorithm = new OverlappingScrollAlgorithm(ControlPoints);
break; break;
case SpeedChangeVisualisationMethod.Constant: case ScrollAlgorithm.Constant:
visualiser = new ConstantSpeedChangeVisualiser(); algorithm = new ConstantScrollAlgorithm();
break; break;
} }
} }
@ -111,7 +111,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
break; break;
} }
visualiser.Reset(); algorithm.Reset();
foreach (var obj in Objects) foreach (var obj in Objects)
computeInitialStateRecursive(obj); computeInitialStateRecursive(obj);
@ -121,7 +121,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
private void computeInitialStateRecursive(DrawableHitObject hitObject) private void computeInitialStateRecursive(DrawableHitObject hitObject)
{ {
hitObject.LifetimeStart = visualiser.GetDisplayStartTime(hitObject.HitObject.StartTime, TimeRange); hitObject.LifetimeStart = algorithm.GetDisplayStartTime(hitObject.HitObject.StartTime, TimeRange);
if (hitObject.HitObject is IHasEndTime endTime) if (hitObject.HitObject is IHasEndTime endTime)
{ {
@ -129,11 +129,11 @@ namespace osu.Game.Rulesets.UI.Scrolling
{ {
case ScrollingDirection.Up: case ScrollingDirection.Up:
case ScrollingDirection.Down: case ScrollingDirection.Down:
hitObject.Height = visualiser.GetLength(hitObject.HitObject.StartTime, endTime.EndTime, TimeRange, scrollLength); hitObject.Height = algorithm.GetLength(hitObject.HitObject.StartTime, endTime.EndTime, TimeRange, scrollLength);
break; break;
case ScrollingDirection.Left: case ScrollingDirection.Left:
case ScrollingDirection.Right: case ScrollingDirection.Right:
hitObject.Width = visualiser.GetLength(hitObject.HitObject.StartTime, endTime.EndTime, TimeRange, scrollLength); hitObject.Width = algorithm.GetLength(hitObject.HitObject.StartTime, endTime.EndTime, TimeRange, scrollLength);
break; break;
} }
} }
@ -161,16 +161,16 @@ namespace osu.Game.Rulesets.UI.Scrolling
switch (Direction.Value) switch (Direction.Value)
{ {
case ScrollingDirection.Up: case ScrollingDirection.Up:
hitObject.Y = visualiser.PositionAt(hitObject.HitObject.StartTime, currentTime, TimeRange, scrollLength); hitObject.Y = algorithm.PositionAt(hitObject.HitObject.StartTime, currentTime, TimeRange, scrollLength);
break; break;
case ScrollingDirection.Down: case ScrollingDirection.Down:
hitObject.Y = -visualiser.PositionAt(hitObject.HitObject.StartTime, currentTime, TimeRange, scrollLength); hitObject.Y = -algorithm.PositionAt(hitObject.HitObject.StartTime, currentTime, TimeRange, scrollLength);
break; break;
case ScrollingDirection.Left: case ScrollingDirection.Left:
hitObject.X = visualiser.PositionAt(hitObject.HitObject.StartTime, currentTime, TimeRange, scrollLength); hitObject.X = algorithm.PositionAt(hitObject.HitObject.StartTime, currentTime, TimeRange, scrollLength);
break; break;
case ScrollingDirection.Right: case ScrollingDirection.Right:
hitObject.X = -visualiser.PositionAt(hitObject.HitObject.StartTime, currentTime, TimeRange, scrollLength); hitObject.X = -algorithm.PositionAt(hitObject.HitObject.StartTime, currentTime, TimeRange, scrollLength);
break; break;
} }
} }

View File

@ -63,7 +63,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
/// </summary> /// </summary>
protected readonly Bindable<ScrollingDirection> Direction = new Bindable<ScrollingDirection>(); protected readonly Bindable<ScrollingDirection> Direction = new Bindable<ScrollingDirection>();
protected virtual SpeedChangeVisualisationMethod VisualisationMethod => SpeedChangeVisualisationMethod.Sequential; protected virtual ScrollAlgorithm ScrollAlgorithm => ScrollAlgorithm.Sequential;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
@ -93,7 +93,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
protected sealed override HitObjectContainer CreateHitObjectContainer() protected sealed override HitObjectContainer CreateHitObjectContainer()
{ {
var container = new ScrollingHitObjectContainer(VisualisationMethod); var container = new ScrollingHitObjectContainer(ScrollAlgorithm);
container.Direction.BindTo(Direction); container.Direction.BindTo(Direction);
return container; return container;
} }

View File

@ -3,7 +3,7 @@
namespace osu.Game.Rulesets.UI.Scrolling.Visualisers namespace osu.Game.Rulesets.UI.Scrolling.Visualisers
{ {
public class ConstantSpeedChangeVisualiser : ISpeedChangeVisualiser public class ConstantScrollAlgorithm : IScrollAlgorithm
{ {
public double GetDisplayStartTime(double time, double timeRange) => time - timeRange; public double GetDisplayStartTime(double time, double timeRange) => time - timeRange;

View File

@ -3,7 +3,7 @@
namespace osu.Game.Rulesets.UI.Scrolling.Visualisers namespace osu.Game.Rulesets.UI.Scrolling.Visualisers
{ {
public interface ISpeedChangeVisualiser public interface IScrollAlgorithm
{ {
/// <summary> /// <summary>
/// Given a point in time, computes the time at which it enters the time range. /// Given a point in time, computes the time at which it enters the time range.
@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.UI.Scrolling.Visualisers
float PositionAt(double time, double currentTime, double timeRange, float scrollLength); float PositionAt(double time, double currentTime, double timeRange, float scrollLength);
/// <summary> /// <summary>
/// Resets this <see cref="ISpeedChangeVisualiser"/> to a default state. /// Resets this <see cref="IScrollAlgorithm"/> to a default state.
/// </summary> /// </summary>
void Reset(); void Reset();
} }

View File

@ -6,13 +6,13 @@ using osu.Game.Rulesets.Timing;
namespace osu.Game.Rulesets.UI.Scrolling.Visualisers namespace osu.Game.Rulesets.UI.Scrolling.Visualisers
{ {
public class OverlappingSpeedChangeVisualiser : ISpeedChangeVisualiser public class OverlappingScrollAlgorithm : IScrollAlgorithm
{ {
private readonly MultiplierControlPoint searchPoint; private readonly MultiplierControlPoint searchPoint;
private readonly SortedList<MultiplierControlPoint> controlPoints; private readonly SortedList<MultiplierControlPoint> controlPoints;
public OverlappingSpeedChangeVisualiser(SortedList<MultiplierControlPoint> controlPoints) public OverlappingScrollAlgorithm(SortedList<MultiplierControlPoint> controlPoints)
{ {
this.controlPoints = controlPoints; this.controlPoints = controlPoints;

View File

@ -7,13 +7,13 @@ using osu.Game.Rulesets.Timing;
namespace osu.Game.Rulesets.UI.Scrolling.Visualisers namespace osu.Game.Rulesets.UI.Scrolling.Visualisers
{ {
public class SequentialSpeedChangeVisualiser : ISpeedChangeVisualiser public class SequentialScrollAlgorithm : IScrollAlgorithm
{ {
private readonly Dictionary<double, double> positionCache; private readonly Dictionary<double, double> positionCache;
private readonly IReadOnlyList<MultiplierControlPoint> controlPoints; private readonly IReadOnlyList<MultiplierControlPoint> controlPoints;
public SequentialSpeedChangeVisualiser(IReadOnlyList<MultiplierControlPoint> controlPoints) public SequentialScrollAlgorithm(IReadOnlyList<MultiplierControlPoint> controlPoints)
{ {
this.controlPoints = controlPoints; this.controlPoints = controlPoints;