场景切换 | var scene = cc.Scene.create(); var layer = new TestController(); scene.addChild(layer); var transition = cc.TransitionProgressRadialCCW.create(0.5,scene); cc.director.runScene(transition); |
系统判断 | if(cc.sys.os == cc.sys.OS_ANDROID) { menuItem.setEnabled( testNames[i].platforms & ( PLATFORM_JSB | PLATFROM_ANDROID ) ); }else if(cc.sys.os == cc.sys.OS_IOS|| cc.sys.os == cc.sys.OS_OSX){ menuItem.setEnabled( testNames[i].platforms & ( PLATFORM_JSB | PLATFROM_IOS) ); }else{ menuItem.setEnabled( testNames[i].platforms & PLATFORM_JSB ); } |
系统语言 | var currentLanguageType = cc.sys.language; switch (currentLanguageType) { case cc.sys.LANGUAGE_ENGLISH: case cc.sys.LANGUAGE_CHINESE: |
监听返回键,menu键 | cc.eventManager.addListener({ event:cc.EventListener.KEYBOARD,onKeyReleased: function(keyCode,event){ if (keyCode == cc.KEY.back) { cc.log("return button clicked. keycode:" + keyCode); cc.director.pause(); } else if( keyCode == cc.KEY.menu){ cc.log("return button clicked. keycode:" + keyCode); cc.director.resume(); } } },this); |