diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongDrumRoll.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongDrumRoll.cs index c886f52397..3e8f5103c9 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongDrumRoll.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongDrumRoll.cs @@ -7,20 +7,17 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables { public class DrawableStrongDrumRoll : DrawableStrongHitObject { - private readonly DrawableDrumRoll drumRoll; - public DrawableStrongDrumRoll(StrongHitObject strong, DrawableDrumRoll drumRoll) - : base(strong) + : base(strong, drumRoll) { - this.drumRoll = drumRoll; } protected override void CheckForJudgements(bool userTriggered, double timeOffset) { - if (!drumRoll.Judged) + if (!MainObject.Judged) return; - ApplyResult(r => r.Type = drumRoll.IsHit ? HitResult.Great : HitResult.Miss); + ApplyResult(r => r.Type = MainObject.IsHit ? HitResult.Great : HitResult.Miss); } public override bool OnPressed(TaikoAction action) => false; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongDrumRollTick.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongDrumRollTick.cs index 6b821ead84..1724054800 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongDrumRollTick.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongDrumRollTick.cs @@ -7,20 +7,17 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables { public class DrawableStrongDrumRollTick : DrawableStrongHitObject { - private readonly DrawableDrumRollTick tick; - public DrawableStrongDrumRollTick(StrongHitObject strong, DrawableDrumRollTick tick) - : base(strong) + : base(strong, tick) { - this.tick = tick; } protected override void CheckForJudgements(bool userTriggered, double timeOffset) { - if (!tick.Judged) + if (!MainObject.Judged) return; - ApplyResult(r => r.Type = tick.IsHit ? HitResult.Great : HitResult.Miss); + ApplyResult(r => r.Type = MainObject.IsHit ? HitResult.Great : HitResult.Miss); } public override bool OnPressed(TaikoAction action) => false; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHit.cs index c9767c9aec..d0c6525cde 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHit.cs @@ -15,23 +15,22 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables /// private const double second_hit_window = 30; - private readonly DrawableHit hit; + public DrawableHit MainObject => (DrawableHit)base.MainObject; public DrawableStrongHit(StrongHitObject strong, DrawableHit hit) - : base(strong) + : base(strong, hit) { - this.hit = hit; } protected override void CheckForJudgements(bool userTriggered, double timeOffset) { - if (!hit.Result.HasResult) + if (!MainObject.Result.HasResult) { base.CheckForJudgements(userTriggered, timeOffset); return; } - if (!hit.Result.IsHit) + if (!MainObject.Result.IsHit) { ApplyResult(r => r.Type = HitResult.Miss); return; @@ -44,22 +43,22 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables return; } - if (Math.Abs(hit.Result.TimeOffset - timeOffset) < second_hit_window) + if (Math.Abs(MainObject.Result.TimeOffset - timeOffset) < second_hit_window) ApplyResult(r => r.Type = HitResult.Great); } public override bool OnPressed(TaikoAction action) { // Don't process actions until the main hitobject is hit - if (!hit.IsHit) + if (!MainObject.IsHit) return false; // Don't process actions if the pressed button was released - if (hit.HitAction == null) + if (MainObject.HitAction == null) return false; // Don't handle invalid hit action presses - if (!hit.HitActions.Contains(action)) + if (!MainObject.HitActions.Contains(action)) return false; return UpdateJudgement(true); diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHitObject.cs index 5ff7d2b396..85a1afd74b 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHitObject.cs @@ -7,9 +7,13 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables { public abstract class DrawableStrongHitObject : DrawableTaikoHitObject { - protected DrawableStrongHitObject(StrongHitObject strong) + public readonly DrawableHitObject MainObject; + + protected DrawableStrongHitObject(StrongHitObject strong, DrawableHitObject mainObject) : base(strong) { + MainObject = mainObject; + AlwaysPresent = true; } diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 7147972c58..4a045ac86f 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -232,30 +232,32 @@ namespace osu.Game.Rulesets.Taiko.UI if (!judgedObject.DisplayJudgement) return; - if (judgementContainer.FirstOrDefault(j => j.JudgedObject == judgedObject) == null) + switch (result.Judgement) { - judgementContainer.Add(new DrawableTaikoJudgement(result, judgedObject) - { - Anchor = result.IsHit ? Anchor.TopLeft : Anchor.CentreLeft, - Origin = result.IsHit ? Anchor.BottomCentre : Anchor.Centre, - RelativePositionAxes = Axes.X, - X = result.IsHit ? judgedObject.Position.X : 0, - }); - } + case TaikoStrongHitJudgement _: + if (result.IsHit) + hitExplosionContainer.Children.FirstOrDefault(e => e.JudgedObject == ((DrawableStrongHitObject)judgedObject).MainObject)?.VisualiseSecondHit(); + break; + default: + judgementContainer.Add(new DrawableTaikoJudgement(result, judgedObject) + { + Anchor = result.IsHit ? Anchor.TopLeft : Anchor.CentreLeft, + Origin = result.IsHit ? Anchor.BottomCentre : Anchor.Centre, + RelativePositionAxes = Axes.X, + X = result.IsHit ? judgedObject.Position.X : 0, + }); - if (!result.IsHit) - return; + if (!result.IsHit) + break; - bool isRim = judgedObject.HitObject is RimHit; + bool isRim = judgedObject.HitObject is RimHit; - if (result.Judgement is TaikoStrongHitJudgement) - hitExplosionContainer.Children.FirstOrDefault(e => e.JudgedObject == judgedObject)?.VisualiseSecondHit(); - else - { - hitExplosionContainer.Add(new HitExplosion(judgedObject, isRim)); + hitExplosionContainer.Add(new HitExplosion(judgedObject, isRim)); - if (judgedObject.HitObject.Kiai) - kiaiExplosionContainer.Add(new KiaiHitExplosion(judgedObject, isRim)); + if (judgedObject.HitObject.Kiai) + kiaiExplosionContainer.Add(new KiaiHitExplosion(judgedObject, isRim)); + + break; } } }