osu.Framework/Screens/ScreenStack.cs
/// <summary>
/// Complete suspend of a screen in the stack.
/// </summary>
/// <param name="from">The screen being suspended.</param>
/// <param name="to">The screen being entered.</param>
Complete suspend of a screen in the stack.
Complete suspend of a screen in the stack .
private void suspend(IScreen from, IScreen to)
        {
            var sourceDrawable = from?.AsDrawable();
            if (sourceDrawable == null)
                return;
            if (sourceDrawable.IsLoaded)
                performSuspend();
            else
            {
                sourceDrawable.OnLoadComplete += _ => performSuspend();
            }
            void performSuspend()
            {
                from.OnSuspending(to);
                sourceDrawable.Expire();
            }
        }
private void suspend ( IScreen from , IScreen to ) { var sourceDrawable = from ? . AsDrawable ( ) ; if ( sourceDrawable == null ) return ; if ( sourceDrawable . IsLoaded ) performSuspend ( ) ; else { sourceDrawable . OnLoadComplete += _ => performSuspend ( ) ; } void performSuspend ( ) { from . OnSuspending ( to ) ; sourceDrawable . Expire ( ) ; } }
Complete suspend of a screen in the stack.
Complete suspend of a screen in the stack .
// Screens only receive OnEntering() upon load completion, so OnSuspending() should be delayed until after that
from
IScreen
The screen being suspended.
The screen being suspended .
to
IScreen
The screen being entered.
The screen being entered .