From 1bb0b96ddcb19bd50c45bea57ad5f6b8c055bd2a Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 22 Apr 2017 20:43:20 +0900 Subject: [PATCH] Make IHasCurve not depend on a SliderCurve object. --- osu.Game.Rulesets.Osu/Objects/Slider.cs | 2 +- .../OsuDifficultyCalculator.cs | 2 +- .../Rulesets/Objects/Legacy/LegacySlider.cs | 24 ++++--------------- osu.Game/Rulesets/Objects/Types/IHasCurve.cs | 5 ---- 4 files changed, 6 insertions(+), 27 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index dba5b6d43f..4d9d3f97ed 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Osu.Objects /// private const float base_scoring_distance = 100; - public SliderCurve Curve { get; } = new SliderCurve(); + public readonly SliderCurve Curve = new SliderCurve(); public double EndTime => StartTime + RepeatCount * Curve.Distance / Velocity; public double Duration => EndTime - StartTime; diff --git a/osu.Game.Rulesets.Osu/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/OsuDifficultyCalculator.cs index 14b890a055..03b88f49b5 100644 --- a/osu.Game.Rulesets.Osu/OsuDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/OsuDifficultyCalculator.cs @@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Osu protected override void PreprocessHitObjects() { foreach (var h in Objects) - (h as IHasCurve)?.Curve?.Calculate(); + (h as Slider)?.Curve?.Calculate(); } protected override double CalculateInternal(Dictionary categoryDifficulty) diff --git a/osu.Game/Rulesets/Objects/Legacy/LegacySlider.cs b/osu.Game/Rulesets/Objects/Legacy/LegacySlider.cs index 6ecd893be2..96a671fcef 100644 --- a/osu.Game/Rulesets/Objects/Legacy/LegacySlider.cs +++ b/osu.Game/Rulesets/Objects/Legacy/LegacySlider.cs @@ -11,27 +11,11 @@ namespace osu.Game.Rulesets.Objects.Legacy { internal class LegacySlider : HitObject, IHasCurve { - public SliderCurve Curve { get; set; } = new SliderCurve(); + public List ControlPoints { get; set; } + public CurveType CurveType { get; set; } + public double Distance { get; set; } - public List ControlPoints - { - get { return Curve.ControlPoints; } - set { Curve.ControlPoints = value; } - } - - public CurveType CurveType - { - get { return Curve.CurveType; } - set { Curve.CurveType = value; } - } - - public double Distance - { - get { return Curve.Distance; } - set { Curve.Distance = value; } - } - - public List> RepeatSamples { get; set; } = new List>(); + public List> RepeatSamples { get; set; } public int RepeatCount { get; set; } = 1; public double EndTime { get; set; } diff --git a/osu.Game/Rulesets/Objects/Types/IHasCurve.cs b/osu.Game/Rulesets/Objects/Types/IHasCurve.cs index 5ff6d03f6d..399138bc24 100644 --- a/osu.Game/Rulesets/Objects/Types/IHasCurve.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasCurve.cs @@ -11,11 +11,6 @@ namespace osu.Game.Rulesets.Objects.Types /// public interface IHasCurve : IHasDistance, IHasRepeats { - /// - /// The curve. - /// - SliderCurve Curve { get; } - /// /// The control points that shape the curve. ///