mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 16:12:40 +08:00
Add method refreshUrl in CCLoader for Editor.
This commit is contained in:
@@ -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;
|
||||
Reference in New Issue
Block a user