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:
parent
2867606913
commit
ba998035a8
@ -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);
|
||||
}
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user