Allow setting Entry of PoolableDrawableWithLifetime

It is more convenient than using the constructor because the only limited kind of expression is allowed in a base constructor call.
Also, the object initializer syntax can be used.
This commit is contained in:
ekrctb
2021-06-16 15:58:17 +09:00
parent 81c43bcf19
commit 117e94bc94
2 changed files with 31 additions and 11 deletions

View File

@ -156,10 +156,11 @@ namespace osu.Game.Rulesets.Objects.Drawables
/// If <c>null</c>, a hitobject is expected to be later applied via <see cref="PoolableDrawableWithLifetime{TEntry}.Apply"/> (or automatically via pooling).
/// </param>
protected DrawableHitObject([CanBeNull] HitObject initialHitObject = null)
: base(initialHitObject != null ? new SyntheticHitObjectEntry(initialHitObject) : null)
{
if (Entry != null)
ensureEntryHasResult();
if (initialHitObject == null) return;
Entry = new SyntheticHitObjectEntry(initialHitObject);
ensureEntryHasResult();
}
[BackgroundDependencyLoader]