mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 16:12:40 +08:00
Fix loader reference key usage issue
This commit is contained in:
@@ -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]);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user