Add the concept of nested DrawableHitObjects.

- Applies to Slider Ticks and start circle. repeat/endpoints still need addressing.
- Removed SliderTicksLayer abstraction for now.
This commit is contained in:
Dean Herbert
2017-02-16 17:02:36 +09:00
parent 2640c2ac43
commit 8bf3902cbd
9 changed files with 60 additions and 115 deletions

View File

@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using osu.Framework;
@ -23,8 +24,6 @@ namespace osu.Game.Modes.Objects.Drawables
public bool Interactive = true;
public Container<DrawableHitObject> ChildObjects;
public JudgementInfo Judgement;
public abstract JudgementInfo CreateJudgementInfo();
@ -85,6 +84,19 @@ namespace osu.Game.Modes.Objects.Drawables
Expire(true);
}
private List<DrawableHitObject> nestedHitObjects;
protected IEnumerable<DrawableHitObject> NestedHitObjects => nestedHitObjects;
protected void AddNested(DrawableHitObject h)
{
if (nestedHitObjects == null)
nestedHitObjects = new List<DrawableHitObject>();
h.OnJudgement += (d, j) => { OnJudgement?.Invoke(d, j); } ;
nestedHitObjects.Add(h);
}
/// <summary>
/// Process a hit of this hitobject. Carries out judgement.
/// </summary>
@ -119,7 +131,11 @@ namespace osu.Game.Modes.Objects.Drawables
protected virtual void CheckJudgement(bool userTriggered)
{
//todo: consider making abstract.
if (NestedHitObjects != null)
{
foreach (var d in NestedHitObjects)
d.CheckJudgement(userTriggered);
}
}
protected override void UpdateAfterChildren()