1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 01:43:15 +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 SpeedChangeVisualisationMethod VisualisationMethod => SpeedChangeVisualisationMethod.Constant;
protected override ScrollAlgorithm ScrollAlgorithm => ScrollAlgorithm.Constant;
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 SpeedChangeVisualisationMethod VisualisationMethod => SpeedChangeVisualisationMethod.Overlapping;
protected override ScrollAlgorithm ScrollAlgorithm => ScrollAlgorithm.Overlapping;
private readonly Container<HitExplosion> hitExplosionContainer;
private readonly Container<KiaiHitExplosion> kiaiExplosionContainer;

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,7 @@
namespace osu.Game.Rulesets.UI.Scrolling.Visualisers
{
public interface ISpeedChangeVisualiser
public interface IScrollAlgorithm
{
/// <summary>
/// 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);
/// <summary>
/// Resets this <see cref="ISpeedChangeVisualiser"/> to a default state.
/// Resets this <see cref="IScrollAlgorithm"/> to a default state.
/// </summary>
void Reset();
}

View File

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

View File

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