Commit ce32f4ac authored by rockyl's avatar rockyl

修复自定义模块链接的素材加载不到的问题

parent 0d95aa07
......@@ -61,7 +61,7 @@ export async function loadAssetsGroups(groups, onStart?, onFinish?) {
await loadAssetsGroup(depAssets, groupName, () => {
loaded++;
globalEvent.dispatchEvent('load-assets-process', {loaded, total})
}, ()=>{
}, () => {
globalEvent.dispatchEvent('load-assets-complete');
});
}
......@@ -113,14 +113,16 @@ export function loadAssets(config, onProgress?, onComplete?) {
return Promise.all(
config.map(assetConfig => {
assetsConfig.push(assetConfig);
if (assetConfig.url.indexOf(linkScheme) === 0) {
let linkUUID = assetConfig.url.replace(linkScheme, '');
assetConfig = getAssetByUUID(linkUUID);
}
if (assetConfig) {
const {url, ext, uuid} = assetConfig;
const loadFunc = loaderMapping[ext];
if (loadFunc) {
if (url.indexOf(linkScheme) === 0) {
loaded++;
onProgress && onProgress(loaded, total);
return Promise.resolve();
}
let method = globalLoader['load' + loadFunc];
return method.call(globalLoader, url, uuid).then(
(data) => {
......@@ -134,6 +136,13 @@ export function loadAssets(config, onProgress?, onComplete?) {
}
);
} else {
return p();
}
} else {
return p();
}
function p() {
loaded++;
onProgress && onProgress(loaded, total);
return Promise.resolve();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment