mirror of https://github.com/axmolengine/axmol.git
Reorder the logic of script invocation for onEnter, onExit etc to the beginning of the function
This commit is contained in:
parent
0a31199a5b
commit
0d7f1e3672
|
@ -1410,14 +1410,6 @@ Mat4 Node::transform(const Mat4& parentTransform)
|
|||
|
||||
void Node::onEnter()
|
||||
{
|
||||
if (_onEnterCallback)
|
||||
_onEnterCallback();
|
||||
|
||||
if (_componentContainer && !_componentContainer->isEmpty())
|
||||
{
|
||||
_componentContainer->onEnter();
|
||||
}
|
||||
|
||||
#if CC_ENABLE_SCRIPT_BINDING
|
||||
if (_scriptType == kScriptTypeJavascript)
|
||||
{
|
||||
|
@ -1426,6 +1418,14 @@ void Node::onEnter()
|
|||
}
|
||||
#endif
|
||||
|
||||
if (_onEnterCallback)
|
||||
_onEnterCallback();
|
||||
|
||||
if (_componentContainer && !_componentContainer->isEmpty())
|
||||
{
|
||||
_componentContainer->onEnter();
|
||||
}
|
||||
|
||||
_isTransitionFinished = false;
|
||||
|
||||
for( const auto &child: _children)
|
||||
|
@ -1445,9 +1445,6 @@ void Node::onEnter()
|
|||
|
||||
void Node::onEnterTransitionDidFinish()
|
||||
{
|
||||
if (_onEnterTransitionDidFinishCallback)
|
||||
_onEnterTransitionDidFinishCallback();
|
||||
|
||||
#if CC_ENABLE_SCRIPT_BINDING
|
||||
if (_scriptType == kScriptTypeJavascript)
|
||||
{
|
||||
|
@ -1455,6 +1452,9 @@ void Node::onEnterTransitionDidFinish()
|
|||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (_onEnterTransitionDidFinishCallback)
|
||||
_onEnterTransitionDidFinishCallback();
|
||||
|
||||
_isTransitionFinished = true;
|
||||
for( const auto &child: _children)
|
||||
|
@ -1470,9 +1470,6 @@ void Node::onEnterTransitionDidFinish()
|
|||
|
||||
void Node::onExitTransitionDidStart()
|
||||
{
|
||||
if (_onExitTransitionDidStartCallback)
|
||||
_onExitTransitionDidStartCallback();
|
||||
|
||||
#if CC_ENABLE_SCRIPT_BINDING
|
||||
if (_scriptType == kScriptTypeJavascript)
|
||||
{
|
||||
|
@ -1481,6 +1478,9 @@ void Node::onExitTransitionDidStart()
|
|||
}
|
||||
#endif
|
||||
|
||||
if (_onExitTransitionDidStartCallback)
|
||||
_onExitTransitionDidStartCallback();
|
||||
|
||||
for( const auto &child: _children)
|
||||
child->onExitTransitionDidStart();
|
||||
|
||||
|
@ -1494,14 +1494,6 @@ void Node::onExitTransitionDidStart()
|
|||
|
||||
void Node::onExit()
|
||||
{
|
||||
if (_onExitCallback)
|
||||
_onExitCallback();
|
||||
|
||||
if (_componentContainer && !_componentContainer->isEmpty())
|
||||
{
|
||||
_componentContainer->onExit();
|
||||
}
|
||||
|
||||
#if CC_ENABLE_SCRIPT_BINDING
|
||||
if (_scriptType == kScriptTypeJavascript)
|
||||
{
|
||||
|
@ -1510,6 +1502,14 @@ void Node::onExit()
|
|||
}
|
||||
#endif
|
||||
|
||||
if (_onExitCallback)
|
||||
_onExitCallback();
|
||||
|
||||
if (_componentContainer && !_componentContainer->isEmpty())
|
||||
{
|
||||
_componentContainer->onExit();
|
||||
}
|
||||
|
||||
this->pause();
|
||||
|
||||
_running = false;
|
||||
|
|
Loading…
Reference in New Issue