1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

removed all usage of hitobject's DifficultyControlPoint

This commit is contained in:
OliBomby 2023-04-26 18:17:02 +02:00
parent c44f71a737
commit 354cd23874
10 changed files with 19 additions and 32 deletions

View File

@ -45,7 +45,7 @@ namespace osu.Game.Rulesets.Catch.Tests.Editor
AddAssert("end time is correct", () => Precision.AlmostEquals(lastObject.EndTime, times[1])); AddAssert("end time is correct", () => Precision.AlmostEquals(lastObject.EndTime, times[1]));
AddAssert("start position is correct", () => Precision.AlmostEquals(lastObject.OriginalX, positions[0])); AddAssert("start position is correct", () => Precision.AlmostEquals(lastObject.OriginalX, positions[0]));
AddAssert("end position is correct", () => Precision.AlmostEquals(lastObject.EndX, positions[1])); AddAssert("end position is correct", () => Precision.AlmostEquals(lastObject.EndX, positions[1]));
AddAssert("default slider velocity", () => lastObject.DifficultyControlPoint.SliderVelocityBindable.IsDefault); AddAssert("default slider velocity", () => lastObject.SliderVelocityBindable.IsDefault);
} }
[Test] [Test]
@ -76,7 +76,7 @@ namespace osu.Game.Rulesets.Catch.Tests.Editor
addPlacementSteps(times, positions); addPlacementSteps(times, positions);
addPathCheckStep(times, positions); addPathCheckStep(times, positions);
AddAssert("slider velocity changed", () => !lastObject.DifficultyControlPoint.SliderVelocityBindable.IsDefault); AddAssert("slider velocity changed", () => !lastObject.SliderVelocityBindable.IsDefault);
} }
[Test] [Test]

View File

@ -108,11 +108,11 @@ namespace osu.Game.Rulesets.Catch.Tests.Editor
double[] times = { 100, 300 }; double[] times = { 100, 300 };
float[] positions = { 200, 300 }; float[] positions = { 200, 300 };
addBlueprintStep(times, positions); addBlueprintStep(times, positions);
AddAssert("default slider velocity", () => hitObject.DifficultyControlPoint.SliderVelocityBindable.IsDefault); AddAssert("default slider velocity", () => hitObject.SliderVelocityBindable.IsDefault);
addDragStartStep(times[1], positions[1]); addDragStartStep(times[1], positions[1]);
AddMouseMoveStep(times[1], 400); AddMouseMoveStep(times[1], 400);
AddAssert("slider velocity changed", () => !hitObject.DifficultyControlPoint.SliderVelocityBindable.IsDefault); AddAssert("slider velocity changed", () => !hitObject.SliderVelocityBindable.IsDefault);
} }
[Test] [Test]

View File

@ -439,7 +439,7 @@ namespace osu.Game.Rulesets.Osu.Tests
{ {
public TestSlider() public TestSlider()
{ {
DifficultyControlPoint = new DifficultyControlPoint { SliderVelocity = 0.1f }; SliderVelocity = 0.1f;
DefaultsApplied += _ => DefaultsApplied += _ =>
{ {

View File

@ -7,7 +7,6 @@ using NUnit.Framework;
using osu.Framework.Screens; using osu.Framework.Screens;
using osu.Framework.Testing; using osu.Framework.Testing;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Replays; using osu.Game.Replays;
using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
@ -47,7 +46,7 @@ namespace osu.Game.Rulesets.Osu.Tests
{ {
StartTime = time_slider_start, StartTime = time_slider_start,
Position = new Vector2(0, 0), Position = new Vector2(0, 0),
DifficultyControlPoint = new DifficultyControlPoint { SliderVelocity = velocity }, SliderVelocity = velocity,
Path = new SliderPath(PathType.Linear, new[] Path = new SliderPath(PathType.Linear, new[]
{ {
Vector2.Zero, Vector2.Zero,

View File

@ -8,7 +8,6 @@ using System.Linq;
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Screens; using osu.Framework.Screens;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Replays; using osu.Game.Replays;
using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
@ -350,7 +349,7 @@ namespace osu.Game.Rulesets.Osu.Tests
{ {
StartTime = time_slider_start, StartTime = time_slider_start,
Position = new Vector2(0, 0), Position = new Vector2(0, 0),
DifficultyControlPoint = new DifficultyControlPoint { SliderVelocity = 0.1f }, SliderVelocity = 0.1f,
Path = new SliderPath(PathType.PerfectCurve, new[] Path = new SliderPath(PathType.PerfectCurve, new[]
{ {
Vector2.Zero, Vector2.Zero,

View File

@ -399,7 +399,7 @@ namespace osu.Game.Rulesets.Osu.Tests
{ {
public TestSlider() public TestSlider()
{ {
DifficultyControlPoint = new DifficultyControlPoint { SliderVelocity = 0.1f }; SliderVelocity = 0.1f;
DefaultsApplied += _ => DefaultsApplied += _ =>
{ {

View File

@ -14,6 +14,7 @@ using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Beatmaps; using osu.Game.Rulesets.Osu.Beatmaps;
using osu.Game.Rulesets.Osu.Edit; using osu.Game.Rulesets.Osu.Edit;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Screens.Edit; using osu.Game.Screens.Edit;
using osu.Game.Tests.Visual; using osu.Game.Tests.Visual;
@ -74,12 +75,9 @@ namespace osu.Game.Tests.Editing
[TestCase(2)] [TestCase(2)]
public void TestSpeedMultiplierDoesNotChangeDistanceSnap(float multiplier) public void TestSpeedMultiplierDoesNotChangeDistanceSnap(float multiplier)
{ {
assertSnapDistance(100, new HitObject assertSnapDistance(100, new Slider
{
DifficultyControlPoint = new DifficultyControlPoint
{ {
SliderVelocity = multiplier SliderVelocity = multiplier
}
}, false); }, false);
} }
@ -87,12 +85,9 @@ namespace osu.Game.Tests.Editing
[TestCase(2)] [TestCase(2)]
public void TestSpeedMultiplierDoesChangeDistanceSnap(float multiplier) public void TestSpeedMultiplierDoesChangeDistanceSnap(float multiplier)
{ {
assertSnapDistance(100 * multiplier, new HitObject assertSnapDistance(100 * multiplier, new Slider
{
DifficultyControlPoint = new DifficultyControlPoint
{ {
SliderVelocity = multiplier SliderVelocity = multiplier
}
}, true); }, true);
} }
@ -114,12 +109,9 @@ namespace osu.Game.Tests.Editing
const float base_distance = 100; const float base_distance = 100;
const float slider_velocity = 1.2f; const float slider_velocity = 1.2f;
var referenceObject = new HitObject var referenceObject = new Slider
{
DifficultyControlPoint = new DifficultyControlPoint
{ {
SliderVelocity = slider_velocity SliderVelocity = slider_velocity
}
}; };
assertSnapDistance(base_distance * slider_velocity, referenceObject, true); assertSnapDistance(base_distance * slider_velocity, referenceObject, true);

View File

@ -6,7 +6,6 @@
using System.Linq; using System.Linq;
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Testing; using osu.Framework.Testing;
using osu.Framework.Utils;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit;

View File

@ -8,10 +8,10 @@ using Humanizer;
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Testing; using osu.Framework.Testing;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.UI; using osu.Game.Rulesets.Osu.UI;
@ -97,8 +97,8 @@ namespace osu.Game.Tests.Visual.Editing
{ {
AddStep("unify slider velocity", () => AddStep("unify slider velocity", () =>
{ {
foreach (var h in EditorBeatmap.HitObjects) foreach (var h in EditorBeatmap.HitObjects.OfType<IHasSliderVelocity>())
h.DifficultyControlPoint.SliderVelocity = 1.5; h.SliderVelocity = 1.5;
}); });
AddStep("select both objects", () => EditorBeatmap.SelectedHitObjects.AddRange(EditorBeatmap.HitObjects)); AddStep("select both objects", () => EditorBeatmap.SelectedHitObjects.AddRange(EditorBeatmap.HitObjects));
@ -182,7 +182,7 @@ namespace osu.Game.Tests.Visual.Editing
private void hitObjectHasVelocity(int objectIndex, double velocity) => AddAssert($"{objectIndex.ToOrdinalWords()} has velocity {velocity}", () => private void hitObjectHasVelocity(int objectIndex, double velocity) => AddAssert($"{objectIndex.ToOrdinalWords()} has velocity {velocity}", () =>
{ {
var h = EditorBeatmap.HitObjects.ElementAt(objectIndex); var h = EditorBeatmap.HitObjects.ElementAt(objectIndex);
return h.DifficultyControlPoint.SliderVelocity == velocity; return h is IHasSliderVelocity hasSliderVelocity && hasSliderVelocity.SliderVelocity == velocity;
}); });
} }
} }

View File

@ -76,8 +76,6 @@ namespace osu.Game.Rulesets.Objects
/// </summary> /// </summary>
public virtual IList<HitSampleInfo> AuxiliarySamples => ImmutableList<HitSampleInfo>.Empty; public virtual IList<HitSampleInfo> AuxiliarySamples => ImmutableList<HitSampleInfo>.Empty;
public DifficultyControlPoint DifficultyControlPoint { get; set; } = DifficultyControlPoint.DEFAULT;
/// <summary> /// <summary>
/// Legacy BPM multiplier that introduces floating-point errors for rulesets that depend on it. /// Legacy BPM multiplier that introduces floating-point errors for rulesets that depend on it.
/// DO NOT USE THIS UNLESS 100% SURE. /// DO NOT USE THIS UNLESS 100% SURE.