diff --git a/cocos2d/core/CCNode.js b/cocos2d/core/CCNode.js index 7e6d228098..b94b5dc7ab 100644 --- a/cocos2d/core/CCNode.js +++ b/cocos2d/core/CCNode.js @@ -1003,6 +1003,10 @@ var Node = cc.Class({ }, _onHierarchyChanged (oldParent) { + this._updateOrderOfArrival(); + if (this._parent) { + this._parent._delaySort(); + } this._onHierarchyChangedBase(oldParent); cc._widgetManager._nodesOrderDirty = true; }, @@ -2323,14 +2327,12 @@ var Node = cc.Class({ // invokes the parent setter child.parent = this; - child._updateOrderOfArrival(); if (zIndex !== undefined) { child.zIndex = zIndex; } if (name !== undefined) { child.name = name; } - this._delaySort(); }, /** diff --git a/cocos2d/core/assets/CCRawAsset.js b/cocos2d/core/assets/CCRawAsset.js index faf5d3c6d0..8d1542551b 100644 --- a/cocos2d/core/assets/CCRawAsset.js +++ b/cocos2d/core/assets/CCRawAsset.js @@ -64,8 +64,8 @@ js.value(cc.RawAsset, 'isRawAssetType', function (ctor) { return js.isChildClassOf(ctor, cc.RawAsset) && !js.isChildClassOf(ctor, cc.Asset); }); -// TODO - DELME after 2.0 -JS.value(cc.RawAsset, 'wasRawAssetType', function (ctor) { + // TODO - DELME after 2.1 +js.value(cc.RawAsset, 'wasRawAssetType', function (ctor) { return ctor === cc.Texture2D || ctor === cc.AudioClip || ctor === cc.ParticleAsset || diff --git a/cocos2d/core/base-ui/CCWidgetManager.js b/cocos2d/core/base-ui/CCWidgetManager.js index d7b2912ddc..15cc604631 100644 --- a/cocos2d/core/base-ui/CCWidgetManager.js +++ b/cocos2d/core/base-ui/CCWidgetManager.js @@ -450,7 +450,7 @@ var widgetManager = cc._widgetManager = module.exports = { if (CC_EDITOR && cc.engine) { cc.engine.on('design-resolution-changed', this.onResized.bind(this)); } - else { + else if (!CC_JSB) { if (cc.sys.isMobile) { window.addEventListener('resize', this.onResized.bind(this)); } diff --git a/cocos2d/core/load-pipeline/asset-table.js b/cocos2d/core/load-pipeline/asset-table.js index a7b9587151..94a9ba0526 100644 --- a/cocos2d/core/load-pipeline/asset-table.js +++ b/cocos2d/core/load-pipeline/asset-table.js @@ -66,10 +66,10 @@ proto.getUuid = function (path, type) { } } // not found - if (CC_DEBUG && cc.isChildClassOf(type, cc.SpriteFrame)) { + if (CC_DEBUG && js.isChildClassOf(type, cc.SpriteFrame)) { for (let i = 0; i < item.length; i++) { let entry = item[i]; - if (cc.isChildClassOf(entry.type, cc.SpriteAtlas)) { + if (js.isChildClassOf(entry.type, cc.SpriteAtlas)) { // not support sprite frame in atlas cc.errorID(4932, path); break; @@ -84,7 +84,7 @@ proto.getUuid = function (path, type) { else if (!type || js.isChildClassOf(item.type, type)) { return item.uuid; } - else if (CC_DEBUG && cc.isChildClassOf(type, cc.SpriteFrame) && cc.isChildClassOf(item.type, cc.SpriteAtlas)) { + else if (CC_DEBUG && js.isChildClassOf(type, cc.SpriteFrame) && js.isChildClassOf(item.type, cc.SpriteAtlas)) { // not support sprite frame in atlas cc.errorID(4932, path); } @@ -131,7 +131,7 @@ proto.getUuidArray = function (path, type, out_urls) { } } } - if (CC_DEBUG && uuids.length === 0 && _foundAtlasUrl && cc.isChildClassOf(type, cc.SpriteFrame)) { + if (CC_DEBUG && uuids.length === 0 && _foundAtlasUrl && js.isChildClassOf(type, cc.SpriteFrame)) { // not support sprite frame in atlas cc.errorID(4932, _foundAtlasUrl); } diff --git a/cocos2d/core/platform/preprocess-class.js b/cocos2d/core/platform/preprocess-class.js index 5ba8f5ed20..89778c4b84 100644 --- a/cocos2d/core/platform/preprocess-class.js +++ b/cocos2d/core/platform/preprocess-class.js @@ -124,7 +124,7 @@ function checkUrl (val, className, propName, url) { 'sorry for the inconvenience. \uD83D\uDE30 )', propName, className, propName, propName, propName, propName, propName); } - else if (cc.isChildClassOf(url, cc.Asset)) { + else if (js.isChildClassOf(url, cc.Asset)) { if (cc.RawAsset.wasRawAssetType(url)) { if (!val._short) { cc.warn('Please change the definition of property \'%s\' in class \'%s\'. Starting from v1.10,\n' + diff --git a/cocos2d/particle/CCParticleAsset.js b/cocos2d/particle/CCParticleAsset.js index 5cddfc22ea..5c8f1f6ca8 100644 --- a/cocos2d/particle/CCParticleAsset.js +++ b/cocos2d/particle/CCParticleAsset.js @@ -25,7 +25,7 @@ ****************************************************************************/ const Asset = require('../core/assets/CCAsset'); -const Texture2D = require('../core/textures/CCTexture2D'); +const Texture2D = require('../core/assets/CCTexture2D'); /** * Class for particle asset handling. diff --git a/cocos2d/particle/CCParticleSystem.js b/cocos2d/particle/CCParticleSystem.js index 92ed7f63dd..0221435026 100644 --- a/cocos2d/particle/CCParticleSystem.js +++ b/cocos2d/particle/CCParticleSystem.js @@ -179,7 +179,7 @@ var properties = { */ _file: { default: null, - type: cc.ParticleAsset + type: ParticleAsset }, file: { get: function () { @@ -201,7 +201,7 @@ var properties = { } }, animatable: false, - type: cc.ParticleAsset, + type: ParticleAsset, tooltip: CC_DEV && 'i18n:COMPONENT.particle_system.file' }, @@ -1096,13 +1096,17 @@ var ParticleSystem = cc.Class({ return; } - self._plistFile = file; + self._plistFile = file.nativeUrl; if (self._custom) { self._initTextureWithDictionary(content); } else { self._initWithDictionary(content); } + + if (file.texture) { + self.spriteFrame = new cc.SpriteFrame(file.texture); + } }); } }, @@ -1137,9 +1141,6 @@ var ParticleSystem = cc.Class({ cc.logID(6010); return false; } - else if (!content.textureImageData && file.texture) { - sgNode.texture = file.texture; - } var imageFormat = getImageFormatByData(buffer); if (imageFormat !== macro.ImageFormat.TIFF && imageFormat !== macro.ImageFormat.PNG) { @@ -1262,7 +1263,7 @@ var ParticleSystem = cc.Class({ else { this._rotationIsDir = false; } - } else if (this._emitterMode === _ccsg.ParticleSystem.Mode.RADIUS) { + } else if (this._emitterMode === EmitterMode.RADIUS) { // or Mode B: radius movement this.startRadius = parseFloat(dict["maxRadius"] || 0); this.startRadiusVar = parseFloat(dict["maxRadiusVariance"] || 0); diff --git a/jsb/jsb-audio.js b/jsb/jsb-audio.js index 5addc536d4..0e68314d90 100644 --- a/jsb/jsb-audio.js +++ b/jsb/jsb-audio.js @@ -217,8 +217,4 @@ cc.Audio = function (src) { audioEngine._preload(filePath, callback); }; - var Module = require('../cocos2d/audio/deprecated'); - Module.removed(audioEngine); - Module.deprecated(audioEngine); - })(cc.Audio.prototype, jsb.AudioEngine);