internal void SetNextScene() { bool runningIsTransition = RunningScene != null && RunningScene.IsTransition;// is CCTransitionScene; // If it is not a transition, call onExit/cleanup if (!NextScene.IsTransition) { if (RunningScene != null) { RunningScene.OnExitTransitionDidStart(); RunningScene.OnExit(); // issue #709. the root node (scene) should receive the cleanup message too // otherwise it might be leaked. if (IsSendCleanupToScene) { RunningScene.Cleanup(); } } } if (NextScene.Director != this) { NextScene.Director = this; } RunningScene = NextScene; NextScene = null; if (!runningIsTransition && RunningScene != null) { RunningScene.OnEnter(); RunningScene.OnEnterTransitionDidFinish(); } }
internal void PurgeDirector() { if (RunningScene != null) { RunningScene.OnExitTransitionDidStart(); RunningScene.OnExit(); RunningScene.Cleanup(); } RunningScene = null; NextScene = null; // remove all objects, but don't release it. // runWithScene might be executed after 'end'. scenesStack.Clear(); }