Quantcast
Channel: Pixi.js Latest Topics
Viewing all articles
Browse latest Browse all 3978

How load texture manually

$
0
0

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? 


Viewing all articles
Browse latest Browse all 3978

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>