diff --git a/cocos2d/core/load-pipeline/CCLoader.js b/cocos2d/core/load-pipeline/CCLoader.js index 13288cc0d5..f9b296e80d 100644 --- a/cocos2d/core/load-pipeline/CCLoader.js +++ b/cocos2d/core/load-pipeline/CCLoader.js @@ -322,14 +322,10 @@ JS.mixin(CCLoader.prototype, { else if (CC_DEV) { cc.warnID(4800, assetOrUrlOrUuid); } - var isUuid = cc.AssetLibrary._getAssetUrl(key); - if (isUuid) { - _info.url = null; - _info.raw = false; - cc.AssetLibrary._getAssetInfoInRuntime(key, _info); - key = _info.url; - } - return key; + _info.url = null; + _info.raw = false; + cc.AssetLibrary._getAssetInfoInRuntime(key, _info); + return this._cache[_info.url] ? _info.url : key; }, /** @@ -603,12 +599,12 @@ JS.mixin(CCLoader.prototype, { if (item) { var removed = this.removeItem(id); asset = item.content; + // TODO: AUDIO if (asset instanceof cc.Asset) { if (CC_JSB && asset instanceof cc.SpriteFrame && removed) { // for the "Temporary solution" in deserialize.js asset.release(); } - // Audio var urls = asset.rawUrls; for (var i = 0; i < urls.length; i++) { this.release(urls[i]); diff --git a/cocos2d/core/platform/CCAssetLibrary.js b/cocos2d/core/platform/CCAssetLibrary.js index 3e7580e6a8..86474e47a4 100644 --- a/cocos2d/core/platform/CCAssetLibrary.js +++ b/cocos2d/core/platform/CCAssetLibrary.js @@ -88,12 +88,12 @@ var AssetLibrary = { Editor.error('Sorry, the scene data of "%s" is corrupted!', uuid); } else { - // We know scene is not a raw asset, so we can pass uuid to this API directly - asset.scene.dependAssets = AutoReleaseUtils.getDependsRecursively(uuid); + var key = cc.loader._getReferenceKey(uuid); + asset.scene.dependAssets = AutoReleaseUtils.getDependsRecursively(key); } } if (CC_EDITOR || isScene(asset)) { - var id = cc.AssetLibrary._getAssetInfoInRuntime(uuid).url; + var id = cc.loader._getReferenceKey(uuid); Loader.removeItem(id); } } @@ -220,11 +220,11 @@ var AssetLibrary = { } else { if (asset.constructor === cc.SceneAsset) { - // We know scene is not a raw asset, so we can pass uuid to this API directly - asset.scene.dependAssets = AutoReleaseUtils.getDependsRecursively(randomUuid); + var key = cc.loader._getReferenceKey(randomUuid); + asset.scene.dependAssets = AutoReleaseUtils.getDependsRecursively(key); } if (CC_EDITOR || isScene(asset)) { - var id = cc.AssetLibrary._getAssetInfoInRuntime(randomUuid).url; + var id = cc.loader._getReferenceKey(randomUuid); Loader.removeItem(id); } }