【js语法相关】 遍历对象或数组obj,执行函数context.iterator,函数返回false表示break cc.each(obj,iterator,context) 从源对象拷贝所有属性到目标对象,并返回目标对象 cc.extend(target,src0,src1..) cc.isFunction(obj) cc.isNumber(obj) cc.isString(obj) cc.isArray(obj) cc.isUndefined(obj) cc.isObject(obj) 定义原型的getter和setter,这样就可用赋值的方式进行set函数的调用,更方便 cc.defineGetterSetter(proto,prop,getter,setter) 【async】 任务流程的控制 cc.async = { series : function (tasks,cb,target) {},parallel : function (tasks,waterful : function (tasks,map : function (tasks,mapLimit : function (tasks,}; 【path路径操作】 cc.path = { join: function () {},// 'a','b.png' -> 'a/b.png' extname: function (str) {},// -> '.png'; null basename: function (str,ext) {},// 'a/b.png' -> 'b.png'; 'a/b.png','.png' -> 'b' dirname: function (str) {},// 'a/b/c.png' -> 'a/b' changeExtname: function(str,// 'a/b.png','.plist' -> 'a/b.plist' changeBasename: function(str,base,sameExt) {},// 'a/b.plist','c.plist' -> 'a/c.plist'; 'a/b.plist','c',true -> 'a/c.plist' }; 【loader加载器】 cc.loader = { getXMLHttpRequest(),loadJs(baseDir,jsList,cb),loadJsWithImg(baseDir,loadTxt(url,loadJson(url,loadImg(url,option,// 加载一张图片 loadBinary(url,loadBinarySync(url),_loadResIterator(item,index,getUrl(basePath,url),load(resources,// 加载资源,然后回调 loadAliases(url,// alias map }; 【字符串格式】 cc.formatStr() // "a: %d,b: %b",a,b 【单例】 cc.director cc.winSize cc.view cc.eventManager = cc.director.getEventDispatcher(); cc.audioEngine = cc.AudioEngine.getInstance(); cc.configuration = cc.Configuration.getInstance(); cc.textureCache = cc.director.getTextureCache(); cc.TextureCache.prototype.addImage = function(url,target) cc.shaderCache = cc.ShaderCache.getInstance(); cc.animationCache cc.spriteFrameCache cc.plistParser = cc.PlistParser.getInstance(); cc.fileUtils = cc.FileUtils.getInstance(); 【jsb】 jsb.fileUtils = cc.fileUtils; delete cc.FileUtils; delete cc.fileUtils; // only android jsb.reflection = { callStaticMethod : function(){ cc.log("not supported on current platform"); } }; 【sys】 cc._initSys(config,CONFIG_KEY) cc._initDebugSetting(mode) // cc.error,cc.assert(cond,msg),cc.warn,cc.log 【game】 cc.game = { setFrameRate,restart,run,// prepare -> onStart _initConfig,prepare // 包含jsb.js及project.json里的js };