Merge pull request #1146 from natural-law/action-tips

Output tips when cc._RendererInSG onEnabled if the node has actions.
This commit is contained in:
Jare Guo
2016-09-23 18:00:48 +08:00
committed by GitHub
3 changed files with 8 additions and 3 deletions
+2 -2
View File
@@ -268,11 +268,11 @@ cc.ActionManager = cc._Class.extend(/** @lends cc.ActionManager# */{
* - 如果您正在运行 7 个动作组成的序列动作(Sequence),这个函数将返回 1。<br/>
* - 如果你正在运行 2 个序列动作(Sequence)和 5 个普通动作,这个函数将返回 7。<br/>
*
* @method numberOfRunningActionsInTarget
* @method getNumberOfRunningActionsInTarget
* @param {Object} target
* @return {Number}
*/
numberOfRunningActionsInTarget:function (target) {
getNumberOfRunningActionsInTarget:function (target) {
var element = this._hashTargets[target.__instanceId];
if (element)
return (element.actions) ? element.actions.length : 0;
@@ -71,6 +71,11 @@ var RendererInSG = cc.Class({
},
onEnable: function () {
if (CC_JSB && cc.director.getActionManager().getNumberOfRunningActionsInTarget(this.node) > 0) {
cc.log('The node "%s" has a component inherited from "cc._RendererInSG"', this.node.name);
cc.log('JSB environment is not support invoke node.runAction before the "cc._RendererInSG" component enabled.');
cc.log('Please use runAction in the method "start" instead.');
}
this._replaceSgNode(this._sgNode);
},
+1 -1
View File
@@ -318,7 +318,7 @@ var targetRelatedFuncs = [
['removeAllActionsFromTarget', 0],
['removeActionByTag', 1],
['getActionByTag', 1],
['numberOfRunningActionsInTarget', 0],
['getNumberOfRunningActionsInTarget', 0],
['pauseTarget', 0],
['resumeTarget', 0]
];