Merge branch 'dev' of https://github.com/GoodBoyDigital/pixi.js into dev
This commit is contained in:
parent
1536397391
commit
733aabf4fa
3 changed files with 4 additions and 110 deletions
|
@ -10859,47 +10859,9 @@ PIXI.SpriteSheetLoader.prototype.load = function () {
|
||||||
var jsonLoader = new PIXI.JsonLoader(this.url, this.crossorigin);
|
var jsonLoader = new PIXI.JsonLoader(this.url, this.crossorigin);
|
||||||
jsonLoader.addEventListener('loaded', function (event) {
|
jsonLoader.addEventListener('loaded', function (event) {
|
||||||
scope.json = event.content.json;
|
scope.json = event.content.json;
|
||||||
scope.onJSONLoaded();
|
|
||||||
});
|
|
||||||
jsonLoader.load();
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoke when JSON file is loaded
|
|
||||||
*
|
|
||||||
* @method onJSONLoaded
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
PIXI.SpriteSheetLoader.prototype.onJSONLoaded = function () {
|
|
||||||
var scope = this;
|
|
||||||
var textureUrl = this.baseUrl + this.json.meta.image;
|
|
||||||
var image = new PIXI.ImageLoader(textureUrl, this.crossorigin);
|
|
||||||
var frameData = this.json.frames;
|
|
||||||
|
|
||||||
this.texture = image.texture.baseTexture;
|
|
||||||
image.addEventListener('loaded', function () {
|
|
||||||
scope.onLoaded();
|
scope.onLoaded();
|
||||||
});
|
});
|
||||||
|
jsonLoader.load();
|
||||||
for (var i in frameData) {
|
|
||||||
var rect = frameData[i].frame;
|
|
||||||
if (rect) {
|
|
||||||
PIXI.TextureCache[i] = new PIXI.Texture(this.texture, {
|
|
||||||
x: rect.x,
|
|
||||||
y: rect.y,
|
|
||||||
width: rect.w,
|
|
||||||
height: rect.h
|
|
||||||
});
|
|
||||||
if (frameData[i].trimmed) {
|
|
||||||
//var realSize = frameData[i].spriteSourceSize;
|
|
||||||
PIXI.TextureCache[i].realSize = frameData[i].spriteSourceSize;
|
|
||||||
PIXI.TextureCache[i].trim.x = 0; // (realSize.x / rect.w)
|
|
||||||
// calculate the offset!
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
image.load();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11259,26 +11221,11 @@ PIXI.SpineLoader.prototype.load = function () {
|
||||||
var jsonLoader = new PIXI.JsonLoader(this.url, this.crossorigin);
|
var jsonLoader = new PIXI.JsonLoader(this.url, this.crossorigin);
|
||||||
jsonLoader.addEventListener("loaded", function (event) {
|
jsonLoader.addEventListener("loaded", function (event) {
|
||||||
scope.json = event.content.json;
|
scope.json = event.content.json;
|
||||||
scope.onJSONLoaded();
|
scope.onLoaded();
|
||||||
});
|
});
|
||||||
jsonLoader.load();
|
jsonLoader.load();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoke when JSON file is loaded
|
|
||||||
*
|
|
||||||
* @method onJSONLoaded
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
PIXI.SpineLoader.prototype.onJSONLoaded = function () {
|
|
||||||
var spineJsonParser = new spine.SkeletonJson();
|
|
||||||
var skeletonData = spineJsonParser.readSkeletonData(this.json);
|
|
||||||
|
|
||||||
PIXI.AnimCache[this.url] = skeletonData;
|
|
||||||
|
|
||||||
this.onLoaded();
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoke when JSON file is loaded
|
* Invoke when JSON file is loaded
|
||||||
*
|
*
|
||||||
|
|
|
@ -64,26 +64,11 @@ PIXI.SpineLoader.prototype.load = function () {
|
||||||
var jsonLoader = new PIXI.JsonLoader(this.url, this.crossorigin);
|
var jsonLoader = new PIXI.JsonLoader(this.url, this.crossorigin);
|
||||||
jsonLoader.addEventListener("loaded", function (event) {
|
jsonLoader.addEventListener("loaded", function (event) {
|
||||||
scope.json = event.content.json;
|
scope.json = event.content.json;
|
||||||
scope.onJSONLoaded();
|
scope.onLoaded();
|
||||||
});
|
});
|
||||||
jsonLoader.load();
|
jsonLoader.load();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoke when JSON file is loaded
|
|
||||||
*
|
|
||||||
* @method onJSONLoaded
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
PIXI.SpineLoader.prototype.onJSONLoaded = function () {
|
|
||||||
var spineJsonParser = new spine.SkeletonJson();
|
|
||||||
var skeletonData = spineJsonParser.readSkeletonData(this.json);
|
|
||||||
|
|
||||||
PIXI.AnimCache[this.url] = skeletonData;
|
|
||||||
|
|
||||||
this.onLoaded();
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoke when JSON file is loaded
|
* Invoke when JSON file is loaded
|
||||||
*
|
*
|
||||||
|
|
|
@ -80,47 +80,9 @@ PIXI.SpriteSheetLoader.prototype.load = function () {
|
||||||
var jsonLoader = new PIXI.JsonLoader(this.url, this.crossorigin);
|
var jsonLoader = new PIXI.JsonLoader(this.url, this.crossorigin);
|
||||||
jsonLoader.addEventListener('loaded', function (event) {
|
jsonLoader.addEventListener('loaded', function (event) {
|
||||||
scope.json = event.content.json;
|
scope.json = event.content.json;
|
||||||
scope.onJSONLoaded();
|
|
||||||
});
|
|
||||||
jsonLoader.load();
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoke when JSON file is loaded
|
|
||||||
*
|
|
||||||
* @method onJSONLoaded
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
PIXI.SpriteSheetLoader.prototype.onJSONLoaded = function () {
|
|
||||||
var scope = this;
|
|
||||||
var textureUrl = this.baseUrl + this.json.meta.image;
|
|
||||||
var image = new PIXI.ImageLoader(textureUrl, this.crossorigin);
|
|
||||||
var frameData = this.json.frames;
|
|
||||||
|
|
||||||
this.texture = image.texture.baseTexture;
|
|
||||||
image.addEventListener('loaded', function () {
|
|
||||||
scope.onLoaded();
|
scope.onLoaded();
|
||||||
});
|
});
|
||||||
|
jsonLoader.load();
|
||||||
for (var i in frameData) {
|
|
||||||
var rect = frameData[i].frame;
|
|
||||||
if (rect) {
|
|
||||||
PIXI.TextureCache[i] = new PIXI.Texture(this.texture, {
|
|
||||||
x: rect.x,
|
|
||||||
y: rect.y,
|
|
||||||
width: rect.w,
|
|
||||||
height: rect.h
|
|
||||||
});
|
|
||||||
if (frameData[i].trimmed) {
|
|
||||||
//var realSize = frameData[i].spriteSourceSize;
|
|
||||||
PIXI.TextureCache[i].realSize = frameData[i].spriteSourceSize;
|
|
||||||
PIXI.TextureCache[i].trim.x = 0; // (realSize.x / rect.w)
|
|
||||||
// calculate the offset!
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
image.load();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue