From 645ccc5b5e69b58fa67cbf48008bc2431e01166c Mon Sep 17 00:00:00 2001 From: yinkaile <501251991@qq.com> Date: Wed, 4 Apr 2018 11:54:31 +0800 Subject: [PATCH] add upgrade code in both _onBatchCreated and _onBatchRestored --- cocos2d/core/CCNode.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/cocos2d/core/CCNode.js b/cocos2d/core/CCNode.js index 56b6495852..819d355a6c 100644 --- a/cocos2d/core/CCNode.js +++ b/cocos2d/core/CCNode.js @@ -1009,10 +1009,7 @@ var Node = cc.Class({ // INTERNAL - /* - * The initializer for Node which will be called before all components onLoad - */ - _onBatchCreated () { + _upgrade_1x_to_2x () { // Upgrade scaleX, scaleY from v1.x // TODO: remove in future version, 3.0 ? if (this._scaleX !== undefined) { @@ -1051,6 +1048,13 @@ var Node = cc.Class({ if (this._opacity !== 255 && this._opacity !== undefined) { this._color.a = this._opacity; } + }, + + /* + * The initializer for Node which will be called before all components onLoad + */ + _onBatchCreated () { + this._upgrade_1x_to_2x(); this._updateOrderOfArrival(); @@ -1079,6 +1083,8 @@ var Node = cc.Class({ // the same as _onBatchCreated but untouch prefab _onBatchRestored () { + this._upgrade_1x_to_2x(); + if (!this._activeInHierarchy) { // deactivate ActionManager and EventManager by default if (ActionManagerExist) {