swanrnd Posted May 14, 2021 Share Posted May 14, 2021 Hello. I use pixiJS. But sometimes I have users with bad internet connection. if(is_preload) { if(typeof _user.system.res_list['1_texture'] === 'undefined' && typeof loader.resources['1_texture'] === 'undefined') { loader.add('1_texture', 'effect/1/0.png'); } if(typeof _user.system.res_list['1_json'] === 'undefined' && typeof loader.resources['1_json'] === 'undefined') { loader.add('1_json', 'effect/1/0.json', {xhrType: "text"}); } } else { if(typeof _user.system.res_list['1'] === 'undefined' && typeof loader.resources['1'] === 'undefined') { _user.system.res_list['1'] = new PIXI.Spritesheet(_user.system.res_list['1_texture'].texture, JSON.parse(_user.system.res_list['1_json'].data)); _user.system.res_list['1'].parse(function(){}); } } But I have a warnings: BaseTexture added to the cache with an id 1 that already had an entry Texture added to the cache with an id 1 that already had an entry. I want to do: 1) download png and json(from TexturePacker). 2) create texture from png and json. If I have failed request I want to repeat it. How can I do that? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted May 15, 2021 Share Posted May 15, 2021 yes, that's standard way to reload if users have bad connection as for warnings, ignore them. I cant really explain that thing - you either understand how pixi does cache through code, or you ignore it before you have a problem. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted May 15, 2021 Share Posted May 15, 2021 btw, there's onError or something like that in loader, author of `resource-loader` lib recommends to use it Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.