Jump to content

How load texture manually


swanrnd
 Share

Recommended Posts

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? 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...