mirror of
https://github.com/ppy/osu.git
synced 2025-03-14 13:27:19 +08:00
Remove unused method
Only used in test code.
This commit is contained in:
parent
a1185df2eb
commit
df37768ff4
@ -107,7 +107,6 @@ namespace osu.Game.Tests.Editing
|
||||
|
||||
assertSnapDistance(base_distance * slider_velocity, referenceObject);
|
||||
assertSnappedDistance(base_distance * slider_velocity + 10, base_distance * slider_velocity, referenceObject);
|
||||
assertSnappedDuration(base_distance * slider_velocity + 10, 1000, referenceObject);
|
||||
|
||||
assertDistanceToDuration(base_distance * slider_velocity, 1000, referenceObject);
|
||||
assertDurationToDistance(1000, base_distance * slider_velocity, referenceObject);
|
||||
@ -155,39 +154,6 @@ namespace osu.Game.Tests.Editing
|
||||
assertDistanceToDuration(400, 1000);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetSnappedDurationFromDistance()
|
||||
{
|
||||
assertSnappedDuration(0, 0);
|
||||
assertSnappedDuration(50, 1000);
|
||||
assertSnappedDuration(100, 1000);
|
||||
assertSnappedDuration(150, 2000);
|
||||
assertSnappedDuration(200, 2000);
|
||||
assertSnappedDuration(250, 3000);
|
||||
|
||||
AddStep("set slider multiplier = 2", () => composer.EditorBeatmap.Difficulty.SliderMultiplier = 2);
|
||||
|
||||
assertSnappedDuration(0, 0);
|
||||
assertSnappedDuration(50, 0);
|
||||
assertSnappedDuration(100, 1000);
|
||||
assertSnappedDuration(150, 1000);
|
||||
assertSnappedDuration(200, 1000);
|
||||
assertSnappedDuration(250, 1000);
|
||||
|
||||
AddStep("set beat length = 500", () =>
|
||||
{
|
||||
composer.EditorBeatmap.ControlPointInfo.Clear();
|
||||
composer.EditorBeatmap.ControlPointInfo.Add(0, new TimingControlPoint { BeatLength = 500 });
|
||||
});
|
||||
|
||||
assertSnappedDuration(50, 0);
|
||||
assertSnappedDuration(100, 500);
|
||||
assertSnappedDuration(150, 500);
|
||||
assertSnappedDuration(200, 500);
|
||||
assertSnappedDuration(250, 500);
|
||||
assertSnappedDuration(400, 1000);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetSnappedDistanceFromDistance()
|
||||
{
|
||||
@ -289,9 +255,6 @@ namespace osu.Game.Tests.Editing
|
||||
private void assertDistanceToDuration(float distance, double expectedDuration, HitObject? referenceObject = null)
|
||||
=> AddAssert($"distance = {distance} -> duration = {expectedDuration}", () => composer.DistanceSnapProvider.DistanceToDuration(distance, referenceObject?.StartTime ?? 0, referenceObject as IHasSliderVelocity), () => Is.EqualTo(expectedDuration).Within(Precision.FLOAT_EPSILON));
|
||||
|
||||
private void assertSnappedDuration(float distance, double expectedDuration, HitObject? referenceObject = null)
|
||||
=> AddAssert($"distance = {distance} -> duration = {expectedDuration} (snapped)", () => composer.DistanceSnapProvider.FindSnappedDuration(distance, referenceObject?.StartTime ?? 0, referenceObject as IHasSliderVelocity), () => Is.EqualTo(expectedDuration).Within(Precision.FLOAT_EPSILON));
|
||||
|
||||
private void assertSnappedDistance(float distance, float expectedDistance, HitObject? referenceObject = null)
|
||||
=> AddAssert($"distance = {distance} -> distance = {expectedDistance} (snapped)", () => composer.DistanceSnapProvider.FindSnappedDistance(distance, referenceObject?.GetEndTime() ?? 0, referenceObject as IHasSliderVelocity), () => Is.EqualTo(expectedDistance).Within(Precision.FLOAT_EPSILON));
|
||||
|
||||
|
@ -197,8 +197,6 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
|
||||
public double DistanceToDuration(float distance, double timingReference, IHasSliderVelocity withVelocity = null) => distance;
|
||||
|
||||
public double FindSnappedDuration(float distance, double snapReferenceTime, IHasSliderVelocity withVelocity = null) => 0;
|
||||
|
||||
public float FindSnappedDistance(float distance, double snapReferenceTime, IHasSliderVelocity? withVelocity = null) => 0;
|
||||
}
|
||||
}
|
||||
|
@ -283,9 +283,6 @@ namespace osu.Game.Rulesets.Edit
|
||||
return distance / GetBeatSnapDistance(withVelocity) * beatLength;
|
||||
}
|
||||
|
||||
public virtual double FindSnappedDuration(float distance, double snapReferenceTime, IHasSliderVelocity? withVelocity = null)
|
||||
=> beatSnapProvider.SnapTime(snapReferenceTime + DistanceToDuration(distance, snapReferenceTime, withVelocity), snapReferenceTime) - snapReferenceTime;
|
||||
|
||||
public virtual float FindSnappedDistance(float distance, double snapReferenceTime, IHasSliderVelocity? withVelocity = null)
|
||||
{
|
||||
double actualDuration = snapReferenceTime + DistanceToDuration(distance, snapReferenceTime, withVelocity);
|
||||
|
@ -66,19 +66,6 @@ namespace osu.Game.Rulesets.Edit
|
||||
/// </summary>
|
||||
double DistanceToDuration(float distance, double timingReference, IHasSliderVelocity? withVelocity = null);
|
||||
|
||||
/// <summary>
|
||||
/// Converts a spatial distance into a temporal duration and then snaps said duration to the beat, relative to <see cref="snapReferenceTime"/>.
|
||||
/// Depends on:
|
||||
/// <list type="bullet">
|
||||
/// <item>the <paramref name="distance"/> provided,</item>
|
||||
/// <item>a <paramref name="snapReferenceTime"/> used to retrieve the beat length of the beatmap at that time,</item>
|
||||
/// <item>the slider velocity taken from <paramref name="withVelocity"/>,</item>
|
||||
/// <item>the beatmap's <see cref="IBeatmapDifficultyInfo.SliderMultiplier"/>,</item>,
|
||||
/// <item>the current beat divisor.</item>
|
||||
/// </list>
|
||||
/// </summary>
|
||||
double FindSnappedDuration(float distance, double snapReferenceTime, IHasSliderVelocity? withVelocity = null);
|
||||
|
||||
/// <summary>
|
||||
/// Snaps a spatial distance to the beat, relative to <see cref="snapReferenceTime"/>.
|
||||
/// Depends on:
|
||||
|
Loading…
x
Reference in New Issue
Block a user