From 73aa2e640fc9ad802250cd92aebfa7597de4a91e Mon Sep 17 00:00:00 2001 From: "Huabing.Xu" Date: Tue, 27 Dec 2016 11:46:55 +0800 Subject: [PATCH] move _deactivateChildComponents to base node --- cocos2d/core/CCNode.js | 16 ---------------- cocos2d/core/utils/base-node.js | 22 +++++++++++++++++----- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/cocos2d/core/CCNode.js b/cocos2d/core/CCNode.js index 7f10bf14e3..2bc74f1e64 100644 --- a/cocos2d/core/CCNode.js +++ b/cocos2d/core/CCNode.js @@ -1246,22 +1246,6 @@ var Node = cc.Class({ } }, - _deactivateChildComponents: function () { - // 和 _activeRecursively 类似但不修改 this._activeInHierarchy - var originCount = this._components.length; - for (var c = 0; c < originCount; ++c) { - var component = this._components[c]; - component.__onNodeActivated(false); - } - // deactivate children recursively - for (var i = 0, len = this.childrenCount; i < len; ++i) { - var entity = this._children[i]; - if (entity._active) { - entity._deactivateChildComponents(); - } - } - }, - _instantiate: function (cloned) { if (!cloned) { cloned = cc.instantiate._clone(this, this); diff --git a/cocos2d/core/utils/base-node.js b/cocos2d/core/utils/base-node.js index dcfeea2db1..ea2916d2d1 100644 --- a/cocos2d/core/utils/base-node.js +++ b/cocos2d/core/utils/base-node.js @@ -418,11 +418,6 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{ removeChildByTag: null, removeAllChildren: null, - getNodeToParentTransform: null, - getNodeToWorldTransform: null, - getParentToNodeTransform: null, - getWorldToNodeTransform: null, - // HIERARCHY METHODS /** @@ -771,6 +766,23 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{ } } }, + + _deactivateChildComponents: function () { + // 和 _activeRecursively 类似但不修改 this._activeInHierarchy + var originCount = this._components.length; + for (var c = 0; c < originCount; ++c) { + var component = this._components[c]; + component.__onNodeActivated(false); + } + // deactivate children recursively + for (var i = 0, len = this.childrenCount; i < len; ++i) { + var entity = this._children[i]; + if (entity._active) { + entity._deactivateChildComponents(); + } + } + }, + });