Merge pull request #1612 from pandamicro/master

Add useful API to cc.Node
This commit is contained in:
pandamicro
2017-04-25 09:38:19 +08:00
committed by GitHub
+54
View File
@@ -1204,6 +1204,38 @@ var Node = cc.Class({
this._checkMouseListeners();
},
/**
* !#en Pause node related system events registered with the current Node. Node system events includes touch and mouse events.
* If recursive is set to true, then this API will pause the node system events for the node and all nodes in its sub node tree.
* Reference: http://cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/internal-events/
* !#zh 暂停当前节点上注册的所有节点系统事件,节点系统事件包含触摸和鼠标事件。
* 如果传递 recursive 为 true,那么这个 API 将暂停本节点和它的子树上所有节点的节点系统事件。
* 参考:http://cocos.com/docs/creator/scripting/internal-events.html
* @method pauseSystemEvents
* @param {Boolean} recursive - Whether to pause node system events on the sub node tree.
* @example
* node.pauseSystemEvents(true);
*/
pauseSystemEvents (recursive) {
cc.eventManager.pauseTarget(this, recursive);
},
/**
* !#en Resume node related system events registered with the current Node. Node system events includes touch and mouse events.
* If recursive is set to true, then this API will resume the node system events for the node and all nodes in its sub node tree.
* Reference: http://cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/internal-events/
* !#zh 恢复当前节点上注册的所有节点系统事件,节点系统事件包含触摸和鼠标事件。
* 如果传递 recursive 为 true,那么这个 API 将恢复本节点和它的子树上所有节点的节点系统事件。
* 参考:http://cocos.com/docs/creator/scripting/internal-events.html
* @method resumeSystemEvents
* @param {Boolean} recursive - Whether to resume node system events on the sub node tree.
* @example
* node.resumeSystemEvents(true);
*/
resumeSystemEvents (recursive) {
cc.eventManager.resumeTarget(this, recursive);
},
_checkTouchListeners () {
if (!(this._objFlags & Destroying) && this._touchListener) {
var i = 0;
@@ -1352,6 +1384,28 @@ var Node = cc.Class({
return action;
} : emptyFunc,
/**
* !#en Pause all actions running on the current node. Equals to `cc.director.getActionManager().pauseTarget(node)`.
* !#zh 暂停本节点上所有正在运行的动作。和 `cc.director.getActionManager().pauseTarget(node);` 等价。
* @method pauseAllActions
* @example
* node.pauseAllActions();
*/
pauseAllActions: ActionManagerExist ? function () {
cc.director.getActionManager().pauseTarget(this);
} : emptyFunc,
/**
* !#en Resume all paused actions on the current node. Equals to `cc.director.getActionManager().resumeTarget(node)`.
* !#zh 恢复运行本节点上所有暂停的动作。和 `cc.director.getActionManager().resumeTarget(node);` 等价。
* @method resumeAllActions
* @example
* node.resumeAllActions();
*/
resumeAllActions: ActionManagerExist ? function () {
cc.director.getActionManager().resumeTarget(this);
} : emptyFunc,
/**
* !#en Stops and removes all actions from the running action list .
* !#zh 停止并且移除所有正在运行的动作列表。