Add method refreshUrl in CCLoader for Editor.

This commit is contained in:
zhangbin
2016-06-16 11:51:33 +08:00
parent 0090606853
commit 941d4e145d
2 changed files with 23 additions and 0 deletions
+6
View File
@@ -490,4 +490,10 @@ JS.mixin(cc.loader, {
}
});
if (CC_EDITOR) {
cc.loader.refreshUrl = function (uuid, oldUrl, newUrl) {
this._items.refreshItemUrl(uuid, oldUrl, newUrl);
};
}
module.exports = cc.loader;
@@ -267,4 +267,21 @@ JS.mixin(LoadingItems.prototype, CallbacksInvoker.prototype, {
}
});
if (CC_EDITOR) {
LoadingItems.prototype.refreshItemUrl = function (id, oldUrl, newUrl) {
var item = this.map[id];
if (item) {
item.url = newUrl;
}
item = this.map[oldUrl];
if (item) {
item.id = newUrl;
item.url = newUrl;
this.map[newUrl] = item;
delete this.map[oldUrl];
}
};
}
module.exports = LoadingItems;