1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 11:27:24 +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 osu.Game.Rulesets.Objects.Types;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Game.Audio; using osu.Game.Audio;
using System.Linq;
namespace osu.Game.Rulesets.Objects.Drawables namespace osu.Game.Rulesets.Objects.Drawables
{ {
@ -25,11 +24,6 @@ namespace osu.Game.Rulesets.Objects.Drawables
public TJudgement Judgement; 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 TJudgement CreateJudgement();
protected abstract void UpdateState(ArmedState state); 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 List<SampleChannel> Samples = new List<SampleChannel>();
protected void PlaySamples() protected void PlaySamples()
@ -94,12 +84,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
/// <summary> /// <summary>
/// The colour used for various elements of this DrawableHitObject. /// The colour used for various elements of this DrawableHitObject.
/// </summary> /// </summary>
public virtual Color4 AccentColour { get; set; } public Color4 AccentColour { get; protected 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) 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 IEnumerable<DrawableHitObject<TObject, TJudgement>> NestedHitObjects => nestedHitObjects;
protected void AddNested(DrawableHitObject<TObject, TJudgement> h) protected void AddNested(DrawableHitObject<TObject, TJudgement> h)
{ {
if (nestedHitObjects == null)
nestedHitObjects = new List<DrawableHitObject<TObject, TJudgement>>();
h.OnJudgement += d => OnJudgement?.Invoke(d); h.OnJudgement += d => OnJudgement?.Invoke(d);
nestedHitObjects.Add(h); nestedHitObjects.Add(h);
} }

View File

@ -187,19 +187,17 @@ namespace osu.Game.Rulesets.UI
public sealed override bool ProvidingUserCursor => !HasReplayLoaded && Playfield.ProvidingUserCursor; public sealed override bool ProvidingUserCursor => !HasReplayLoaded && Playfield.ProvidingUserCursor;
public override IEnumerable<HitObject> Objects => Beatmap.HitObjects; protected override Container<Drawable> Content => content;
protected override bool AllObjectsJudged => Playfield.HitObjects.Children.All(h => h.Judgement.Result != HitResult.None);
protected override bool AllObjectsJudged => drawableObjects.All(o => o.Judged);
/// <summary> /// <summary>
/// The playfield. /// The playfield.
/// </summary> /// </summary>
protected Playfield<TObject, TJudgement> Playfield; protected Playfield<TObject, TJudgement> Playfield;
protected override Container<Drawable> Content => content;
private readonly Container 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) protected HitRenderer(WorkingBeatmap beatmap)
: base(beatmap) : base(beatmap)
@ -226,8 +224,6 @@ namespace osu.Game.Rulesets.UI
private void loadObjects() private void loadObjects()
{ {
drawableObjects.Clear();
foreach (TObject h in Beatmap.HitObjects) foreach (TObject h in Beatmap.HitObjects)
{ {
var drawableObject = GetVisualRepresentation(h); var drawableObject = GetVisualRepresentation(h);
@ -237,7 +233,6 @@ namespace osu.Game.Rulesets.UI
drawableObject.OnJudgement += onJudgement; drawableObject.OnJudgement += onJudgement;
drawableObjects.Add(drawableObject);
Playfield.Add(drawableObject); Playfield.Add(drawableObject);
} }

View File

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