protected void PurgeDirector() { // cleanup scheduler Scheduler.UnscheduleAll(); // don't release the event handlers // They are needed in case the director is run again m_pTouchDispatcher.RemoveAllDelegates(); if (m_pRunningScene != null) { m_pRunningScene.OnExitTransitionDidStart(); m_pRunningScene.OnExit(); m_pRunningScene.Cleanup(); } m_pRunningScene = null; m_pNextScene = null; // remove all objects, but don't release it. // runWithScene might be executed after 'end'. m_pobScenesStack.Clear(); StopAnimation(); // purge bitmap cache CCLabelBMFont.PurgeCachedData(); // purge all managed caches CCAnimationCache.PurgeSharedAnimationCache(); CCSpriteFrameCache.PurgeSharedSpriteFrameCache(); CCTextureCache.PurgeSharedTextureCache(); // CCFileUtils.PurgeFileUtils(); // CCConfiguration.purgeConfiguration(); // cocos2d-x specific data structures CCUserDefault.PurgeSharedUserDefault(); // CCNotificationCenter.purgeNotificationCenter(); CCDrawManager.PurgeDrawManager(); m_NeedsInit = true; }