码迷,mamicode.com
首页 > Web开发 > 详细

cocos3——2.js启动 js_boot.js

时间:2014-12-29 23:04:01      阅读:225      评论:0      收藏:0      [点我收藏+]

标签:

【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, cb, target) {},
	waterful : function (tasks, cb, target) {},
	map : function (tasks, cb, target) {},
	mapLimit : function (tasks, cb, target) {},
};

【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, ext) {}, // '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, jsList, cb),
	loadTxt(url, cb),
	loadJson(url, cb),
	loadImg(url, option, cb),	// 加载一张图片
	loadBinary(url, cb),
	loadBinarySync(url),
	
	_loadResIterator(item, index, cb),
	getUrl(basePath, url),
	load(resources, option, cb),	// 加载资源,然后回调
	loadAliases(url, cb),			// 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, cb, 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
};

cocos3——2.js启动 js_boot.js

标签:

原文地址:http://blog.csdn.net/adfansong/article/details/42246657

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!