Remove OnParentReceived()

This commit is contained in:
smoogipoo
2020-12-03 20:03:39 +09:00
parent 73e99718bc
commit 0bdf99b97a
6 changed files with 29 additions and 67 deletions

View File

@ -43,6 +43,12 @@ namespace osu.Game.Rulesets.Objects.Drawables
/// </summary>
public HitObject HitObject { get; private set; }
/// <summary>
/// The parenting <see cref="DrawableHitObject"/>, if any.
/// </summary>
[CanBeNull]
protected internal DrawableHitObject ParentHitObject { get; internal set; }
/// <summary>
/// The colour used for various elements of this DrawableHitObject.
/// </summary>
@ -243,9 +249,9 @@ namespace osu.Game.Rulesets.Objects.Drawables
drawableNested.OnRevertResult += onRevertResult;
drawableNested.ApplyCustomUpdateState += onApplyCustomUpdateState;
// ApplyParent() should occur before Apply() in all cases, so it's invoked before the nested DHO is added to the hierarchy below, but after its events are initialised.
if (pooledDrawableNested == null)
drawableNested.ApplyParent(this);
// This is only necessary for non-pooled DHOs. For pooled DHOs, this is handled inside GetPooledDrawableRepresentation().
// Must be done before the nested DHO is added to occur before the nested Apply()!
drawableNested.ParentHitObject = this;
nestedHitObjects.Value.Add(drawableNested);
AddNestedHitObject(drawableNested);
@ -317,6 +323,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
OnFree();
HitObject = null;
ParentHitObject = null;
Result = null;
lifetimeEntry = null;
@ -350,20 +357,6 @@ namespace osu.Game.Rulesets.Objects.Drawables
{
}
/// <summary>
/// Applies a parenting <see cref="DrawableHitObject"/> to this <see cref="DrawableHitObject"/>.
/// </summary>
/// <param name="parent">The parenting <see cref="DrawableHitObject"/>.</param>
public void ApplyParent(DrawableHitObject parent) => OnParentReceived(parent);
/// <summary>
/// Invoked when this <see cref="DrawableHitObject"/> receives a new parenting <see cref="DrawableHitObject"/>.
/// </summary>
/// <param name="parent">The parenting <see cref="DrawableHitObject"/>.</param>
protected virtual void OnParentReceived(DrawableHitObject parent)
{
}
/// <summary>
/// Invoked by the base <see cref="DrawableHitObject"/> to populate samples, once on initial load and potentially again on any change to the samples collection.
/// </summary>