mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 07:07:45 +08:00
Remove CentreHit/RimHit hitobject abstraction
This commit is contained in:
parent
2e9fc80a72
commit
5106d275ca
@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Mods
|
||||
|
||||
[TestCase(false)]
|
||||
[TestCase(true)]
|
||||
public void TestHit(bool shouldMiss) => CreateHitObjectTest(new HitObjectTestData(new CentreHit { StartTime = 1000 }), shouldMiss);
|
||||
public void TestHit(bool shouldMiss) => CreateHitObjectTest(new HitObjectTestData(new Hit { StartTime = 1000, Type = HitType.Centre }), shouldMiss);
|
||||
|
||||
[TestCase(false)]
|
||||
[TestCase(true)]
|
||||
|
@ -27,8 +27,8 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
||||
{
|
||||
StartTime = hitObject.StartTime,
|
||||
EndTime = hitObject.GetEndTime(),
|
||||
IsRim = hitObject is RimHit,
|
||||
IsCentre = hitObject is CentreHit,
|
||||
IsRim = (hitObject as Hit)?.Type == HitType.Rim,
|
||||
IsCentre = (hitObject as Hit)?.Type == HitType.Centre,
|
||||
IsDrumRoll = hitObject is DrumRoll,
|
||||
IsSwell = hitObject is Swell,
|
||||
IsStrong = ((TaikoHitObject)hitObject).IsStrong
|
||||
|
@ -69,7 +69,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
||||
|
||||
WorkingBeatmap beatmap = CreateWorkingBeatmap(new Beatmap
|
||||
{
|
||||
HitObjects = new List<HitObject> { new CentreHit() },
|
||||
HitObjects = new List<HitObject> { new Hit { Type = HitType.Centre } },
|
||||
BeatmapInfo = new BeatmapInfo
|
||||
{
|
||||
BaseDifficulty = new BeatmapDifficulty(),
|
||||
|
@ -124,24 +124,13 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
|
||||
bool isRim = currentSamples.Any(s => s.Name == HitSampleInfo.HIT_CLAP || s.Name == HitSampleInfo.HIT_WHISTLE);
|
||||
strong = currentSamples.Any(s => s.Name == HitSampleInfo.HIT_FINISH);
|
||||
|
||||
if (isRim)
|
||||
yield return new Hit
|
||||
{
|
||||
yield return new RimHit
|
||||
{
|
||||
StartTime = j,
|
||||
Samples = currentSamples,
|
||||
IsStrong = strong
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
yield return new CentreHit
|
||||
{
|
||||
StartTime = j,
|
||||
Samples = currentSamples,
|
||||
IsStrong = strong
|
||||
};
|
||||
}
|
||||
StartTime = j,
|
||||
Type = isRim ? HitType.Rim : HitType.Centre,
|
||||
Samples = currentSamples,
|
||||
IsStrong = strong
|
||||
};
|
||||
|
||||
i = (i + 1) % allSamples.Count;
|
||||
}
|
||||
@ -180,24 +169,13 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
|
||||
{
|
||||
bool isRim = samples.Any(s => s.Name == HitSampleInfo.HIT_CLAP || s.Name == HitSampleInfo.HIT_WHISTLE);
|
||||
|
||||
if (isRim)
|
||||
yield return new Hit
|
||||
{
|
||||
yield return new RimHit
|
||||
{
|
||||
StartTime = obj.StartTime,
|
||||
Samples = obj.Samples,
|
||||
IsStrong = strong
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
yield return new CentreHit
|
||||
{
|
||||
StartTime = obj.StartTime,
|
||||
Samples = obj.Samples,
|
||||
IsStrong = strong
|
||||
};
|
||||
}
|
||||
StartTime = obj.StartTime,
|
||||
Type = isRim ? HitType.Rim : HitType.Centre,
|
||||
Samples = obj.Samples,
|
||||
IsStrong = strong
|
||||
};
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
|
||||
public TaikoDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate)
|
||||
: base(hitObject, lastObject, clockRate)
|
||||
{
|
||||
HasTypeChange = lastObject is RimHit != hitObject is RimHit;
|
||||
HasTypeChange = (lastObject as Hit)?.Type != (hitObject as Hit)?.Type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +0,0 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Objects
|
||||
{
|
||||
public class CentreHit : Hit
|
||||
{
|
||||
}
|
||||
}
|
@ -5,5 +5,9 @@ namespace osu.Game.Rulesets.Taiko.Objects
|
||||
{
|
||||
public class Hit : TaikoHitObject
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="HitType"/> that actuates this <see cref="Hit"/>.
|
||||
/// </summary>
|
||||
public HitType Type { get; set; }
|
||||
}
|
||||
}
|
||||
|
21
osu.Game.Rulesets.Taiko/Objects/HitType.cs
Normal file
21
osu.Game.Rulesets.Taiko/Objects/HitType.cs
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Objects
|
||||
{
|
||||
/// <summary>
|
||||
/// The type of a <see cref="Hit"/>.
|
||||
/// </summary>
|
||||
public enum HitType
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see cref="Hit"/> that can be hit by the centre portion of the drum.
|
||||
/// </summary>
|
||||
Centre,
|
||||
|
||||
/// <summary>
|
||||
/// A <see cref="Hit"/> that can be hit by the rim portion of the drum.
|
||||
/// </summary>
|
||||
Rim
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Objects
|
||||
{
|
||||
public class RimHit : Hit
|
||||
{
|
||||
}
|
||||
}
|
@ -97,7 +97,7 @@ namespace osu.Game.Rulesets.Taiko.Replays
|
||||
{
|
||||
TaikoAction[] actions;
|
||||
|
||||
if (hit is CentreHit)
|
||||
if (hit.Type == HitType.Centre)
|
||||
{
|
||||
actions = h.IsStrong
|
||||
? new[] { TaikoAction.LeftCentre, TaikoAction.RightCentre }
|
||||
|
@ -48,11 +48,11 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
{
|
||||
switch (h)
|
||||
{
|
||||
case CentreHit centreHit:
|
||||
return new DrawableCentreHit(centreHit);
|
||||
|
||||
case RimHit rimHit:
|
||||
return new DrawableRimHit(rimHit);
|
||||
case Hit hit:
|
||||
if (hit.Type == HitType.Centre)
|
||||
return new DrawableCentreHit(hit);
|
||||
else
|
||||
return new DrawableRimHit(hit);
|
||||
|
||||
case DrumRoll drumRoll:
|
||||
return new DrawableDrumRoll(drumRoll);
|
||||
|
@ -14,9 +14,9 @@ using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Rulesets.UI.Scrolling;
|
||||
using osu.Game.Rulesets.Taiko.Objects;
|
||||
using osu.Game.Rulesets.Taiko.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Taiko.Judgements;
|
||||
using osu.Game.Rulesets.Taiko.Objects;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
@ -245,7 +245,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
if (!result.IsHit)
|
||||
break;
|
||||
|
||||
bool isRim = judgedObject.HitObject is RimHit;
|
||||
bool isRim = (judgedObject.HitObject as Hit)?.Type == HitType.Rim;
|
||||
|
||||
hitExplosionContainer.Add(new HitExplosion(judgedObject, isRim));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user