1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 09:07:25 +08:00

Subtract out playfield/hitrenderer/drawablehitobject changes.

This commit is contained in:
smoogipooo 2017-05-11 15:05:21 +09:00
parent da4be2f9d6
commit 3118dad52b
3 changed files with 10 additions and 26 deletions

View File

@ -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;
/// <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);
@ -55,10 +49,6 @@ namespace osu.Game.Rulesets.Objects.Drawables
}
}
internal DrawableHitObject()
{
}
protected List<SampleChannel> Samples = new List<SampleChannel>();
protected void PlaySamples()
@ -94,12 +84,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
/// <summary>
/// The colour used for various elements of this DrawableHitObject.
/// </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);
public Color4 AccentColour { get; protected set; }
protected DrawableHitObject(TObject hitObject)
{
@ -183,11 +168,15 @@ namespace osu.Game.Rulesets.Objects.Drawables
}
}
private readonly List<DrawableHitObject<TObject, TJudgement>> nestedHitObjects = new List<DrawableHitObject<TObject, TJudgement>>();
private List<DrawableHitObject<TObject, TJudgement>> nestedHitObjects;
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

@ -187,19 +187,17 @@ namespace osu.Game.Rulesets.UI
public sealed override bool ProvidingUserCursor => !HasReplayLoaded && Playfield.ProvidingUserCursor;
public override IEnumerable<HitObject> Objects => Beatmap.HitObjects;
protected override bool AllObjectsJudged => drawableObjects.All(o => o.Judged);
protected override Container<Drawable> Content => content;
protected override bool AllObjectsJudged => Playfield.HitObjects.Children.All(h => h.Judgement.Result != HitResult.None);
/// <summary>
/// The playfield.
/// </summary>
protected Playfield<TObject, TJudgement> Playfield;
protected override Container<Drawable> Content => content;
private readonly Container content;
private readonly List<DrawableHitObject<TObject, TJudgement>> drawableObjects = new List<DrawableHitObject<TObject, TJudgement>>();
public override IEnumerable<HitObject> 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);
}

View File

@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.UI
/// <summary>
/// The HitObjects contained in this Playfield.
/// </summary>
protected HitObjectContainer<DrawableHitObject<TObject, TJudgement>> HitObjects;
public HitObjectContainer<DrawableHitObject<TObject, TJudgement>> HitObjects;
internal Container<Drawable> ScaledContent;