mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 00:02:54 +08:00
Expose full hitobject rather than hit windows
This commit is contained in:
parent
f2bdf94a1d
commit
0c73c5acf3
@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
{
|
||||
foreach (HitResult result in Enum.GetValues(typeof(HitResult)).OfType<HitResult>().Skip(1))
|
||||
AddStep("Show " + result.GetDescription(), () => SetContents(() =>
|
||||
new DrawableOsuJudgement(new JudgementResult(null, new HitWindows()) { Type = result }, null)
|
||||
new DrawableOsuJudgement(new JudgementResult(new HitObject(), new Judgement()) { Type = result }, null)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
|
@ -10,8 +10,8 @@ namespace osu.Game.Rulesets.Osu.Judgements
|
||||
{
|
||||
public ComboResult ComboType;
|
||||
|
||||
public OsuJudgementResult(Judgement judgement, HitWindows hitWindows)
|
||||
: base(judgement, hitWindows)
|
||||
public OsuJudgementResult(HitObject hitObject, Judgement judgement)
|
||||
: base(hitObject, judgement)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ using osu.Framework.Graphics;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Osu.Judgements;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
{
|
||||
@ -42,6 +41,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
|
||||
protected virtual void Shake(double maximumLength) => shakeContainer.Shake(maximumLength);
|
||||
|
||||
protected override JudgementResult CreateResult(Judgement judgement, HitWindows hitWindows) => new OsuJudgementResult(judgement, hitWindows);
|
||||
protected override JudgementResult CreateResult(Judgement judgement) => new OsuJudgementResult(HitObject, judgement);
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ namespace osu.Game.Rulesets.Osu.Scoring
|
||||
}
|
||||
}
|
||||
|
||||
protected override JudgementResult CreateResult(Judgement judgement) => new OsuJudgementResult(judgement, null);
|
||||
protected override JudgementResult CreateResult(HitObject hitObject, Judgement judgement) => new OsuJudgementResult(hitObject, judgement);
|
||||
|
||||
public override HitWindows CreateHitWindows() => new OsuHitWindows();
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
||||
|
||||
var h = new DrawableTestHit(hit) { X = RNG.NextSingle(hitResult == HitResult.Good ? -0.1f : -0.05f, hitResult == HitResult.Good ? 0.1f : 0.05f) };
|
||||
|
||||
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(h, new JudgementResult(new TaikoJudgement(), new TaikoHitWindows()) { Type = hitResult });
|
||||
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(h, new JudgementResult(new HitObject(), new TaikoJudgement()) { Type = hitResult });
|
||||
}
|
||||
|
||||
private void addStrongHitJudgement(bool kiai)
|
||||
@ -159,13 +159,13 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
||||
|
||||
var h = new DrawableTestHit(hit) { X = RNG.NextSingle(hitResult == HitResult.Good ? -0.1f : -0.05f, hitResult == HitResult.Good ? 0.1f : 0.05f) };
|
||||
|
||||
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(h, new JudgementResult(new TaikoJudgement(), new TaikoHitWindows()) { Type = hitResult });
|
||||
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(new TestStrongNestedHit(h), new JudgementResult(new TaikoStrongJudgement(), new TaikoHitWindows()) { Type = HitResult.Great });
|
||||
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(h, new JudgementResult(new HitObject(), new TaikoJudgement()) { Type = hitResult });
|
||||
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(new TestStrongNestedHit(h), new JudgementResult(new HitObject(), new TaikoStrongJudgement()) { Type = HitResult.Great });
|
||||
}
|
||||
|
||||
private void addMissJudgement()
|
||||
{
|
||||
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(new DrawableTestHit(new Hit()), new JudgementResult(new TaikoJudgement(), new TaikoHitWindows()) { Type = HitResult.Miss });
|
||||
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(new DrawableTestHit(new Hit()), new JudgementResult(new HitObject(), new TaikoJudgement()) { Type = HitResult.Miss });
|
||||
}
|
||||
|
||||
private void addBarLine(bool major, double delay = scroll_time)
|
||||
|
@ -106,7 +106,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
private void newJudgement(double offset = 0)
|
||||
{
|
||||
var judgement = new JudgementResult(new Judgement(), hitWindows)
|
||||
var judgement = new JudgementResult(new HitObject(), new Judgement())
|
||||
{
|
||||
TimeOffset = offset == 0 ? RNG.Next(-150, 150) : offset,
|
||||
Type = HitResult.Perfect,
|
||||
|
@ -19,16 +19,16 @@ namespace osu.Game.Rulesets.Judgements
|
||||
public HitResult Type;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="Judgement"/> which this <see cref="JudgementResult"/> applies for.
|
||||
/// The <see cref="HitObject"/> which was judged.
|
||||
/// </summary>
|
||||
public readonly Judgement Judgement;
|
||||
[NotNull]
|
||||
public readonly HitObject HitObject;
|
||||
|
||||
/// <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.
|
||||
/// The <see cref="Judgement"/> which this <see cref="JudgementResult"/> applies for.
|
||||
/// </summary>
|
||||
[CanBeNull]
|
||||
public readonly HitWindows HitWindows;
|
||||
[NotNull]
|
||||
public readonly Judgement Judgement;
|
||||
|
||||
/// <summary>
|
||||
/// The offset from a perfect hit at which this <see cref="JudgementResult"/> occurred.
|
||||
@ -64,13 +64,12 @@ namespace osu.Game.Rulesets.Judgements
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="JudgementResult"/>.
|
||||
/// </summary>
|
||||
/// <param name="hitObject">The <see cref="HitObject"/> which was judged.</param>
|
||||
/// <param name="judgement">The <see cref="Judgement"/> to refer to for scoring information.</param>
|
||||
/// <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)
|
||||
public JudgementResult([NotNull] HitObject hitObject, [NotNull] Judgement judgement)
|
||||
{
|
||||
HitObject = hitObject;
|
||||
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, HitObject.HitWindows);
|
||||
Result = CreateResult(judgement);
|
||||
if (Result == null)
|
||||
throw new InvalidOperationException($"{GetType().ReadableName()} must provide a {nameof(JudgementResult)} through {nameof(CreateResult)}.");
|
||||
}
|
||||
@ -401,9 +401,7 @@ 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>
|
||||
/// <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);
|
||||
protected virtual JudgementResult CreateResult(Judgement judgement) => new JudgementResult(HitObject, judgement);
|
||||
}
|
||||
|
||||
public abstract class DrawableHitObject<TObject> : DrawableHitObject
|
||||
|
@ -275,7 +275,7 @@ namespace osu.Game.Rulesets.Scoring
|
||||
if (judgement == null)
|
||||
return;
|
||||
|
||||
var result = CreateResult(judgement);
|
||||
var result = CreateResult(obj, judgement);
|
||||
if (result == null)
|
||||
throw new InvalidOperationException($"{GetType().ReadableName()} must provide a {nameof(JudgementResult)} through {nameof(CreateResult)}.");
|
||||
|
||||
@ -441,8 +441,9 @@ namespace osu.Game.Rulesets.Scoring
|
||||
/// <summary>
|
||||
/// Creates the <see cref="JudgementResult"/> that represents the scoring result for a <see cref="HitObject"/>.
|
||||
/// </summary>
|
||||
/// <param name="hitObject">The <see cref="HitObject"/> which was judged.</param>
|
||||
/// <param name="judgement">The <see cref="Judgement"/> that provides the scoring information.</param>
|
||||
protected virtual JudgementResult CreateResult(Judgement judgement) => new JudgementResult(judgement, null);
|
||||
protected virtual JudgementResult CreateResult(HitObject hitObject, Judgement judgement) => new JudgementResult(hitObject, judgement);
|
||||
}
|
||||
|
||||
public enum ScoringMode
|
||||
|
@ -49,7 +49,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
|
||||
private void onNewJudgement(JudgementResult result)
|
||||
{
|
||||
if (result.HitWindows == null)
|
||||
if (result.HitObject.HitWindows == null)
|
||||
return;
|
||||
|
||||
foreach (var c in Children)
|
||||
|
Loading…
Reference in New Issue
Block a user