【cocos2d-js官方文档】十、log
来源:互联网 发布:美国硕士申请文书知乎 编辑:程序博客网 时间:2024/06/01 08:39
api改动情况,左边为新增,右边为原来的。
cc.log 不变cc.warn 新增cc.error 新增cc.assert <-- cc.Assert
此次改造有以下几点原因:
添加原来没有的api:cc.warn、cc.error。
修改cc.Assert名称,使其符合开发规范。
新的api的使用范例:
cc.log("this is a log");cc.log("this is a log for %s", "Cocos2d-html5");cc.warn("this is a waring");cc.warn("this is a waring for %s", "Cocos2d-html5");cc.error("this is an error");cc.error("this is an error for %s", "Cocos2d-html5");cc.assert(false, "this is an assert");cc.assert(false, "this is an assert for %s", "Cocos2d-html5");
然后今后会定义出msgCode.js
cc.msgCode = { log1 : "this is a log", log2 : "this is a log for %s", warn1 : "this is a waring", warn2 : "this is a waring for %s", error1 : "this is an error", error2 : "this is an error for %s", assert1 : "this is an assert", assert2 : "this is an assert for %s", throw1 : "this is an throw", throw2 : "this is an throw for %s", "Cocos2d-html5"}
这样一来可以让消息字符串等到最大程度的复用并且利于管理。
转载:http://www.douapp.com/post/2454
0 0
- 【cocos2d-js官方文档】十、log
- 【cocos2d-js官方文档】十、log
- 【cocos2d-js官方文档】二十、moduleConfig.json
- Cocos2d-JS 官方文档
- 【cocos2d-js官方文档】十三、CCSAXParser.js
- 【cocos2d-js官方文档】十三、CCSAXParser.js
- 【cocos2d-js官方文档】四、基础数据类型
- 【cocos2d-js官方文档】六、cc.async
- 【cocos2d-js官方文档】七、CCFileUtils
- 【cocos2d-js官方文档】八、cc.game
- 【cocos2d-js官方文档】九、cc.loader
- 【cocos2d-js官方文档】十一、cc.path
- 【cocos2d-js官方文档】十五、cc.sys
- 【cocos2d-js官方文档】十六、create
- 【Cocos2d-js官方文档】 九、cc.loader
- 【Cocos2d-js官方文档】八、cc.game
- 【cocos2d-js官方文档】四、基础数据类型
- 【cocos2d-js官方文档】六、cc.async
- cocos 杂记
- Java Collection
- Cocos2d-x3.2总结:使用物理引擎进行碰撞检测
- oracle 数据库字符集研究 中篇
- Linux的文件操作API
- 【cocos2d-js官方文档】十、log
- Android 4.2 工程导入 5.0 SDK Eclipse 开发环境出现的问题总结
- android WIN DEATH
- UICollectionView介绍 ios
- SQL之乱笔--事务、性能、系统、加密
- fragment的用法笔记
- poj1260--Pearls(dp,从一开始就想错了......)
- [LeetCode]Set Matrix Zeroes
- Google高级搜索技巧