daily pastebin goal
64%
SHARE
TWEET

Untitled

a guest Apr 15th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. _resolveSpine(entry: any) {
  2.         if(!entry.options || !entry.options.metadata || !entry.options.metadata.data)
  3.             return;
  4.         const pack = entry.options.metadata as IPacket;
  5.         if(pack.mime != "application/json")
  6.             return;
  7.  
  8.         const text = decodeURIComponent(pack.data.replace("data:application/json;,",""));
  9.         const json = JSON.parse(unescape(text));
  10.         if(!json.bones)
  11.             return;
  12.        
  13.         const path = pack.path;
  14.         const atlasPath = path.replace(".json", ".atlas");
  15.         const imagePath = path.replace(".json", ".png");
  16.        
  17.         const imageRes = this.bundle[imagePath].data;
  18.         const atlasRes = decodeURIComponent(this.bundle[atlasPath].data.replace("data:text/plain;,",""));
  19.        
  20.         const image = new Image();
  21.         image.src = imageRes;
  22.         entry.options.metadata.image = PIXI.BaseTexture.from(image);
  23.         entry.options.metadata.atlasRawData = atlasRes;
  24.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top