mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 19:32:55 +08:00
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.Modes.Objects.Drawables;
|
|||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace osu.Game.Modes.UI
|
namespace osu.Game.Modes.UI
|
||||||
{
|
{
|
||||||
@ -27,38 +28,25 @@ namespace osu.Game.Modes.UI
|
|||||||
public abstract Func<Vector2, Vector2> MapPlayfieldToScreenSpace { get; }
|
public abstract Func<Vector2, Vector2> MapPlayfieldToScreenSpace { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The number of Judgements required to be triggered
|
/// Whether all the HitObjects have been judged.
|
||||||
/// before the game enters post-play routines.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected abstract int JudgementCount { get; }
|
protected abstract bool AllObjectsJudged { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The beatmap this HitRenderer is initialized with.
|
/// The beatmap this HitRenderer is initialized with.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected readonly Beatmap Beatmap;
|
protected readonly Beatmap Beatmap;
|
||||||
|
|
||||||
private int maxJudgements;
|
|
||||||
private int countJudgements;
|
|
||||||
|
|
||||||
protected HitRenderer(Beatmap beatmap)
|
protected HitRenderer(Beatmap beatmap)
|
||||||
{
|
{
|
||||||
Beatmap = beatmap;
|
Beatmap = beatmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
|
||||||
{
|
|
||||||
base.LoadComplete();
|
|
||||||
|
|
||||||
maxJudgements = JudgementCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void TriggerOnJudgement(JudgementInfo j)
|
protected void TriggerOnJudgement(JudgementInfo j)
|
||||||
{
|
{
|
||||||
countJudgements++;
|
|
||||||
|
|
||||||
OnJudgement?.Invoke(j);
|
OnJudgement?.Invoke(j);
|
||||||
|
|
||||||
if (countJudgements == maxJudgements)
|
if (AllObjectsJudged)
|
||||||
OnAllJudged?.Invoke();
|
OnAllJudged?.Invoke();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -73,9 +61,7 @@ namespace osu.Game.Modes.UI
|
|||||||
protected virtual List<TObject> Convert(Beatmap beatmap) => Converter.Convert(beatmap);
|
protected virtual List<TObject> Convert(Beatmap beatmap) => Converter.Convert(beatmap);
|
||||||
|
|
||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
|
protected override bool AllObjectsJudged => Playfield.HitObjects.Children.All(h => h.Judgement.Result.HasValue);
|
||||||
private int judgementCount;
|
|
||||||
protected override int JudgementCount => judgementCount;
|
|
||||||
|
|
||||||
protected Playfield<TObject> Playfield;
|
protected Playfield<TObject> Playfield;
|
||||||
|
|
||||||
@ -117,8 +103,6 @@ namespace osu.Game.Modes.UI
|
|||||||
drawableObject.OnJudgement += onJudgement;
|
drawableObject.OnJudgement += onJudgement;
|
||||||
|
|
||||||
Playfield.Add(drawableObject);
|
Playfield.Add(drawableObject);
|
||||||
|
|
||||||
judgementCount++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Playfield.PostProcess();
|
Playfield.PostProcess();
|
||||||
|
Loading…
Reference in New Issue
Block a user