osu.Framework/Graphics/Containers/CompositeDrawable.cs
/// <summary>
/// Changes the depth of an internal child. This affects ordering of <see cref="InternalChildren"/>.
/// </summary>
/// <param name="child">The child whose depth is to be changed.</param>
/// <param name="newDepth">The new depth value to be set.</param>
Changes the depth of an internal child. This affects ordering of .
Changes the depth of an internal child . This affects ordering of .
protected internal void ChangeInternalChildDepth(Drawable child, float newDepth)
        {
            ensureChildMutationAllowed();
            if (child.Depth == newDepth) return;
            var index = IndexOfInternal(child);
            if (index < 0)
                throw new InvalidOperationException($"Can not change depth of drawable which is not contained within this {nameof(CompositeDrawable)}.");
            internalChildren.RemoveAt(index);
            var aliveIndex = aliveInternalChildren.IndexOf(child);
            if (aliveIndex >= 0) 
                aliveInternalChildren.RemoveAt(aliveIndex);
            var chId = child.ChildID;
            child.ChildID = 0; 
            child.Depth = newDepth;
            child.ChildID = chId;
            internalChildren.Add(child);
            if (aliveIndex >= 0) 
                aliveInternalChildren.Add(child);
            ChildDepthChanged?.Invoke(child);
        }
protected internal void ChangeInternalChildDepth ( Drawable child , float newDepth ) { ensureChildMutationAllowed ( ) ; if ( child . Depth == newDepth ) return ; var index = IndexOfInternal ( child ) ; if ( index < 0 ) throw new InvalidOperationException ( $" Can not change depth of drawable which is not contained within this  { nameof ( CompositeDrawable ) } . " ) ; internalChildren . RemoveAt ( index ) ; var aliveIndex = aliveInternalChildren . IndexOf ( child ) ; if ( aliveIndex >= 0 ) aliveInternalChildren . RemoveAt ( aliveIndex ) ; var chId = child . ChildID ; child . ChildID = 0 ; child . Depth = newDepth ; child . ChildID = chId ; internalChildren . Add ( child ) ; if ( aliveIndex >= 0 ) aliveInternalChildren . Add ( child ) ; ChildDepthChanged ? . Invoke ( child ) ; }
Changes the depth of an internal child.
Changes the depth of an internal child .
// remove if found // ensure Depth-change does not throw an exception // re-add if it used to be in aliveInternalChildren
child
Drawable
The child whose depth is to be changed.
The child whose depth is to be changed .
newDepth
float
The new depth value to be set.
The new depth value to be set .