1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 07:33:20 +08:00

Introduce the concept of a "MainResult"

This commit is contained in:
smoogipoo 2018-08-02 21:07:31 +09:00
parent 8d81e66f88
commit 35b4ab5456
2 changed files with 21 additions and 11 deletions

View File

@ -21,10 +21,10 @@ namespace osu.Game.Rulesets.Taiko.Objects
protected override IEnumerable<Judgement> CreateJudgements()
{
yield return new TaikoJudgement();
for (int i = 0; i < RequiredHits; i++)
yield return new TaikoIntermediateSwellJudgement();
yield return new TaikoJudgement();
}
}
}

View File

@ -62,6 +62,13 @@ namespace osu.Game.Rulesets.Objects.Drawables
private readonly List<JudgementResult> results = new List<JudgementResult>();
public IReadOnlyList<JudgementResult> Results => results;
/// <summary>
/// The <see cref="JudgementResult"/> that affects whether this <see cref="DrawableHitObject"/> has been hit or missed.
/// By default, this is the last <see cref="JudgementResult"/> in <see cref="Results"/>, and should be overridden if the order
/// of <see cref="Judgement"/>s in <see cref="HitObject.CreateJudgements"/> doesn't list the main <see cref="Judgement"/> as its last element.
/// </summary>
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);