Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onEnterTransitionDidFinish and getRunningScene #8348

Closed
minggo opened this issue Sep 30, 2014 · 0 comments
Closed

onEnterTransitionDidFinish and getRunningScene #8348

minggo opened this issue Sep 30, 2014 · 0 comments

Comments

@minggo
Copy link
Contributor

minggo commented Sep 30, 2014

Note

This issue is migrated from here. It was created at 2014/02/19 07:51:31 +0000

Description

When scene receives onEnterTransitionDidFinish() Director::getRunningScene() returns transition scene BUT not scene that was wrapped.
Current behavior is scene receive onEnterTransitionDidFinish in onExit of Transition, when transition is not finished and runningScene has not been updated yet.

Suggested fix:

--- a/cocos/2d/CCDirector.cpp
+++ b/cocos/2d/CCDirector.cpp
@@ -773,9 +773,12 @@ void Director::setNextScene()
_nextScene->retain();
_nextScene = nullptr;

  • if ((! runningIsTransition) && _runningScene)
  • if (_runningScene)
    {
  •    _runningScene->onEnter();
    
  •    if (!runningIsTransition)
    
  •    {
    
  •        _runningScene->onEnter();
    
  •    }
     _runningScene->onEnterTransitionDidFinish();
    
    }
    }

--- a/cocos/2d/CCTransition.cpp
+++ b/cocos/2d/CCTransition.cpp
@@ -180,7 +180,7 @@ void TransitionScene::onExit()

 // _inScene should not receive the onEnter callback
 // only the onEnterTransitionDidFinish
  • _inScene->onEnterTransitionDidFinish();
    +// _inScene->onEnterTransitionDidFinish();
    }

// custom cleanup

@minggo minggo closed this as completed Dec 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant