From 35b4ab545646b80501a7d12a60957f67459b14e7 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 2 Aug 2018 21:07:31 +0900 Subject: [PATCH] Introduce the concept of a "MainResult" --- osu.Game.Rulesets.Taiko/Objects/Swell.cs | 4 +-- .../Objects/Drawables/DrawableHitObject.cs | 28 +++++++++++++------ 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/Swell.cs b/osu.Game.Rulesets.Taiko/Objects/Swell.cs index 2dec6019eb..fef7f4b889 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Swell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Swell.cs @@ -21,10 +21,10 @@ namespace osu.Game.Rulesets.Taiko.Objects protected override IEnumerable CreateJudgements() { - yield return new TaikoJudgement(); - for (int i = 0; i < RequiredHits; i++) yield return new TaikoIntermediateSwellJudgement(); + + yield return new TaikoJudgement(); } } } diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 27de18177f..06f2d689d8 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -62,6 +62,13 @@ namespace osu.Game.Rulesets.Objects.Drawables private readonly List results = new List(); public IReadOnlyList Results => results; + /// + /// The that affects whether this has been hit or missed. + /// By default, this is the last in , and should be overridden if the order + /// of s in doesn't list the main as its last element. + /// + protected virtual JudgementResult MainResult => Results.LastOrDefault(); + private bool judgementOccurred; public bool Interactive = true; @@ -192,16 +199,19 @@ namespace osu.Game.Rulesets.Objects.Drawables var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime; result.TimeOffset = Time.Current - endTime; - switch (result.Type) + if (result == MainResult) { - case HitResult.None: - break; - case HitResult.Miss: - State.Value = ArmedState.Miss; - break; - default: - State.Value = ArmedState.Hit; - break; + switch (result.Type) + { + case HitResult.None: + break; + case HitResult.Miss: + State.Value = ArmedState.Miss; + break; + default: + State.Value = ArmedState.Hit; + break; + } } OnJudgement?.Invoke(this, result);