From 3118dad52b2aa7173f10858f201dd9cea9e42733 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 11 May 2017 15:05:21 +0900 Subject: [PATCH] Subtract out playfield/hitrenderer/drawablehitobject changes. --- .../Objects/Drawables/DrawableHitObject.cs | 23 +++++-------------- osu.Game/Rulesets/UI/HitRenderer.cs | 11 +++------ osu.Game/Rulesets/UI/Playfield.cs | 2 +- 3 files changed, 10 insertions(+), 26 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 8e153415c7..a300eeab31 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -12,7 +12,6 @@ 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 { @@ -25,11 +24,6 @@ namespace osu.Game.Rulesets.Objects.Drawables public TJudgement Judgement; - /// - /// Whether this hit object has been judged. - /// - public virtual bool Judged => (Judgement?.Result ?? HitResult.None) != HitResult.None; - protected abstract TJudgement CreateJudgement(); protected abstract void UpdateState(ArmedState state); @@ -55,10 +49,6 @@ namespace osu.Game.Rulesets.Objects.Drawables } } - internal DrawableHitObject() - { - } - protected List Samples = new List(); protected void PlaySamples() @@ -94,12 +84,7 @@ namespace osu.Game.Rulesets.Objects.Drawables /// /// The colour used for various elements of this DrawableHitObject. /// - public virtual Color4 AccentColour { get; set; } - - /// - /// Whether this hit object and all of its nested hit objects have been judged. - /// - public sealed override bool Judged => base.Judged && NestedHitObjects.All(h => h.Judged); + public Color4 AccentColour { get; protected set; } protected DrawableHitObject(TObject hitObject) { @@ -183,11 +168,15 @@ namespace osu.Game.Rulesets.Objects.Drawables } } - private readonly List> nestedHitObjects = new List>(); + private List> nestedHitObjects; + protected IEnumerable> NestedHitObjects => nestedHitObjects; protected void AddNested(DrawableHitObject h) { + if (nestedHitObjects == null) + nestedHitObjects = new List>(); + h.OnJudgement += d => OnJudgement?.Invoke(d); nestedHitObjects.Add(h); } diff --git a/osu.Game/Rulesets/UI/HitRenderer.cs b/osu.Game/Rulesets/UI/HitRenderer.cs index 52b7a2766a..8ee67df95a 100644 --- a/osu.Game/Rulesets/UI/HitRenderer.cs +++ b/osu.Game/Rulesets/UI/HitRenderer.cs @@ -187,19 +187,17 @@ namespace osu.Game.Rulesets.UI public sealed override bool ProvidingUserCursor => !HasReplayLoaded && Playfield.ProvidingUserCursor; - public override IEnumerable Objects => Beatmap.HitObjects; - - protected override bool AllObjectsJudged => drawableObjects.All(o => o.Judged); + protected override Container Content => content; + protected override bool AllObjectsJudged => Playfield.HitObjects.Children.All(h => h.Judgement.Result != HitResult.None); /// /// The playfield. /// protected Playfield Playfield; - protected override Container Content => content; private readonly Container content; - private readonly List> drawableObjects = new List>(); + public override IEnumerable Objects => Beatmap.HitObjects; protected HitRenderer(WorkingBeatmap beatmap) : base(beatmap) @@ -226,8 +224,6 @@ namespace osu.Game.Rulesets.UI private void loadObjects() { - drawableObjects.Clear(); - foreach (TObject h in Beatmap.HitObjects) { var drawableObject = GetVisualRepresentation(h); @@ -237,7 +233,6 @@ namespace osu.Game.Rulesets.UI drawableObject.OnJudgement += onJudgement; - drawableObjects.Add(drawableObject); Playfield.Add(drawableObject); } diff --git a/osu.Game/Rulesets/UI/Playfield.cs b/osu.Game/Rulesets/UI/Playfield.cs index 612569a9ae..0586c0385a 100644 --- a/osu.Game/Rulesets/UI/Playfield.cs +++ b/osu.Game/Rulesets/UI/Playfield.cs @@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.UI /// /// The HitObjects contained in this Playfield. /// - protected HitObjectContainer> HitObjects; + public HitObjectContainer> HitObjects; internal Container ScaledContent;