1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-16 15:02:55 +08:00

More concrete way to determine whether all hit objects have been judged.

This commit is contained in:
smoogipooo 2017-05-10 17:53:51 +09:00
parent 2867606913
commit ba998035a8
2 changed files with 13 additions and 6 deletions

View File

@ -12,6 +12,7 @@ using Container = osu.Framework.Graphics.Containers.Container;
using osu.Game.Rulesets.Objects.Types;
using OpenTK.Graphics;
using osu.Game.Audio;
using System.Linq;
namespace osu.Game.Rulesets.Objects.Drawables
{
@ -24,6 +25,11 @@ namespace osu.Game.Rulesets.Objects.Drawables
public TJudgement Judgement;
/// <summary>
/// Whether this hit object has been judged.
/// </summary>
public virtual bool Judged => (Judgement?.Result ?? HitResult.None) != HitResult.None;
protected abstract TJudgement CreateJudgement();
protected abstract void UpdateState(ArmedState state);
@ -90,6 +96,11 @@ namespace osu.Game.Rulesets.Objects.Drawables
/// </summary>
public virtual Color4 AccentColour { get; set; }
/// <summary>
/// Whether this hit object and all of its nested hit objects have been judged.
/// </summary>
public sealed override bool Judged => base.Judged && NestedHitObjects.All(h => h.Judged);
protected DrawableHitObject(TObject hitObject)
{
HitObject = hitObject;
@ -172,15 +183,11 @@ namespace osu.Game.Rulesets.Objects.Drawables
}
}
private List<DrawableHitObject<TObject, TJudgement>> nestedHitObjects;
private List<DrawableHitObject<TObject, TJudgement>> nestedHitObjects = new List<DrawableHitObject<TObject, TJudgement>>();
protected IEnumerable<DrawableHitObject<TObject, TJudgement>> NestedHitObjects => nestedHitObjects;
protected void AddNested(DrawableHitObject<TObject, TJudgement> h)
{
if (nestedHitObjects == null)
nestedHitObjects = new List<DrawableHitObject<TObject, TJudgement>>();
h.OnJudgement += d => OnJudgement?.Invoke(d);
nestedHitObjects.Add(h);
}

View File

@ -188,7 +188,7 @@ namespace osu.Game.Rulesets.UI
public sealed override bool ProvidingUserCursor => !HasReplayLoaded && Playfield.ProvidingUserCursor;
protected override Container<Drawable> Content => content;
protected override bool AllObjectsJudged => Playfield.HitObjects.Children.All(h => h.Judgement.Result != HitResult.None);
protected override bool AllObjectsJudged => Playfield.HitObjects.Children.All(h => h.Judged);
/// <summary>
/// The playfield.