现在的位置: 首页 > 综合 > 正文

cocos2d-x游戏暂停和恢复

2018年02月10日 ⁄ 综合 ⁄ 共 541字 ⁄ 字号 评论关闭

Feel free to use my recursive methods:  
  

2Pause:

void GamePlayGuiLayer::RevursivelyPauseAllChildren( CCNode * node ) {  
    node->pauseSchedulerAndActions();  
  
    CCObject * obj;  
    CCARRAY_FOREACH(node -> getChildren(), obj) {  
        CCNode * n = (CCNode *)obj;  
        RevursivelyPauseAllChildren(n);   
    }  
} 

2Resume:

void GamePlayGuiLayer::RevursivelyResumeAllChildren( CCNode * node ) {  
    node->resumeSchedulerAndActions();  
  
    CCObject * obj;  
    CCARRAY_FOREACH(node -> getChildren(), obj) {  
        CCNode * n = (CCNode *)obj;  
        RevursivelyResumeAllChildren(n);   
    }  
}  

- See more at: http://www.cocos2d-x.org/boards/6/topics/6887#sthash.xqm2JwU6.dpuf  

抱歉!评论已关闭.