标签:str code init 调用 virtual clean 对象 scene rtu
生命周期函数:
1. bool init():初始化场景时调用
2. void onEnter():进入场景时调用
3. void onEnterTransitionDidFinish():进入场景且过度动画结束时调用
4. void onExit():退出场景时调用
5. void onExitTransitionDidStart():退出场景且开始过度动画时调用
6. void cleanup():场景对象被清除时调用
如:
virtual void onEnter() override { Scene::onEnter(); cocos2d::log("...TestScene onEnter..."); } virtual void onEnterTransitionDidFinish() override { Scene::onEnterTransitionDidFinish(); cocos2d::log("...TestScene onEnterTransitionDidFinish..."); } virtual void onExit() override { Scene::onExit(); cocos2d::log("...TestScene onExit..."); } virtual void onExitTransitionDidStart() override { Scene::onExitTransitionDidStart(); cocos2d::log("...TestScene onExitTransitionDidStart..."); } virtual void cleanup() override { Scene::cleanup(); cocos2d::log("...TestScene cleanup..."); }
标签:str code init 调用 virtual clean 对象 scene rtu
原文地址:https://www.cnblogs.com/teternity/p/Cocos2xd__LifeCycle.html