mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 10:42:54 +08:00
Reduce complexity of AllHitObjects enumerator when nested playfields are not present
This commit is contained in:
parent
77f9ba09a3
commit
e0a2321822
@ -37,7 +37,21 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// All the <see cref="DrawableHitObject"/>s contained in this <see cref="Playfield"/> and all <see cref="NestedPlayfields"/>.
|
/// All the <see cref="DrawableHitObject"/>s contained in this <see cref="Playfield"/> and all <see cref="NestedPlayfields"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IEnumerable<DrawableHitObject> AllHitObjects => HitObjectContainer?.Objects.Concat(NestedPlayfields.SelectMany(p => p.AllHitObjects)) ?? Enumerable.Empty<DrawableHitObject>();
|
public IEnumerable<DrawableHitObject> AllHitObjects
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (HitObjectContainer == null)
|
||||||
|
return Enumerable.Empty<DrawableHitObject>();
|
||||||
|
|
||||||
|
var enumerable = HitObjectContainer.Objects;
|
||||||
|
|
||||||
|
if (nestedPlayfields.IsValueCreated)
|
||||||
|
enumerable = enumerable.Concat(NestedPlayfields.SelectMany(p => p.AllHitObjects));
|
||||||
|
|
||||||
|
return enumerable;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// All <see cref="Playfield"/>s nested inside this <see cref="Playfield"/>.
|
/// All <see cref="Playfield"/>s nested inside this <see cref="Playfield"/>.
|
||||||
|
Loading…
Reference in New Issue
Block a user