From 090e8bbb795656741fb5699700ce623343defe7c Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 20 Mar 2017 13:10:24 +0900 Subject: [PATCH] Remove hit object types solution-wide. --- .../Tests/TestCaseHitObjects.cs | 7 +++++++ osu.Game.Modes.Osu/Objects/HitCircle.cs | 1 - osu.Game.Modes.Osu/Objects/HitObjectType.cs | 13 ------------ osu.Game.Modes.Osu/Objects/OsuHitObject.cs | 2 -- .../Objects/OsuHitObjectDifficulty.cs | 6 +++--- osu.Game.Modes.Osu/Objects/Slider.cs | 2 -- osu.Game.Modes.Osu/Objects/SliderTick.cs | 2 -- osu.Game.Modes.Osu/Objects/Spinner.cs | 2 -- osu.Game.Modes.Osu/OsuDifficultyCalculator.cs | 4 ++-- osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj | 1 - osu.Game.Modes.Taiko/Objects/TaikoHitType.cs | 21 ------------------- .../osu.Game.Modes.Taiko.csproj | 1 - 12 files changed, 12 insertions(+), 50 deletions(-) delete mode 100644 osu.Game.Modes.Osu/Objects/HitObjectType.cs delete mode 100644 osu.Game.Modes.Taiko/Objects/TaikoHitType.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs index 8462de92cd..eeebc7faa8 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs @@ -144,5 +144,12 @@ namespace osu.Desktop.VisualTests.Tests if (proxyable != null) approachContainer.Add(proxyable.ProxiedLayer.CreateProxy()); } + + private enum HitObjectType + { + Circle, + Slider, + Spinner + } } } diff --git a/osu.Game.Modes.Osu/Objects/HitCircle.cs b/osu.Game.Modes.Osu/Objects/HitCircle.cs index 2d86f0225f..aa45ac7fb9 100644 --- a/osu.Game.Modes.Osu/Objects/HitCircle.cs +++ b/osu.Game.Modes.Osu/Objects/HitCircle.cs @@ -5,6 +5,5 @@ namespace osu.Game.Modes.Osu.Objects { public class HitCircle : OsuHitObject { - public override HitObjectType Type => HitObjectType.Circle; } } diff --git a/osu.Game.Modes.Osu/Objects/HitObjectType.cs b/osu.Game.Modes.Osu/Objects/HitObjectType.cs deleted file mode 100644 index 7d2d84c94c..0000000000 --- a/osu.Game.Modes.Osu/Objects/HitObjectType.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -namespace osu.Game.Modes.Osu.Objects -{ - public enum HitObjectType - { - Circle, - Slider, - Spinner, - SliderTick - } -} diff --git a/osu.Game.Modes.Osu/Objects/OsuHitObject.cs b/osu.Game.Modes.Osu/Objects/OsuHitObject.cs index bedde7a763..2af669b4ef 100644 --- a/osu.Game.Modes.Osu/Objects/OsuHitObject.cs +++ b/osu.Game.Modes.Osu/Objects/OsuHitObject.cs @@ -36,8 +36,6 @@ namespace osu.Game.Modes.Osu.Objects public float Scale { get; set; } = 1; - public abstract HitObjectType Type { get; } - public Color4 ComboColour { get; set; } public virtual bool NewCombo { get; set; } public int ComboIndex { get; set; } diff --git a/osu.Game.Modes.Osu/Objects/OsuHitObjectDifficulty.cs b/osu.Game.Modes.Osu/Objects/OsuHitObjectDifficulty.cs index c67c28b526..926e5132bd 100644 --- a/osu.Game.Modes.Osu/Objects/OsuHitObjectDifficulty.cs +++ b/osu.Game.Modes.Osu/Objects/OsuHitObjectDifficulty.cs @@ -148,11 +148,11 @@ namespace osu.Game.Modes.Osu.Objects double timeElapsed = (BaseHitObject.StartTime - previousHitObject.BaseHitObject.StartTime) / timeRate; double decay = Math.Pow(DECAY_BASE[(int)type], timeElapsed / 1000); - if (BaseHitObject.Type == HitObjectType.Spinner) + if (BaseHitObject is Spinner) { // Do nothing for spinners } - else if (BaseHitObject.Type == HitObjectType.Slider) + else if (BaseHitObject is Slider) { switch (type) { @@ -180,7 +180,7 @@ namespace osu.Game.Modes.Osu.Objects break; } } - else if (BaseHitObject.Type == HitObjectType.Circle) + else if (BaseHitObject is HitCircle) { addition = spacingWeight(DistanceTo(previousHitObject), type) * spacing_weight_scaling[(int)type]; } diff --git a/osu.Game.Modes.Osu/Objects/Slider.cs b/osu.Game.Modes.Osu/Objects/Slider.cs index d94b6534ed..213a4a7bee 100644 --- a/osu.Game.Modes.Osu/Objects/Slider.cs +++ b/osu.Game.Modes.Osu/Objects/Slider.cs @@ -103,7 +103,5 @@ namespace osu.Game.Modes.Osu.Objects } } } - - public override HitObjectType Type => HitObjectType.Slider; } } diff --git a/osu.Game.Modes.Osu/Objects/SliderTick.cs b/osu.Game.Modes.Osu/Objects/SliderTick.cs index 4492af86f9..67f393b126 100644 --- a/osu.Game.Modes.Osu/Objects/SliderTick.cs +++ b/osu.Game.Modes.Osu/Objects/SliderTick.cs @@ -6,7 +6,5 @@ namespace osu.Game.Modes.Osu.Objects public class SliderTick : OsuHitObject { public int RepeatIndex { get; set; } - - public override HitObjectType Type => HitObjectType.SliderTick; } } diff --git a/osu.Game.Modes.Osu/Objects/Spinner.cs b/osu.Game.Modes.Osu/Objects/Spinner.cs index 65e39f30ed..dd9a6c386a 100644 --- a/osu.Game.Modes.Osu/Objects/Spinner.cs +++ b/osu.Game.Modes.Osu/Objects/Spinner.cs @@ -10,8 +10,6 @@ namespace osu.Game.Modes.Osu.Objects public double EndTime { get; set; } public double Duration => EndTime - StartTime; - public override HitObjectType Type => HitObjectType.Spinner; - public override bool NewCombo => true; } } diff --git a/osu.Game.Modes.Osu/OsuDifficultyCalculator.cs b/osu.Game.Modes.Osu/OsuDifficultyCalculator.cs index 5ef0f0059d..7696638082 100644 --- a/osu.Game.Modes.Osu/OsuDifficultyCalculator.cs +++ b/osu.Game.Modes.Osu/OsuDifficultyCalculator.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Beatmaps; +using osu.Game.Modes.Objects.Types; using osu.Game.Modes.Osu.Beatmaps; using osu.Game.Modes.Osu.Objects; using System; @@ -26,8 +27,7 @@ namespace osu.Game.Modes.Osu protected override void PreprocessHitObjects() { foreach (var h in Objects) - if (h.Type == HitObjectType.Slider) - ((Slider)h).Curve.Calculate(); + (h as IHasCurve)?.Curve?.Calculate(); } protected override double CalculateInternal(Dictionary categoryDifficulty) diff --git a/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj b/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj index 2c7f3a0916..12135a38fb 100644 --- a/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj +++ b/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj @@ -67,7 +67,6 @@ - diff --git a/osu.Game.Modes.Taiko/Objects/TaikoHitType.cs b/osu.Game.Modes.Taiko/Objects/TaikoHitType.cs deleted file mode 100644 index adf3a67246..0000000000 --- a/osu.Game.Modes.Taiko/Objects/TaikoHitType.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System; - -namespace osu.Game.Modes.Taiko.Objects -{ - [Flags] - public enum TaikoHitType - { - None = 0, - CentreHit = 1 << 0, - RimHit = 1 << 1, - DrumRoll = 1 << 2, - DrumRollTick = 1 << 3, - Bash = 1 << 4, - Finisher = 1 << 5, - - Hit = CentreHit | RimHit - } -} \ No newline at end of file diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index 0e9e6a56b4..7ea6dfeadb 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -50,7 +50,6 @@ -