mirror of https://github.com/ppy/osu
Move back to using an abstract method to determine if all objects have been judged.
Because sliderticks provide judgements even though they are added as nested hitobjects, the count method would not work to determine if all hitobjects have been judged. This needs a little bit more thought put in...
This commit is contained in:
parent
75ed7406e4
commit
74db255c78
|
@ -11,6 +11,7 @@
|
|||
using osu.Game.Screens.Play;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace osu.Game.Modes.UI
|
||||
{
|
||||
|
@ -27,38 +28,25 @@ public abstract class HitRenderer : Container
|
|||
public abstract Func<Vector2, Vector2> MapPlayfieldToScreenSpace { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The number of Judgements required to be triggered
|
||||
/// before the game enters post-play routines.
|
||||
/// Whether all the HitObjects have been judged.
|
||||
/// </summary>
|
||||
protected abstract int JudgementCount { get; }
|
||||
protected abstract bool AllObjectsJudged { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The beatmap this HitRenderer is initialized with.
|
||||
/// </summary>
|
||||
protected readonly Beatmap Beatmap;
|
||||
|
||||
private int maxJudgements;
|
||||
private int countJudgements;
|
||||
|
||||
protected HitRenderer(Beatmap beatmap)
|
||||
{
|
||||
Beatmap = beatmap;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
maxJudgements = JudgementCount;
|
||||
}
|
||||
|
||||
protected void TriggerOnJudgement(JudgementInfo j)
|
||||
{
|
||||
countJudgements++;
|
||||
|
||||
OnJudgement?.Invoke(j);
|
||||
|
||||
if (countJudgements == maxJudgements)
|
||||
if (AllObjectsJudged)
|
||||
OnAllJudged?.Invoke();
|
||||
}
|
||||
}
|
||||
|
@ -73,9 +61,7 @@ public abstract class HitRenderer<TObject> : HitRenderer
|
|||
protected virtual List<TObject> Convert(Beatmap beatmap) => Converter.Convert(beatmap);
|
||||
|
||||
protected override Container<Drawable> Content => content;
|
||||
|
||||
private int judgementCount;
|
||||
protected override int JudgementCount => judgementCount;
|
||||
protected override bool AllObjectsJudged => Playfield.HitObjects.Children.All(h => h.Judgement.Result.HasValue);
|
||||
|
||||
protected Playfield<TObject> Playfield;
|
||||
|
||||
|
@ -117,8 +103,6 @@ private void loadObjects()
|
|||
drawableObject.OnJudgement += onJudgement;
|
||||
|
||||
Playfield.Add(drawableObject);
|
||||
|
||||
judgementCount++;
|
||||
}
|
||||
|
||||
Playfield.PostProcess();
|
||||
|
|
Loading…
Reference in New Issue