1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 23:12:55 +08:00

Merge pull request #510 from smoogipooo/remove_type_enums

Remove hit object types solution-wide.
This commit is contained in:
Dean Herbert 2017-03-20 13:16:36 +09:00 committed by GitHub
commit df17f2c996
12 changed files with 12 additions and 50 deletions

View File

@ -144,5 +144,12 @@ namespace osu.Desktop.VisualTests.Tests
if (proxyable != null) if (proxyable != null)
approachContainer.Add(proxyable.ProxiedLayer.CreateProxy()); approachContainer.Add(proxyable.ProxiedLayer.CreateProxy());
} }
private enum HitObjectType
{
Circle,
Slider,
Spinner
}
} }
} }

View File

@ -5,6 +5,5 @@ namespace osu.Game.Modes.Osu.Objects
{ {
public class HitCircle : OsuHitObject public class HitCircle : OsuHitObject
{ {
public override HitObjectType Type => HitObjectType.Circle;
} }
} }

View File

@ -1,13 +0,0 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// 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
}
}

View File

@ -36,8 +36,6 @@ namespace osu.Game.Modes.Osu.Objects
public float Scale { get; set; } = 1; public float Scale { get; set; } = 1;
public abstract HitObjectType Type { get; }
public Color4 ComboColour { get; set; } public Color4 ComboColour { get; set; }
public virtual bool NewCombo { get; set; } public virtual bool NewCombo { get; set; }
public int ComboIndex { get; set; } public int ComboIndex { get; set; }

View File

@ -148,11 +148,11 @@ namespace osu.Game.Modes.Osu.Objects
double timeElapsed = (BaseHitObject.StartTime - previousHitObject.BaseHitObject.StartTime) / timeRate; double timeElapsed = (BaseHitObject.StartTime - previousHitObject.BaseHitObject.StartTime) / timeRate;
double decay = Math.Pow(DECAY_BASE[(int)type], timeElapsed / 1000); double decay = Math.Pow(DECAY_BASE[(int)type], timeElapsed / 1000);
if (BaseHitObject.Type == HitObjectType.Spinner) if (BaseHitObject is Spinner)
{ {
// Do nothing for spinners // Do nothing for spinners
} }
else if (BaseHitObject.Type == HitObjectType.Slider) else if (BaseHitObject is Slider)
{ {
switch (type) switch (type)
{ {
@ -180,7 +180,7 @@ namespace osu.Game.Modes.Osu.Objects
break; break;
} }
} }
else if (BaseHitObject.Type == HitObjectType.Circle) else if (BaseHitObject is HitCircle)
{ {
addition = spacingWeight(DistanceTo(previousHitObject), type) * spacing_weight_scaling[(int)type]; addition = spacingWeight(DistanceTo(previousHitObject), type) * spacing_weight_scaling[(int)type];
} }

View File

@ -103,7 +103,5 @@ namespace osu.Game.Modes.Osu.Objects
} }
} }
} }
public override HitObjectType Type => HitObjectType.Slider;
} }
} }

View File

@ -6,7 +6,5 @@ namespace osu.Game.Modes.Osu.Objects
public class SliderTick : OsuHitObject public class SliderTick : OsuHitObject
{ {
public int RepeatIndex { get; set; } public int RepeatIndex { get; set; }
public override HitObjectType Type => HitObjectType.SliderTick;
} }
} }

View File

@ -10,8 +10,6 @@ namespace osu.Game.Modes.Osu.Objects
public double EndTime { get; set; } public double EndTime { get; set; }
public double Duration => EndTime - StartTime; public double Duration => EndTime - StartTime;
public override HitObjectType Type => HitObjectType.Spinner;
public override bool NewCombo => true; public override bool NewCombo => true;
} }
} }

View File

@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Modes.Objects.Types;
using osu.Game.Modes.Osu.Beatmaps; using osu.Game.Modes.Osu.Beatmaps;
using osu.Game.Modes.Osu.Objects; using osu.Game.Modes.Osu.Objects;
using System; using System;
@ -26,8 +27,7 @@ namespace osu.Game.Modes.Osu
protected override void PreprocessHitObjects() protected override void PreprocessHitObjects()
{ {
foreach (var h in Objects) foreach (var h in Objects)
if (h.Type == HitObjectType.Slider) (h as IHasCurve)?.Curve?.Calculate();
((Slider)h).Curve.Calculate();
} }
protected override double CalculateInternal(Dictionary<string, string> categoryDifficulty) protected override double CalculateInternal(Dictionary<string, string> categoryDifficulty)

View File

@ -67,7 +67,6 @@
<Compile Include="Objects\Drawables\Pieces\TrianglesPiece.cs" /> <Compile Include="Objects\Drawables\Pieces\TrianglesPiece.cs" />
<Compile Include="Objects\Drawables\Pieces\SliderBall.cs" /> <Compile Include="Objects\Drawables\Pieces\SliderBall.cs" />
<Compile Include="Objects\Drawables\Pieces\SliderBody.cs" /> <Compile Include="Objects\Drawables\Pieces\SliderBody.cs" />
<Compile Include="Objects\HitObjectType.cs" />
<Compile Include="Objects\OsuHitObjectDifficulty.cs" /> <Compile Include="Objects\OsuHitObjectDifficulty.cs" />
<Compile Include="Objects\SliderTick.cs" /> <Compile Include="Objects\SliderTick.cs" />
<Compile Include="OsuAutoReplay.cs" /> <Compile Include="OsuAutoReplay.cs" />

View File

@ -1,21 +0,0 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// 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
}
}

View File

@ -50,7 +50,6 @@
<Compile Include="Beatmaps\TaikoBeatmapConverter.cs" /> <Compile Include="Beatmaps\TaikoBeatmapConverter.cs" />
<Compile Include="Beatmaps\TaikoBeatmapProcessor.cs" /> <Compile Include="Beatmaps\TaikoBeatmapProcessor.cs" />
<Compile Include="Judgements\TaikoJudgementInfo.cs" /> <Compile Include="Judgements\TaikoJudgementInfo.cs" />
<Compile Include="Objects\TaikoHitType.cs" />
<Compile Include="TaikoDifficultyCalculator.cs" /> <Compile Include="TaikoDifficultyCalculator.cs" />
<Compile Include="Objects\Drawable\DrawableTaikoHit.cs" /> <Compile Include="Objects\Drawable\DrawableTaikoHit.cs" />
<Compile Include="Objects\TaikoHitObject.cs" /> <Compile Include="Objects\TaikoHitObject.cs" />