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

Move distance spacing application to DistanceSnapGrid

This commit is contained in:
Salman Ahmed 2022-04-28 10:54:38 +03:00
parent 7aaa88cac2
commit abb88b0907
5 changed files with 4 additions and 18 deletions

View File

@ -19,10 +19,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
{ {
private OsuPlayfield playfield; private OsuPlayfield playfield;
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) => new TestBeatmap(Ruleset.Value, false) protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) => new TestBeatmap(Ruleset.Value, false);
{
BeatmapInfo = { DistanceSpacing = 1 }
};
public override void SetUpSteps() public override void SetUpSteps()
{ {

View File

@ -35,8 +35,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
controlPointInfo.Add(0, new TimingControlPoint { BeatLength = beat_length }); controlPointInfo.Add(0, new TimingControlPoint { BeatLength = beat_length });
return new TestBeatmap(ruleset, false) return new TestBeatmap(ruleset, false)
{ {
ControlPointInfo = controlPointInfo, ControlPointInfo = controlPointInfo
BeatmapInfo = { DistanceSpacing = 1 },
}; };
} }

View File

@ -62,7 +62,6 @@ namespace osu.Game.Tests.Editing
BeatDivisor.Value = 1; BeatDivisor.Value = 1;
composer.EditorBeatmap.Difficulty.SliderMultiplier = 1; composer.EditorBeatmap.Difficulty.SliderMultiplier = 1;
composer.EditorBeatmap.BeatmapInfo.DistanceSpacing = 1;
composer.EditorBeatmap.ControlPointInfo.Clear(); composer.EditorBeatmap.ControlPointInfo.Clear();
composer.EditorBeatmap.ControlPointInfo.Add(0, new TimingControlPoint { BeatLength = 1000 }); composer.EditorBeatmap.ControlPointInfo.Add(0, new TimingControlPoint { BeatLength = 1000 });
}); });
@ -89,15 +88,6 @@ namespace osu.Game.Tests.Editing
}); });
} }
[TestCase(1)]
[TestCase(2)]
public void TestDistanceSpacingMultiplier(float multiplier)
{
AddStep($"set distance spacing = {multiplier}", () => composer.DistanceSpacingMultiplier.Value = multiplier);
assertSnapDistance(100 * multiplier);
}
[TestCase(1)] [TestCase(1)]
[TestCase(2)] [TestCase(2)]
public void TestBeatDivisor(int divisor) public void TestBeatDivisor(int divisor)

View File

@ -109,7 +109,7 @@ namespace osu.Game.Rulesets.Edit
public virtual float GetBeatSnapDistanceAt(HitObject referenceObject) public virtual float GetBeatSnapDistanceAt(HitObject referenceObject)
{ {
return (float)(100 * EditorBeatmap.Difficulty.SliderMultiplier * referenceObject.DifficultyControlPoint.SliderVelocity * DistanceSpacingMultiplier.Value / BeatSnapProvider.BeatDivisor); return (float)(100 * EditorBeatmap.Difficulty.SliderMultiplier * referenceObject.DifficultyControlPoint.SliderVelocity / BeatSnapProvider.BeatDivisor);
} }
public virtual float DurationToDistance(HitObject referenceObject, double duration) public virtual float DurationToDistance(HitObject referenceObject, double duration)

View File

@ -92,7 +92,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
private void updateSpacing() private void updateSpacing()
{ {
DistanceSpacing = SnapProvider.GetBeatSnapDistanceAt(ReferenceObject); DistanceSpacing = SnapProvider.GetBeatSnapDistanceAt(ReferenceObject) * distanceSpacingMultiplier.Value;
if (endTime == null) if (endTime == null)
MaxIntervals = int.MaxValue; MaxIntervals = int.MaxValue;