Herbert Posted January 16, 2019 Share Posted January 16, 2019 Hi there, How can I load a list of sprite sheet with different query string e.g. image01.json?a01 image01.png?a01 image02.json?b02 image02.png?b02 before I use PIXI.loader.defaultQueryString to handle query string, but it applies to all resources. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted January 16, 2019 Share Posted January 16, 2019 Hack https://github.com/pixijs/pixi.js/blob/v4.x/src/loaders/spritesheetParser.js that way it takes query string from parent resource url, then rebuild pixi. Or you can hack it in already built pixijs. Quote Link to comment Share on other sites More sharing options...
Exca Posted January 16, 2019 Share Posted January 16, 2019 I have done similar solution with code like this: function beforeSheetLoad(r,next){ if(r.name.indexOf("json_image") >= 0 && r.url.indexOf("?") == -1) { r.url += "?" + something; } else if(r.name.indexOf(".json") >= 0 && r.url.indexOf("?") == -1) { r.url += "?" + something; } next(); } loader = new Loader(); loader.pre(beforeSheetLoad); Quote Link to comment Share on other sites More sharing options...
Herbert Posted January 16, 2019 Author Share Posted January 16, 2019 I prefer hack it in already built pixijs, but I am not so familiar with hacking. It uses some imported file in the function, how can I deal with it? any instruction would be grateful. import { Resource } from 'resource-loader'; import url from 'url'; import { Spritesheet } from '../core'; Quote Link to comment Share on other sites More sharing options...
jonforum Posted January 16, 2019 Share Posted January 16, 2019 and another ways https://github.com/djmisterjon/PIXI.ProStageEditor/blob/2e81ffc12c1ec7f2646fd581a021e6086fcf5b7a/js/core/loaders.js#L203 Quote Link to comment Share on other sites More sharing options...
xerver Posted January 17, 2019 Share Posted January 17, 2019 The correct way to implement this would be through a proposed "subresource options" feature (https://github.com/englercj/resource-loader/issues/98) and the addition of a Resource-specific option for appending a query string. If you have better ideas for how this should work, please add them to: https://github.com/englercj/resource-loader/issues As always PRs are welcome for additional features that make your life easier. 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.