mirror of
https://github.com/photonstorm/phaser
synced 2024-11-17 02:08:40 +00:00
Now handles passing in pma to file loader
This commit is contained in:
parent
b44eb25a63
commit
0cff60c242
1 changed files with 22 additions and 27 deletions
|
@ -42,6 +42,7 @@ var TextFile = require('../../../src/loader/filetypes/TextFile.js');
|
||||||
* @param {(string|Phaser.Loader.FileTypes.UnityAtlasFileConfig)} key - The key to use for this file, or a file configuration object.
|
* @param {(string|Phaser.Loader.FileTypes.UnityAtlasFileConfig)} key - The key to use for this file, or a file configuration object.
|
||||||
* @param {string|string[]} [textureURL] - The absolute or relative URL to load the texture image file from. If undefined or `null` it will be set to `<key>.png`, i.e. if `key` was "alien" then the URL will be "alien.png".
|
* @param {string|string[]} [textureURL] - The absolute or relative URL to load the texture image file from. If undefined or `null` it will be set to `<key>.png`, i.e. if `key` was "alien" then the URL will be "alien.png".
|
||||||
* @param {string} [atlasURL] - The absolute or relative URL to load the texture atlas data file from. If undefined or `null` it will be set to `<key>.txt`, i.e. if `key` was "alien" then the URL will be "alien.txt".
|
* @param {string} [atlasURL] - The absolute or relative URL to load the texture atlas data file from. If undefined or `null` it will be set to `<key>.txt`, i.e. if `key` was "alien" then the URL will be "alien.txt".
|
||||||
|
* @param {boolean} [preMultipliedAlpha=false] -
|
||||||
* @param {XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings.
|
* @param {XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings.
|
||||||
* @param {XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas data file. Used in replacement of the Loaders default XHR Settings.
|
* @param {XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas data file. Used in replacement of the Loaders default XHR Settings.
|
||||||
*/
|
*/
|
||||||
|
@ -51,7 +52,7 @@ var SpineFile = new Class({
|
||||||
|
|
||||||
initialize:
|
initialize:
|
||||||
|
|
||||||
function SpineFile (loader, key, jsonURL, atlasURL, jsonXhrSettings, atlasXhrSettings)
|
function SpineFile (loader, key, jsonURL, atlasURL, preMultipliedAlpha, jsonXhrSettings, atlasXhrSettings)
|
||||||
{
|
{
|
||||||
var i;
|
var i;
|
||||||
var json;
|
var json;
|
||||||
|
@ -75,29 +76,24 @@ var SpineFile = new Class({
|
||||||
});
|
});
|
||||||
|
|
||||||
atlasURL = GetFastValue(config, 'atlasURL');
|
atlasURL = GetFastValue(config, 'atlasURL');
|
||||||
|
preMultipliedAlpha = GetFastValue(config, 'preMultipliedAlpha');
|
||||||
|
|
||||||
if (Array.isArray(atlasURL))
|
if (!Array.isArray(atlasURL))
|
||||||
{
|
{
|
||||||
|
atlasURL = [ atlasURL ];
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < atlasURL.length; i++)
|
for (i = 0; i < atlasURL.length; i++)
|
||||||
{
|
{
|
||||||
atlas = new TextFile(loader, {
|
atlas = new TextFile(loader, {
|
||||||
key: key,
|
key: key,
|
||||||
url: atlasURL[i],
|
url: atlasURL[i],
|
||||||
extension: GetFastValue(config, 'atlasExtension', 'atlas'),
|
extension: GetFastValue(config, 'atlasExtension', 'atlas'),
|
||||||
xhrSettings: GetFastValue(config, 'atlasXhrSettings')
|
xhrSettings: GetFastValue(config, 'atlasXhrSettings'),
|
||||||
});
|
});
|
||||||
|
|
||||||
files.push(atlas);
|
atlas.cache = cache;
|
||||||
}
|
// atlas.config.preMultipliedAlpha = preMultipliedAlpha;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
atlas = new TextFile(loader, {
|
|
||||||
key: key,
|
|
||||||
url: atlasURL,
|
|
||||||
extension: GetFastValue(config, 'atlasExtension', 'atlas'),
|
|
||||||
xhrSettings: GetFastValue(config, 'atlasXhrSettings')
|
|
||||||
});
|
|
||||||
|
|
||||||
files.push(atlas);
|
files.push(atlas);
|
||||||
}
|
}
|
||||||
|
@ -106,20 +102,16 @@ var SpineFile = new Class({
|
||||||
{
|
{
|
||||||
json = new JSONFile(loader, key, jsonURL, jsonXhrSettings);
|
json = new JSONFile(loader, key, jsonURL, jsonXhrSettings);
|
||||||
|
|
||||||
if (Array.isArray(atlasURL))
|
if (!Array.isArray(atlasURL))
|
||||||
{
|
{
|
||||||
|
atlasURL = [ atlasURL ];
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < atlasURL.length; i++)
|
for (i = 0; i < atlasURL.length; i++)
|
||||||
{
|
{
|
||||||
atlas = new TextFile(loader, key + '_' + i, atlasURL[i], atlasXhrSettings);
|
atlas = new TextFile(loader, key + '_' + i, atlasURL[i], atlasXhrSettings);
|
||||||
atlas.cache = cache;
|
atlas.cache = cache;
|
||||||
|
// atlas.config.preMultipliedAlpha = preMultipliedAlpha;
|
||||||
files.push(atlas);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
atlas = new TextFile(loader, key + '_0', atlasURL, atlasXhrSettings);
|
|
||||||
atlas.cache = cache;
|
|
||||||
|
|
||||||
files.push(atlas);
|
files.push(atlas);
|
||||||
}
|
}
|
||||||
|
@ -128,6 +120,8 @@ var SpineFile = new Class({
|
||||||
files.unshift(json);
|
files.unshift(json);
|
||||||
|
|
||||||
MultiFile.call(this, loader, 'spine', key, files);
|
MultiFile.call(this, loader, 'spine', key, files);
|
||||||
|
|
||||||
|
this.config.preMultipliedAlpha = preMultipliedAlpha;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -220,6 +214,7 @@ var SpineFile = new Class({
|
||||||
var atlasCache;
|
var atlasCache;
|
||||||
var atlasKey = '';
|
var atlasKey = '';
|
||||||
var combinedAtlastData = '';
|
var combinedAtlastData = '';
|
||||||
|
var preMultipliedAlpha = (this.config.preMultipliedAlpha) ? true : false;
|
||||||
|
|
||||||
for (var i = 1; i < this.files.length; i++)
|
for (var i = 1; i < this.files.length; i++)
|
||||||
{
|
{
|
||||||
|
@ -243,7 +238,7 @@ var SpineFile = new Class({
|
||||||
file.pendingDestroy();
|
file.pendingDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
atlasCache.add(atlasKey, combinedAtlastData);
|
atlasCache.add(atlasKey, { preMultipliedAlpha: preMultipliedAlpha, data: combinedAtlastData });
|
||||||
|
|
||||||
this.complete = true;
|
this.complete = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue