Commit ddb14d82 authored by liujiaxin's avatar liujiaxin

2222

parent 0213f881
...@@ -323,6 +323,7 @@ let pg = { ...@@ -323,6 +323,7 @@ let pg = {
// if (err && !texture) return resolve(pg.logger.w('loading loadNetImg warn-> ' + texture)); // if (err && !texture) return resolve(pg.logger.w('loading loadNetImg warn-> ' + texture));
// resolve(texture); // resolve(texture);
// }); // });
console.log('loadNetImg', url)
if (url && typeof url == 'string') { if (url && typeof url == 'string') {
if (url.startsWith('http')) { if (url.startsWith('http')) {
cc.assetManager.loadRemote(url, (err, texture) => { cc.assetManager.loadRemote(url, (err, texture) => {
...@@ -330,7 +331,6 @@ let pg = { ...@@ -330,7 +331,6 @@ let pg = {
resolve(texture); resolve(texture);
}); });
} else { } else {
console.log('cc.resources.load', url)
const [uri, ext] = url.split('.'); const [uri, ext] = url.split('.');
cc.resources.load(uri, cc.Texture2D ,(a,b)=>{},(err, texture)=>{ cc.resources.load(uri, cc.Texture2D ,(a,b)=>{},(err, texture)=>{
if (err && !texture) return reject(pg.logger.w('loading cc.resources.load warn-> ' + texture)); if (err && !texture) return reject(pg.logger.w('loading cc.resources.load warn-> ' + texture));
...@@ -348,24 +348,28 @@ let pg = { ...@@ -348,24 +348,28 @@ let pg = {
// if (err && !texture) return resolve(pg.logger.w('loading loadNetImg warn-> ' + texture)); // if (err && !texture) return resolve(pg.logger.w('loading loadNetImg warn-> ' + texture));
// resolve(texture); // resolve(texture);
// }); // });
console.log('loadAsset', url)
if (typeof url !== 'string') { if (typeof url !== 'string') {
resolve(url); resolve(url);
} }
if (!option || Object.keys(option).length == 0) option = {type: cc.Texture2D}; if (url) {
if (url && typeof url == 'string' && url.startsWith('http')) { if (!option || Object.keys(option).length == 0) option = {type: cc.Texture2D};
cc.assetManager.loadRemote(url,option, (err, texture) => { if (typeof url == 'string' && url.startsWith('http')) {
if (err && !texture) return reject(pg.logger.w('loading loadNetImg warn-> ' + texture)); cc.assetManager.loadRemote(url,option, (err, texture) => {
resolve(texture); if (err && !texture) return reject(pg.logger.w('loading loadNetImg warn-> ' + texture));
}); resolve(texture);
} else { });
console.log('cc.resources.load', url) } else {
const [uri, ext] = url.split('.'); console.log('cc.resources.load', url)
cc.resources.load(uri, option.type ,(a,b)=>{},(err, texture)=>{ const [uri, ext] = url.split('.');
console.log(uri, option.type.name, err, texture ) cc.resources.load(uri, option.type ,(a,b)=>{},(err, texture)=>{
if (err && !texture) return reject(pg.logger.w('loading cc.resources.load warn-> ' + texture)); console.log(uri, option.type.name, err, texture )
resolve(texture); if (err && !texture) return reject(pg.logger.w('loading cc.resources.load warn-> ' + texture));
}); resolve(texture);
});
}
} }
}) })
}, },
/** /**
......
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