Commit ddb14d82 authored by liujiaxin's avatar liujiaxin

2222

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