1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 10:52:53 +08:00

Rename DistanceBetweenTick to be plural

This commit is contained in:
Dean Herbert 2022-05-06 15:45:36 +09:00
parent 5029710de7
commit 32b40bdabf
3 changed files with 16 additions and 16 deletions

View File

@ -79,7 +79,7 @@ namespace osu.Game.Tests.Visual.Editing
public void TestDistanceSpacing(double multiplier)
{
AddStep($"set distance spacing = {multiplier}", () => snapProvider.DistanceSpacingMultiplier.Value = multiplier);
AddAssert("distance spacing matches multiplier", () => grid.DistanceBetweenTick == beat_snap_distance * multiplier);
AddAssert("distance spacing matches multiplier", () => grid.DistanceBetweenTicks == beat_snap_distance * multiplier);
}
[TestCase(1.0)]
@ -103,12 +103,12 @@ namespace osu.Game.Tests.Visual.Editing
});
AddStep($"set distance spacing = {multiplier}", () => snapProvider.DistanceSpacingMultiplier.Value = multiplier);
AddAssert("check correct interval count", () => grid.MaxIntervals == (end_time / grid.DistanceBetweenTick));
AddAssert("check correct interval count", () => grid.MaxIntervals == (end_time / grid.DistanceBetweenTicks));
}
private class TestDistanceSnapGrid : DistanceSnapGrid
{
public new float DistanceBetweenTick => base.DistanceBetweenTick;
public new float DistanceBetweenTicks => base.DistanceBetweenTicks;
public new int MaxIntervals => base.MaxIntervals;
@ -128,7 +128,7 @@ namespace osu.Game.Tests.Visual.Editing
int indexFromPlacement = 0;
for (float s = StartPosition.X + DistanceBetweenTick; s <= DrawWidth && indexFromPlacement < MaxIntervals; s += DistanceBetweenTick, indexFromPlacement++)
for (float s = StartPosition.X + DistanceBetweenTicks; s <= DrawWidth && indexFromPlacement < MaxIntervals; s += DistanceBetweenTicks, indexFromPlacement++)
{
AddInternal(new Circle
{
@ -141,7 +141,7 @@ namespace osu.Game.Tests.Visual.Editing
indexFromPlacement = 0;
for (float s = StartPosition.X - DistanceBetweenTick; s >= 0 && indexFromPlacement < MaxIntervals; s -= DistanceBetweenTick, indexFromPlacement++)
for (float s = StartPosition.X - DistanceBetweenTicks; s >= 0 && indexFromPlacement < MaxIntervals; s -= DistanceBetweenTicks, indexFromPlacement++)
{
AddInternal(new Circle
{
@ -154,7 +154,7 @@ namespace osu.Game.Tests.Visual.Editing
indexFromPlacement = 0;
for (float s = StartPosition.Y + DistanceBetweenTick; s <= DrawHeight && indexFromPlacement < MaxIntervals; s += DistanceBetweenTick, indexFromPlacement++)
for (float s = StartPosition.Y + DistanceBetweenTicks; s <= DrawHeight && indexFromPlacement < MaxIntervals; s += DistanceBetweenTicks, indexFromPlacement++)
{
AddInternal(new Circle
{
@ -167,7 +167,7 @@ namespace osu.Game.Tests.Visual.Editing
indexFromPlacement = 0;
for (float s = StartPosition.Y - DistanceBetweenTick; s >= 0 && indexFromPlacement < MaxIntervals; s -= DistanceBetweenTick, indexFromPlacement++)
for (float s = StartPosition.Y - DistanceBetweenTicks; s >= 0 && indexFromPlacement < MaxIntervals; s -= DistanceBetweenTicks, indexFromPlacement++)
{
AddInternal(new Circle
{

View File

@ -30,14 +30,14 @@ namespace osu.Game.Screens.Edit.Compose.Components
Position = StartPosition,
Width = crosshair_thickness,
EdgeSmoothness = new Vector2(1),
Height = Math.Min(crosshair_max_size, DistanceBetweenTick * 2),
Height = Math.Min(crosshair_max_size, DistanceBetweenTicks * 2),
},
new Box
{
Origin = Anchor.Centre,
Position = StartPosition,
EdgeSmoothness = new Vector2(1),
Width = Math.Min(crosshair_max_size, DistanceBetweenTick * 2),
Width = Math.Min(crosshair_max_size, DistanceBetweenTicks * 2),
Height = crosshair_thickness,
}
});
@ -45,11 +45,11 @@ namespace osu.Game.Screens.Edit.Compose.Components
float dx = Math.Max(StartPosition.X, DrawWidth - StartPosition.X);
float dy = Math.Max(StartPosition.Y, DrawHeight - StartPosition.Y);
float maxDistance = new Vector2(dx, dy).Length;
int requiredCircles = Math.Min(MaxIntervals, (int)(maxDistance / DistanceBetweenTick));
int requiredCircles = Math.Min(MaxIntervals, (int)(maxDistance / DistanceBetweenTicks));
for (int i = 0; i < requiredCircles; i++)
{
float radius = (i + 1) * DistanceBetweenTick * 2;
float radius = (i + 1) * DistanceBetweenTicks * 2;
AddInternal(new CircularProgress
{
@ -80,7 +80,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
float travelLength = travelVector.Length;
// FindSnappedDistance will always round down, but we want to potentially round upwards.
travelLength += DistanceBetweenTick / 2;
travelLength += DistanceBetweenTicks / 2;
// When interacting with the resolved snap provider, the distance spacing multiplier should first be removed
// to allow for snapping at a non-multiplied ratio.

View File

@ -23,7 +23,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// <summary>
/// The spacing between each tick of the beat snapping grid.
/// </summary>
protected float DistanceBetweenTick { get; private set; }
protected float DistanceBetweenTicks { get; private set; }
protected IBindable<double> DistanceSpacingMultiplier { get; private set; }
@ -34,7 +34,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// <summary>
/// The position which the grid should start.
/// The first beat snapping tick is located at <see cref="StartPosition"/> + <see cref="DistanceBetweenTick"/> away from this point.
/// The first beat snapping tick is located at <see cref="StartPosition"/> + <see cref="DistanceBetweenTicks"/> away from this point.
/// </summary>
protected readonly Vector2 StartPosition;
@ -93,7 +93,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
private void updateSpacing()
{
DistanceBetweenTick = (float)(SnapProvider.GetBeatSnapDistanceAt(ReferenceObject) * DistanceSpacingMultiplier.Value);
DistanceBetweenTicks = (float)(SnapProvider.GetBeatSnapDistanceAt(ReferenceObject) * DistanceSpacingMultiplier.Value);
if (LatestEndTime == null)
MaxIntervals = int.MaxValue;
@ -101,7 +101,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
{
// +1 is added since a snapped hitobject may have its start time slightly less than the snapped time due to floating point errors
double maxDuration = LatestEndTime.Value - StartTime + 1;
MaxIntervals = (int)(maxDuration / SnapProvider.DistanceToDuration(ReferenceObject, DistanceBetweenTick));
MaxIntervals = (int)(maxDuration / SnapProvider.DistanceToDuration(ReferenceObject, DistanceBetweenTicks));
}
gridCache.Invalidate();