mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 13:13:43 +00:00
fixed multiatlas loader to support new TexturePacker atlas format introduced for Phaser 3
This commit is contained in:
parent
6b77ca6ae5
commit
22ecd23f09
3 changed files with 6 additions and 4 deletions
|
@ -656,7 +656,7 @@ var LoaderPlugin = new Class({
|
|||
// Yup, add them to the Texture Manager
|
||||
|
||||
// Is the data JSON Hash or JSON Array?
|
||||
if (Array.isArray(data[0].frames))
|
||||
if (Array.isArray(data[0].textures) || Array.isArray(data[0].frames))
|
||||
{
|
||||
textures.addAtlasJSONArray(key, images, data);
|
||||
}
|
||||
|
|
|
@ -314,9 +314,11 @@ var TextureManager = new Class({
|
|||
|
||||
if (Array.isArray(data))
|
||||
{
|
||||
for (var i = 0; i < data.length; i++)
|
||||
var singleAtlasFile = (data.length === 1); // multi-pack with one atlas file for all images
|
||||
for (var i = 0; i < texture.source.length; i++)
|
||||
{
|
||||
Parser.JSONArray(texture, i, data[i]);
|
||||
var atlasData = singleAtlasFile ? data[0] : data[i];
|
||||
Parser.JSONArray(texture, i, atlasData);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -34,7 +34,7 @@ var JSONArray = function (texture, sourceIndex, json)
|
|||
texture.add('__BASE', sourceIndex, 0, 0, source.width, source.height);
|
||||
|
||||
// By this stage frames is a fully parsed array
|
||||
var frames = (Array.isArray(json.textures)) ? json.textures[0].frames : json.frames;
|
||||
var frames = (Array.isArray(json.textures)) ? json.textures[sourceIndex].frames : json.frames;
|
||||
|
||||
var newFrame;
|
||||
|
||||
|
|
Loading…
Reference in a new issue