@esotericsoftware/spine-phaser-v3 4.2.93 → 4.2.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SpinePlugin.js +5 -2
- package/dist/esm/spine-phaser-v3.min.mjs +3 -3
- package/dist/esm/spine-phaser-v3.mjs +36 -7
- package/dist/esm/spine-phaser-v3.mjs.map +2 -2
- package/dist/iife/spine-phaser-v3.js +36 -7
- package/dist/iife/spine-phaser-v3.js.map +2 -2
- package/dist/iife/spine-phaser-v3.min.js +3 -3
- package/package.json +4 -4
|
@@ -5651,7 +5651,7 @@ var AssetManagerBase = class {
|
|
|
5651
5651
|
return blob ? createImageBitmap(blob, { premultiplyAlpha: "none", colorSpaceConversion: "none" }) : null;
|
|
5652
5652
|
}).then((bitmap) => {
|
|
5653
5653
|
if (bitmap) {
|
|
5654
|
-
const texture = this.
|
|
5654
|
+
const texture = this.createTexture(path, bitmap);
|
|
5655
5655
|
this.success(success, path, texture);
|
|
5656
5656
|
resolve(texture);
|
|
5657
5657
|
}
|
|
@@ -5661,7 +5661,7 @@ var AssetManagerBase = class {
|
|
|
5661
5661
|
let image = new Image();
|
|
5662
5662
|
image.crossOrigin = "anonymous";
|
|
5663
5663
|
image.onload = () => {
|
|
5664
|
-
const texture = this.
|
|
5664
|
+
const texture = this.createTexture(path, image);
|
|
5665
5665
|
this.success(success, path, texture);
|
|
5666
5666
|
resolve(texture);
|
|
5667
5667
|
};
|
|
@@ -5685,7 +5685,7 @@ var AssetManagerBase = class {
|
|
|
5685
5685
|
this.cache.assetsLoaded[path] = new Promise((resolve, reject) => {
|
|
5686
5686
|
this.downloader.downloadText(path, (atlasText) => {
|
|
5687
5687
|
try {
|
|
5688
|
-
|
|
5688
|
+
const atlas = this.createTextureAtlas(path, atlasText);
|
|
5689
5689
|
let toLoad = atlas.pages.length, abort = false;
|
|
5690
5690
|
for (let page of atlas.pages) {
|
|
5691
5691
|
this.loadTexture(
|
|
@@ -5729,7 +5729,7 @@ var AssetManagerBase = class {
|
|
|
5729
5729
|
this.cache.assetsLoaded[path] = new Promise((resolve, reject) => {
|
|
5730
5730
|
this.downloader.downloadText(path, (atlasText) => {
|
|
5731
5731
|
try {
|
|
5732
|
-
const atlas =
|
|
5732
|
+
const atlas = this.createTextureAtlas(path, atlasText);
|
|
5733
5733
|
this.success(success, path, atlas);
|
|
5734
5734
|
resolve(atlas);
|
|
5735
5735
|
} catch (e) {
|
|
@@ -5835,9 +5835,12 @@ var AssetManagerBase = class {
|
|
|
5835
5835
|
}
|
|
5836
5836
|
// dispose asset only if it's not used by others
|
|
5837
5837
|
disposeAsset(path) {
|
|
5838
|
-
|
|
5839
|
-
|
|
5838
|
+
const asset = this.cache.assets[path];
|
|
5839
|
+
if (asset instanceof TextureAtlas) {
|
|
5840
|
+
asset.dispose();
|
|
5841
|
+
return;
|
|
5840
5842
|
}
|
|
5843
|
+
this.disposeAssetInternal(path);
|
|
5841
5844
|
}
|
|
5842
5845
|
hasErrors() {
|
|
5843
5846
|
return Object.keys(this.errors).length > 0;
|
|
@@ -5845,6 +5848,30 @@ var AssetManagerBase = class {
|
|
|
5845
5848
|
getErrors() {
|
|
5846
5849
|
return this.errors;
|
|
5847
5850
|
}
|
|
5851
|
+
disposeAssetInternal(path) {
|
|
5852
|
+
if (this.cache.assetsRefCount[path] > 0 && --this.cache.assetsRefCount[path] === 0) {
|
|
5853
|
+
return this.remove(path);
|
|
5854
|
+
}
|
|
5855
|
+
}
|
|
5856
|
+
createTextureAtlas(path, atlasText) {
|
|
5857
|
+
const atlas = new TextureAtlas(atlasText);
|
|
5858
|
+
atlas.dispose = () => {
|
|
5859
|
+
if (this.cache.assetsRefCount[path] <= 0) return;
|
|
5860
|
+
this.disposeAssetInternal(path);
|
|
5861
|
+
for (const page of atlas.pages) {
|
|
5862
|
+
page.texture?.dispose();
|
|
5863
|
+
}
|
|
5864
|
+
};
|
|
5865
|
+
return atlas;
|
|
5866
|
+
}
|
|
5867
|
+
createTexture(path, image) {
|
|
5868
|
+
const texture = this.textureLoader(image);
|
|
5869
|
+
const textureDispose = texture.dispose.bind(texture);
|
|
5870
|
+
texture.dispose = () => {
|
|
5871
|
+
if (this.disposeAssetInternal(path)) textureDispose();
|
|
5872
|
+
};
|
|
5873
|
+
return texture;
|
|
5874
|
+
}
|
|
5848
5875
|
};
|
|
5849
5876
|
var AssetCache = class _AssetCache {
|
|
5850
5877
|
assets = {};
|
|
@@ -14728,7 +14755,9 @@ var SpineAtlasFile = class extends Phaser2.Loader.MultiFile {
|
|
|
14728
14755
|
textures.push(line);
|
|
14729
14756
|
}
|
|
14730
14757
|
}
|
|
14731
|
-
let
|
|
14758
|
+
let fileUrl = file.url;
|
|
14759
|
+
if (typeof fileUrl === "object") fileUrl = file.src;
|
|
14760
|
+
let basePath = (fileUrl.match(/^.*\//) ?? "").toString();
|
|
14732
14761
|
if (this.loader.path && this.loader.path.length > 0 && basePath.startsWith(this.loader.path))
|
|
14733
14762
|
basePath = basePath.slice(this.loader.path.length);
|
|
14734
14763
|
for (var i = 0; i < textures.length; i++) {
|