1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 20:22:55 +08:00

Add a playfield method to retrieve all hitobjects

This commit is contained in:
smoogipoo 2018-07-17 15:51:10 +09:00
parent 48190e3b5a
commit 3905a9105c
2 changed files with 12 additions and 4 deletions

View File

@ -28,8 +28,7 @@ namespace osu.Game.Rulesets.Edit
private RulesetContainer rulesetContainer;
private readonly List<Container> layerContainers = new List<Container>();
public IEnumerable<DrawableHitObject> HitObjects => rulesetContainer.Playfield.HitObjects.Objects;
public IEnumerable<DrawableHitObject> AliveHitObjects => rulesetContainer.Playfield.HitObjects.AliveObjects;
public IEnumerable<DrawableHitObject> HitObjects => rulesetContainer.Playfield.AllHitObjects;
private readonly IBindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();

View File

@ -14,13 +14,22 @@ namespace osu.Game.Rulesets.UI
public abstract class Playfield : ScalableContainer
{
/// <summary>
/// The HitObjects contained in this Playfield.
/// The <see cref="DrawableHitObject"/> contained in this Playfield.
/// </summary>
public HitObjectContainer HitObjects { get; private set; }
private readonly Lazy<List<Playfield>> nestedPlayfields = new Lazy<List<Playfield>>();
/// <summary>
/// All the <see cref="DrawableHitObject"/>s contained in this <see cref="Playfield"/> and all <see cref="NestedPlayfields"/>.
/// </summary>
public IEnumerable<DrawableHitObject> AllHitObjects => HitObjects?.Objects.Concat(NestedPlayfields.SelectMany(p => p.AllHitObjects)) ?? Enumerable.Empty<DrawableHitObject>();
/// <summary>
/// All <see cref="Playfield"/>s nested inside this <see cref="Playfield"/>.
/// </summary>
public IEnumerable<Playfield> NestedPlayfields => nestedPlayfields.IsValueCreated ? nestedPlayfields.Value : Enumerable.Empty<Playfield>();
private readonly Lazy<List<Playfield>> nestedPlayfields = new Lazy<List<Playfield>>();
/// <summary>
/// A container for keeping track of DrawableHitObjects.
/// </summary>