mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Add HitWindows to JudgementResult to indicate timing errors
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
// 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.
|
||||
|
||||
using JetBrains.Annotations;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
|
||||
@ -21,6 +23,13 @@ namespace osu.Game.Rulesets.Judgements
|
||||
/// </summary>
|
||||
public readonly Judgement Judgement;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="HitWindows"/> which the <see cref="HitObject"/> was judged against.
|
||||
/// May be null to indicate that the timing error should not be displayed to the user.
|
||||
/// </summary>
|
||||
[CanBeNull]
|
||||
public readonly HitWindows HitWindows;
|
||||
|
||||
/// <summary>
|
||||
/// The offset from a perfect hit at which this <see cref="JudgementResult"/> occurred.
|
||||
/// Populated when this <see cref="JudgementResult"/> is applied via <see cref="DrawableHitObject.ApplyResult"/>.
|
||||
@ -56,9 +65,12 @@ namespace osu.Game.Rulesets.Judgements
|
||||
/// Creates a new <see cref="JudgementResult"/>.
|
||||
/// </summary>
|
||||
/// <param name="judgement">The <see cref="Judgement"/> to refer to for scoring information.</param>
|
||||
public JudgementResult(Judgement judgement)
|
||||
/// <param name="hitWindows">The <see cref="HitWindows"/> which the <see cref="HitObject"/> was judged against.
|
||||
/// May be null to indicate that the timing error should not be displayed to the user.</param>
|
||||
public JudgementResult([NotNull] Judgement judgement, [CanBeNull] HitWindows hitWindows)
|
||||
{
|
||||
Judgement = judgement;
|
||||
HitWindows = hitWindows;
|
||||
}
|
||||
|
||||
public override string ToString() => $"{Type} (Score:{Judgement.NumericResultFor(this)} HP:{Judgement.HealthIncreaseFor(this)} {Judgement})";
|
||||
|
@ -99,7 +99,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
|
||||
if (judgement != null)
|
||||
{
|
||||
Result = CreateResult(judgement);
|
||||
Result = CreateResult(judgement, HitObject.HitWindows);
|
||||
if (Result == null)
|
||||
throw new InvalidOperationException($"{GetType().ReadableName()} must provide a {nameof(JudgementResult)} through {nameof(CreateResult)}.");
|
||||
}
|
||||
@ -401,7 +401,9 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
/// Creates the <see cref="JudgementResult"/> that represents the scoring result for this <see cref="DrawableHitObject"/>.
|
||||
/// </summary>
|
||||
/// <param name="judgement">The <see cref="Judgement"/> that provides the scoring information.</param>
|
||||
protected virtual JudgementResult CreateResult(Judgement judgement) => new JudgementResult(judgement);
|
||||
/// <param name="hitWindows">The <see cref="HitWindows"/> which the <see cref="HitObject"/> was judged against.
|
||||
/// May be null to indicate that the timing error should not be displayed to the user.</param>
|
||||
protected virtual JudgementResult CreateResult(Judgement judgement, HitWindows hitWindows) => new JudgementResult(judgement, hitWindows);
|
||||
}
|
||||
|
||||
public abstract class DrawableHitObject<TObject> : DrawableHitObject
|
||||
|
@ -442,7 +442,7 @@ namespace osu.Game.Rulesets.Scoring
|
||||
/// Creates the <see cref="JudgementResult"/> that represents the scoring result for a <see cref="HitObject"/>.
|
||||
/// </summary>
|
||||
/// <param name="judgement">The <see cref="Judgement"/> that provides the scoring information.</param>
|
||||
protected virtual JudgementResult CreateResult(Judgement judgement) => new JudgementResult(judgement);
|
||||
protected virtual JudgementResult CreateResult(Judgement judgement) => new JudgementResult(judgement, null);
|
||||
}
|
||||
|
||||
public enum ScoringMode
|
||||
|
Reference in New Issue
Block a user