I’ve been looking around sample code and I noticed 4 callbacks: OnEnter, OnExit, OnEnterTransitionDidFinish, and OnExitTransitionDidStart. I am replacing scenes with transitions like this:
CCScene* pScene = CCTransitionFade::transitionWithDuration(1.5f, OpeningSequenceLogo::scene()); if (pScene) { CCDirector::sharedDirector()->replaceScene(pScene); }
Only the first 3 get called though. When does OnExitTransitionDidStart occur?
if (m_pRunningScene)
{
m_pRunningScene->onExitTransitionDidStart();
m_pRunningScene->onExit();
}
OnExit is overriden in CCTransitionScene, as you can see:
(here is where the 3 methods that get called are actually called)
// custom onEnter
void CCTransitionScene::onEnter()
{
CCScene::onEnter();
m_pInScene->onEnter();
// outScene should not receive the onEnter callback
}
// custom onExit
void CCTransitionScene::onExit()
{
CCScene::onExit();
m_pOutScene->onExit();
// inScene should not receive the onExit callback
// only the onEnterTransitionDidFinish
m_pInScene->onEnterTransitionDidFinish();
}
But onExitTransitionDidStart is not overriden in CCTransitionScene.
So, the call in CCDirector falls to CCNode, which has no relation with the outgoing scene, whose onExitTransitionDidStart is never called.
Maybe the method CCTransitionScene::onEnter() should be modifies to also call the onExitTransitionDidStart of the outgoing scene like
I don’t think cocos2d-x developers are reading all threads here but this bug is already reported on github https://github.com/cocos2d/cocos2d-x/issues/1450 so you can also send a comment there.
I don’t think cocos2d-x developers are reading all threads here but this bug is already reported on github https://github.com/cocos2d/cocos2d-x/issues/1450 so you can also send a comment there.