diff --git a/AUTHORS.txt b/AUTHORS.txt
index 5a20dc7535..d57a37fbe6 100644
--- a/AUTHORS.txt
+++ b/AUTHORS.txt
@@ -12,9 +12,15 @@ Core Developers:
Sijie Wang (@VisualSJ)
- Long Jiang (@jianglong0156)
+ Huabing Xu (@dabingnn)
- Menghe Zhang (@ZhangMenghe)
+ Guanghui Qu (@zilongshanren)
+
+ Jiawei Guo (@jareguo)
+
+ Kaile Yin (@2youyouo2)
+
+ Yanbin Huang (@knoxHuang)
Contributors:
Name GithubID Main contribution
@@ -277,9 +283,12 @@ Maxim Litvinov @metalim Throw new Error object instead of error mess
Retired Core Developers:
Shengxiang Chen (Nero Chan)
Xingsen Ma
+ Xiaojun Zheng
Jialong Zhai (@JoshuaAstray)
Hao Wu (WuHao)
Dingping Lv (David Lv)
+ Long Jiang (@jianglong0156)
+ Menghe Zhang (@ZhangMenghe)
Cocos2d-x and cocos2d-html5 can not grow so fast without the active community.
diff --git a/README.mdown b/README.mdown
index bb9fdb495a..25d7eb9d83 100644
--- a/README.mdown
+++ b/README.mdown
@@ -1,51 +1,20 @@
-Cocos Creator Game Engine
+Cocos Creator Engine Framework
==================
-[Cocos2d-html5][1] is a cross-platform 2D game engine written in Javascript, based on [Cocos2d-X][2] and licensed under MIT.
-It incorporates the same high level api as “Cocos2d JS-binding engine” and compatible with Cocos2d-X.
-It currently supports canvas and WebGL renderer.
+This repo is the engine framework for Cocos Creator, Cocos Creator is a game development tool focused on content creation, which has realized features like thorough scriptability, componentization and data driven, etc. on the basis of Cocos2d-x.
-Cross Platform
--------------
- * Popular browsers: Chrome 14+, Safari 5.0+, IE9+, Firefox 3.5+.
- * Mobile platforms: coming soon.
- * Native App: Same piece of code can run on "Cocos2d JS-Binding Engine" without or with little modification.
+Cocos Creator's in-editor scene view and web runtime share the same framework, which is the content of this repo. It's originally forked from [Cocos2d-html5](https://github.com/cocos2d/cocos2d-html5/), we build up an Entity Component architecture on it to meet the needs of Cocos Creator.
-Documentation
-------------------
- * Website: [www.cocos2d-x.org][3]
- * API References: [http://www.cocos2d-x.org/wiki/Reference] [4]
+This framework is a cross-platform game engine written in Javascript and licensed under MIT. It supports major desktop and mobile browsers, it's also compatible with Cocos2d Javascript Binding engine to support native platforms like iOS, Android, Win32, Mac OS X.
+The framework is naturally integrated with Cocos Creator, so it's not designed to be used independently.
-Installing from [bower][8] (version >=3.4)
+Links
------------------
-```shell
-$ bower install cocos2d-html5
-```
-
-Running the tests (version <3)
-------------------
-
-```shell
-$ git clone git://github.com/fireball-x/engine.git
-$ cd engine
-$ python -m SimpleHTTPServer
-```
-... and then open a browser and go to `http://localhost:8000/tests`
-
-
-Contact us
-------------------
- * Forum: [http://forum.cocos2d-x.org][5]
- * Twitter: [http://www.twitter.com/cocos2dhtml5][6]
- * Sina Microblog: [http://t.sina.com.cn/cocos2dhtml5][7]
-
-[1]: http://www.cocos2d-x.org "Cocos2d-html5"
-[2]: http://www.cocos2d-x.org "Cocos2d-X"
-[3]: http://www.cocos2d-x.org "www.cocos2d-x.org"
-[4]: http://www.cocos2d-x.org/wiki/Reference "API References"
-[5]: http://forum.cocos2d-x.org "http://forum.cocos2d-x.org"
-[6]: http://www.twitter.com/cocos2dhtml5 "http://www.twitter.com/cocos2dhtml5"
-[7]: http://t.sina.com.cn/cocos2dhtml5 "http://t.sina.com.cn/cocos2dhtml5"
-[8]: http://bower.io "http://bower.io"
\ No newline at end of file
+* [Official site](http://cocos2d-x.org/)
+* [Download](http://cocos2d-x.org/download)
+* [Documentation](http://cocos2d-x.org/docs/editors_and_tools/creator/index.html)
+* [API References](http://cocos2d-x.org/docs/api-ref/creator/v0.71/)
+* [Forum](http://discuss.cocos2d-x.org/c/editors-and-tools/cocos-creator)
+
\ No newline at end of file
diff --git a/bower.json b/bower.json
deleted file mode 100644
index e97d56bb83..0000000000
--- a/bower.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "name": "cocos2d-html5",
- "homepage": "http://www.cocos2d-x.org",
- "authors": [
- "AUTHORS.txt"
- ],
- "description": "Cocos2d-html5 is a cross-platform 2D game engine written in Javascript, based on Cocos2d-X and licensed under MIT. It incorporates the same high level api as “Cocos2d JS-binding engine” and compatible with Cocos2d-X. It currently supports canvas and WebGL renderering.",
- "main": "README.mdown",
- "keywords": [
- "cocos2d-x",
- "cocos2d",
- "game",
- "engine",
- "opengl",
- "cross",
- "multi",
- "platform",
- "iphone",
- "ipad",
- "android",
- "windows",
- "metro",
- "bada",
- "marmalade",
- "playbook"
- ],
- "license": "MIT",
- "private": false,
- "ignore": [
- "**/.*",
- "node_modules",
- "bower_components",
- "test",
- "tests"
- ]
-}
diff --git a/cocos2d/audio/CCAudio.js b/cocos2d/audio/CCAudio.js
index 85df6850c2..5b6de99c6c 100644
--- a/cocos2d/audio/CCAudio.js
+++ b/cocos2d/audio/CCAudio.js
@@ -334,11 +334,17 @@ JS.mixin(cc.Audio.prototype, {
(function(polyfill){
var SWA = polyfill.WEB_AUDIO,
- SWB = polyfill.MULTI_CHANNEL,
SWC = polyfill.AUTOPLAY;
/**
- * cc.audioEngine is the singleton object, it provide simple audio APIs.
+ * !#en cc.audioEngine is the singleton object, it provide simple audio APIs.
+ * !#zn
+ * cc.audioengine是单例对象。
+ * 主要用来播放背景音乐和音效,背景音乐同一时间只能播放一个,而音效则可以同时播放多个。
+ * 注意:
+ * 在 Android 系统浏览器上,不同浏览器,不同版本的效果不尽相同。
+ * 比如说:大多数浏览器都需要用户物理交互才可以开始播放音效,有一些不支持 WebAudio,
+ * 有一些不支持多音轨播放。总之如果对音乐依赖比较强,请做尽可能多的测试。
* @class audioEngine
* @static
*/
@@ -349,17 +355,13 @@ JS.mixin(cc.Audio.prototype, {
features: polyfill,
/**
- * Indicates whether any background music can be played or not.
- * @method willPlayMusic
- * @returns {boolean} true if the background music is playing, otherwise false
- */
- willPlayMusic: function(){return false;},
-
- /**
- * Play music.
+ * !#en Play music.
+ * !#zh
+ * 播放指定音乐,并可以设置是否循环播放。
+ * 注意:音乐播放接口不支持多音轨,同一时间只能播放一个音乐。
* @method playMusic
- * @param {String} url The path of the music file without filename extension.
- * @param {Boolean} loop Whether the music loop or not.
+ * @param {String} url - The path of the music file without filename extension.
+ * @param {Boolean} loop - Whether the music loop or not.
* @example
* //example
* cc.audioEngine.playMusic(path, false);
@@ -391,9 +393,10 @@ JS.mixin(cc.Audio.prototype, {
},
/**
- * Stop playing music.
+ * !#en Stop playing music.
+ * !#zh 停止当前音乐。
* @method stopMusic
- * @param {Boolean} [releaseData] If release the music data or not.As default value is false.
+ * @param {Boolean} [releaseData] - If release the music data or not.As default value is false.
* @example
* //example
* cc.audioEngine.stopMusic();
@@ -408,7 +411,8 @@ JS.mixin(cc.Audio.prototype, {
},
/**
- * Pause playing music.
+ * !#en Pause playing music.
+ * !#zh 暂停正在播放音乐。
* @method pauseMusic
* @example
* //example
@@ -421,7 +425,8 @@ JS.mixin(cc.Audio.prototype, {
},
/**
- * Resume playing music.
+ * !#en Resume playing music.
+ * !#zh 恢复音乐播放。
* @method resumeMusic
* @example
* //example
@@ -434,7 +439,8 @@ JS.mixin(cc.Audio.prototype, {
},
/**
- * Rewind playing music.
+ * !#en Rewind playing music.
+ * !#zh 从头开始重新播放当前音乐。
* @method rewindMusic
* @example
* //example
@@ -449,7 +455,8 @@ JS.mixin(cc.Audio.prototype, {
},
/**
- * The volume of the music max value is 1.0,the min value is 0.0 .
+ * !#en The volume of the music max value is 1.0,the min value is 0.0 .
+ * !#zh 获取音量(0.0 ~ 1.0)。
* @method getMusicVolume
* @return {Number}
* @example
@@ -461,7 +468,8 @@ JS.mixin(cc.Audio.prototype, {
},
/**
- * Set the volume of music.
+ * !#en Set the volume of music.
+ * !#zh 设置音量(0.0 ~ 1.0)。
* @method setMusicVolume
* @param {Number} volume Volume must be in 0.0~1.0 .
* @example
@@ -482,7 +490,8 @@ JS.mixin(cc.Audio.prototype, {
},
/**
- * Whether the music is playing.
+ * !#en Whether the music is playing.
+ * !#zh 音乐是否正在播放。
* @method isMusicPlaying
* @return {Boolean} If is playing return true,or return false.
* @example
@@ -507,7 +516,10 @@ JS.mixin(cc.Audio.prototype, {
_maxAudioInstance: 5,
_effectVolume: 1,
/**
- * Play sound effect.
+ * !#en Play sound effect.
+ * !#zh
+ * 播放指定音效,并可以设置是否循环播放。
+ * 注意:在部分不支持多音轨的浏览器上,这个接口会失效,请使用 playMusic
* @method playEffect
* @param {String} url The path of the sound effect with filename extension.
* @param {Boolean} loop Whether to loop the effect playing, default value is false
@@ -518,7 +530,7 @@ JS.mixin(cc.Audio.prototype, {
*/
playEffect: function(url, loop){
//If the browser just support playing single audio
- if(!SWB){
+ if(!polyfill.MULTI_CHANNEL){
//Must be forced to shut down
//Because playing MULTI_CHANNEL audio will be stuck in chrome 28 (android)
return null;
@@ -564,7 +576,8 @@ JS.mixin(cc.Audio.prototype, {
},
/**
- * Set the volume of sound effects.
+ * !#en Set the volume of sound effects.
+ * !#zh 设置音效音量(0.0 ~ 1.0)。
* @method setEffectsVolume
* @param {Number} volume Volume must be in 0.0~1.0 .
* @example
@@ -589,7 +602,8 @@ JS.mixin(cc.Audio.prototype, {
},
/**
- * The volume of the effects max value is 1.0,the min value is 0.0 .
+ * !#en The volume of the effects max value is 1.0,the min value is 0.0 .
+ * !#zh 获取音效音量(0.0 ~ 1.0)。
* @method getEffectsVolume
* @return {Number}
* @example
@@ -601,7 +615,8 @@ JS.mixin(cc.Audio.prototype, {
},
/**
- * Pause playing sound effect.
+ * !#en Pause playing sound effect.
+ * !#zh 暂停指定的音效。
* @method pauseEffect
* @param {Number} audio - The return value of function playEffect.
* @example
@@ -615,7 +630,8 @@ JS.mixin(cc.Audio.prototype, {
},
/**
- * Pause all playing sound effect.
+ * !#en Pause all playing sound effect.
+ * !#zh 暂停现在正在播放的所有音效。
* @method pauseAllEffects
* @example
* //example
@@ -634,7 +650,8 @@ JS.mixin(cc.Audio.prototype, {
},
/**
- * Resume playing sound effect.
+ * !#en Resume playing sound effect.
+ * !#zh 恢复播放指定的音效。
* @method resumeEffect
* @param {Number} audioID - The return value of function playEffect.
* @audioID
@@ -647,7 +664,8 @@ JS.mixin(cc.Audio.prototype, {
},
/**
- * Resume all playing sound effect
+ * !#en Resume all playing sound effect.
+ * !#zh 恢复播放所有之前暂停的所有音效。
* @method resumeAllEffects
* @example
* //example
@@ -664,7 +682,8 @@ JS.mixin(cc.Audio.prototype, {
},
/**
- * Stop playing sound effect.
+ * !#en Stop playing sound effect.
+ * !#zh 停止播放指定音效。
* @method stopEffect
* @param {Number} audioID - The return value of function playEffect.
* @example
@@ -677,7 +696,8 @@ JS.mixin(cc.Audio.prototype, {
},
/**
- * Stop all playing sound effects.
+ * !#en Stop all playing sound effects.
+ * !#zh 停止正在播放的所有音效。
* @method stopAllEffects
* @example
* //example
@@ -694,7 +714,8 @@ JS.mixin(cc.Audio.prototype, {
},
/**
- * Unload the preloaded effect from internal buffer
+ * !#en Unload the preloaded effect from internal buffer.
+ * !#zh 卸载预加载的音效。
* @method unloadEffect
* @param {String} url
* @example
@@ -713,7 +734,8 @@ JS.mixin(cc.Audio.prototype, {
},
/**
- * End music and effects.
+ * !#en End music and effects.
+ * !#zh 停止所有音乐和音效的播放。
* @method end
*/
end: function(){
diff --git a/cocos2d/core/CCDirector.js b/cocos2d/core/CCDirector.js
index 6d219df7ea..4953f603b8 100644
--- a/cocos2d/core/CCDirector.js
+++ b/cocos2d/core/CCDirector.js
@@ -680,7 +680,7 @@ cc.Director = Class.extend(/** @lends cc.Director# */{
scene = sceneAsset;
}
if (scene instanceof cc.Scene) {
- self.runScene(scene, onUnloaded, onLaunched);
+ self.runSceneImmediate(scene, onUnloaded, onLaunched);
}
else {
error = 'The asset ' + uuid + ' is not a scene';
diff --git a/cocos2d/core/CCNode.js b/cocos2d/core/CCNode.js
index 416e087a12..94dcb66443 100644
--- a/cocos2d/core/CCNode.js
+++ b/cocos2d/core/CCNode.js
@@ -312,10 +312,13 @@ function findChildComponents (children, constructor, components) {
}
/**
- * Class of all entities in Cocos Creator scenes.
+ * !#en
+ * Class of all entities in Cocos Creator scenes.
* Node also inherits from {{#crossLink "EventTarget"}}Event Target{{/crossLink}}, it permits Node to dispatch events.
* For events supported by Node, please refer to {{#crossLink "Node.EventType"}}{{/crossLink}}
- *
+ * !#zh
+ * Cocos Creator 场景中的所有节点类。节点也继承了 {{#crossLink "EventTarget"}}EventTarget{{/crossLink}},它允许节点发送事件。
+ * 支持的节点事件,请参阅 {{#crossLink "Node.EventType"}}{{/crossLink}}。
* @class Node
* @extends _BaseNode
*/
@@ -326,10 +329,19 @@ var Node = cc.Class({
properties: {
/**
- * The local active state of this node.
+ * !#en
+ * The local active state of this node.
+ * Note that a Node may be inactive because a parent is not active, even if this returns true.
+ * Use {{#crossLink "Node/activeInHierarchy:property"}}{{/crossLink}} if you want to check if the Node is actually treated as active in the scene.
+ * !#zh
+ * 当前节点的自身激活状态。
+ * 值得注意的是,一个节点的父节点如果不被激活,那么即使它自身设为激活,它仍然无法激活。
+ * 如果你想检查节点在场景中实际的激活状态可以使用 {{#crossLink "Node/activeInHierarchy:property"}}{{/crossLink}}。
* @property active
* @type {Boolean}
* @default true
+ * @example
+ * node.active = false;
*/
active: {
get: function () {
@@ -349,9 +361,12 @@ var Node = cc.Class({
},
/**
- * Indicates whether this node is active in the scene.
+ * !#en Indicates whether this node is active in the scene.
+ * !#zh 表示此节点是否在场景中激活。
* @property activeInHierarchy
* @type {Boolean}
+ * @example
+ * cc.log("activeInHierarchy: " + node.activeInHierarchy);
*/
activeInHierarchy: {
get: function () {
@@ -523,12 +538,20 @@ var Node = cc.Class({
// COMPONENT
/**
- * Returns the component of supplied type if the node has one attached, null if it doesn't.
+ * !#en
+ * Returns the component of supplied type if the node has one attached, null if it doesn't.
* You can also get component in the node by passing in the name of the script.
- *
+ * !#zh
+ * 获取节点上指定类型的组件,如果节点有附加指定类型的组件,则返回,如果没有则为空。
+ * 传入参数也可以是脚本的名称。
* @method getComponent
* @param {Function|String} typeOrClassName
* @returns {Component}
+ * @example
+ * // get sprite component.
+ * var sprite = node.getComponent(cc.Sprite);
+ * // get custom test calss.
+ * var test = node.getComponent("Test");
*/
getComponent: function (typeOrClassName) {
var constructor = getConstructor(typeOrClassName);
@@ -539,11 +562,14 @@ var Node = cc.Class({
},
/**
- * Returns all components of supplied Type in the node.
- *
+ * !#en Returns all components of supplied type in the node.
+ * !#zh 返回节点上指定类型的所有组件。
* @method getComponents
* @param {Function|String} typeOrClassName
* @returns {Component[]}
+ * @example
+ * var sprites = node.getComponents(cc.Sprite);
+ * var tests = node.getComponents("Test");
*/
getComponents: function (typeOrClassName) {
var constructor = getConstructor(typeOrClassName), components = [];
@@ -555,11 +581,14 @@ var Node = cc.Class({
},
/**
- * Returns the component of supplied type in any of its children using depth first search.
- *
+ * !#en Returns the component of supplied type in any of its children using depth first search.
+ * !#zh 递归查找所有子节点中第一个匹配指定类型的组件。
* @method getComponentInChildren
* @param {Function|String} typeOrClassName
* @returns {Component}
+ * @example
+ * var sprite = node.getComponentInChildren(cc.Sprite);
+ * var Test = node.getComponentInChildren("Test");
*/
getComponentInChildren: function (typeOrClassName) {
var constructor = getConstructor(typeOrClassName);
@@ -571,11 +600,14 @@ var Node = cc.Class({
},
/**
- * Returns the components of supplied type in any of its children using depth first search.
- *
+ * !#en Returns all components of supplied type in any of its children.
+ * !#zh 递归查找所有子节点中指定类型的组件。
* @method getComponentsInChildren
* @param {Function|String} typeOrClassName
* @returns {Component[]}
+ * @example
+ * var sprites = node.getComponentsInChildren(cc.Sprite);
+ * var tests = node.getComponentsInChildren("Test");
*/
getComponentsInChildren: function (typeOrClassName) {
var constructor = getConstructor(typeOrClassName), components = [];
@@ -603,11 +635,14 @@ var Node = cc.Class({
},
/**
- * Adds a component class to the node. You can also add component to node by passing in the name of the script.
- *
+ * !#en Adds a component class to the node. You can also add component to node by passing in the name of the script.
+ * !#zh 向节点添加一个指定类型的组件类,你还可以通过传入脚本的名称来添加组件。
* @method addComponent
* @param {Function|String} typeOrClassName - The constructor or the class name of the component to add
* @returns {Component} - The newly added component
+ * @example
+ * var sprite = node.addComponent(cc.Sprite);
+ * var test = node.addComponent("Test");
*/
addComponent: function (typeOrClassName) {
@@ -728,11 +763,19 @@ var Node = cc.Class({
},
/**
+ * !#en
* Removes a component identified by the given name or removes the component object given.
* You can also use component.destroy() if you already have the reference.
+ * !#zh
+ * 删除节点上的指定组件,传入参数可以是一个组件构造函数或组件名,也可以是已经获得的组件引用。
+ * 如果你已经获得组件引用,你也可以直接调用 component.destroy()
* @method removeComponent
* @param {String|Function|Component} component - The need remove component.
* @deprecated please destroy the component to remove it.
+ * @example
+ * node.removeComponent(cc.Sprite);
+ * var Test = require("Test");
+ * node.removeComponent(Test);
*/
removeComponent: function (component) {
if ( !component ) {
@@ -973,12 +1016,16 @@ var Node = cc.Class({
// EVENTS
/**
- * Register an callback of a specific event type on Node.
+ * !#en
+ * Register a callback of a specific event type on Node.
* Use this method to register touch or mouse event permit propagation based on scene graph,
- * you can propagate the event to the parents or swallow it by calling stopPropagation on the event.
+ * you can propagate the event to the parents or swallow it by calling stopPropagation on the event.
* It's the recommended way to register touch/mouse event for Node,
* please do not use cc.eventManager directly for Node.
- *
+ * !#zh
+ * 在节点上注册指定类型的回调函数,也可以设置 target 用于绑定响应函数的调用者。
+ * 同时您可以将事件派发到父节点或者通过调用 stopPropagation 拦截它。
+ * 推荐使用这种方式来监听节点上的触摸或鼠标事件,请不要在节点上直接使用 cc.eventManager。
* @method on
* @param {String} type - A string representing the event type to listen for.
* @param {Function} callback - The callback that will be invoked when the event is dispatched.
@@ -986,6 +1033,12 @@ var Node = cc.Class({
* @param {Event} callback.param event
* @param {Object} [target] - The target to invoke the callback, can be null
* @return {Function} - Just returns the incoming callback so you can save the anonymous function easier.
+ * @example
+ * // add Node Touch Event
+ * node.on(cc.Node.EventType.TOUCH_START, callback, this.node);
+ * node.on(cc.Node.EventType.TOUCH_MOVE, callback, this.node);
+ * node.on(cc.Node.EventType.TOUCH_END, callback, this.node);
+ * node.on(cc.Node.EventType.TOUCH_END, callback, this.node);
*/
on: function (type, callback, target) {
if (_touchEvents.indexOf(type) !== -1) {
@@ -1023,13 +1076,18 @@ var Node = cc.Class({
},
/**
+ * !#en
* Removes the callback previously registered with the same type, callback, target and or useCapture.
* This method is merely an alias to removeEventListener.
- *
+ * !#zh 删除之前与同类型,回调,目标或 useCapture 注册的回调。
* @method off
* @param {String} type - A string representing the event type being removed.
* @param {Function} callback - The callback to remove.
* @param {Object} [target] - The target to invoke the callback, if it's not given, only callback without target will be removed
+ * @example
+ * // remove Node TOUCH_START Event.
+ * node.on(cc.Node.EventType.TOUCH_START, callback, this.node);
+ * node.off(cc.Node.EventType.TOUCH_START, callback, this.node);
*/
off: function (type, callback, target) {
EventTarget.prototype.off.call(this, type, callback, target);
@@ -1043,10 +1101,12 @@ var Node = cc.Class({
},
/**
- * Removes all callbacks previously registered with the same target.
- *
+ * !#en Removes all callbacks previously registered with the same target.
+ * !#zh 移除目标上的所有注册事件。
* @method targetOff
* @param {Object} target - The target to be searched for all related callbacks
+ * @example
+ * node.targetOff(target);
*/
targetOff: function (target) {
EventTarget.prototype.targetOff.call(this, target);
@@ -1131,12 +1191,19 @@ var Node = cc.Class({
// ACTIONS
/**
+ * !#en
* Executes an action, and returns the action that is executed.
- * The node becomes the action's target. Refer to cc.Action's getTarget()
- * Calling runAction while the node is not active won't have any effect
+ * The node becomes the action's target. Refer to cc.Action's getTarget()
+ * Calling runAction while the node is not active won't have any effect.
+ * !#zh
+ * 执行并返回该执行的动作。该节点将会变成动作的目标。
+ * 调用 runAction 时,节点自身处于不激活状态将不会有任何效果。
* @method runAction
* @param {Action} action
* @return {Action} An Action pointer
+ * @example
+ * var action = cc.scaleTo(0.2, 1, 0.6);
+ * node.runAction(action);
*/
runAction: function (action) {
if (!this.active)
@@ -1152,26 +1219,36 @@ var Node = cc.Class({
},
/**
- * Stops and removes all actions from the running action list .
+ * !#en Stops and removes all actions from the running action list .
+ * !#zh 停止并且移除所有正在运行的动作列表。
* @method stopAllActions
+ * @example
+ * node.stopAllActions();
*/
stopAllActions: function () {
cc.director.getActionManager().removeAllActionsFromTarget(this);
},
/**
- * Stops and removes an action from the running action list.
+ * !#en Stops and removes an action from the running action list.
+ * !#zh 停止并移除指定的动作。
* @method stopAction
* @param {Action} action An action object to be removed.
+ * @example
+ * var action = cc.scaleTo(0.2, 1, 0.6);
+ * node.stopAction(action);
*/
stopAction: function (action) {
cc.director.getActionManager().removeAction(action);
},
/**
- * Removes an action from the running action list by its tag.
+ * !#en Removes an action from the running action list by its tag.
+ * !#zh 停止并且移除指定标签的动作。
* @method stopActionByTag
* @param {Number} tag A tag that indicates the action to be removed.
+ * @example
+ * node.stopAction(1);
*/
stopActionByTag: function (tag) {
if (tag === cc.Action.TAG_INVALID) {
@@ -1182,11 +1259,14 @@ var Node = cc.Class({
},
/**
- * Returns an action from the running action list by its tag.
+ * !#en Returns an action from the running action list by its tag.
+ * !#zh 通过标签获取指定动作。
* @method getActionByTag
* @see cc.Action#getTag and cc.Action#setTag
* @param {Number} tag
* @return {Action} The action object with the given tag.
+ * @example
+ * var action = node.getActionByTag(1);
*/
getActionByTag: function (tag) {
if (tag === cc.Action.TAG_INVALID) {
@@ -1196,12 +1276,23 @@ var Node = cc.Class({
cc.director.getActionManager().getActionByTag(tag, this);
},
- /**
Returns the numbers of actions that are running plus the ones that are schedule to run (actions in actionsToAdd and actions arrays).
+ /**
+ * !#en
+ * Returns the numbers of actions that are running plus the ones that are schedule to run (actions in actionsToAdd and actions arrays).
* Composable actions are counted as 1 action. Example:
* If you are running 1 Sequence of 7 actions, it will return 1.
* If you are running 7 Sequences of 2 actions, it will return 7.
+ * !#zh
+ * 获取运行着的动作加上正在调度运行的动作的总数。
+ * 例如:
+ * - 如果你正在运行 7 个动作中的 1 个 Sequence,它将返回 1。
+ * - 如果你正在运行 2 个动作中的 7 个 Sequence,它将返回 7。
+ *
* @method getNumberOfRunningActions
* @return {Number} The number of actions that are running plus the ones that are schedule to run
+ * @example
+ * var count = node.getNumberOfRunningActions();
+ * cc.log("Running Action Count: " + count);
*/
getNumberOfRunningActions: function () {
cc.director.getActionManager().numberOfRunningActionsInTarget(this);
@@ -1252,6 +1343,7 @@ if (cc.sys.isNative) {
}
/**
+ *
* @event position-changed
* @param {Event} event
* @param {Vec2} event.detail - old position
@@ -1301,8 +1393,11 @@ if (cc.sys.isNative) {
* @param {Event} event
*/
/**
+ * !#en
* Note: This event is only emitted from the top most node whose active value did changed,
* not including its child nodes.
+ * !#zh
+ * 注意:此节点激活时,此事件仅从最顶部的节点发出。
* @event active-in-hierarchy-changed
* @param {Event} event
*/
diff --git a/cocos2d/core/CCScheduler.js b/cocos2d/core/CCScheduler.js
index a268bba740..d4c4642c99 100644
--- a/cocos2d/core/CCScheduler.js
+++ b/cocos2d/core/CCScheduler.js
@@ -198,44 +198,6 @@ var TimerTargetSelector = Timer.extend({
});
-var TimerTargetCallback = Timer.extend({
-
- ctor: function(){
- this._target = null;
- this._callback = null;
- this._key = null;
- },
-
- initWithCallback: function(scheduler, callback, target, key, seconds, repeat, delay){
- this._scheduler = scheduler;
- this._target = target;
- this._callback = callback;
- this._key = key;
- this.setupTimerWithInterval(seconds, repeat, delay);
- return true;
- },
-
- getCallback: function(){
- return this._callback;
- },
-
- getKey: function(){
- return this._key;
- },
-
- trigger: function(){
- //override
- if(this._callback)
- this._callback.call(this._target, this._elapsed);
- },
-
- cancel: function(){
- //override
- this._scheduler.unschedule(this._callback, this._target);
- }
-
-});
-
var getTargetId = function (target) {
return target.__instanceId || target.uuid;
};
@@ -575,6 +537,14 @@ cc.Scheduler = cc._Class.extend(/** @lends cc.Scheduler# */{
element.timers.push(timer);
},
+ /**
+ * Schedules the update callback for a given target, the callback will be invoked every frame after schedule started
+ * @method scheduleUpdate
+ * @param {Object} target
+ * @param {Number} priority
+ * @param {Boolean} paused
+ * @param {Function} updateFunc
+ */
scheduleUpdate: function(target, priority, paused, updateFunc){
updateFunc = updateFunc || target.update;
this._schedulePerFrame(updateFunc, target, priority, paused);
@@ -591,8 +561,10 @@ cc.Scheduler = cc._Class.extend(/** @lends cc.Scheduler# */{
}
},
- /** Unschedules a callback for a callback and a given target.
+ /**
+ * Unschedules a callback for a callback and a given target.
* If you want to unschedule the "update", use `unscheudleUpdate()`
+ * @method unschedule
* @param {Function} callback The callback to be unscheduled
* @param {Object} target The target bound to the callback.
*/
@@ -635,6 +607,7 @@ cc.Scheduler = cc._Class.extend(/** @lends cc.Scheduler# */{
/**
* Unschedules the update callback for a given target
+ * @method unscheduleUpdate
* @param {Object} target The target to be unscheduled.
*/
unscheduleUpdate: function(target){
@@ -655,6 +628,7 @@ cc.Scheduler = cc._Class.extend(/** @lends cc.Scheduler# */{
/**
* Unschedules all scheduled callbacks for a given target.
* This also includes the "update" callback.
+ * @method unscheduleAllForTarget
* @param {Object} target The target to be unscheduled.
*/
unscheduleAllForTarget: function(target){
@@ -688,6 +662,7 @@ cc.Scheduler = cc._Class.extend(/** @lends cc.Scheduler# */{
/**
* Unschedules all scheduled callbacks from all targets including the system callbacks.
* You should NEVER call this method, unless you know what you are doing.
+ * @method unscheduleAll
*/
unscheduleAll: function(){
this.unscheduleAllWithMinPriority(cc.Scheduler.PRIORITY_SYSTEM);
@@ -696,6 +671,7 @@ cc.Scheduler = cc._Class.extend(/** @lends cc.Scheduler# */{
/**
* Unschedules all callbacks from all targets with a minimum priority.
* You should only call this with `PRIORITY_NON_SYSTEM_MIN` or higher.
+ * @method unscheduleAllWithMinPriority
* @param {Number} minPriority The minimum priority of selector to be unscheduled. Which means, all selectors which
* priority is higher than minPriority will be unscheduled.
*/
@@ -742,7 +718,9 @@ cc.Scheduler = cc._Class.extend(/** @lends cc.Scheduler# */{
}
},
- /** Checks whether a callback for a given target is scheduled.
+ /**
+ * Checks whether a callback for a given target is scheduled.
+ * @method isScheduled
* @param {Function|String} key The callback to check.
* @param {Object} target The target of the callback.
* @return {Boolean} True if the specified callback is invoked, false if not.
diff --git a/cocos2d/core/assets/CCAsset.js b/cocos2d/core/assets/CCAsset.js
index bf839fe45c..6ba78c6f93 100644
--- a/cocos2d/core/assets/CCAsset.js
+++ b/cocos2d/core/assets/CCAsset.js
@@ -25,12 +25,20 @@
var RawAsset = require('./CCRawAsset');
/**
+ * !#en
* Base class for handling assets used in Fireball. This class can be instantiate.
*
- * You may want to override:
- * - createNode
- * - cc.Object._serialize
- * - cc.Object._deserialize
+ * You may want to override:
+ * - createNode
+ * - cc.Object._serialize
+ * - cc.Object._deserialize
+ * !#zh
+ * 资源基类,该类可以被实例化。
+ *
+ * 您可能需要重写:
+ * - createNode
+ * - cc.Object._serialize
+ * - cc.Object._deserialize
*
* @class Asset
* @extends RawAsset
@@ -41,9 +49,10 @@ cc.Asset = cc.Class({
properties: {
/**
+ * !#en
* Returns the url of this asset's first raw file, if none of rawFile exists,
* it will returns an empty string.
- *
+ * !#zh 返回该资源的原始文件的 URL,如果不支持 RAW 文件,它将返回一个空字符串。
* @property rawUrl
* @type {String}
* @readOnly
@@ -64,9 +73,10 @@ cc.Asset = cc.Class({
},
/**
+ * !#en
* Returns the url of this asset's raw files, if none of rawFile exists,
* it will returns an empty array.
- *
+ * !#zh 返回该资源的原文件的 URL 数组,如果不支持 RAW 文件,它将返回一个空数组。
* @property rawUrls
* @type {String[]}
* @readOnly
@@ -129,9 +139,12 @@ cc.Asset = cc.Class({
},
/**
- * Create a new node using this asset in the scene.
+ * !#en
+ * Create a new node using this asset in the scene.
* If this type of asset dont have its corresponding node type, this method should be null.
- *
+ * !#zh
+ * 使用该资产在场景中创建一个新节点。
+ * 如果这类资产没有相应的节点类型,该方法应该是空的。
* @method createNode
* @param {Function} callback
* @param {String} callback.error - null or the error info
diff --git a/cocos2d/core/assets/CCAudioClip.js b/cocos2d/core/assets/CCAudioClip.js
index 440c885b32..a08f47f86c 100644
--- a/cocos2d/core/assets/CCAudioClip.js
+++ b/cocos2d/core/assets/CCAudioClip.js
@@ -24,7 +24,8 @@
****************************************************************************/
/**
- * Class for audio data handling.
+ * !#en Class for audio data handling.
+ * !#zh 音频资源类。
* @class AudioClip
* @extends RawAsset
* @constructor
diff --git a/cocos2d/core/assets/CCBitmapFont.js b/cocos2d/core/assets/CCBitmapFont.js
index febdc4039b..f85af284ba 100644
--- a/cocos2d/core/assets/CCBitmapFont.js
+++ b/cocos2d/core/assets/CCBitmapFont.js
@@ -27,7 +27,8 @@
* @module cc
*/
/**
- * Class for BitmapFont handling.
+ * !#en Class for BitmapFont handling.
+ * !#zh 位图字体资源类。
* @class BitmapFont
* @extends RawAsset
* @constructor
diff --git a/cocos2d/core/assets/CCFont.js b/cocos2d/core/assets/CCFont.js
index d70144c620..1eb3c29477 100644
--- a/cocos2d/core/assets/CCFont.js
+++ b/cocos2d/core/assets/CCFont.js
@@ -27,7 +27,8 @@
* @module cc
*/
/**
- * Class for Font handling.
+ * !#en Class for Font handling.
+ * !#zh 字体资源类。
* @class Font
* @extends RawAsset
* @constructor
diff --git a/cocos2d/core/assets/CCPrefab.js b/cocos2d/core/assets/CCPrefab.js
index b2775296ed..0b28d47fd7 100644
--- a/cocos2d/core/assets/CCPrefab.js
+++ b/cocos2d/core/assets/CCPrefab.js
@@ -33,7 +33,8 @@ function visitWrapper (wrapper, visitor) {
}
/**
- * Class for prefab handling.
+ * !#en Class for prefab handling.
+ * !#zh 预制资源类。
* @class Prefab
* @extends Asset
* @constructor
diff --git a/cocos2d/core/assets/CCRawAsset.js b/cocos2d/core/assets/CCRawAsset.js
index 0727b93d78..390108cb50 100644
--- a/cocos2d/core/assets/CCRawAsset.js
+++ b/cocos2d/core/assets/CCRawAsset.js
@@ -25,10 +25,15 @@
var CCObject = require('../platform/CCObject');
/**
+ * !#en
* The base class for registering asset types.
*
* You may want to override:
* - createNode (static)
+ * !#zh
+ * 注册用的资源基类。
+ * 你可能要重写:
+ * - createNode (static)
*
* @class RawAsset
* @extends CCObject
@@ -52,9 +57,12 @@ cc.RawAsset = cc.Class({
statics: {
/**
- * Create a new node in the scene.
+ * !#en
+ * Create a new node in the scene.
* If this type of asset dont have its corresponding node type, this method should be null.
- *
+ * !#zh
+ * 在场景中创建一个新节点。
+ * 如果这类资源没有相应的节点类型,该方法应该是空的。
* @method createNodeByInfo
* @param {Object} Info
* @param {Function} callback
diff --git a/cocos2d/core/assets/CCSceneAsset.js b/cocos2d/core/assets/CCSceneAsset.js
index 95d2fb6088..1988b172d9 100644
--- a/cocos2d/core/assets/CCSceneAsset.js
+++ b/cocos2d/core/assets/CCSceneAsset.js
@@ -24,7 +24,8 @@
****************************************************************************/
/**
- * Class for scene handling.
+ * !#en Class for scene handling.
+ * !#zh 场景资源类。
* @class Scene
* @extends Asset
* @constructor
diff --git a/cocos2d/core/assets/CCScripts.js b/cocos2d/core/assets/CCScripts.js
index 46a9ac433f..3f9568ffdf 100644
--- a/cocos2d/core/assets/CCScripts.js
+++ b/cocos2d/core/assets/CCScripts.js
@@ -24,7 +24,8 @@
****************************************************************************/
/**
- * Class for script handling.
+ * !#en Class for script handling.
+ * !#zh Script 资源类。
* @class _Script
* @extends Asset
* @constructor
@@ -38,7 +39,8 @@ var Script = cc.Class({
cc._Script = Script;
/**
- * Class for JavaScript handling.
+ * !#en Class for JavaScript handling.
+ * !#zh JavaScript 资源类。
* @class _JavaScript
* @extends Asset
* @private
@@ -52,7 +54,8 @@ var JavaScript = cc.Class({
cc._JavaScript = JavaScript;
/**
- * Class for coffee script handling.
+ * !#en Class for coffee script handling.
+ * !#zh CoffeeScript 资源类。
* @class CoffeeScript
* @extends Asset
* @constructor
diff --git a/cocos2d/core/assets/CCSpriteAtlas.js b/cocos2d/core/assets/CCSpriteAtlas.js
index 4d5d85bb4e..8c1041876f 100644
--- a/cocos2d/core/assets/CCSpriteAtlas.js
+++ b/cocos2d/core/assets/CCSpriteAtlas.js
@@ -24,7 +24,8 @@
****************************************************************************/
/**
- * Class for sprite atlas handling.
+ * !#en Class for sprite atlas handling.
+ * !#zh 精灵图集资源类。
* @class SpriteAtlas
* @extends RawAsset
* @constructor
@@ -32,6 +33,37 @@
var SpriteAtlas = cc.Class({
name: 'cc.SpriteAtlas',
extends: cc.Asset,
+ properties: {
+ _spriteFrames: {
+ default: {}
+ },
+ },
+
+ /**
+ * Returns the texture of the sprite atlas
+ * @method getTexture
+ * @returns {cc.Texture2D}
+ */
+ getTexture: function () {
+ var keys = Object.keys(this._spriteFrames);
+ if (keys.length > 0) {
+ var spriteFrame = this._spriteFrames[keys[0]];
+ return spriteFrame ? spriteFrame.getTexture() : null;
+ }
+ else {
+ return null;
+ }
+ },
+
+ /**
+ * Returns the sprite frame correspond to the given key in sprite atlas.
+ * @method getSpriteFrame
+ * @param {String} key
+ * @returns {cc.SpriteFrame}
+ */
+ getSpriteFrame: function (key) {
+ return this._spriteFrames[key];
+ }
});
cc.SpriteAtlas = SpriteAtlas;
diff --git a/cocos2d/core/assets/CCTTFFont.js b/cocos2d/core/assets/CCTTFFont.js
index 5980feb5ce..d0535609aa 100644
--- a/cocos2d/core/assets/CCTTFFont.js
+++ b/cocos2d/core/assets/CCTTFFont.js
@@ -27,7 +27,8 @@
* @module cc
*/
/**
- * Class for TTFFont handling.
+ * !#en Class for TTFFont handling.
+ * !#zh TTF 字体资源类。
* @class TTFFont
* @extends Asset
* @constructor
diff --git a/cocos2d/core/assets/CCTextAsset.js b/cocos2d/core/assets/CCTextAsset.js
index 409ee40296..7a5c69a48c 100644
--- a/cocos2d/core/assets/CCTextAsset.js
+++ b/cocos2d/core/assets/CCTextAsset.js
@@ -24,7 +24,8 @@
****************************************************************************/
/**
- * Class for text file.
+ * !#en Class for text file.
+ * !#zh 文本资源类。
* @class TextAsset
* @extends Asset
* @constructor
diff --git a/cocos2d/core/base-nodes/CCSGNodeCanvasRenderCmd.js b/cocos2d/core/base-nodes/CCSGNodeCanvasRenderCmd.js
index 0193f3c083..b7facce48e 100644
--- a/cocos2d/core/base-nodes/CCSGNodeCanvasRenderCmd.js
+++ b/cocos2d/core/base-nodes/CCSGNodeCanvasRenderCmd.js
@@ -375,7 +375,7 @@ _ccsg.Node.RenderCmd.prototype = {
if (transformDirty)
//update the transform
- this.transform(parentCmd);
+ this.transform(parentCmd, true);
},
visitChildren: function(){
diff --git a/cocos2d/core/components/CCAudioSource.js b/cocos2d/core/components/CCAudioSource.js
index 02a54e893a..a16ee78ca5 100644
--- a/cocos2d/core/components/CCAudioSource.js
+++ b/cocos2d/core/components/CCAudioSource.js
@@ -24,7 +24,8 @@
****************************************************************************/
/**
- * Audio Source.
+ * !#en Audio Source.
+ * !#zh 音频源组件,能对音频剪辑。
* @class AudioSource
* @extends Component
*/
@@ -54,7 +55,8 @@ var AudioSource = cc.Class({
_loop: false,
/**
- * Is the audio source playing (Read Only)
+ * !#en Is the audio source playing (Read Only).
+ * !#zh 该音频剪辑是否正播放(只读)。
* @property isPlaying
* @type {Boolean}
* @readOnly
@@ -68,7 +70,8 @@ var AudioSource = cc.Class({
},
/**
- * The clip of the audio source.
+ * !#en The clip of the audio source.
+ * !#zh 默认要播放的音频剪辑。
* @property clip
* @type {AudioClip}
* @default 1
@@ -86,7 +89,8 @@ var AudioSource = cc.Class({
},
/**
- * The volume of the audio source.
+ * !#en The volume of the audio source.
+ * !#zh 音频源的音量(0.0 ~ 1.0)。
* @property volume
* @type {Number}
* @default 1
@@ -110,7 +114,8 @@ var AudioSource = cc.Class({
},
/**
- * Is the audio source mute?
+ * !#en Is the audio source mute?
+ * !#zh 是否静音音频源。Mute 是设置音量为 0,取消静音是恢复原来的音量。
* @property mute
* @type {Boolean}
* @default false
@@ -145,7 +150,8 @@ var AudioSource = cc.Class({
},
/**
- * Is the audio source looping?
+ * !#en Is the audio source looping?
+ * !#zh 音频源是否循环播放?
* @property loop
* @type {Boolean}
* @default false
@@ -163,7 +169,8 @@ var AudioSource = cc.Class({
},
/**
- * If set to true, the audio source will automatically start playing on onLoad.
+ * !#en If set to true, the audio source will automatically start playing on onLoad.
+ * !#zh 如果设置为true,音频源将在 onLoad 时自动播放。
* @property playOnLoad
* @type {Boolean}
* @default true
@@ -196,7 +203,8 @@ var AudioSource = cc.Class({
},
/**
- * Plays the clip.
+ * !#en Plays the clip.
+ * !#zh 播放音频剪辑。
* @method play
*/
play: function () {
@@ -207,7 +215,8 @@ var AudioSource = cc.Class({
},
/**
- * Stops the clip
+ * !#en Stops the clip.
+ * !#zh 停止当前音频剪辑。
* @method stop
*/
stop: function () {
@@ -215,7 +224,8 @@ var AudioSource = cc.Class({
},
/**
- * Pause the clip.
+ * !#en Pause the clip.
+ * !#zh 暂停当前音频剪辑。
* @method pause
*/
pause: function () {
@@ -223,7 +233,8 @@ var AudioSource = cc.Class({
},
/**
- * Resume the clip.
+ * !#en Resume the clip.
+ * !#zh 恢复播放。
* @method resume
*/
resume: function () {
@@ -231,7 +242,8 @@ var AudioSource = cc.Class({
},
/**
- * Rewind playing music.
+ * !#en Rewind playing music.
+ * !#zh 从头开始播放。
* @method rewind
*/
rewind: function(){
diff --git a/cocos2d/core/components/CCComponent.js b/cocos2d/core/components/CCComponent.js
index 19e33fc5ef..487b356a56 100644
--- a/cocos2d/core/components/CCComponent.js
+++ b/cocos2d/core/components/CCComponent.js
@@ -181,10 +181,15 @@ var _callLateUpdate = CC_EDITOR ? function (event) {
var idGenerater = new IdGenerater('Comp');
/**
- * Base class for everything attached to Node(Entity).
- *
+ * !#en
+ * Base class for everything attached to Node(Entity).
+ *
* NOTE: Not allowed to use construction parameters for Component's subclasses,
* because Component is created by the engine.
+ * !#zh
+ * 所有附加到节点的基类。
+ *
+ * 注意:不允许使用组件的子类构造参数,因为组件是由引擎创建的。
*
* @class Component
* @extends Object
@@ -211,9 +216,12 @@ var Component = cc.Class({
properties: {
/**
- * The node this component is attached to. A component is always attached to a node.
+ * !#en The node this component is attached to. A component is always attached to a node.
+ * !#zh 该组件被附加到的节点。组件总会附加到一个节点。
* @property node
* @type {Node}
+ * @example
+ * cc.log(comp.node);
*/
node: {
default: null,
@@ -243,10 +251,13 @@ var Component = cc.Class({
},
/**
- * The uuid for editor
+ * !#en The uuid for editor.
+ * !#zh 组件的 uuid,用于编辑器。
* @property uuid
* @type {String}
* @readOnly
+ * @example
+ * cc.log(comp.uuid);
*/
uuid: {
get: function () {
@@ -295,10 +306,14 @@ var Component = cc.Class({
_enabled: true,
/**
- * indicates whether this component is enabled or not.
+ * !#en indicates whether this component is enabled or not.
+ * !#zh 表示该组件自身是否启用。
* @property enabled
* @type {Boolean}
* @default true
+ * @example
+ * comp.enabled = true;
+ * cc.log(comp.enabled);
*/
enabled: {
get: function () {
@@ -316,10 +331,13 @@ var Component = cc.Class({
},
/**
- * indicates whether this component is enabled and its node is also active in the hierarchy.
+ * !#en indicates whether this component is enabled and its node is also active in the hierarchy.
+ * !#zh 表示该组件是否被启用并且所在的节点也处于激活状态。。
* @property enabledInHierarchy
* @type {Boolean}
* @readOnly
+ * @example
+ * cc.log(comp.enabledInHierarchy);
*/
enabledInHierarchy: {
get: function () {
@@ -329,9 +347,13 @@ var Component = cc.Class({
},
/**
+ * !#en TODO
+ * !#zh onLoad 是否被调用。
* @property _isOnLoadCalled
* @type {Boolean}
* @readOnly
+ * @example
+ * cc.log(_isOnLoadCalled);
*/
_isOnLoadCalled: {
get: function () {
@@ -358,43 +380,50 @@ var Component = cc.Class({
// We provide Pre methods, which are called right before something happens, and Post methods which are called right after something happens.
/**
- * Update is called every frame, if the Component is enabled.
+ * !#en Update is called every frame, if the Component is enabled.
+ * !#zh 如果该组件启用,则每帧调用 update。
* @method update
*/
update: null,
/**
- * LateUpdate is called every frame, if the Component is enabled.
+ * !#en LateUpdate is called every frame, if the Component is enabled.
+ * !#zh 如果该组件启用,则每帧调用 LateUpdate。
* @method lateUpdate
*/
lateUpdate: null,
/**
- * When attaching to an active node or its node first activated
+ * !#en When attaching to an active node or its node first activated.
+ * !#zh 当附加到一个激活的节点上或者其节点第一次激活时候调用。
* @method onLoad
*/
onLoad: null,
/**
- * Called before all scripts' update if the Component is enabled
+ * !#en Called before all scripts' update if the Component is enabled.
+ * !#zh 如果该组件启用,则在所有组件的 update 之前调用。
* @method start
*/
start: null,
/**
- * Called when this component becomes enabled and its node becomes active
+ * !#en Called when this component becomes enabled and its node is active.
+ * !#zh 当该组件被启用,并且它的节点也激活时。
* @method onEnable
*/
onEnable: null,
/**
- * Called when this component becomes disabled or its node becomes inactive
+ * !#en Called when this component becomes disabled or its node becomes inactive.
+ * !#zh 当该组件被禁用或节点变为无效时调用。
* @method onDisable
*/
onDisable: null,
/**
- * Called when this component will be destroyed.
+ * !#en Called when this component will be destroyed.
+ * !#zh 当该组件被销毁时调用
* @method onDestroy
*/
onDestroy: null,
@@ -411,57 +440,81 @@ var Component = cc.Class({
// PUBLIC
/**
- * Adds a component class to the node. You can also add component to node by passing in the name of the
- * script.
+ * !#en Adds a component class to the node. You can also add component to node by passing in the name of the script.
+ * !#zh 向节点添加一个组件类,你还可以通过传入脚本的名称来添加组件。
*
* @method addComponent
* @param {Function|String} typeOrTypename - the constructor or the class name of the component to add
* @return {Component} - the newly added component
+ * @example
+ * var sprite = node.addComponent(cc.Sprite);
+ * var test = node.addComponent("Test");
*/
addComponent: function (typeOrTypename) {
return this.node.addComponent(typeOrTypename);
},
/**
- * Returns the component of supplied type if the node has one attached, null if it doesn't. You can also get
- * component in the node by passing in the name of the script.
+ * !#en
+ * Returns the component of supplied type if the node has one attached, null if it doesn't.
+ * You can also get component in the node by passing in the name of the script.
+ * !#zh
+ * 获取节点上指定类型的组件,如果节点有附加指定类型的组件,则返回,如果没有则为空。
+ * 传入参数也可以是脚本的名称。
*
* @method getComponent
* @param {Function|String} typeOrClassName
* @return {Component}
+ * @example
+ * // get sprite component.
+ * var sprite = node.getComponent(cc.Sprite);
+ * // get custom test calss.
+ * var test = node.getComponent("Test");
*/
getComponent: function (typeOrClassName) {
return this.node.getComponent(typeOrClassName);
},
/**
- * Returns all components of supplied Type in the node.
+ * !#en Returns all components of supplied Type in the node.
+ * !#zh 返回节点上指定类型的所有组件。
*
* @method getComponents
* @param {Function|String} typeOrClassName
* @return {Component[]}
+ * @example
+ * var sprites = node.getComponents(cc.Sprite);
+ * var tests = node.getComponents("Test");
*/
getComponents: function (typeOrClassName) {
return this.node.getComponents(typeOrClassName);
},
/**
- * Returns the component of supplied type in any of its children using depth first search.
+ * !#en Returns the component of supplied type in any of its children using depth first search.
+ * !#zh 递归查找所有子节点中第一个匹配指定类型的组件。
*
* @method getComponentInChildren
* @param {Function|String} typeOrClassName
* @returns {Component}
+ * @example
+ * var sprite = node.getComponentInChildren(cc.Sprite);
+ * var Test = node.getComponentInChildren("Test");
*/
getComponentInChildren: function (typeOrClassName) {
return this.node.getComponentInChildren(typeOrClassName);
},
/**
- * Returns the components of supplied type in any of its children using depth first search.
+ * !#en Returns the components of supplied type in any of its children using depth first search.
+ * !#zh 递归查找所有子节点中指定类型的组件。
*
* @method getComponentsInChildren
* @param {Function|String} typeOrClassName
* @returns {Component[]}
+ * @example
+ * var sprites = node.getComponentsInChildren(cc.Sprite);
+ * var tests = node.getComponentsInChildren("Test");
*/
getComponentsInChildren: function (typeOrClassName) {
return this.node.getComponentsInChildren(typeOrClassName);
@@ -539,8 +592,12 @@ var Component = cc.Class({
// VIRTUAL
/**
+ * !#en
* If the component's bounding box is different from the node's, you can implement this method to supply
* a custom axis aligned bounding box (AABB), so the editor's scene view can perform hit test properly.
+ * !#zh
+ * 如果组件的包围盒与节点不同,您可以实现该方法以提供自定义的轴向对齐的包围盒(AABB),
+ * 以便编辑器的场景视图可以正确地执行点选测试。
*
* @method _getLocalBounds
* @param {Rect} out_rect - the Rect to receive the bounding box
@@ -548,27 +605,44 @@ var Component = cc.Class({
_getLocalBounds: null,
/**
+ * !#en
* onRestore is called after the user clicks the Reset item in the Inspector's context menu or performs
- * an undo operation on this component.
- *
- * If the component contains the "internal state", short for "temporary member variables which not included
- * in its CCClass properties", then you may need to implement this function.
- *
- * The editor will call the getset accessors of your component to record/restore the component's state
- * for undo/redo operation. However, in extreme cases, it may not works well. Then you should implement
- * this function to manually synchronize your component's "internal states" with its public properties.
- * Once you implement this function, all the getset accessors of your component will not be called when
- * the user performs an undo/redo operation. Which means that only the properties with default value
- * will be recorded or restored by editor.
- *
- * Similarly, the editor may failed to reset your component correctly in extreme cases. Then if you need
- * to support the reset menu, you should manually synchronize your component's "internal states" with its
- * properties in this function. Once you implement this function, all the getset accessors of your component
- * will not be called during reset operation. Which means that only the properties with default value
+ * an undo operation on this component.
+ *
+ * If the component contains the "internal state", short for "temporary member variables which not included
+ * in its CCClass properties", then you may need to implement this function.
+ *
+ * The editor will call the getset accessors of your component to record/restore the component's state
+ * for undo/redo operation. However, in extreme cases, it may not works well. Then you should implement
+ * this function to manually synchronize your component's "internal states" with its public properties.
+ * Once you implement this function, all the getset accessors of your component will not be called when
+ * the user performs an undo/redo operation. Which means that only the properties with default value
+ * will be recorded or restored by editor.
+ *
+ * Similarly, the editor may failed to reset your component correctly in extreme cases. Then if you need
+ * to support the reset menu, you should manually synchronize your component's "internal states" with its
+ * properties in this function. Once you implement this function, all the getset accessors of your component
+ * will not be called during reset operation. Which means that only the properties with default value
* will be reset by editor.
*
* This function is only called in editor mode.
- *
+ * !#zh
+ * onRestore 是用户在检查器菜单点击 Reset 时,对此组件执行撤消操作后调用的。
+ *
+ * 如果组件包含了“内部状态”(不在 CCClass 属性中定义的临时成员变量),那么你可能需要实现该方法。
+ *
+ * 编辑器执行撤销/重做操作时,将调用组件的 get set 来录制和还原组件的状态。
+ * 然而,在极端的情况下,它可能无法良好运作。
+ * 那么你就应该实现这个方法,手动根据组件的属性同步“内部状态”。
+ * 一旦你实现这个方法,当用户撤销或重做时,组件的所有 get set 都不会再被调用。
+ * 这意味着仅仅指定了默认值的属性将被编辑器记录和还原。
+ *
+ * 同样的,编辑可能无法在极端情况下正确地重置您的组件。
+ * 于是如果你需要支持组件重置菜单,你需要在该方法中手工同步组件属性到“内部状态”。
+ * 一旦你实现这个方法,组件的所有 get set 都不会在重置操作时被调用。
+ * 这意味着仅仅指定了默认值的属性将被编辑器重置。
+ *
+ * 此方法仅在编辑器下会被调用。
* @method onRestore
*/
onRestore: null,
@@ -685,13 +759,20 @@ var Component = cc.Class({
},
/**
- * Schedules a custom selector.
- * If the selector is already scheduled, then the interval parameter will be updated without scheduling it again.
+ * !#en
+ * Schedules a custom selector.
+ * If the selector is already scheduled, then the interval parameter will be updated without scheduling it again.
+ * !#zh
+ * 调度一个自定义的回调函数。
+ * 如果回调函数已调度,那么将不会重复调度它,只会更新时间间隔参数。
* @method schedule
* @param {function} callback The callback function
* @param {Number} [interval=0] Tick interval in seconds. 0 means tick every frame. If interval = 0, it's recommended to use scheduleUpdate() instead.
* @param {Number} [repeat=cc.macro.REPEAT_FOREVER] The selector will be executed (repeat + 1) times, you can use kCCRepeatForever for tick infinitely.
* @param {Number} [delay=0] The amount of time that the first tick will wait before execution.
+ * @example
+ * var squashAction = cc.scaleTo(0.2, 1, 0.6);
+ * this.seq = cc.sequence(squashAction);
*/
schedule: function (callback, interval, repeat, delay) {
cc.assert(callback, cc._LogInfos.Node.schedule);
@@ -705,21 +786,28 @@ var Component = cc.Class({
},
/**
- * Schedules a callback function that runs only once, with a delay of 0 or larger
+ * !#en Schedules a callback function that runs only once, with a delay of 0 or larger.
+ * !#zh 调度一个只运行一次的回调函数,可以指定 0 让回调函数在下一帧立即执行或者在一定的延时之后执行。
* @method scheduleOnce
* @see cc.Node#schedule
* @param {function} callback A function wrapped as a selector
* @param {Number} [delay=0] The amount of time that the first tick will wait before execution.
+ * @example
+ * var squashAction = cc.scaleTo(0.2, 1, 0.6);
+ * this.seq = cc.scheduleOnce(squashAction);
*/
scheduleOnce: function (callback, delay) {
this.schedule(callback, 0, 0, delay);
},
/**
- * Unschedules a custom callback function.
+ * !#en Unschedules a custom callback function.
+ * !#zh 取消调度一个自定义的回调函数。
* @method unschedule
* @see cc.Node#schedule
* @param {function} callback_fn A function wrapped as a selector
+ * @example
+ * this.unschedule(_callback);
*/
unschedule: function (callback_fn) {
if (!callback_fn)
@@ -729,9 +817,13 @@ var Component = cc.Class({
},
/**
- * unschedule all scheduled callback functions: custom callback functions, and the 'update' callback function.
- * Actions are not affected by this method.
+ * !#en
+ * unschedule all scheduled callback functions: custom callback functions, and the 'update' callback function.
+ * Actions are not affected by this method.
+ * !#zh 取消调度所有已调度的回调函数:定制的回调函数以及 'update' 回调函数。动作不受此方法影响。
* @method unscheduleAllCallbacks
+ * @example
+ * this.unscheduleAllCallbacks();
*/
unscheduleAllCallbacks: function () {
cc.director.getScheduler().unscheduleAllForTarget(this);
diff --git a/cocos2d/core/components/CCEditBox.js b/cocos2d/core/components/CCEditBox.js
index 589066374f..ed38bbe3f2 100644
--- a/cocos2d/core/components/CCEditBox.js
+++ b/cocos2d/core/components/CCEditBox.js
@@ -420,7 +420,10 @@ var EditBox = cc.Class({
this._createBackgroundSprite();
- if (!this._useOriginalSize) {
+ if(this._useOriginalSize && CC_EDITOR){
+ this.node.setContentSize(sgNode.getContentSize());
+ this._useOriginalSize = false;
+ } else {
sgNode.setContentSize(this.node.getContentSize());
}
@@ -441,16 +444,6 @@ var EditBox = cc.Class({
sgNode.setDelegate(this);
},
- _resized: function () {
- this._useOriginalSize = false;
- },
-
- onLoad: function () {
- this._super();
-
- this.node.on('size-changed', this._resized, this);
- },
-
editBoxEditingDidBegan: function() {
cc.Component.EventHandler.emitEvents(this.editingDidBegan);
},
diff --git a/cocos2d/core/components/CCLabel.js b/cocos2d/core/components/CCLabel.js
index 2bf9e84523..346e395b01 100644
--- a/cocos2d/core/components/CCLabel.js
+++ b/cocos2d/core/components/CCLabel.js
@@ -293,8 +293,6 @@ var Label = cc.Class({
onLoad: function () {
this._super();
- this.node.on('size-changed', this._resized, this);
-
var sgSizeInitialized = this._sgNode._isUseSystemFont;
if (sgSizeInitialized) {
this._updateNodeSize();
@@ -310,11 +308,6 @@ var Label = cc.Class({
}
},
- onDestroy: function () {
- this._super();
- this.node.off('size-changed', this._resized, this);
- },
-
_createSgNode: function () {
return null;
},
@@ -335,18 +328,15 @@ var Label = cc.Class({
sgNode.setLineHeight(this._lineHeight);
sgNode.setString(this.string);
sgNode.setFontFileOrFamily(this.file);
- if(!this._useOriginalSize){
- if(this.overflow !== Overflow.NONE) {
- sgNode.setContentSize(this.node.getContentSize());
- }
+ if(this._useOriginalSize && CC_EDITOR){
+ this.node.setContentSize(sgNode.getContentSize());
+ this._useOriginalSize = false;
+ } else {
+ sgNode.setContentSize(this.node.getContentSize());
}
sgNode.setColor(this.node.color);
},
- _resized: function () {
- this._useOriginalSize = false;
- },
-
// update node size (this will also invoke the size-changed event)
_updateNodeSize: function () {
var initialized = this._sgNode && this._sgNode.parent;
diff --git a/cocos2d/core/components/CCProgressBar.js b/cocos2d/core/components/CCProgressBar.js
index 7d3d5b5022..0332b214ed 100644
--- a/cocos2d/core/components/CCProgressBar.js
+++ b/cocos2d/core/components/CCProgressBar.js
@@ -259,6 +259,9 @@ var ProgressBar = cc.Class({
default: false,
tooltip: 'i18n:COMPONENT.progress.reverse',
notify: function() {
+ if (this.barSprite) {
+ this.barSprite.fillStart = 1 - this.barSprite.fillStart;
+ }
this._updateBarStatus();
},
animatable: false
diff --git a/cocos2d/core/components/CCSprite.js b/cocos2d/core/components/CCSprite.js
index 9d685c9c2b..de398eadd2 100644
--- a/cocos2d/core/components/CCSprite.js
+++ b/cocos2d/core/components/CCSprite.js
@@ -166,9 +166,6 @@ var Sprite = cc.Class({
var lastSprite = this._spriteFrame;
this._spriteFrame = value;
this._applySpriteFrame(lastSprite);
- // color cleared after reset texture, should re-apply color
- this._sgNode.setColor(this.node._color);
- this._sgNode.setOpacity(this.node._opacity);
},
type: cc.SpriteFrame,
},
diff --git a/cocos2d/core/editbox/CCSGEditBox.js b/cocos2d/core/editbox/CCSGEditBox.js
index 94c1acbbdb..8e640f9374 100644
--- a/cocos2d/core/editbox/CCSGEditBox.js
+++ b/cocos2d/core/editbox/CCSGEditBox.js
@@ -250,9 +250,8 @@ EditBoxImpl.prototype = {
},
_updateLabelPosition: function (editBoxSize) {
- var textLabelSize = this._textLabel.getContentSize();
- this._placeholderLabel.setLineHeight(editBoxSize.height);
this._textLabel.setContentSize(editBoxSize);
+ this._placeholderLabel.setLineHeight(editBoxSize.height);
var placeholderLabelSize = this._placeholderLabel.getContentSize();
if (this._editBox._editBoxInputMode === InputMode.ANY){
@@ -264,7 +263,7 @@ EditBoxImpl.prototype = {
}
else {
this._textLabel.enableWrapText(false);
- this._textLabel.setPosition(cc.p(0, (editBoxSize.height + textLabelSize.height) / 2));
+ this._textLabel.setPosition(cc.p(0, editBoxSize.height));
this._placeholderLabel.setPosition(cc.p(0, (editBoxSize.height + placeholderLabelSize.height) / 2));
this._placeholderLabel.setVerticalAlign(cc.VerticalTextAlignment.CENTER);
this._textLabel.setVerticalAlign(cc.VerticalTextAlignment.CENTER);
diff --git a/cocos2d/core/event/event-target.js b/cocos2d/core/event/event-target.js
index a55b208d8a..3e15ef5ba2 100644
--- a/cocos2d/core/event/event-target.js
+++ b/cocos2d/core/event/event-target.js
@@ -175,7 +175,7 @@ JS.mixin(EventTarget.prototype, {
* When false, callback will NOT be invoked when event's eventPhase attribute value is CAPTURING_PHASE.
* Either way, callback will be invoked when event's eventPhase attribute value is AT_TARGET.
* @return {Function} - Just returns the incoming callback so you can save the anonymous function easier.
- * @exmaple
+ * @example
* node.on(cc.Node.EventType.TOUCH_END, function (event) {
* cc.log("this is callback");
* }, node);
@@ -222,7 +222,7 @@ JS.mixin(EventTarget.prototype, {
* If not specified, useCapture defaults to false. If a callback was registered twice,
* one with capture and one without, each must be removed separately. Removal of a capturing callback
* does not affect a non-capturing version of the same listener, and vice versa.
- * @exmaple
+ * @example
* // register touchEnd eventListener
* var touchEnd = node.on(cc.Node.EventType.TOUCH_END, function (event) {
* cc.log("this is callback");
@@ -283,7 +283,7 @@ JS.mixin(EventTarget.prototype, {
* from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE.
* When false, callback will NOT be invoked when event's eventPhase attribute value is CAPTURING_PHASE.
* Either way, callback will be invoked when event's eventPhase attribute value is AT_TARGET.
- * @exmaple
+ * @example
* node.once(cc.Node.EventType.TOUCH_END, function (event) {
* cc.log("this is callback");
* }, node);
diff --git a/cocos2d/core/load-pipeline/audio-downloader.js b/cocos2d/core/load-pipeline/audio-downloader.js
index 00190f3560..b37d53eaac 100644
--- a/cocos2d/core/load-pipeline/audio-downloader.js
+++ b/cocos2d/core/load-pipeline/audio-downloader.js
@@ -126,8 +126,8 @@ function loadAudioFromExtList (url, typeList, audio, cb){
if(__audioSupport.USE_EMPTIED_EVENT)
element.addEventListener('emptied', emptied, false);
- element.src = url;
document.body.appendChild(element);
+ element.src = url;
element.volume = 0;
//some browsers cannot pause(qq 6.1)
//element.play();
diff --git a/cocos2d/core/platform/CCObject.js b/cocos2d/core/platform/CCObject.js
index dca5d045a3..fcb356c59f 100644
--- a/cocos2d/core/platform/CCObject.js
+++ b/cocos2d/core/platform/CCObject.js
@@ -65,13 +65,15 @@ CCObject.Flags = {
//ToDestroy: ToDestroy,
/**
- * The object will not be saved.
+ * !#en The object will not be saved.
+ * !#zh 该对象将不会被保存。
* @property {Number} DontSave
*/
DontSave: DontSave,
/**
- * The object will not be saved when building a player.
+ * !#en The object will not be saved when building a player.
+ * !#zh 构建项目时,该对象将不会被保存。
* @property {Number} EditorOnly
*/
EditorOnly: EditorOnly,
@@ -79,7 +81,8 @@ CCObject.Flags = {
Dirty: Dirty,
/**
- * Dont destroy automatically when loading a new scene.
+ * !#en Dont destroy automatically when loading a new scene.
+ * !#zh 加载一个新场景时,不自动删除该对象
* @property DontDestroy
* @private
*/
@@ -92,8 +95,12 @@ CCObject.Flags = {
Destroying: Destroying,
/**
+ * !#en
* Hide in game and hierarchy.
- * This flag is readonly, it can only be used as an argument of scene.addEntity() or Entity.createWithFlags()
+ * This flag is readonly, it can only be used as an argument of scene.addEntity() or Entity.createWithFlags().
+ * !#zh
+ * 在游戏和层级中隐藏该对象。
+ * 该标记只读,它只能被用作 scene.addEntity()的一个参数。
* @property {Number} HideInGame
*/
HideInGame: HideInGame,
@@ -101,14 +108,19 @@ CCObject.Flags = {
// FLAGS FOR EDITOR
/**
- * This flag is readonly, it can only be used as an argument of scene.addEntity() or Entity.createWithFlags()
+ * !#en This flag is readonly, it can only be used as an argument of scene.addEntity() or Entity.createWithFlags().
+ * !#zh 该标记只读,它只能被用作 scene.addEntity()的一个参数。
* @property {Number} HideInEditor
*/
HideInEditor: HideInEditor,
/**
+ * !#en
* Hide in game view, hierarchy, and scene view... etc.
- * This flag is readonly, it can only be used as an argument of scene.addEntity() or Entity.createWithFlags()
+ * This flag is readonly, it can only be used as an argument of scene.addEntity() or Entity.createWithFlags().
+ * !#zh
+ * 在游戏视图,层级,场景视图等等...中隐藏该对象。
+ * 该标记只读,它只能被用作 scene.addEntity()的一个参数。
* @property {Number} Hide
*/
Hide: Hide,
@@ -184,9 +196,12 @@ if (CC_EDITOR) {
var prototype = CCObject.prototype;
/**
- * The name of the object.
+ * !#en The name of the object.
+ * !#zh 该对象的名称。
* @property {String} name
* @default ""
+ * @example
+ * obj.name = "New Obj";
*/
JS.getset(prototype, 'name',
function () {
@@ -198,10 +213,13 @@ JS.getset(prototype, 'name',
);
/**
- * Indicates whether the object is not yet destroyed
+ * !#en Indicates whether the object is not yet destroyed.
+ * !#zh 表示该对象是否可用(被销毁后将不可用)。
* @property {Boolean} isValid
* @default true
* @readOnly
+ * @example
+ * cc.log(obj.isValid);
*/
JS.get(prototype, 'isValid', function () {
return !(this._objFlags & Destroyed);
@@ -210,14 +228,20 @@ JS.get(prototype, 'isValid', function () {
var deferredDestroyTimer = null;
/**
- * Destroy this Object, and release all its own references to other objects.
- *
- * After destroy, this CCObject is not usable any more.
+ * !#en
+ * Destroy this Object, and release all its own references to other objects.
+ *
+ * After destroy, this CCObject is not usable any more.
* You can use cc.isValid(obj) (or obj.isValid if obj is non-nil) to check whether the object is destroyed before
* accessing it.
- *
+ * !#zh
+ * 销毁该对象,并释放所有它对其它对象的引用。
+ * 销毁后,CCObject 不再可用。
+ * 您可以在访问对象之前使用 cc.isValid(obj)(或 obj.isValid 如果 obj 不为 null)来检查对象是否已被销毁。
* @method destroy
* @return {Boolean} whether it is the first time the destroy being called
+ * @example
+ * obj.destroy();
*/
prototype.destroy = function () {
if (this._objFlags & Destroyed) {
@@ -239,10 +263,15 @@ prototype.destroy = function () {
if (CC_DEV) {
/**
+ * !#en
* In fact, Object's "destroy" will not trigger the destruct operation in Firebal Editor.
* The destruct operation will be executed by Undo system later.
- *
+ * !#zh
+ * 事实上,对象的 “destroy” 不会在编辑器中触发析构操作,
+ * 析构操作将在 Undo 系统中延后执行。
* @method realDestroyInEditor
+ * @example
+ * cc.log(obj.realDestroyInEditor());
*/
prototype.realDestroyInEditor = function () {
if (this._objFlags & Destroyed) {
@@ -342,10 +371,13 @@ prototype._deserialize = null;
*/
/**
- * Checks whether the object is non-nil and not yet destroyed
+ * !#en Checks whether the object is non-nil and not yet destroyed.
+ * !#zh 检查该对象是否不为 null 并且尚未销毁。
* @method isValid
* @param {any} value
* @return {Boolean} whether is valid
+ * @example
+ * cc.log(cc.isValid(target));
*/
cc.isValid = function (value) {
if (typeof value === 'object') {
diff --git a/cocos2d/core/platform/CCView.js b/cocos2d/core/platform/CCView.js
index f7dd3f1776..0527739f43 100644
--- a/cocos2d/core/platform/CCView.js
+++ b/cocos2d/core/platform/CCView.js
@@ -367,7 +367,7 @@ var View = cc._Class.extend({
* @param {Boolean} enabled - Enable or disable retina display
*/
enableRetina: function(enabled) {
- this._retinaEnabled = enabled ? true : false;
+ this._retinaEnabled = !!enabled;
},
/**
diff --git a/cocos2d/core/sprites/CCScale9Sprite.js b/cocos2d/core/sprites/CCScale9Sprite.js
index 20115ce9e1..d5e5383411 100644
--- a/cocos2d/core/sprites/CCScale9Sprite.js
+++ b/cocos2d/core/sprites/CCScale9Sprite.js
@@ -1303,6 +1303,5 @@ cc.Scale9Sprite.RenderingType = cc.Enum({
cc.Scale9Sprite.FillType = cc.Enum({
HORIZONTAL: 0,
VERTICAL: 1,
- //todo implement this
RADIAL:2,
});
diff --git a/cocos2d/core/utils/base-node.js b/cocos2d/core/utils/base-node.js
index 271a2c031f..20782b3499 100644
--- a/cocos2d/core/utils/base-node.js
+++ b/cocos2d/core/utils/base-node.js
@@ -99,9 +99,13 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
// API
/**
- * Name of node
+ * !#en Name of node.
+ * !#zh 该节点名称。
* @property name
* @type {String}
+ * @example
+ * node.name = "New Node";
+ * cc.log("Node Name: " + node.name);
*/
name: {
get: function () {
@@ -113,10 +117,13 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * The parent of the node.
+ * !#en The parent of the node.
+ * !#zh 该节点的父节点。
* @property parent
* @type {Node}
* @default null
+ * @example
+ * node.parent = newNode;
*/
parent: {
get: function () {
@@ -168,10 +175,13 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * The uuid for editor, will be stripped before building project
+ * !#en The uuid for editor, will be stripped before building project.
+ * !#zh 用于编辑器使用的 uuid,在构建项目之前将会被剔除。
* @property uuid
* @type {String}
* @readOnly
+ * @example
+ * cc.log("Node Uuid: " + node.uuid);
*/
uuid: {
get: function () {
@@ -184,9 +194,13 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * Skew x
+ * !#en Skew x
+ * !#zh 该节点 Y 轴倾斜角度。
* @property skewX
* @type {Number}
+ * @example
+ * node.skewX = 0;
+ * cc.log("Node SkewX: " + node.skewX);
*/
skewX: {
get: function () {
@@ -199,9 +213,13 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * Skew y
+ * !#en Skew y
+ * !#zh 该节点 X 轴倾斜角度。
* @property skewY
* @type {Number}
+ * @example
+ * node.skewY = 0;
+ * cc.log("Node SkewY: " + node.skewY);
*/
skewY: {
get: function () {
@@ -214,9 +232,13 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * Z order in depth which stands for the drawing order.
+ * !#en Z order in depth which stands for the drawing order.
+ * !#zh 该节点渲染排序的 Z 轴深度。
* @property zIndex
* @type {Number}
+ * @example
+ * node.zIndex = 1;
+ * cc.log("Node zIndex: " + node.zIndex);
*/
zIndex: {
get: function () {
@@ -229,9 +251,13 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * Rotation of node
+ * !#en Rotation of node.
+ * !#zh 该节点旋转角度。
* @property rotation
* @type {Number}
+ * @example
+ * node.rotation = 90;
+ * cc.log("Node Rotation: " + node.rotation);
*/
rotation: {
get: function () {
@@ -250,9 +276,13 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * Rotation on x axis
+ * !#en Rotation on x axis.
+ * !#zh 该节点 X 轴旋转角度。
* @property rotationX
* @type {Number}
+ * @example
+ * node.rotationX = 45;
+ * cc.log("Node Rotation X: " + node.rotationX);
*/
rotationX: {
get: function () {
@@ -269,9 +299,13 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * Rotation on y axis
+ * !#en Rotation on y axis.
+ * !#zh 该节点 Y 轴旋转角度。
* @property rotationY
* @type {Number}
+ * @example
+ * node.rotationY = 45;
+ * cc.log("Node Rotation Y: " + node.rotationY);
*/
rotationY: {
get: function () {
@@ -290,9 +324,13 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * Scale on x axis
+ * !#en Scale on x axis.
+ * !#zh 节点 X 轴缩放。
* @property scaleX
* @type {Number}
+ * @example
+ * node.scaleX = 0.5;
+ * cc.log("Node Scale X: " + node.scaleX);
*/
scaleX: {
get: function () {
@@ -309,9 +347,13 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * Scale on y axis
+ * !#en Scale on y axis.
+ * !#zh 节点 Y 轴缩放。
* @property scaleY
* @type {Number}
+ * @example
+ * node.scaleY = 0.5;
+ * cc.log("Node Scale Y: " + node.scaleY);
*/
scaleY: {
get: function () {
@@ -328,9 +370,13 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * x axis position of node.
+ * !#en x axis position of node.
+ * !#zh 节点 X 轴坐标。
* @property x
* @type {Number}
+ * @example
+ * node.x = 100;
+ * cc.log("Node Position X: " + node.x);
*/
x: {
get: function () {
@@ -357,9 +403,13 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * y axis position of node.
+ * !#en y axis position of node.
+ * !#zh 节点 Y 轴坐标。
* @property y
* @type {Number}
+ * @example
+ * node.y = 100;
+ * cc.log("Node Position Y: " + node.y);
*/
y: {
get: function () {
@@ -386,10 +436,16 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * All children nodes
+ * !#en All children nodes.
+ * !#zh 节点的所有子节点。
* @property children
* @type {Node[]}
* @readOnly
+ * @example
+ * var children = node.children;
+ * for (var i = 0; i < children.lenght; ++i) {
+ * cc.log("Node: " + children[i]);
+ * }
*/
children: {
get: function () {
@@ -398,10 +454,14 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * All children nodes.
+ * !#en All children nodes.
+ * !#zh 节点的子节点数量。
* @property childrenCount
* @type {Number}
* @readOnly
+ * @example
+ * var count = node.childrenCount;
+ * cc.log("Node Children Count: " + count);
*/
childrenCount: {
get: function () {
@@ -410,9 +470,12 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * Anchor point's position on x axis.
+ * !#en Anchor point's position on x axis.
+ * !#zh 节点 X 轴锚点位置。
* @property anchorX
* @type {Number}
+ * @example
+ * node.anchorX = 0;
*/
anchorX: {
get: function () {
@@ -429,9 +492,12 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * Anchor point's position on y axis.
+ * !#en Anchor point's position on y axis.
+ * !#zh 节点 Y 轴锚点位置。
* @property anchorY
* @type {Number}
+ * @example
+ * node.anchorY = 0;
*/
anchorY: {
get: function () {
@@ -448,9 +514,12 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * Width of node.
+ * !#en Width of node.
+ * !#zh 节点宽度。
* @property width
* @type {Number}
+ * @example
+ * node.width = 100;
*/
width: {
get: function () {
@@ -476,9 +545,12 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * Height of node.
+ * !#en Height of node.
+ * !#zh 节点高度。
* @property height
* @type {Number}
+ * @example
+ * node.height = 100;
*/
height: {
get: function () {
@@ -528,9 +600,12 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * Tag of node.
+ * !#en Tag of node.
+ * !#zh 节点标签。
* @property tag
* @type {Number}
+ * @example
+ * node.tag = 1001;
*/
tag: {
get: function () {
@@ -543,9 +618,12 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * Opacity of node, default value is 255.
+ * !#en Opacity of node, default value is 255.
+ * !#zh 节点透明度,默认值为 255。
* @property opacity
* @type {Number}
+ * @example
+ * node.opacity = 255;
*/
opacity: {
get: function () {
@@ -564,9 +642,12 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * Indicate whether node's opacity value affect its child nodes, default value is false.
+ * !#en Indicate whether node's opacity value affect its child nodes, default value is false.
+ * !#zh 节点的不透明度值是否影响其子节点,默认值为 false。
* @property cascadeOpacity
* @type {Boolean}
+ * @example
+ * cc.log("CascadeOpacity: " + node.cascadeOpacity);
*/
cascadeOpacity: {
get: function () {
@@ -582,9 +663,12 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * Color of node, default value is white: (255, 255, 255).
+ * !#en Color of node, default value is white: (255, 255, 255).
+ * !#zh 节点颜色。默认为白色,数值为:(255,255,255)。
* @property color
* @type {Color}
+ * @example
+ * node.color = new cc.Color(255, 255, 255);
*/
color: {
get: function () {
@@ -664,7 +748,7 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
_onOpacityModifyRGBChanged: null,
- /**
+ /*
* Initializes the instance of cc.Node
* @method init
* @returns {Boolean} Whether the initialization was successful.
@@ -675,13 +759,17 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * Properties configuration function
+ * !#en
+ * Properties configuration function
* All properties in attrs will be set to the node,
* when the setter of the node is available,
* the property will be set via setter function.
- *
+ * !#zh 属性配置函数。在 attrs 的所有属性将被设置为节点属性。
* @method attr
* @param {Object} attrs - Properties to be set to node
+ * @example
+ * var attrs = { key: 0, num: 100 };
+ * node.attr(attrs);
*/
attr: function (attrs) {
for (var key in attrs) {
@@ -690,20 +778,36 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * Defines the oder in which the nodes are renderer.
- * Nodes that have a Global Z Order lower, are renderer first.
- *
- * In case two or more nodes have the same Global Z Order, the oder is not guaranteed.
- * The only exception if the Nodes have a Global Z Order == 0. In that case, the Scene Graph order is used.
- *
- * By default, all nodes have a Global Z Order = 0. That means that by default, the Scene Graph order is used to render the nodes.
- *
- * Global Z Order is useful when you need to render nodes in an order different than the Scene Graph order.
- *
- * Limitations: Global Z Order can't be used used by Nodes that have SpriteBatchNode as one of their ancestors.
- * And if ClippingNode is one of the ancestors, then "global Z order" will be relative to the ClippingNode.
+ * !#en
+ * Defines the oder in which the nodes are renderer.
+ * Nodes that have a Global Z Order lower, are renderer first.
+ *
+ * In case two or more nodes have the same Global Z Order, the oder is not guaranteed.
+ * The only exception if the Nodes have a Global Z Order == 0. In that case, the Scene Graph order is used.
+ *
+ * By default, all nodes have a Global Z Order = 0. That means that by default, the Scene Graph order is used to render the nodes.
+ *
+ * Global Z Order is useful when you need to render nodes in an order different than the Scene Graph order.
+ *
+ * Limitations: Global Z Order can't be used used by Nodes that have SpriteBatchNode as one of their ancestors.
+ * And if ClippingNode is one of the ancestors, then "global Z order" will be relative to the ClippingNode.
+ * !#zh
+ * 定义节点的渲染顺序。
+ * 节点具有全局 Z 顺序,顺序越小的节点,最先渲染。
+ *
+ * 假设两个或者更多的节点拥有相同的全局 Z 顺序,那么渲染顺序无法保证。
+ * 唯一的例外是如果节点的全局 Z 顺序为零,那么场景中的顺序是可以使用默认的。
+ *
+ * 所有的节点全局 Z 顺序都是零。这就是说,默认使用场景中的顺序来渲染节点。
+ *
+ * 全局 Z 顺序是非常有用的当你需要渲染节点按照不同的顺序而不是场景顺序。
+ *
+ * 局限性: 全局 Z 顺序不能够被拥有继承 “SpriteBatchNode” 的节点使用。
+ * 并且如果 “ClippingNode” 是其中之一的上代,那么 “global Z order” 将会和 “ClippingNode” 有关。
* @method setGlobalZOrder
* @param {Number} globalZOrder
+ * @example
+ * node.setGlobalZOrder(0);
*/
setGlobalZOrder: function (globalZOrder) {
this._globalZOrder = globalZOrder;
@@ -711,9 +815,12 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * Return the Node's Global Z Order.
+ * !#en Return the Node's Global Z Order.
+ * !#zh 获取节点的全局 Z 顺序。
* @method getGlobalZOrder
* @returns {number} The node's global Z order
+ * @example
+ * cc.log("Global Z Order: " + node.getGlobalZOrder());
*/
getGlobalZOrder: function () {
this._globalZOrder = this._sgNode.getGlobalZOrder();
@@ -721,10 +828,14 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
+ * !#en
* Returns the scale factor of the node.
* Assertion will fail when _scaleX != _scaleY.
+ * !#zh 获取节点的缩放。当 X 轴和 Y 轴有相同的缩放数值时。
* @method getScale
* @return {Number} The scale factor
+ * @example
+ * cc.log("Node Scale: " + node.getScale());
*/
getScale: function () {
if (this._scaleX !== this._scaleY)
@@ -733,10 +844,14 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * Sets the scale factor of the node. 1.0 is the default scale factor. This function can modify the X and Y scale at the same time.
+ * !#en Sets the scale factor of the node. 1.0 is the default scale factor. This function can modify the X and Y scale at the same time.
+ * !#zh 设置节点的缩放比例,默认值为 1.0。这个函数可以在同一时间修改 X 和 Y 缩放。
* @method setScale
* @param {Number|Vec2} scale - scaleX or scale
* @param {Number} [scaleY=scale]
+ * @example
+ * node.setScale(cc.v2(1, 1));
+ * node.setScale(1, 1);
*/
setScale: function (scale, scaleY) {
if (scale instanceof cc.Vec2) {
@@ -756,25 +871,32 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * Returns a copy of the position (x,y) of the node in cocos2d coordinates. (0,0) is the left-bottom corner.
+ * !#en Returns a copy of the position (x,y) of the node in cocos2d coordinates. (0,0) is the left-bottom corner.
+ * !#zh 获取在父节点坐标系中节点的位置( x , y )。
* @method getPosition
* @return {Vec2} The position (x,y) of the node in OpenGL coordinates
+ * @example
+ * cc.log("Node Position: " + node.getPosition());
*/
getPosition: function () {
return cc.p(this._position);
},
/**
- *
- * Changes the position (x,y) of the node in cocos2d coordinates.
- * The original point (0,0) is at the left-bottom corner of screen.
- * Usually we use cc.p(x,y) to compose CCPoint object.
- * and Passing two numbers (x,y) is more efficient than passing CCPoint object.
- *
+ * !#en
+ * Changes the position (x,y) of the node in cocos2d coordinates.
+ * The original point (0,0) is at the left-bottom corner of screen.
+ * Usually we use cc.v2(x,y) to compose CCVec2 object.
+ * and Passing two numbers (x,y) is more efficient than passing CCPoint object.
+ * !#zh
+ * 设置节点在父坐标系中的位置。
+ * 可以通过 2 种方式设置坐标点:
+ * 1.传入 cc.v2(x, y) 类型为 cc.Vec2 的对象。
+ * 2.传入 2 个数值 x 和 y。
* @method setPosition
* @param {Vec2|Number} newPosOrxValue - The position (x,y) of the node in coordinates or the X coordinate for position
* @param {Number} [yValue] - Y coordinate for position
- * @example {@link utils/api/engine/docs/cocos2d/core/utils/node-wrapper/setPosition.js}
+ * @example {@link utils/api/engine/docs/cocos2d/core/utils/base-node/setPosition.js}
*/
setPosition: function (newPosOrxValue, yValue) {
var xValue;
@@ -815,32 +937,50 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * Returns a copy of the anchor point.
- * Anchor point is the point around which all transformations and positioning manipulations take place.
- * It's like a pin in the node where it is "attached" to its parent.
- * The anchorPoint is normalized, like a percentage. (0,0) means the bottom-left corner and (1,1) means the top-right corner.
- * But you can use values higher than (1,1) and lower than (0,0) too.
- * The default anchor point is (0.5,0.5), so it starts at the center of the node.
+ * !#en
+ * Returns a copy of the anchor point.
+ * Anchor point is the point around which all transformations and positioning manipulations take place.
+ * It's like a pin in the node where it is "attached" to its parent.
+ * The anchorPoint is normalized, like a percentage. (0,0) means the bottom-left corner and (1,1) means the top-right corner.
+ * But you can use values higher than (1,1) and lower than (0,0) too.
+ * The default anchor point is (0.5,0.5), so it starts at the center of the node.
+ * !#zh
+ * 获取节点锚点,用百分比表示。
+ * 锚点应用于所有变换和坐标点的操作,它就像在节点上连接其父节点的大头针。
+ * 锚点是标准化的,就像百分比一样。(0,0) 表示左下角,(1,1) 表示右上角。
+ * 但是你可以使用比(1,1)更高的值或者比(0,0)更低的值。
+ * 默认的锚点是(0.5,0.5),因此它开始于节点的中心位置。
+ * 注意:Creator 中的锚点仅用于定位所在的节点,子节点的定位不受影响。
* @method getAnchorPoint
* @return {Vec2} The anchor point of node.
+ * @example
+ * cc.log("Node AnchorPoint: " + node.getAnchorPoint());
*/
getAnchorPoint: function () {
return cc.p(this._anchorPoint);
},
/**
- *
- * Sets the anchor point in percent.
- *
- * anchor point is the point around which all transformations and positioning manipulations take place.
- * It's like a pin in the node where it is "attached" to its parent.
- * The anchorPoint is normalized, like a percentage. (0,0) means the bottom-left corner and (1,1) means the top-right corner.
- * But you can use values higher than (1,1) and lower than (0,0) too.
- * The default anchor point is (0.5,0.5), so it starts at the center of the node.
- *
+ * !#en
+ * Sets the anchor point in percent.
+ * anchor point is the point around which all transformations and positioning manipulations take place.
+ * It's like a pin in the node where it is "attached" to its parent.
+ * The anchorPoint is normalized, like a percentage. (0,0) means the bottom-left corner and (1,1) means the top-right corner.
+ * But you can use values higher than (1,1) and lower than (0,0) too.
+ * The default anchor point is (0.5,0.5), so it starts at the center of the node.
+ * !#zh
+ * 设置锚点的百分比。
+ * 锚点应用于所有变换和坐标点的操作,它就像在节点上连接其父节点的大头针。
+ * 锚点是标准化的,就像百分比一样。(0,0) 表示左下角,(1,1) 表示右上角。
+ * 但是你可以使用比(1,1)更高的值或者比(0,0)更低的值。
+ * 默认的锚点是(0.5,0.5),因此它开始于节点的中心位置。
+ * 注意:Creator 中的锚点仅用于定位所在的节点,子节点的定位不受影响。
* @method setAnchorPoint
* @param {Vec2|Number} point - The anchor point of node or The x axis anchor of node.
* @param {Number} [y] - The y axis anchor of node.
+ * @example
+ * node.setAnchorPoint(cc.v2(1, 1));
+ * node.setAnchorPoint(1, 1);
*/
setAnchorPoint: function (point, y) {
var locAnchorPoint = this._anchorPoint;
@@ -863,23 +1003,33 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
+ * !#en
* Returns a copy of the anchor point in absolute pixels.
- * you can only read it. If you wish to modify it, use setAnchorPoint
+ * you can only read it. If you wish to modify it, use setAnchorPoint.
+ * !#zh
+ * 返回锚点的绝对像素位置。
+ * 你只能读它。如果您要修改它,使用 setAnchorPoint。
* @see cc.Node#getAnchorPoint
* @method getAnchorPointInPoints
* @return {Vec2} The anchor point in absolute pixels.
+ * @example
+ * cc.log("AnchorPointInPoints: " + node.getAnchorPointInPoints());
*/
getAnchorPointInPoints: function () {
return this._sgNode.getAnchorPointInPoints();
},
/**
- * Returns a copy the untransformed size of the node.
+ * !#en
+ * Returns a copy the untransformed size of the node.
* The contentSize remains the same no matter the node is scaled or rotated.
- * All nodes has a size. Layer and Scene has the same size of the screen by default.
+ * All nodes has a size. Layer and Scene has the same size of the screen by default.
+ * !#zh 获取节点自身大小,不受该节点是否被缩放或者旋转的影响。
* @method getContentSize
* @param {Boolean} [ignoreSizeProvider=false] - true if you need to get the original size of the node
* @return {Size} The untransformed size of the node.
+ * @example
+ * cc.log("Content Size: " + node.getContentSize());
*/
getContentSize: function (ignoreSizeProvider) {
if (this._sizeProvider && !ignoreSizeProvider) {
@@ -893,15 +1043,17 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- *
- * Sets the untransformed size of the node.
- *
- * The contentSize remains the same no matter the node is scaled or rotated.
- * All nodes has a size. Layer and Scene has the same size of the screen.
- *
+ * !#en
+ * Sets the untransformed size of the node.
+ * The contentSize remains the same no matter the node is scaled or rotated.
+ * All nodes has a size. Layer and Scene has the same size of the screen.
+ * !#zh 设置节点原始大小,不受该节点是否被缩放或者旋转的影响。
* @method setContentSize
* @param {Size|Number} size - The untransformed size of the node or The untransformed size's width of the node.
* @param {Number} [height] - The untransformed size's height of the node.
+ * @example
+ * node.setContentSize(cc.size(100, 100));
+ * node.setContentSize(100, 100);
*/
setContentSize: function (size, height) {
var locContentSize = this._contentSize;
@@ -926,10 +1078,14 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
+ * !#en
* Returns a "local" axis aligned bounding box of the node.
* The returned box is relative only to its parent.
+ * !#zh 返回父节坐标系下的轴向对齐的包围盒。
* @method getBoundingBox
* @return {Rect} The calculated bounding box of the node
+ * @example
+ * var boundingBox = node.getBoundingBox();
*/
getBoundingBox: function () {
var size = this.getContentSize();
@@ -938,8 +1094,11 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * Stops all running actions and schedulers
+ * !#en Stops all running actions and schedulers.
+ * !#zh 停止所有正在播放的动作和计时器。
* @method cleanup
+ * @example
+ * node.cleanup();
*/
cleanup: function () {
// actions
@@ -959,10 +1118,13 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
// composition: GET
/**
- * Returns a child from the container given its tag
+ * !#en Returns a child from the container given its tag.
+ * !#zh 通过标签获取节点的子节点。
* @method getChildByTag
* @param {Number} aTag - An identifier to find the child node.
* @return {Node} a CCNode object whose tag equals to the input parameter
+ * @example
+ * var child = node.getChildByTag(1001);
*/
getChildByTag: function (aTag) {
var children = this._children;
@@ -977,10 +1139,13 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * Returns a child from the container given its uuid
+ * !#en Returns a child from the container given its uuid.
+ * !#zh 通过 uuid 获取节点的子节点。
* @method getChildByUuid
* @param {String} uuid - The uuid to find the child node.
* @return {Node} a Node whose uuid equals to the input parameter
+ * @example
+ * var child = node.getChildByUuid(uuid);
*/
getChildByUuid: function(uuid){
if(!uuid){
@@ -997,10 +1162,13 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * Returns a child from the container given its name
+ * !#en Returns a child from the container given its name.
+ * !#zh 通过名称获取节点的子节点。
* @method getChildByName
* @param {String} name - A name to find the child node.
* @return {Node} a CCNode object whose name equals to the input parameter
+ * @example
+ * var child = node.getChildByName("Test Node");
*/
getChildByName: function(name){
if(!name){
@@ -1018,13 +1186,17 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
// composition: ADD
- /** "add" logic MUST only be in this method
- *
- * If the child is added to a 'running' node, then 'onEnter' and 'onEnterTransitionDidFinish' will be called immediately.
+ /**
+ * !#en
+ * "add" logic MUST only be in this method
+ * !#zh
+ * 添加子节点,并且可以修改该节点的 局部 Z 顺序和标签。
* @method addChild
* @param {Node} child - A child node
- * @param {Number} [localZOrder=] - Z order for drawing priority. Please refer to setZOrder(int)
- * @param {Number|String} [tag=] - An integer or a name to identify the node easily. Please refer to setTag(int) and setName(string)
+ * @param {Number} [localZOrder] - Z order for drawing priority. Please refer to setZOrder(int)
+ * @param {Number|String} [tag] - An integer or a name to identify the node easily. Please refer to setTag(int) and setName(string)
+ * @example
+ * node.addChild(newNode, 1, 1001);
*/
addChild: function (child, localZOrder, tag) {
localZOrder = localZOrder === undefined ? child._localZOrder : localZOrder;
@@ -1062,12 +1234,20 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
// composition: REMOVE
/**
+ * !#en
* Remove itself from its parent node. If cleanup is true, then also remove all actions and callbacks.
* If the cleanup parameter is not passed, it will force a cleanup.
* If the node orphan, then nothing happens.
+ * !#zh
+ * 从父节点中删除一个节点。cleanup 参数为 true,那么在这个节点上所有的动作和回调都会被删除,反之则不会。
+ * 如果不传入 cleanup 参数,默认是 true 的。
+ * 如果这个节点是一个孤节点,那么什么都不会发生。
* @method removeFromParent
* @param {Boolean} [cleanup=true] - true if all actions and callbacks on this node should be removed, false otherwise.
* @see cc.Node#removeFromParentAndCleanup
+ * @example
+ * node.removeFromParent();
+ * node.removeFromParent(false);
*/
removeFromParent: function (cleanup) {
if (this._parent) {
@@ -1077,14 +1257,22 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
}
},
- /** Removes a child from the container. It will also cleanup all running actions depending on the cleanup parameter.
+ /**
+ * !#en
+ * Removes a child from the container. It will also cleanup all running actions depending on the cleanup parameter.
* If the cleanup parameter is not passed, it will force a cleanup.
- * "remove" logic MUST only be on this method
+ * "remove" logic MUST only be on this method
* If a class wants to extend the 'removeChild' behavior it only needs
- * to override this method
+ * to override this method.
+ * !#zh
+ * 移除节点中指定的子节点,是否需要清理所有正在运行的行为取决于 cleanup 参数。
+ * 如果 cleanup 参数不传入,默认为 true 表示清理。
* @method removeChild
* @param {Node} child - The child node which will be removed.
* @param {Boolean} [cleanup=true] - true if all running actions and callbacks on the child node will be cleanup, false otherwise.
+ * @example
+ * node.removeChild(newNode);
+ * node.removeChild(newNode, false);
*/
removeChild: function (child, cleanup) {
// explicit nil handling
@@ -1098,12 +1286,19 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
+ * !#en
* Removes a child from the container by tag value. It will also cleanup all running actions depending on the cleanup parameter.
* If the cleanup parameter is not passed, it will force a cleanup.
+ * !#zh
+ * 通过标签移除节点中指定的子节点,是否需要清理所有正在运行的行为取决于 cleanup 参数。
+ * 如果 cleanup 参数不传入,默认为 true 表示清理。
* @method removeChildByTag
* @param {Number} tag - An integer number that identifies a child node
* @param {Boolean} [cleanup=true] - true if all running actions and callbacks on the child node will be cleanup, false otherwise.
* @see cc.Node#removeChildByTag
+ * @example
+ * node.removeChildByTag(1001);
+ * node.removeChildByTag(1001, false);
*/
removeChildByTag: function (tag, cleanup) {
if (tag === cc.macro.NODE_TAG_INVALID)
@@ -1117,10 +1312,17 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
+ * !#en
* Removes all children from the container and do a cleanup all running actions depending on the cleanup parameter.
- * If the cleanup parameter is not passed, it will force a cleanup.
+ * If the cleanup parameter is not passed, it will force a cleanup.
+ * !#zh
+ * 移除节点所有的子节点,是否需要清理所有正在运行的行为取决于 cleanup 参数。
+ * 如果 cleanup 参数不传入,默认为 true 表示清理。
* @method removeAllChildren
* @param {Boolean} [cleanup=true] - true if all running actions on all children nodes should be cleanup, false otherwise.
+ * @example
+ * node.removeAllChildren();
+ * node.removeAllChildren(false);
*/
removeAllChildren: function (cleanup) {
// not using detachChild improves speed here
@@ -1166,11 +1368,16 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
+ * !#en
* Returns the matrix that transform parent's space coordinates to the node's (local) space coordinates.
- * The matrix is in Pixels.
- * The returned transform is readonly and cannot be changed.
+ * The matrix is in Pixels. The returned transform is readonly and cannot be changed.
+ * !#zh
+ * 返回将父节点的坐标系转换成节点(局部)的空间坐标系的矩阵。
+ * 该矩阵以像素为单位。返回的矩阵是只读的,不能更改。
* @method getParentToNodeTransform
* @return {AffineTransform}
+ * @example
+ * var affineTransform = node.getParentToNodeTransform();
*/
getParentToNodeTransform: function () {
return this._sgNode.getParentToNodeTransform();
@@ -1191,9 +1398,12 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * Returns the world affine transform matrix. The matrix is in Pixels.
+ * !#en Returns the world affine transform matrix. The matrix is in Pixels.
+ * !#zh 返回节点到世界坐标系的仿射变换矩阵。矩阵单位是像素。
* @method getNodeToWorldTransform
* @return {AffineTransform}
+ * @example
+ * var affineTransform = node.getNodeToWorldTransform();
*/
getNodeToWorldTransform: function () {
var contentSize = this.getContentSize();
@@ -1212,10 +1422,16 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
/**
+ * !#en
* Returns the world affine transform matrix. The matrix is in Pixels.
* This method is AR (Anchor Relative).
+ * !#zh
+ * 返回节点到世界坐标仿射变换矩阵。矩阵单位是像素。
+ * 该方法基于节点坐标。
* @method getNodeToWorldTransformAR
* @return {AffineTransform}
+ * @example
+ * var mat = node.getNodeToWorldTransformAR();
*/
getNodeToWorldTransformAR: function () {
var contentSize = this.getContentSize();
@@ -1230,19 +1446,25 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
return mat;
},
/**
- * Returns the inverse world affine transform matrix. The matrix is in Pixels.
+ * !#en Returns the inverse world affine transform matrix. The matrix is in Pixels.
+ * !#en 返回世界坐标系到节点坐标系的逆矩阵。
* @method getWorldToNodeTransform
* @return {AffineTransform}
+ * @example
+ * var affineTransform = node.getWorldToNodeTransform();
*/
getWorldToNodeTransform: function () {
return this._sgNode.getWorldToNodeTransform();
},
/**
- * Converts a Point to node (local) space coordinates. The result is in Points.
+ * !#en Converts a Point to node (local) space coordinates. The result is in Vec2.
+ * !#zh 将一个点转换到节点 (局部) 坐标系。结果以 Vec2 为单位。
* @method convertToNodeSpace
* @param {Vec2} worldPoint
* @return {Vec2}
+ * @example
+ * var newVec2 = node.convertToNodeSpace(cc.v2(100, 100));
*/
convertToNodeSpace: function (worldPoint) {
var nodePositionIgnoreAnchorPoint = this._sgNode.convertToNodeSpace(worldPoint);
@@ -1250,10 +1472,13 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * Converts a Point to world space coordinates. The result is in Points.
+ * !#en Converts a Point to world space coordinates. The result is in Points.
+ * !#zh 将一个点转换到世界空间坐标系。结果以 Vec2 为单位。
* @method convertToWorldSpace
* @param {Vec2} nodePoint
* @return {Vec2}
+ * @example
+ * var newVec2 = node.convertToWorldSpace(cc.v2(100, 100));
*/
convertToWorldSpace: function (nodePoint) {
var worldPositionIgnoreAnchorPoint = this._sgNode.convertToWorldSpace(nodePoint);
@@ -1261,11 +1486,17 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
+ * !#en
* Converts a Point to node (local) space coordinates. The result is in Points.
* treating the returned/received node point as anchor relative.
+ * !#zh
+ * 将一个点转换到节点 (局部) 空间坐标系。结果以 Vec2 为单位。
+ * 返回值将基于节点坐标。
* @method convertToNodeSpaceAR
* @param {Vec2} worldPoint
* @return {Vec2}
+ * @example
+ * var newVec2 = node.convertToNodeSpaceAR(cc.v2(100, 100));
*/
convertToNodeSpaceAR: function (worldPoint) {
if (this._sgNode.isIgnoreAnchorPointForPosition()) {
@@ -1278,11 +1509,17 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
+ * !#en
* Converts a local Point to world space coordinates.The result is in Points.
* treating the returned/received node point as anchor relative.
+ * !#zh
+ * 将一个点转换到世界空间坐标系。结果以 Vec2 为单位。
+ * 返回值将基于节点坐标。
* @method convertToWorldSpaceAR
* @param {Vec2} nodePoint
* @return {Vec2}
+ * @example
+ * var newVec2 = node.convertToWorldSpaceAR(cc.v2(100, 100));
*/
convertToWorldSpaceAR: function (nodePoint) {
if (this._sgNode.isIgnoreAnchorPointForPosition()) {
@@ -1299,30 +1536,40 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
// },
/**
- * convenience methods which take a cc.Touch instead of cc.Vec2
+ * !#en convenience methods which take a cc.Touch instead of cc.Vec2.
+ * !#zh 将触摸点转换成本地坐标系中位置。
* @method convertTouchToNodeSpace
* @param {Touch} touch - The touch object
* @return {Vec2}
+ * @example
+ * var newVec2 = node.convertTouchToNodeSpace(touch);
*/
convertTouchToNodeSpace: function (touch) {
return this.convertToNodeSpace(touch.getLocation());
},
/**
- * converts a cc.Touch (world coordinates) into a local coordinate. This method is AR (Anchor Relative).
+ * !#en converts a cc.Touch (world coordinates) into a local coordinate. This method is AR (Anchor Relative).
+ * !#zh 转换一个 cc.Touch(世界坐标)到一个局部坐标,该方法基于节点坐标。
* @method convertTouchToNodeSpaceAR
* @param {Touch} touch - The touch object
* @return {Vec2}
+ * @example
+ * var newVec2 = node.convertTouchToNodeSpaceAR(touch);
*/
convertTouchToNodeSpaceAR: function (touch) {
return this.convertToNodeSpaceAR(touch.getLocation());
},
/**
+ * !#en
* Returns the matrix that transform the node's (local) space coordinates into the parent's space coordinates.
* The matrix is in Pixels.
+ * !#zh 返回这个将节点(局部)的空间坐标系转换成父节点的空间坐标系的矩阵。这个矩阵以像素为单位。
* @method getNodeToParentTransform
* @return {AffineTransform} The affine transform object
+ * @example
+ * var affineTransform = node.getNodeToParentTransform();
*/
getNodeToParentTransform: function () {
var contentSize = this.getContentSize();
@@ -1338,11 +1585,18 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
+ * !#en
* Returns the matrix that transform the node's (local) space coordinates into the parent's space coordinates.
* The matrix is in Pixels.
* This method is AR (Anchor Relative).
+ * !#zh
+ * 返回这个将节点(局部)的空间坐标系转换成父节点的空间坐标系的矩阵。
+ * 这个矩阵以像素为单位。
+ * 该方法基于节点坐标。
* @method getNodeToParentTransformAR
* @return {AffineTransform} The affine transform object
+ * @example
+ * var affineTransform = node.getNodeToParentTransformAR();
*/
getNodeToParentTransformAR: function () {
var contentSize = this.getContentSize();
@@ -1358,10 +1612,16 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
+ * !#en
* Returns a "world" axis aligned bounding box of the node.
* The bounding box contains self and active children's world bounding box.
+ * !#zh
+ * 返回节点在世界坐标系下的对齐轴向的包围盒(AABB)。
+ * 该边框包含自身和已激活的子节点的世界边框。
* @method getBoundingBoxToWorld
* @return {Rect}
+ * @example
+ * var newRect = node.getBoundingBoxToWorld();
*/
getBoundingBoxToWorld: function () {
var trans;
@@ -1397,39 +1657,60 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
+ * !#en
* Returns the displayed opacity of Node,
* the difference between displayed opacity and opacity is that displayed opacity is calculated based on opacity and parent node's opacity when cascade opacity enabled.
+ * !#zh
+ * 获取节点显示透明度,
+ * 显示透明度和透明度之间的不同之处在于当启用级连透明度时,
+ * 显示透明度是基于自身透明度和父节点透明度计算的。
+ *
* @method getDisplayedOpacity
* @returns {number} displayed opacity
+ * @example
+ * var displayOpacity = node.getDisplayedOpacity();
*/
getDisplayedOpacity: function () {
return this._sgNode.getDisplayedOpacity();
},
/*
- * Update displayed opacity
+ * !#en Update displayed opacity.
+ * !#zh 更新显示透明度。
* @method _updateDisplayedOpacity
* @param {Number} parentOpacity
+ * @example
+ * node._updateDisplayedOpacity(255);
*/
_updateDisplayedOpacity: function (parentOpacity) {
this._sgNode.updateDisplayedOpacity(parentOpacity);
},
/**
+ * !#en
* Returns the displayed color of Node,
* the difference between displayed color and color is that displayed color is calculated based on color and parent node's color when cascade color enabled.
+ * !#zh
+ * 获取节点的显示透明度,
+ * 显示透明度和透明度之间的不同之处在于显示透明度是基于透明度和父节点透明度启用级连透明度时计算的。
* @method getDisplayedColor
* @returns {Color}
+ * @example
+ * var displayColor = node.getDisplayedColor();
*/
getDisplayedColor: function () {
return this._sgNode.getDisplayedColor();
},
/**
+ * !#en
* Set whether color should be changed with the opacity value,
* useless in ccsg.Node, but this function is override in some class to have such behavior.
+ * !#zh 设置更改透明度时是否修改RGB值,
* @method setOpacityModifyRGB
* @param {Boolean} opacityValue
+ * @example
+ * node.setOpacityModifyRGB(true);
*/
setOpacityModifyRGB: function (opacityValue) {
if (this._opacityModifyRGB !== opacityValue) {
@@ -1440,9 +1721,12 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * Get whether color should be changed with the opacity value
+ * !#en Get whether color should be changed with the opacity value.
+ * !#zh 更改透明度时是否修改RGB值。
* @method isOpacityModifyRGB
* @return {Boolean}
+ * @example
+ * var hasChange = node.isOpacityModifyRGB();
*/
isOpacityModifyRGB: function () {
return this._opacityModifyRGB;
@@ -1451,10 +1735,12 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
// HIERARCHY METHODS
/**
- * Get the sibling index.
- *
+ * !#en Get the sibling index.
+ * !#zh 获取同级索引。
* @method getSiblingIndex
* @return {number}
+ * @example
+ * var index = node.getSiblingIndex();
*/
getSiblingIndex: function () {
if (this._parent) {
@@ -1466,10 +1752,12 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * Set the sibling index of this node.
- *
+ * !#en Set the sibling index of this node.
+ * !#zh 设置节点同级索引。
* @method setSiblingIndex
* @param {Number} index
+ * @example
+ * node.setSiblingIndex(1);
*/
setSiblingIndex: function (index) {
if (!this._parent) {
@@ -1501,11 +1789,13 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
},
/**
- * Is this node a child of the given node?
- *
+ * !#en Is this node a child of the given node?
+ * !#zh 是否是指定节点的子节点?
* @method isChildOf
* @param {Node} parent
* @return {Boolean} - Returns true if this node is a child, deep child or identical to the given node.
+ * @example
+ * node.isChildOf(newNode);
*/
isChildOf: function (parent) {
var child = this;
@@ -1631,102 +1921,151 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
})();
/**
- * position of node.
+ * !#en position of node.
+ * !#zh 节点相对父节点的坐标。
* @property position
* @type {Vec2}
+ * @example
+ * node.position = new cc.Vec2(0, 0);
*/
/**
- * Scale of node
+ * !#en Scale of node.
+ * !#zh 节点缩放
* @property scale
* @type {Number}
+ * @example
+ * node.scale = 1;
*/
/**
- * Returns the x axis position of the node in cocos2d coordinates.
+ * !#en Returns the x axis position of the node in cocos2d coordinates.
+ * !#zh 获取节点 X 轴坐标。
* @method getPositionX
- * @param {Number} x - The new position in x axis
+ * @return {Number} x - The new position in x axis
+ * @example
+ * var posX = node.getPositionX();
*/
/**
- * Sets the x axis position of the node in cocos2d coordinates.
+ * !#en Sets the x axis position of the node in cocos2d coordinates.
+ * !#zh 设置节点 X 轴坐标。
* @method setPositionX
- * @return {Number}
+ * @param {Number} x
+ * @example
+ * node.setPositionX(1);
*/
/**
- * Returns the y axis position of the node in cocos2d coordinates.
+ * !#en Returns the y axis position of the node in cocos2d coordinates.
+ * !#zh 获取节点 Y 轴坐标。
* @method getPositionY
* @return {Number}
+ * @example
+ * var posY = node.getPositionY();
*/
/**
- * Sets the y axis position of the node in cocos2d coordinates.
+ * !#en Sets the y axis position of the node in cocos2d coordinates.
+ * !#zh 设置节点 Y 轴坐标。
* @method setPositionY
* @param {Number} y - The new position in y axis
+ * @example
+ * node.setPositionY(100);
*/
/**
- * Returns the local Z order of this node.
+ * !#en Returns the local Z order of this node.
+ * !#zh 获取节点局部 Z 轴顺序。
* @method getLocalZOrder
* @returns {Number} The local (relative to its siblings) Z order.
+ * @example
+ * var localZorder = node.getLocalZOrder();
*/
/**
- * LocalZOrder is the 'key' used to sort the node relative to its siblings.
+ * !#en
+ * LocalZOrder is the 'key' used to sort the node relative to its siblings.
*
* The Node's parent will sort all its children based ont the LocalZOrder value.
* If two nodes have the same LocalZOrder, then the node that was added first to the children's array
* will be in front of the other node in the array.
- *
- * Also, the Scene Graph is traversed using the "In-Order" tree traversal algorithm ( http://en.wikipedia.org/wiki/Tree_traversal#In-order )
- *
- * And Nodes that have LocalZOder values smaller than 0 are the "left" subtree
- * While Nodes with LocalZOder greater than 0 are the "right" subtree.
+ * Also, the Scene Graph is traversed using the "In-Order" tree traversal algorithm ( http://en.wikipedia.org/wiki/Tree_traversal#In-order )
+ * And Nodes that have LocalZOder values smaller than 0 are the "left" subtree
+ * While Nodes with LocalZOder greater than 0 are the "right" subtree.
+ * !#zh
+ * LocalZOrder 是 “key” (关键)来分辨节点和它兄弟节点的相关性。
+ * 父节点将会通过 LocalZOrder 的值来分辨所有的子节点。
+ * 如果两个节点有同样的 LocalZOrder,那么先加入子节点数组的节点将会显示在后加入的节点的前面。
+ * 同样的,场景图使用 “In-Order(按顺序)” 遍历数算法来遍历
+ * ( http://en.wikipedia.org/wiki/Tree_traversal#In-order ) 并且拥有小于 0 的 LocalZOrder 的值的节点是 “ left ” 子树(左子树)
+ * 所以拥有大于 0 的 LocalZOrder 的值得节点是 “ right ”子树(右子树)。
* @method setLocalZOrder
* @param {Number} localZOrder
+ * @example
+ * node.setLocalZOrder(1);
*/
-/**
+/*
+ * !#en
* Returns whether the anchor point will be ignored when you position this node.
* When anchor point ignored, position will be calculated based on the origin point (0, 0) in parent's coordinates.
+ * !#zh
+ * 返回这个节点位置时,是否会忽略这个锚点。
+ * 当锚点被忽略时,在父坐标系中的原点(0,0)计算位置。
* @method isIgnoreAnchorPointForPosition
* @return {Boolean} true if the anchor point will be ignored when you position this node.
*/
-/**
- *
- * Sets whether the anchor point will be ignored when you position this node.
- * When anchor point ignored, position will be calculated based on the origin point (0, 0) in parent's coordinates.
- * This is an internal method, only used by CCLayer and CCScene. Don't call it outside framework.
- * The default value is false, while in CCLayer and CCScene are true
- *
+/*
+ * !#en
+ * Sets whether the anchor point will be ignored when you position this node.
+ * When anchor point ignored, position will be calculated based on the origin point (0, 0) in parent's coordinates.
+ * This is an internal method, only used by CCLayer and CCScene. Don't call it outside framework.
+ * The default value is false, while in CCLayer and CCScene are true
+ * !#zh
+ * 设置抹点为(0,0)当你摆放这个节点的时候。
+ * 这是一个内部方法,仅仅被 Layer 和 Scene 使用。不要在框架外调用。默认值是 false,但是在 Layer 和 Scene 中是 true.
* @method ignoreAnchorPointForPosition
* @param {Boolean} newValue - true if anchor point will be ignored when you position this node
+ * @example
+ * node.ignoreAnchorPointForPosition(true);
*/
/**
- * Returns whether node's opacity value affect its child nodes.
+ * !#en Returns whether node's opacity value affect its child nodes.
+ * !#zh 返回节点的不透明度值是否影响其子节点。
* @method isCascadeOpacityEnabled
* @returns {Boolean}
+ * @example
+ * cc.log(node.isCascadeOpacityEnabled());
*/
/**
- * Enable or disable cascade opacity, if cascade enabled, child nodes' opacity will be the multiplication of parent opacity and its own opacity.
+ * !#en Enable or disable cascade opacity, if cascade enabled, child nodes' opacity will be the multiplication of parent opacity and its own opacity.
+ * !#zh 启用或禁用级连不透明度,如果级连启用,子节点的不透明度将是父不透明度乘上它自己的不透明度。
* @method setCascadeOpacityEnabled
* @param {Boolean} cascadeOpacityEnabled
+ * @example
+ * node.setCascadeOpacityEnabled(true);
*/
-/**
- * Returns whether node's color value affect its child nodes.
+/*
+ * !#en Returns whether node's color value affect its child nodes.
+ * !#zh 返回节点的颜色值是否影响其子节点。
* @method isCascadeColorEnabled
* @returns {Boolean}
+ * @example
+ * cc.log(node.isCascadeColorEnabled());
*/
/**
- * Enable or disable cascade color, if cascade enabled, child nodes' opacity will be the cascade value of parent color and its own color.
+ * !#en Enable or disable cascade color, if cascade enabled, child nodes' opacity will be the cascade value of parent color and its own color.
+ * !#zh 启用或禁用级连颜色,如果级连启用,子节点的颜色将是父颜色和它自己的颜色的级连值。
* @method setCascadeColorEnabled
* @param {Boolean} cascadeColorEnabled
+ * @example
+ * node.setCascadeColorEnabled(true);
*/
diff --git a/cocos2d/tilemap/CCTiledMap.js b/cocos2d/tilemap/CCTiledMap.js
index 26a98ab833..78fc644474 100644
--- a/cocos2d/tilemap/CCTiledMap.js
+++ b/cocos2d/tilemap/CCTiledMap.js
@@ -731,9 +731,9 @@ var TiledMap = cc.Class({
} else {
// tmx file is cleared
// 1. hide the tmx layers in _sgNode
- var layers = self._sgNode.allLayers();
+ var layers = sgNode.allLayers();
for (var i = 0, n = layers.length; i < n; i++) {
- self._sgNode.removeChild(layers);
+ sgNode.removeChild(layers[i]);
}
// 2. if the component is enabled,
diff --git a/docs/cocos2d/core/utils/base-node/setPosition.js b/docs/cocos2d/core/utils/base-node/setPosition.js
new file mode 100644
index 0000000000..9fb077b9a7
--- /dev/null
+++ b/docs/cocos2d/core/utils/base-node/setPosition.js
@@ -0,0 +1,2 @@
+node.setPosition(cc.v2(0, 0));
+node.setPosition(0, 0);
diff --git a/extensions/spine/Skeleton.js b/extensions/spine/Skeleton.js
index 92835d2b0d..8854f17d07 100644
--- a/extensions/spine/Skeleton.js
+++ b/extensions/spine/Skeleton.js
@@ -294,8 +294,11 @@ sp.Skeleton = cc.Class({
// IMPLEMENT
onLoad: function () {
+ // sgNode 的尺寸不是很可靠 同时 Node 的框框也没办法和渲染匹配 只好强制尺寸为零
var Flags = cc.Object.Flags;
this._objFlags |= (Flags.IsAnchorLocked | Flags.IsSizeLocked);
+ this.node.setContentSize(0, 0);
+ //
this._refresh();
},
@@ -736,6 +739,7 @@ sp.Skeleton = cc.Class({
var sgNode = self._sgNode = self._createSgNode();
if (sgNode) {
sgNode.retain();
+ sgNode.setContentSize(0, 0); // restore content size
self._initSgNode();
self._appendSgNode(sgNode);
if ( !self.node._sizeProvider ) {
@@ -743,9 +747,6 @@ sp.Skeleton = cc.Class({
}
}
- // sgNode 的尺寸不是很可靠 同时 Node 的框框也没办法和渲染匹配 只好先强制尺寸为零
- self.node.setContentSize(0, 0);
-
if (CC_EDITOR) {
// update inspector
self._updateAnimEnum();
diff --git a/jsb/jsb-editbox.js b/jsb/jsb-editbox.js
index a503dae3ba..dadd0ccb98 100644
--- a/jsb/jsb-editbox.js
+++ b/jsb/jsb-editbox.js
@@ -42,6 +42,13 @@ cc.defineGetterSetter(_p, 'delegate', null, _p.setDelegate);
cc.defineGetterSetter(_p, 'inputMode', null, _p.setInputMode);
cc.defineGetterSetter(_p, 'returnType', null, _p.setReturnType);
+_p._setMaxLength = _p.setMaxLength;
+_p.setMaxLength = function(maxLength) {
+ if (maxLength == -1) {
+ maxLength = Number.MAX_VALUE;
+ }
+ this._setMaxLength(maxLength);
+}
_p.editBoxEditingDidBegin = function (sender) {
this.editBoxEditingDidBegan(sender);
diff --git a/moduleConfig.json b/moduleConfig.json
deleted file mode 100644
index 212d1378e2..0000000000
--- a/moduleConfig.json
+++ /dev/null
@@ -1,470 +0,0 @@
-{
- "module" : {
- "actions" : [
- "core",
-
- "cocos2d/actions/CCAction.js",
- "cocos2d/actions/CCActionInterval.js",
- "cocos2d/actions/CCActionInstant.js",
- "cocos2d/actions/CCActionCamera.js",
- "cocos2d/actions/CCActionEase.js",
- "cocos2d/actions/CCActionCatmullRom.js",
- "cocos2d/actions/CCActionTween.js"
- ],
- "actions3d" : [
- "core", "kazmath", "shaders", "actions", "effects", "render-texture",
-
- "cocos2d/actions3d/CCActionGrid.js",
- "cocos2d/actions3d/CCActionGrid3D.js",
- "cocos2d/actions3d/CCActionTiledGrid.js",
- "cocos2d/actions3d/CCActionPageTurn3D.js"
- ],
- "audio" : [
- "core",
-
- "cocos2d/audio/CCAudio.js"
- ],
- "clipping-nodes" : [
- "core", "shape-nodes",
-
- "cocos2d/clipping-nodes/CCClippingNode.js",
- "cocos2d/clipping-nodes/CCClippingNodeCanvasRenderCmd.js",
- "cocos2d/clipping-nodes/CCClippingNodeWebGLRenderCmd.js"
- ],
- "compression" : [
- "core",
-
- "cocos2d/compression/ZipUtils.js",
- "cocos2d/compression/base64.js",
- "cocos2d/compression/gzip.js",
- "cocos2d/compression/zlib.min.js"
- ],
- "core" : [
- "cocos2d/core/event-manager/CCEventHelper.js",
- "Base64Images.js",
- "cocos2d/core/platform/CCClass.js",
- "cocos2d/core/platform/CCCommon.js",
- "cocos2d/core/platform/CCSAXParser.js",
- "cocos2d/core/platform/CCConfig.js",
- "cocos2d/core/platform/miniFramework.js",
- "cocos2d/core/platform/CCMacro.js",
- "cocos2d/core/platform/CCEGLView.js",
- "cocos2d/core/platform/CCScreen.js",
- "cocos2d/core/platform/CCVisibleRect.js",
-
- "cocos2d/core/support/CCVertex.js",
- "cocos2d/core/support/TransformUtils.js",
- "cocos2d/core/event-manager/CCTouch.js",
-
- "cocos2d/core/event-manager/CCSystemEvent.js",
- "cocos2d/core/event-manager/CCEventListener.js",
- "cocos2d/core/event-manager/CCEventManager.js",
-
- "cocos2d/core/renderer/RendererCanvas.js",
- "cocos2d/core/renderer/RendererWebGL.js",
-
- "cocos2d/core/base-nodes/BaseNodesPropertyDefine.js",
- "cocos2d/core/base-nodes/CCSGNode.js",
- "cocos2d/core/base-nodes/CCSGNodeCanvasRenderCmd.js",
- "cocos2d/core/base-nodes/CCSGNodeWebGLRenderCmd.js",
- "cocos2d/core/base-nodes/CCAtlasNode.js",
- "cocos2d/core/base-nodes/CCAtlasNodeCanvasRenderCmd.js",
- "cocos2d/core/base-nodes/CCAtlasNodeWebGLRenderCmd.js",
-
- "cocos2d/core/textures/CCTexture2D.js",
- "cocos2d/core/textures/CCTextureCache.js",
- "cocos2d/core/textures/CCTextureAtlas.js",
-
- "cocos2d/core/scenes/CCSGScene.js",
- "cocos2d/core/scenes/CCLoaderScene.js",
-
- "cocos2d/core/layers/CCLayer.js",
- "cocos2d/core/layers/CCLayerCanvasRenderCmd.js",
- "cocos2d/core/layers/CCLayerWebGLRenderCmd.js",
-
- "cocos2d/core/sprites/SpritesPropertyDefine.js",
- "cocos2d/core/sprites/CCSGSprite.js",
- "cocos2d/core/sprites/CCSGSpriteCanvasRenderCmd.js",
- "cocos2d/core/sprites/CCSGSpriteWebGLRenderCmd.js",
- "cocos2d/core/sprites/CCSpriteBatchNode.js",
- "cocos2d/core/sprites/CCSpriteBatchNodeCanvasRenderCmd.js",
- "cocos2d/core/sprites/CCSpriteBatchNodeWebGLRenderCmd.js",
- "cocos2d/core/sprites/CCBakeSprite.js",
- "cocos2d/core/sprites/CCAnimation.js",
- "cocos2d/core/sprites/CCAnimationCache.js",
- "cocos2d/core/sprites/CCSpriteFrame.js",
- "cocos2d/core/sprites/CCSpriteFrameCache.js",
- "cocos2d/core/CCConfiguration.js",
-
- "cocos2d/core/CCCamera.js",
- "cocos2d/core/CCScheduler.js",
- "cocos2d/core/CCDrawingPrimitivesCanvas.js",
- "cocos2d/core/CCDrawingPrimitivesWebGL.js",
-
- "cocos2d/core/labelttf/LabelTTFPropertyDefine.js",
- "cocos2d/core/labelttf/CCLabelTTF.js",
- "cocos2d/core/labelttf/CCLabelTTFCanvasRenderCmd.js",
- "cocos2d/core/labelttf/CCLabelTTFWebGLRenderCmd.js",
-
- "cocos2d/core/CCActionManager.js"
- ],
- "effects" : [
- "core",
-
- "cocos2d/effects/CCGrid.js",
- "cocos2d/effects/CCGrabber.js"
- ],
- "kazmath" : [
- "core",
-
- "cocos2d/kazmath/utility.js",
- "cocos2d/kazmath/vec2.js",
- "cocos2d/kazmath/vec3.js",
- "cocos2d/kazmath/vec4.js",
- "cocos2d/kazmath/ray2.js",
- "cocos2d/kazmath/mat3.js",
- "cocos2d/kazmath/mat4.js",
- "cocos2d/kazmath/plane.js",
- "cocos2d/kazmath/quaternion.js",
- "cocos2d/kazmath/aabb.js",
- "cocos2d/kazmath/gl/mat4stack.js",
- "cocos2d/kazmath/gl/matrix.js"
- ],
- "kazmathSIMD" : [
- "kazmath",
-
- "cocos2d/kazmath/vec3SIMD.js",
- "cocos2d/kazmath/mat4SIMD.js",
- "cocos2d/kazmath/SIMDPolyfill.js"
- ],
- "labels" : [
- "core",
-
- "cocos2d/labels/CCLabelAtlas.js",
- "cocos2d/labels/CCLabelAtlasCanvasRenderCmd.js",
- "cocos2d/labels/CCLabelAtlasWebGLRenderCmd.js",
- "cocos2d/labels/CCLabelBMFont.js",
- "cocos2d/labels/CCLabelBMFontCanvasRenderCmd.js",
- "cocos2d/labels/CCLabelBMFontWebGLRenderCmd.js"
- ],
- "menus" : [
- "core", "actions",
-
- "cocos2d/menus/CCMenuItem.js",
- "cocos2d/menus/CCMenu.js"
- ],
- "motion-streak" : [
- "core", "shaders", "kazmath", "labels",
-
- "cocos2d/motion-streak/CCMotionStreak.js",
- "cocos2d/motion-streak/CCMotionStreakWebGLRenderCmd.js"
- ],
- "node-grid" : [
- "core",
-
- "cocos2d/node-grid/CCNodeGrid.js",
- "cocos2d/node-grid/CCNodeGridWebGLRenderCmd.js"
- ],
- "parallax" : [
- "core",
-
- "cocos2d/parallax/CCParallaxNode.js",
- "cocos2d/parallax/CCParallaxNodeRenderCmd.js"
- ],
- "particle" : [
- "core", "compression",
-
- "cocos2d/particle/CCPNGReader.js",
- "cocos2d/particle/CCTIFFReader.js",
- "cocos2d/particle/CCSGParticleSystem.js",
- "cocos2d/particle/CCSGParticleSystemCanvasRenderCmd.js",
- "cocos2d/particle/CCSGParticleSystemWebGLRenderCmd.js",
- "cocos2d/particle/CCSGParticleExamples.js",
- "cocos2d/particle/CCParticleBatchNode.js",
- "cocos2d/particle/CCParticleBatchNodeCanvasRenderCmd.js",
- "cocos2d/particle/CCParticleBatchNodeWebGLRenderCmd.js"
- ],
- "physics" : [
- "core", "shape-nodes",
-
- "cocos2d/physics/CCPhysicsSprite.js",
- "cocos2d/physics/CCPhysicsDebugNode.js",
- "cocos2d/physics/CCPhysicsDebugNodeCanvasRenderCmd.js",
- "cocos2d/physics/CCPhysicsDebugNodeWebGLRenderCmd.js",
- "cocos2d/physics/CCPhysicsSpriteCanvasRenderCmd.js",
- "cocos2d/physics/CCPhysicsSpriteWebGLRenderCmd.js"
- ],
- "progress-timer" : [
- "core", "actions",
-
- "cocos2d/progress-timer/CCProgressTimer.js",
- "cocos2d/progress-timer/CCActionProgressTimer.js",
- "cocos2d/progress-timer/CCProgressTimerCanvasRenderCmd.js",
- "cocos2d/progress-timer/CCProgressTimerWebGLRenderCmd.js"
- ],
- "render-texture" : [
- "core",
-
- "cocos2d/render-texture/CCRenderTexture.js",
- "cocos2d/render-texture/CCRenderTextureCanvasRenderCmd.js",
- "cocos2d/render-texture/CCRenderTextureWebGLRenderCmd.js"
- ],
- "shaders" : [
- "core", "kazmath",
-
- "cocos2d/shaders/CCShaders.js",
- "cocos2d/shaders/CCShaderCache.js",
- "cocos2d/shaders/CCGLProgram.js",
- "cocos2d/shaders/CCGLStateCache.js"
- ],
- "shape-nodes" : [
- "core",
-
- "cocos2d/shape-nodes/CCDrawNode.js",
- "cocos2d/shape-nodes/CCDrawNodeCanvasRenderCmd.js",
- "cocos2d/shape-nodes/CCDrawNodeWebGLRenderCmd.js"
- ],
- "text-input" : [
- "core",
-
- "cocos2d/text-input/CCIMEDispatcher.js",
- "cocos2d/text-input/CCTextFieldTTF.js"
- ],
- "tilemap" : [
- "core", "compression",
-
- "cocos2d/tilemap/CCTGAlib.js",
- "cocos2d/tilemap/CCTMXTiledMap.js",
- "cocos2d/tilemap/CCTMXXMLParser.js",
- "cocos2d/tilemap/CCTMXObjectGroup.js",
- "cocos2d/tilemap/CCTMXLayer.js",
- "cocos2d/tilemap/CCTMXLayerCanvasRenderCmd.js",
- "cocos2d/tilemap/CCTMXLayerWebGLRenderCmd.js"
- ],
- "transitions" : [
- "core", "actions", "render-texture", "progress-timer",
-
- "cocos2d/transitions/CCTransition.js",
- "cocos2d/transitions/CCTransitionProgress.js",
- "cocos2d/transitions/CCTransitionPageTurn.js"
- ],
-
- "base4webgl" : ["core", "kazmath", "shaders"],
- "cocos2d" : [
- "core", "kazmath", "shaders", "render-texture", "motion-streak", "node-grid",
- "clipping-nodes", "effects", "shape-nodes", "actions", "actions3d",
- "progress-timer", "transitions", "labels", "compression", "particle",
- "text-input", "menus", "tilemap", "parallax", "audio"
- ],
-
- "ccbreader" : [
- "core", "audio", "gui", "menus", "particle", "actions", "labels",
-
- "extensions/ccb-reader/CCNodeLoader.js",
- "extensions/ccb-reader/CCBReaderUtil.js",
- "extensions/ccb-reader/CCControlLoader.js",
- "extensions/ccb-reader/CCSpriteLoader.js",
- "extensions/ccb-reader/CCNodeLoaderLibrary.js",
- "extensions/ccb-reader/CCBReader.js",
- "extensions/ccb-reader/CCBValue.js",
- "extensions/ccb-reader/CCBKeyframe.js",
- "extensions/ccb-reader/CCBSequence.js",
- "extensions/ccb-reader/CCBRelativePositioning.js",
- "extensions/ccb-reader/CCBAnimationManager.js"
- ],
- "ccpool" : [
- "core",
-
- "extensions/ccpool/CCPool.js"
- ],
- "ccui" : [
- "core", "actions", "labels", "text-input","clipping-nodes",
- "extensions/ccui/base-classes/CCProtectedNode.js",
- "extensions/ccui/base-classes/CCProtectedNodeCanvasRenderCmd.js",
- "extensions/ccui/base-classes/CCProtectedNodeWebGLRenderCmd.js",
- "extensions/ccui/system/CocosGUI.js",
- "extensions/ccui/base-classes/UIWidget.js",
- "extensions/ccui/base-classes/UIWidgetRenderCmd.js",
- "extensions/ccui/base-classes/UIScale9Sprite.js",
- "extensions/ccui/base-classes/UIScale9SpriteCanvasRenderCmd.js",
- "extensions/ccui/base-classes/UIScale9SpriteWebGLRenderCmd.js",
- "extensions/ccui/layouts/UILayout.js",
- "extensions/ccui/layouts/UILayoutCanvasRenderCmd.js",
- "extensions/ccui/layouts/UILayoutWebGLRenderCmd.js",
- "extensions/ccui/layouts/UILayoutParameter.js",
- "extensions/ccui/layouts/UILayoutManager.js",
- "extensions/ccui/layouts/UIHBox.js",
- "extensions/ccui/layouts/UIRelativeBox.js",
- "extensions/ccui/layouts/UIVBox.js",
- "extensions/ccui/system/UIHelper.js",
- "extensions/ccui/uiwidgets/UIButton.js",
- "extensions/ccui/uiwidgets/UICheckBox.js",
- "extensions/ccui/uiwidgets/UIImageView.js",
- "extensions/ccui/uiwidgets/UILoadingBar.js",
- "extensions/ccui/uiwidgets/UISlider.js",
- "extensions/ccui/uiwidgets/UIText.js",
- "extensions/ccui/uiwidgets/UITextAtlas.js",
- "extensions/ccui/uiwidgets/UITextBMFont.js",
- "extensions/ccui/uiwidgets/UITextField.js",
- "extensions/ccui/uiwidgets/UIVideoPlayer.js",
- "extensions/ccui/uiwidgets/UIRichText.js",
- "extensions/ccui/uiwidgets/UIWebView.js",
- "extensions/ccui/uiwidgets/scroll-widget/UIScrollView.js",
- "extensions/ccui/uiwidgets/scroll-widget/UIListView.js",
- "extensions/ccui/uiwidgets/scroll-widget/UIPageView.js",
- "extensions/ccui/uiwidgets/scroll-widget/UIScrollViewCanvasRenderCmd.js",
- "extensions/ccui/uiwidgets/scroll-widget/UIScrollViewWebGLRenderCmd.js"
- ],
- "cocostudio" : [
- "core", "tilemap", "particle", "shape-nodes", "ccui",
-
- "extensions/cocostudio/components/CCComponent.js",
- "extensions/cocostudio/components/CCComponentContainer.js",
- "extensions/ccui/layouts/UILayoutComponent.js",
- "extensions/cocostudio/CocoStudio.js",
-
- "extensions/cocostudio/armature/utils/CCArmatureDefine.js",
- "extensions/cocostudio/armature/utils/CCDataReaderHelper.js",
- "extensions/cocostudio/armature/utils/CCSpriteFrameCacheHelper.js",
- "extensions/cocostudio/armature/utils/CCTransformHelp.js",
- "extensions/cocostudio/armature/utils/CCTweenFunction.js",
- "extensions/cocostudio/armature/utils/CCUtilMath.js",
- "extensions/cocostudio/armature/utils/CCArmatureDataManager.js",
- "extensions/cocostudio/armature/datas/CCDatas.js",
- "extensions/cocostudio/armature/display/CCDecorativeDisplay.js",
- "extensions/cocostudio/armature/display/CCDisplayFactory.js",
- "extensions/cocostudio/armature/display/CCDisplayManager.js",
- "extensions/cocostudio/armature/display/CCSkin.js",
- "extensions/cocostudio/armature/display/CCSkinCanvasRenderCmd.js",
- "extensions/cocostudio/armature/display/CCSkinWebGLRenderCmd.js",
- "extensions/cocostudio/armature/animation/CCProcessBase.js",
- "extensions/cocostudio/armature/animation/CCArmatureAnimation.js",
- "extensions/cocostudio/armature/animation/CCTween.js",
- "extensions/cocostudio/armature/physics/CCColliderDetector.js",
- "extensions/cocostudio/armature/CCArmature.js",
- "extensions/cocostudio/armature/CCArmatureCanvasRenderCmd.js",
- "extensions/cocostudio/armature/CCArmatureWebGLRenderCmd.js",
- "extensions/cocostudio/armature/CCBone.js",
-
- "extensions/cocostudio/action/CCActionFrame.js",
- "extensions/cocostudio/action/CCActionManager.js",
- "extensions/cocostudio/action/CCActionNode.js",
- "extensions/cocostudio/action/CCActionObject.js",
-
- "extensions/cocostudio/components/CCComAttribute.js",
- "extensions/cocostudio/components/CCComAudio.js",
- "extensions/cocostudio/components/CCComController.js",
- "extensions/cocostudio/components/CCComRender.js",
-
- "extensions/cocostudio/trigger/ObjectFactory.js",
- "extensions/cocostudio/trigger/TriggerBase.js",
- "extensions/cocostudio/trigger/TriggerMng.js",
- "extensions/cocostudio/trigger/TriggerObj.js",
-
- "extensions/cocostudio/timeline/ActionTimeline.js",
- "extensions/cocostudio/timeline/Frame.js",
- "extensions/cocostudio/timeline/Timeline.js",
-
- "extensions/cocostudio/timeline/CCSkinNode.js",
- "extensions/cocostudio/timeline/CCBoneNode.js",
- "extensions/cocostudio/timeline/CCSkeletonNode.js",
-
- "extensions/cocostudio/loader/load.js",
- "extensions/cocostudio/loader/parsers/scene-1.x.js",
- "extensions/cocostudio/loader/parsers/uiParser-1.x.js",
- "extensions/cocostudio/loader/parsers/action-1.x.js",
- "extensions/cocostudio/loader/parsers/action-2.x.js",
- "extensions/cocostudio/loader/parsers/timelineParser-1.x.js",
- "extensions/cocostudio/loader/parsers/timelineParser-2.x.js",
- "extensions/cocostudio/loader/parsers/compatible.js"
-
-
- ],
- "gui" : [
- "core", "clipping-nodes", "render-texture", "actions", "progress-timer",
-
- "extensions/gui/control-extension/CCControl.js",
- "extensions/gui/control-extension/CCControlButton.js",
- "extensions/gui/control-extension/CCControlUtils.js",
- "extensions/gui/control-extension/CCInvocation.js",
- "extensions/gui/control-extension/CCMenuPassive.js",
- "extensions/gui/control-extension/CCControlSaturationBrightnessPicker.js",
- "extensions/gui/control-extension/CCControlHuePicker.js",
- "extensions/gui/control-extension/CCControlColourPicker.js",
- "extensions/gui/control-extension/CCControlSlider.js",
- "extensions/gui/control-extension/CCControlSwitch.js",
- "extensions/gui/control-extension/CCControlStepper.js",
- "extensions/gui/control-extension/CCControlPotentiometer.js",
- "extensions/gui/scrollview/CCScrollView.js",
- "extensions/gui/scrollview/CCScrollViewCanvasRenderCmd.js",
- "extensions/gui/scrollview/CCScrollViewWebGLRenderCmd.js",
- "extensions/gui/scrollview/CCSorting.js",
- "extensions/gui/scrollview/CCTableView.js"
- ],
-
- "pluginx" : [
- "core",
-
- "external/pluginx/Plugin.js"
- ],
- "plugin-facebook" : [
- "external/pluginx/platform/facebook_sdk.js",
- "external/pluginx/platform/facebook.js"
- ],
-
- "spine":[
- "core",
-
- "extensions/spine/Spine.js",
- "extensions/spine/CCSkeleton.js",
- "extensions/spine/CCSkeletonAnimation.js",
- "extensions/spine/CCSkeletonCanvasRenderCmd.js",
- "extensions/spine/CCSkeletonWebGLRenderCmd.js"
- ],
- "gaf":[
- "core",
-
- "external/gaf/GAFMacros.js",
- "external/gaf/GAFBoot.js",
- "external/gaf/Library/GAFAssetPreload.js",
- "external/gaf/Library/GAFAsset.js",
- "external/gaf/Library/GAFObject.js",
- "external/gaf/Library/GAFTimeLine.js",
- "external/gaf/Library/GAFTextField.js",
- "external/gaf/Library/GAFSprite.js",
- "external/gaf/Library/GAFMask.js",
- "external/gaf/Library/GAFSpriteCanvasRenderCmd.js",
- "external/gaf/Library/GAFSpriteWebGLRenderCmd.js",
- "external/gaf/Library/GAFTimeLineProto.js",
- "external/gaf/Library/GAFSpriteProto.js",
- "external/gaf/Library/GAFMaskProto.js",
- "external/gaf/Library/GAFTags.js",
- "external/gaf/Library/GAFLoader.js",
- "external/gaf/Library/GAFDataReader.js",
- "external/gaf/Library/GAFShaders.js",
- "external/gaf/Library/GAFShaderManager.js",
- "external/gaf/Library/GAFAtlasLoader.js"
- ],
- "extensions" : ["gui", "ccbreader", "editbox", "cocostudio", "spine", "ccpool"],
-
- "box2d" : [
- "core", "physics",
-
- "external/box2d/box2d.js"
- ],
- "chipmunk" : [
- "core", "physics",
-
- "external/chipmunk/chipmunk.js"
- ],
- "runtime":[
- "core",
- "extensions/runtime/CCLoaderLayer.js"
- ],
- "socketio" : [
- "external/socketio/socket.io.min.js"
- ],
- "external" : ["box2d", "chipmunk", "socketio", "pluginx", "gaf"]
- },
- "bootFile" : "CCBoot.js"
-}