标签:cocos2d-x cocos2d-js cococs2d-xlua c++ 开发人员
在多个场景切换时候,场景的生命周期会更加复杂。这一节我们介绍一下场景切换生命周期。function SettingScene:ctor() -- self.visibleSize = cc.Director:getInstance():getVisibleSize() cclog("SettingScene init") --场景节点事件处理 local function onNodeEvent(event) if event == "enter" then self:onEnter() elseif event == "enterTransitionFinish" then self:onEnterTransitionFinish() elseif event == "exit" then self:onExit() elseif event == "exitTransitionStart" then self:onExitTransitionStart() elseif event == "cleanup" then self:cleanup() end end self:registerScriptHandler(onNodeEvent) end function SettingScene:onEnter() cclog("SettingScene onEnter") end function SettingScene:onEnterTransitionFinish() cclog("SettingScene onEnterTransitionFinish") end function SettingScene:onExit() cclog("SettingScene onExit") end function SettingScene:onExitTransitionStart() cclog("SettingScene onExitTransitionStart") end function SettingScene:cleanup() cclog("SettingScene cleanup") end1、情况1时候,它的调用顺序如图所示。
京东:http://item.jd.com/11659697.html
欢迎关注智捷iOS课堂微信公共平台,了解最新技术文章、图书、教程信息标签:cocos2d-x cocos2d-js cococs2d-xlua c++ 开发人员
原文地址:http://blog.csdn.net/tonny_guan/article/details/45825487