@eva/spine-base 2.0.0-beta.9 → 2.0.1-beta.0

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.
@@ -1,6 +1,6 @@
1
1
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- window.EVA = window.EVA || {};
3
- window.EVA.plugin = window.EVA.plugin || {};
2
+ globalThis.EVA = globalThis.EVA || {};
3
+ globalThis.EVA.plugin = globalThis.EVA.plugin || {};
4
4
  var _EVA_IIFE_spineBase = function (exports, eva_js, pluginRenderer, pixi_js) {
5
5
  'use strict';
6
6
  function __decorate(decorators, target, key, desc) {
@@ -140,7 +140,7 @@ var _EVA_IIFE_spineBase = function (exports, eva_js, pluginRenderer, pixi_js) {
140
140
  }
141
141
  setMix(from, to, duration) {
142
142
  if (!this.armature) ;else {
143
- this.armature.stateData.setMix(from, to, duration);
143
+ this.armature.state.data.setMix(from, to, duration);
144
144
  }
145
145
  }
146
146
  getAnim(track = 0) {
@@ -154,7 +154,7 @@ var _EVA_IIFE_spineBase = function (exports, eva_js, pluginRenderer, pixi_js) {
154
154
  }
155
155
  setDefaultMix(duration) {
156
156
  if (!this.armature) ;else {
157
- this.armature.stateData.defaultMix = duration;
157
+ this.armature.state.data.defaultMix = duration;
158
158
  }
159
159
  }
160
160
  setAttachment(slotName, attachmentName) {
@@ -194,19 +194,20 @@ var _EVA_IIFE_spineBase = function (exports, eva_js, pluginRenderer, pixi_js) {
194
194
  }
195
195
  function releaseTexture(imageSrc) {
196
196
  if (!imageSrc) return;
197
- setTimeout(() => {
197
+ setTimeout(() => __awaiter(this, void 0, void 0, function* () {
198
198
  const cache = texCache[imageSrc];
199
199
  if (cache) {
200
200
  cache.count--;
201
201
  if (cache.count <= 0) {
202
202
  if (cache.tex) {
203
+ yield pixi_js.Assets.unload(imageSrc);
203
204
  cache.tex.destroy(true);
204
205
  cache.tex = null;
205
206
  }
206
207
  delete texCache[imageSrc];
207
208
  }
208
209
  }
209
- }, 100);
210
+ }), 100);
210
211
  }
211
212
  let dataMap = {};
212
213
  function createSpineData(name, data, scale, pixiSpine) {
@@ -239,16 +240,28 @@ var _EVA_IIFE_spineBase = function (exports, eva_js, pluginRenderer, pixi_js) {
239
240
  return data.spineData;
240
241
  });
241
242
  }
242
- function releaseSpineData(resourceName, imageSrc) {
243
- const data = dataMap[resourceName];
244
- if (!data) {
245
- return;
246
- }
247
- data.ref--;
248
- if (data.ref <= 0) {
249
- releaseTexture(imageSrc);
250
- delete dataMap[resourceName];
251
- }
243
+ function releaseSpineData(res, imageSrc) {
244
+ return __awaiter(this, void 0, void 0, function* () {
245
+ const resourceName = res.name;
246
+ yield pixi_js.Assets.unload([res.src.image.url, res.src.atlas.url, res.src.ske.url]);
247
+ const resolver = pixi_js.Assets.resolver;
248
+ delete resolver._assetMap[res.src.image.url];
249
+ delete resolver._assetMap[res.src.atlas.url];
250
+ delete resolver._assetMap[res.src.ske.url];
251
+ delete resolver._resolverHash[res.src.image.url];
252
+ delete resolver._resolverHash[res.src.atlas.url];
253
+ delete resolver._resolverHash[res.src.ske.url];
254
+ const data = dataMap[resourceName];
255
+ if (!data) {
256
+ return;
257
+ }
258
+ data.ref--;
259
+ if (data.ref <= 0) {
260
+ releaseTexture(imageSrc);
261
+ eva_js.resource.destroy(resourceName);
262
+ delete dataMap[resourceName];
263
+ }
264
+ });
252
265
  }
253
266
  const MaxRetryCount = 20;
254
267
  let SpineSystem = class SpineSystem extends pluginRenderer.Renderer {
@@ -404,7 +417,7 @@ var _EVA_IIFE_spineBase = function (exports, eva_js, pluginRenderer, pixi_js) {
404
417
  this.add(changed);
405
418
  }
406
419
  remove(changed) {
407
- var _a, _b, _c, _d;
420
+ var _a, _b, _c, _d, _e, _f;
408
421
  return __awaiter(this, void 0, void 0, function* () {
409
422
  this.increaseAsyncId(changed.gameObject.id);
410
423
  const component = changed.component;
@@ -419,7 +432,8 @@ var _EVA_IIFE_spineBase = function (exports, eva_js, pluginRenderer, pixi_js) {
419
432
  children: true
420
433
  });
421
434
  const res = yield eva_js.resource.getResource(component.lastResource);
422
- releaseSpineData(res.name, (_d = (_c = res.data) === null || _c === void 0 ? void 0 : _c.image) === null || _d === void 0 ? void 0 : _d.src);
435
+ const imageSrc = ((_d = (_c = res.data) === null || _c === void 0 ? void 0 : _c.image) === null || _d === void 0 ? void 0 : _d.src) || ((_f = (_e = res.data) === null || _e === void 0 ? void 0 : _e.image) === null || _f === void 0 ? void 0 : _f.label);
436
+ yield releaseSpineData(res, imageSrc);
423
437
  }
424
438
  component.armature = null;
425
439
  delete this.armatures[changed.gameObject.id];
@@ -440,4 +454,4 @@ var _EVA_IIFE_spineBase = function (exports, eva_js, pluginRenderer, pixi_js) {
440
454
  });
441
455
  return exports;
442
456
  }({}, EVA, EVA.plugin.renderer, PIXI);
443
- window.EVA.plugin.spineBase = window.EVA.plugin.spineBase || _EVA_IIFE_spineBase;
457
+ globalThis.EVA.plugin.spineBase = globalThis.EVA.plugin.spineBase || _EVA_IIFE_spineBase;
@@ -1 +1 @@
1
- function _extends(){return _extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_extends.apply(null,arguments)}window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{};var _EVA_IIFE_spineBase=function(e,t,n,r){"use strict";function a(e,t,n,r){var a,i=arguments.length,o=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(o=(i<3?a(o):i>3?a(t,n,o):a(t,n))||o);return i>3&&o&&Object.defineProperty(t,n,o),o}function i(e,t,n,r){return new(n||(n=Promise))((function(a,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}c((r=r.apply(e,t||[])).next())}))}function o(e){return function(t,n){var r=function(e,t){return e.constructor.IDEProps||(e.constructor.IDEProps={}),e.constructor.IDEProps[t]||(e.constructor.IDEProps[t]={}),e.constructor.IDEProps[t]}(t,n);r.key=n,r.type=e}}class s extends t.Component{constructor(){super(...arguments),this.resource="",this.scale=1,this.animationName="",this.autoPlay=!0,this.waitExecuteInfos=[]}set armature(e){if(this._armature=e,e){this.autoPlay&&this.play(this.animationName);for(const e of this.waitExecuteInfos)if(e.playType){const{name:t,loop:n,track:r}=e;this.play(t,n,r)}else this.stop(e.track);this.waitExecuteInfos=[]}}get armature(){return this._armature}init(e){e&&_extends(this,e)}onDestroy(){this.destroied=!0}play(e,t,n){try{e&&(this.animationName=e),this.armature?(void 0===n&&(n=0),this.armature.state.setAnimation(n,this.animationName,t)):this.waitExecuteInfos.push({playType:!0,name:e,loop:null!=t?t:this.autoPlay,track:n})}catch(e){console.log(e)}}stop(e){this.armature?(void 0===e&&(e=0),this.armature.state.setEmptyAnimation(e,0)):this.waitExecuteInfos.push({playType:!1,track:e})}addAnimation(e,t,n,r){try{this.armature&&(void 0===r&&(r=0),this.armature.state.addAnimation(r,e,n,t))}catch(e){console.log(e)}}setMix(e,t,n){this.armature&&this.armature.stateData.setMix(e,t,n)}getAnim(e=0){try{if(this.armature)return this.armature.state.tracks[e].animation.name}catch(e){console.log(e)}}setDefaultMix(e){this.armature&&(this.armature.stateData.defaultMix=e)}setAttachment(e,t){this.armature&&this.armature.skeleton.setAttachment(e,t)}getBone(e){if(this.armature)return this.armature.skeleton.findBone(e)}}s.componentName="Spine",a([o("string")],s.prototype,"resource",void 0),a([o("number")],s.prototype,"scale",void 0),a([o("string")],s.prototype,"animationName",void 0),a([o("boolean")],s.prototype,"autoPlay",void 0);let c={};function u(e,t){let n=c[e];return n||(n=function(e){const t=e.image;return{tex:t instanceof r.Texture?t:r.Texture.from(t),count:0}}(t),c[e]=n),n.count++,n.tex}let m={};function d(e,t,n){return i(this,void 0,void 0,(function*(){let r=m[e.name];if(!r)if(e.complete)r=function(e,t,n,r){const a=t.ske,i=t.atlas,o=new r.AtlasAttachmentLoader(i),s=a instanceof Uint8Array?new r.SkeletonBinary(o):new r.SkeletonJson(o);s.scale=n||1;const c={spineData:s.readSkeletonData(a),ref:0,imageSrc:t.image.label};return m[e]=c,c}(e.name,e.data,t,n);else if(!r)return;return u(e.data.image.label,e.data),r.ref++,r.spineData}))}function l(e,t){const n=m[e];n&&(n.ref--,n.ref<=0&&(!function(e){e&&setTimeout((()=>{const t=c[e];t&&(t.count--,t.count<=0&&(t.tex&&(t.tex.destroy(!0),t.tex=null),delete c[e]))}),100)}(t),delete m[e]))}let p=class extends n.Renderer{constructor(){super(...arguments),this.armatures={}}init({pixiSpine:e}){this.renderSystem=this.game.getSystem(n.RendererSystem),this.renderSystem.rendererManager.register(this),this.pixiSpine=e,this.game.canvas.addEventListener("webglcontextrestored",(()=>{const e=this.game.gameObjects;let n=[];for(let r in this.armatures){const a=+r;for(let r=0;r<e.length;++r){let i=e[r];if(i.id===a){let e=i.getComponent(s);e&&(this.remove({type:t.OBSERVER_TYPE.REMOVE,gameObject:i,component:e,componentName:s.componentName}),n.push({type:t.OBSERVER_TYPE.ADD,gameObject:i,component:e,componentName:s.componentName}));break}}}setTimeout((()=>{n.forEach((e=>{this.add(e)}))}),1e3)}),!1)}update(e){for(let t in this.armatures)this.armatures[t].update(.001*e.deltaTime);super.update()}componentChanged(e){return i(this,void 0,void 0,(function*(){if("Spine"===e.componentName)if(e.type===t.OBSERVER_TYPE.ADD)this.add(e);else if(e.type===t.OBSERVER_TYPE.CHANGE){if("resource"===e.prop.prop[0])this.change(e)}else e.type===t.OBSERVER_TYPE.REMOVE&&this.remove(e)}))}add(e,n){var r,a;return i(this,void 0,void 0,(function*(){const i=e.component;clearTimeout(i.addHandler);const o=e.gameObject.id,s=this.increaseAsyncId(o),c=yield t.resource.getResource(i.resource);if(!this.validateAsyncId(o,s))return;const u=yield d(c,i.scale,this.pixiSpine);if(!this.validateAsyncId(o,s))return;if(!u)return void(i.addHandler=setTimeout((()=>{i.destroied||(void 0===n&&(n=20),--n>0?this.add(e,n):console.log("retry exceed max times",i.resource))}),1e3));this.remove(e);const m=null===(a=null===(r=this.renderSystem)||void 0===r?void 0:r.containerManager)||void 0===a?void 0:a.getContainer(e.gameObject.id);if(!m)return;i.lastResource=i.resource;const l=new this.pixiSpine.Spine({skeletonData:u,autoUpdate:!1});if(this.armatures[e.gameObject.id]=l,e.gameObject&&e.gameObject.transform){const t=e.gameObject.transform;l.x=t.size.width*t.origin.x,l.y=t.size.height*t.origin.y}m.addChildAt(l,0),l.update(),i.armature=l,i.emit("loaded",{resource:i.resource}),l.state.addListener({start:(e,t)=>{i.emit("start",{track:e,name:e.animation.name})},complete:(e,t)=>{i.emit("complete",{track:e,name:e.animation.name})},interrupt:(e,t)=>{i.emit("interrupt",{track:e,name:e.animation.name})},end:(e,t)=>{i.emit("end",{track:e,name:e.animation.name})},event:(e,t)=>{i.emit("event",e,t)}})}))}change(e){this.remove(e),this.add(e)}remove(e){var n,r,a,o;return i(this,void 0,void 0,(function*(){this.increaseAsyncId(e.gameObject.id);const i=e.component;clearTimeout(i.addHandler);const s=this.armatures[e.gameObject.id],c=null===(r=null===(n=this.renderSystem)||void 0===n?void 0:n.containerManager)||void 0===r?void 0:r.getContainer(e.gameObject.id);if(c&&s&&c.removeChild(s),i.armature){i.armature.destroy({children:!0});const e=yield t.resource.getResource(i.lastResource);l(e.name,null===(o=null===(a=e.data)||void 0===a?void 0:a.image)||void 0===o?void 0:o.src)}i.armature=null,delete this.armatures[e.gameObject.id],e.type,t.OBSERVER_TYPE.CHANGE}))}};p.systemName="SpineSystem",p=a([t.decorators.componentObserver({Spine:["resource"]})],p);var h=p;return t.resource.registerResourceType("SPINE"),e.Spine=s,e.SpineSystem=h,Object.defineProperty(e,"__esModule",{value:!0}),e}({},EVA,EVA.plugin.renderer,PIXI);window.EVA.plugin.spineBase=window.EVA.plugin.spineBase||_EVA_IIFE_spineBase;
1
+ function _extends(){return _extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)({}).hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},_extends.apply(null,arguments)}globalThis.EVA=globalThis.EVA||{},globalThis.EVA.plugin=globalThis.EVA.plugin||{};var _EVA_IIFE_spineBase=function(e,t,r,a){"use strict";function n(e,t,r,a){var n,i=arguments.length,s=i<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,r):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,a);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(s=(i<3?n(s):i>3?n(t,r,s):n(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s}function i(e,t,r,a){return new(r||(r=Promise))((function(n,i){function s(e){try{c(a.next(e))}catch(e){i(e)}}function o(e){try{c(a.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,o)}c((a=a.apply(e,t||[])).next())}))}function s(e){return function(t,r){var a=function(e,t){return e.constructor.IDEProps||(e.constructor.IDEProps={}),e.constructor.IDEProps[t]||(e.constructor.IDEProps[t]={}),e.constructor.IDEProps[t]}(t,r);a.key=r,a.type=e}}class o extends t.Component{constructor(){super(...arguments),this.resource="",this.scale=1,this.animationName="",this.autoPlay=!0,this.waitExecuteInfos=[]}set armature(e){if(this._armature=e,e){this.autoPlay&&this.play(this.animationName);for(const e of this.waitExecuteInfos)if(e.playType){const{name:t,loop:r,track:a}=e;this.play(t,r,a)}else this.stop(e.track);this.waitExecuteInfos=[]}}get armature(){return this._armature}init(e){e&&_extends(this,e)}onDestroy(){this.destroied=!0}play(e,t,r){try{e&&(this.animationName=e),this.armature?(void 0===r&&(r=0),this.armature.state.setAnimation(r,this.animationName,t)):this.waitExecuteInfos.push({playType:!0,name:e,loop:null!=t?t:this.autoPlay,track:r})}catch(e){console.log(e)}}stop(e){this.armature?(void 0===e&&(e=0),this.armature.state.setEmptyAnimation(e,0)):this.waitExecuteInfos.push({playType:!1,track:e})}addAnimation(e,t,r,a){try{this.armature&&(void 0===a&&(a=0),this.armature.state.addAnimation(a,e,r,t))}catch(e){console.log(e)}}setMix(e,t,r){this.armature&&this.armature.state.data.setMix(e,t,r)}getAnim(e=0){try{if(this.armature)return this.armature.state.tracks[e].animation.name}catch(e){console.log(e)}}setDefaultMix(e){this.armature&&(this.armature.state.data.defaultMix=e)}setAttachment(e,t){this.armature&&this.armature.skeleton.setAttachment(e,t)}getBone(e){if(this.armature)return this.armature.skeleton.findBone(e)}}o.componentName="Spine",n([s("string")],o.prototype,"resource",void 0),n([s("number")],o.prototype,"scale",void 0),n([s("string")],o.prototype,"animationName",void 0),n([s("boolean")],o.prototype,"autoPlay",void 0);let c={};function u(e,t){let r=c[e];return r||(r=function(e){const t=e.image;return{tex:t instanceof a.Texture?t:a.Texture.from(t),count:0}}(t),c[e]=r),r.count++,r.tex}let l={};function d(e,t,r){return i(this,void 0,void 0,(function*(){let a=l[e.name];if(!a)if(e.complete)a=function(e,t,r,a){const n=t.ske,i=t.atlas,s=new a.AtlasAttachmentLoader(i),o=n instanceof Uint8Array?new a.SkeletonBinary(s):new a.SkeletonJson(s);o.scale=r||1;const c={spineData:o.readSkeletonData(n),ref:0,imageSrc:t.image.label};return l[e]=c,c}(e.name,e.data,t,r);else if(!a)return;return u(e.data.image.label,e.data),a.ref++,a.spineData}))}function m(e,r){return i(this,void 0,void 0,(function*(){const n=e.name;yield a.Assets.unload([e.src.image.url,e.src.atlas.url,e.src.ske.url]);const s=a.Assets.resolver;delete s._assetMap[e.src.image.url],delete s._assetMap[e.src.atlas.url],delete s._assetMap[e.src.ske.url],delete s._resolverHash[e.src.image.url],delete s._resolverHash[e.src.atlas.url],delete s._resolverHash[e.src.ske.url];const o=l[n];o&&(o.ref--,o.ref<=0&&(!function(e){e&&setTimeout((()=>i(this,void 0,void 0,(function*(){const t=c[e];t&&(t.count--,t.count<=0&&(t.tex&&(yield a.Assets.unload(e),t.tex.destroy(!0),t.tex=null),delete c[e]))}))),100)}(r),t.resource.destroy(n),delete l[n]))}))}let h=class extends r.Renderer{constructor(){super(...arguments),this.armatures={}}init({pixiSpine:e}){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this),this.pixiSpine=e,this.game.canvas.addEventListener("webglcontextrestored",(()=>{const e=this.game.gameObjects;let r=[];for(let a in this.armatures){const n=+a;for(let a=0;a<e.length;++a){let i=e[a];if(i.id===n){let e=i.getComponent(o);e&&(this.remove({type:t.OBSERVER_TYPE.REMOVE,gameObject:i,component:e,componentName:o.componentName}),r.push({type:t.OBSERVER_TYPE.ADD,gameObject:i,component:e,componentName:o.componentName}));break}}}setTimeout((()=>{r.forEach((e=>{this.add(e)}))}),1e3)}),!1)}update(e){for(let t in this.armatures)this.armatures[t].update(.001*e.deltaTime);super.update()}componentChanged(e){return i(this,void 0,void 0,(function*(){if("Spine"===e.componentName)if(e.type===t.OBSERVER_TYPE.ADD)this.add(e);else if(e.type===t.OBSERVER_TYPE.CHANGE){if("resource"===e.prop.prop[0])this.change(e)}else e.type===t.OBSERVER_TYPE.REMOVE&&this.remove(e)}))}add(e,r){var a,n;return i(this,void 0,void 0,(function*(){const i=e.component;clearTimeout(i.addHandler);const s=e.gameObject.id,o=this.increaseAsyncId(s),c=yield t.resource.getResource(i.resource);if(!this.validateAsyncId(s,o))return;const u=yield d(c,i.scale,this.pixiSpine);if(!this.validateAsyncId(s,o))return;if(!u)return void(i.addHandler=setTimeout((()=>{i.destroied||(void 0===r&&(r=20),--r>0?this.add(e,r):console.log("retry exceed max times",i.resource))}),1e3));this.remove(e);const l=null===(n=null===(a=this.renderSystem)||void 0===a?void 0:a.containerManager)||void 0===n?void 0:n.getContainer(e.gameObject.id);if(!l)return;i.lastResource=i.resource;const m=new this.pixiSpine.Spine({skeletonData:u,autoUpdate:!1});if(this.armatures[e.gameObject.id]=m,e.gameObject&&e.gameObject.transform){const t=e.gameObject.transform;m.x=t.size.width*t.origin.x,m.y=t.size.height*t.origin.y}l.addChildAt(m,0),m.update(),i.armature=m,i.emit("loaded",{resource:i.resource}),m.state.addListener({start:(e,t)=>{i.emit("start",{track:e,name:e.animation.name})},complete:(e,t)=>{i.emit("complete",{track:e,name:e.animation.name})},interrupt:(e,t)=>{i.emit("interrupt",{track:e,name:e.animation.name})},end:(e,t)=>{i.emit("end",{track:e,name:e.animation.name})},event:(e,t)=>{i.emit("event",e,t)}})}))}change(e){this.remove(e),this.add(e)}remove(e){var r,a,n,s,o,c;return i(this,void 0,void 0,(function*(){this.increaseAsyncId(e.gameObject.id);const i=e.component;clearTimeout(i.addHandler);const u=this.armatures[e.gameObject.id],l=null===(a=null===(r=this.renderSystem)||void 0===r?void 0:r.containerManager)||void 0===a?void 0:a.getContainer(e.gameObject.id);if(l&&u&&l.removeChild(u),i.armature){i.armature.destroy({children:!0});const e=yield t.resource.getResource(i.lastResource),r=(null===(s=null===(n=e.data)||void 0===n?void 0:n.image)||void 0===s?void 0:s.src)||(null===(c=null===(o=e.data)||void 0===o?void 0:o.image)||void 0===c?void 0:c.label);yield m(e,r)}i.armature=null,delete this.armatures[e.gameObject.id],e.type,t.OBSERVER_TYPE.CHANGE}))}};h.systemName="SpineSystem",h=n([t.decorators.componentObserver({Spine:["resource"]})],h);var p=h;return t.resource.registerResourceType("SPINE"),e.Spine=o,e.SpineSystem=p,Object.defineProperty(e,"__esModule",{value:!0}),e}({},EVA,EVA.plugin.renderer,PIXI);globalThis.EVA.plugin.spineBase=globalThis.EVA.plugin.spineBase||_EVA_IIFE_spineBase;
@@ -130,7 +130,7 @@ class Spine extends eva_js.Component {
130
130
  setMix(from, to, duration) {
131
131
  if (!this.armature) ;
132
132
  else {
133
- this.armature.stateData.setMix(from, to, duration);
133
+ this.armature.state.data.setMix(from, to, duration);
134
134
  }
135
135
  }
136
136
  getAnim(track = 0) {
@@ -148,7 +148,7 @@ class Spine extends eva_js.Component {
148
148
  setDefaultMix(duration) {
149
149
  if (!this.armature) ;
150
150
  else {
151
- this.armature.stateData.defaultMix = duration;
151
+ this.armature.state.data.defaultMix = duration;
152
152
  }
153
153
  }
154
154
  setAttachment(slotName, attachmentName) {
@@ -198,19 +198,20 @@ function retainTexture(name, data) {
198
198
  function releaseTexture(imageSrc) {
199
199
  if (!imageSrc)
200
200
  return;
201
- setTimeout(() => {
201
+ setTimeout(() => __awaiter(this, void 0, void 0, function* () {
202
202
  const cache = texCache[imageSrc];
203
203
  if (cache) {
204
204
  cache.count--;
205
205
  if (cache.count <= 0) {
206
206
  if (cache.tex) {
207
+ yield pixi_js.Assets.unload(imageSrc);
207
208
  cache.tex.destroy(true);
208
209
  cache.tex = null;
209
210
  }
210
211
  delete texCache[imageSrc];
211
212
  }
212
213
  }
213
- }, 100);
214
+ }), 100);
214
215
  }
215
216
 
216
217
  let dataMap = {};
@@ -243,16 +244,28 @@ function getSpineData(res, scale, pixiSpine) {
243
244
  return data.spineData;
244
245
  });
245
246
  }
246
- function releaseSpineData(resourceName, imageSrc) {
247
- const data = dataMap[resourceName];
248
- if (!data) {
249
- return;
250
- }
251
- data.ref--;
252
- if (data.ref <= 0) {
253
- releaseTexture(imageSrc);
254
- delete dataMap[resourceName];
255
- }
247
+ function releaseSpineData(res, imageSrc) {
248
+ return __awaiter(this, void 0, void 0, function* () {
249
+ const resourceName = res.name;
250
+ yield pixi_js.Assets.unload([res.src.image.url, res.src.atlas.url, res.src.ske.url]);
251
+ const resolver = pixi_js.Assets.resolver;
252
+ delete resolver._assetMap[res.src.image.url];
253
+ delete resolver._assetMap[res.src.atlas.url];
254
+ delete resolver._assetMap[res.src.ske.url];
255
+ delete resolver._resolverHash[res.src.image.url];
256
+ delete resolver._resolverHash[res.src.atlas.url];
257
+ delete resolver._resolverHash[res.src.ske.url];
258
+ const data = dataMap[resourceName];
259
+ if (!data) {
260
+ return;
261
+ }
262
+ data.ref--;
263
+ if (data.ref <= 0) {
264
+ releaseTexture(imageSrc);
265
+ eva_js.resource.destroy(resourceName);
266
+ delete dataMap[resourceName];
267
+ }
268
+ });
256
269
  }
257
270
 
258
271
  const MaxRetryCount = 20;
@@ -398,7 +411,7 @@ let SpineSystem = class SpineSystem extends pluginRenderer.Renderer {
398
411
  this.add(changed);
399
412
  }
400
413
  remove(changed) {
401
- var _a, _b, _c, _d;
414
+ var _a, _b, _c, _d, _e, _f;
402
415
  return __awaiter(this, void 0, void 0, function* () {
403
416
  this.increaseAsyncId(changed.gameObject.id);
404
417
  const component = changed.component;
@@ -411,7 +424,8 @@ let SpineSystem = class SpineSystem extends pluginRenderer.Renderer {
411
424
  if (component.armature) {
412
425
  component.armature.destroy({ children: true });
413
426
  const res = yield eva_js.resource.getResource(component.lastResource);
414
- releaseSpineData(res.name, (_d = (_c = res.data) === null || _c === void 0 ? void 0 : _c.image) === null || _d === void 0 ? void 0 : _d.src);
427
+ const imageSrc = ((_d = (_c = res.data) === null || _c === void 0 ? void 0 : _c.image) === null || _d === void 0 ? void 0 : _d.src) || ((_f = (_e = res.data) === null || _e === void 0 ? void 0 : _e.image) === null || _f === void 0 ? void 0 : _f.label);
428
+ yield releaseSpineData(res, imageSrc);
415
429
  }
416
430
  component.armature = null;
417
431
  delete this.armatures[changed.gameObject.id];
@@ -13,4 +13,4 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
13
13
  See the Apache Version 2.0 License for specific language governing permissions
14
14
  and limitations under the License.
15
15
  ***************************************************************************** */
16
- function i(e,t,a,r){var i,n=arguments.length,o=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,a):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,a,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(n<3?i(o):n>3?i(t,a,o):i(t,a))||o);return n>3&&o&&Object.defineProperty(t,a,o),o}function n(e,t,a,r){return new(a||(a=Promise))((function(i,n){function o(e){try{c(r.next(e))}catch(e){n(e)}}function s(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){e.done?i(e.value):new a((function(t){t(e.value)})).then(o,s)}c((r=r.apply(e,t||[])).next())}))}class o extends e.Component{constructor(){super(...arguments),this.resource="",this.scale=1,this.animationName="",this.autoPlay=!0,this.waitExecuteInfos=[]}set armature(e){if(this._armature=e,e){this.autoPlay&&this.play(this.animationName);for(const e of this.waitExecuteInfos)if(e.playType){const{name:t,loop:a,track:r}=e;this.play(t,a,r)}else this.stop(e.track);this.waitExecuteInfos=[]}}get armature(){return this._armature}init(e){e&&Object.assign(this,e)}onDestroy(){this.destroied=!0}play(e,t,a){try{e&&(this.animationName=e),this.armature?(void 0===a&&(a=0),this.armature.state.setAnimation(a,this.animationName,t)):this.waitExecuteInfos.push({playType:!0,name:e,loop:null!=t?t:this.autoPlay,track:a})}catch(e){console.log(e)}}stop(e){this.armature?(void 0===e&&(e=0),this.armature.state.setEmptyAnimation(e,0)):this.waitExecuteInfos.push({playType:!1,track:e})}addAnimation(e,t,a,r){try{this.armature&&(void 0===r&&(r=0),this.armature.state.addAnimation(r,e,a,t))}catch(e){console.log(e)}}setMix(e,t,a){this.armature&&this.armature.stateData.setMix(e,t,a)}getAnim(e=0){try{if(this.armature)return this.armature.state.tracks[e].animation.name}catch(e){console.log(e)}}setDefaultMix(e){this.armature&&(this.armature.stateData.defaultMix=e)}setAttachment(e,t){this.armature&&this.armature.skeleton.setAttachment(e,t)}getBone(e){if(this.armature)return this.armature.skeleton.findBone(e)}}o.componentName="Spine",i([a.type("string")],o.prototype,"resource",void 0),i([a.type("number")],o.prototype,"scale",void 0),i([a.type("string")],o.prototype,"animationName",void 0),i([a.type("boolean")],o.prototype,"autoPlay",void 0);let s={};function c(e,t){let a=s[e];return a||(a=function(e){const t=e.image;return{tex:t instanceof r.Texture?t:r.Texture.from(t),count:0}}(t),s[e]=a),a.count++,a.tex}let m={};function u(e,t,a){return n(this,void 0,void 0,(function*(){let r=m[e.name];if(!r)if(e.complete)r=function(e,t,a,r){const i=t.ske,n=t.atlas,o=new r.AtlasAttachmentLoader(n),s=i instanceof Uint8Array?new r.SkeletonBinary(o):new r.SkeletonJson(o);s.scale=a||1;const c={spineData:s.readSkeletonData(i),ref:0,imageSrc:t.image.label};return m[e]=c,c}(e.name,e.data,t,a);else if(!r)return;return c(e.data.image.label,e.data),r.ref++,r.spineData}))}function d(e,t){const a=m[e];a&&(a.ref--,a.ref<=0&&(!function(e){e&&setTimeout((()=>{const t=s[e];t&&(t.count--,t.count<=0&&(t.tex&&(t.tex.destroy(!0),t.tex=null),delete s[e]))}),100)}(t),delete m[e]))}let l=class extends t.Renderer{constructor(){super(...arguments),this.armatures={}}init({pixiSpine:a}){this.renderSystem=this.game.getSystem(t.RendererSystem),this.renderSystem.rendererManager.register(this),this.pixiSpine=a,this.game.canvas.addEventListener("webglcontextrestored",(()=>{const t=this.game.gameObjects;let a=[];for(let r in this.armatures){const i=+r;for(let r=0;r<t.length;++r){let n=t[r];if(n.id===i){let t=n.getComponent(o);t&&(this.remove({type:e.OBSERVER_TYPE.REMOVE,gameObject:n,component:t,componentName:o.componentName}),a.push({type:e.OBSERVER_TYPE.ADD,gameObject:n,component:t,componentName:o.componentName}));break}}}setTimeout((()=>{a.forEach((e=>{this.add(e)}))}),1e3)}),!1)}update(e){for(let t in this.armatures)this.armatures[t].update(.001*e.deltaTime);super.update()}componentChanged(t){return n(this,void 0,void 0,(function*(){if("Spine"===t.componentName)if(t.type===e.OBSERVER_TYPE.ADD)this.add(t);else if(t.type===e.OBSERVER_TYPE.CHANGE){if("resource"===t.prop.prop[0])this.change(t)}else t.type===e.OBSERVER_TYPE.REMOVE&&this.remove(t)}))}add(t,a){var r,i;return n(this,void 0,void 0,(function*(){const n=t.component;clearTimeout(n.addHandler);const o=t.gameObject.id,s=this.increaseAsyncId(o),c=yield e.resource.getResource(n.resource);if(!this.validateAsyncId(o,s))return;const m=yield u(c,n.scale,this.pixiSpine);if(!this.validateAsyncId(o,s))return;if(!m)return void(n.addHandler=setTimeout((()=>{n.destroied||(void 0===a&&(a=20),--a>0?this.add(t,a):console.log("retry exceed max times",n.resource))}),1e3));this.remove(t);const d=null===(i=null===(r=this.renderSystem)||void 0===r?void 0:r.containerManager)||void 0===i?void 0:i.getContainer(t.gameObject.id);if(!d)return;n.lastResource=n.resource;const l=new this.pixiSpine.Spine({skeletonData:m,autoUpdate:!1});if(this.armatures[t.gameObject.id]=l,t.gameObject&&t.gameObject.transform){const e=t.gameObject.transform;l.x=e.size.width*e.origin.x,l.y=e.size.height*e.origin.y}d.addChildAt(l,0),l.update(),n.armature=l,n.emit("loaded",{resource:n.resource}),l.state.addListener({start:(e,t)=>{n.emit("start",{track:e,name:e.animation.name})},complete:(e,t)=>{n.emit("complete",{track:e,name:e.animation.name})},interrupt:(e,t)=>{n.emit("interrupt",{track:e,name:e.animation.name})},end:(e,t)=>{n.emit("end",{track:e,name:e.animation.name})},event:(e,t)=>{n.emit("event",e,t)}})}))}change(e){this.remove(e),this.add(e)}remove(t){var a,r,i,o;return n(this,void 0,void 0,(function*(){this.increaseAsyncId(t.gameObject.id);const n=t.component;clearTimeout(n.addHandler);const s=this.armatures[t.gameObject.id],c=null===(r=null===(a=this.renderSystem)||void 0===a?void 0:a.containerManager)||void 0===r?void 0:r.getContainer(t.gameObject.id);if(c&&s&&c.removeChild(s),n.armature){n.armature.destroy({children:!0});const t=yield e.resource.getResource(n.lastResource);d(t.name,null===(o=null===(i=t.data)||void 0===i?void 0:i.image)||void 0===o?void 0:o.src)}n.armature=null,delete this.armatures[t.gameObject.id],t.type,e.OBSERVER_TYPE.CHANGE}))}};l.systemName="SpineSystem",l=i([e.decorators.componentObserver({Spine:["resource"]})],l);var h=l;e.resource.registerResourceType("SPINE"),exports.Spine=o,exports.SpineSystem=h;
16
+ function i(e,t,a,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,a):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,a,r);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(s=(n<3?i(s):n>3?i(t,a,s):i(t,a))||s);return n>3&&s&&Object.defineProperty(t,a,s),s}function n(e,t,a,r){return new(a||(a=Promise))((function(i,n){function s(e){try{c(r.next(e))}catch(e){n(e)}}function o(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){e.done?i(e.value):new a((function(t){t(e.value)})).then(s,o)}c((r=r.apply(e,t||[])).next())}))}class s extends e.Component{constructor(){super(...arguments),this.resource="",this.scale=1,this.animationName="",this.autoPlay=!0,this.waitExecuteInfos=[]}set armature(e){if(this._armature=e,e){this.autoPlay&&this.play(this.animationName);for(const e of this.waitExecuteInfos)if(e.playType){const{name:t,loop:a,track:r}=e;this.play(t,a,r)}else this.stop(e.track);this.waitExecuteInfos=[]}}get armature(){return this._armature}init(e){e&&Object.assign(this,e)}onDestroy(){this.destroied=!0}play(e,t,a){try{e&&(this.animationName=e),this.armature?(void 0===a&&(a=0),this.armature.state.setAnimation(a,this.animationName,t)):this.waitExecuteInfos.push({playType:!0,name:e,loop:null!=t?t:this.autoPlay,track:a})}catch(e){console.log(e)}}stop(e){this.armature?(void 0===e&&(e=0),this.armature.state.setEmptyAnimation(e,0)):this.waitExecuteInfos.push({playType:!1,track:e})}addAnimation(e,t,a,r){try{this.armature&&(void 0===r&&(r=0),this.armature.state.addAnimation(r,e,a,t))}catch(e){console.log(e)}}setMix(e,t,a){this.armature&&this.armature.state.data.setMix(e,t,a)}getAnim(e=0){try{if(this.armature)return this.armature.state.tracks[e].animation.name}catch(e){console.log(e)}}setDefaultMix(e){this.armature&&(this.armature.state.data.defaultMix=e)}setAttachment(e,t){this.armature&&this.armature.skeleton.setAttachment(e,t)}getBone(e){if(this.armature)return this.armature.skeleton.findBone(e)}}s.componentName="Spine",i([a.type("string")],s.prototype,"resource",void 0),i([a.type("number")],s.prototype,"scale",void 0),i([a.type("string")],s.prototype,"animationName",void 0),i([a.type("boolean")],s.prototype,"autoPlay",void 0);let o={};function c(e,t){let a=o[e];return a||(a=function(e){const t=e.image;return{tex:t instanceof r.Texture?t:r.Texture.from(t),count:0}}(t),o[e]=a),a.count++,a.tex}let u={};function m(e,t,a){return n(this,void 0,void 0,(function*(){let r=u[e.name];if(!r)if(e.complete)r=function(e,t,a,r){const i=t.ske,n=t.atlas,s=new r.AtlasAttachmentLoader(n),o=i instanceof Uint8Array?new r.SkeletonBinary(s):new r.SkeletonJson(s);o.scale=a||1;const c={spineData:o.readSkeletonData(i),ref:0,imageSrc:t.image.label};return u[e]=c,c}(e.name,e.data,t,a);else if(!r)return;return c(e.data.image.label,e.data),r.ref++,r.spineData}))}function d(t,a){return n(this,void 0,void 0,(function*(){const i=t.name;yield r.Assets.unload([t.src.image.url,t.src.atlas.url,t.src.ske.url]);const s=r.Assets.resolver;delete s._assetMap[t.src.image.url],delete s._assetMap[t.src.atlas.url],delete s._assetMap[t.src.ske.url],delete s._resolverHash[t.src.image.url],delete s._resolverHash[t.src.atlas.url],delete s._resolverHash[t.src.ske.url];const c=u[i];c&&(c.ref--,c.ref<=0&&(!function(e){e&&setTimeout((()=>n(this,void 0,void 0,(function*(){const t=o[e];t&&(t.count--,t.count<=0&&(t.tex&&(yield r.Assets.unload(e),t.tex.destroy(!0),t.tex=null),delete o[e]))}))),100)}(a),e.resource.destroy(i),delete u[i]))}))}let l=class extends t.Renderer{constructor(){super(...arguments),this.armatures={}}init({pixiSpine:a}){this.renderSystem=this.game.getSystem(t.RendererSystem),this.renderSystem.rendererManager.register(this),this.pixiSpine=a,this.game.canvas.addEventListener("webglcontextrestored",(()=>{const t=this.game.gameObjects;let a=[];for(let r in this.armatures){const i=+r;for(let r=0;r<t.length;++r){let n=t[r];if(n.id===i){let t=n.getComponent(s);t&&(this.remove({type:e.OBSERVER_TYPE.REMOVE,gameObject:n,component:t,componentName:s.componentName}),a.push({type:e.OBSERVER_TYPE.ADD,gameObject:n,component:t,componentName:s.componentName}));break}}}setTimeout((()=>{a.forEach((e=>{this.add(e)}))}),1e3)}),!1)}update(e){for(let t in this.armatures)this.armatures[t].update(.001*e.deltaTime);super.update()}componentChanged(t){return n(this,void 0,void 0,(function*(){if("Spine"===t.componentName)if(t.type===e.OBSERVER_TYPE.ADD)this.add(t);else if(t.type===e.OBSERVER_TYPE.CHANGE){if("resource"===t.prop.prop[0])this.change(t)}else t.type===e.OBSERVER_TYPE.REMOVE&&this.remove(t)}))}add(t,a){var r,i;return n(this,void 0,void 0,(function*(){const n=t.component;clearTimeout(n.addHandler);const s=t.gameObject.id,o=this.increaseAsyncId(s),c=yield e.resource.getResource(n.resource);if(!this.validateAsyncId(s,o))return;const u=yield m(c,n.scale,this.pixiSpine);if(!this.validateAsyncId(s,o))return;if(!u)return void(n.addHandler=setTimeout((()=>{n.destroied||(void 0===a&&(a=20),--a>0?this.add(t,a):console.log("retry exceed max times",n.resource))}),1e3));this.remove(t);const d=null===(i=null===(r=this.renderSystem)||void 0===r?void 0:r.containerManager)||void 0===i?void 0:i.getContainer(t.gameObject.id);if(!d)return;n.lastResource=n.resource;const l=new this.pixiSpine.Spine({skeletonData:u,autoUpdate:!1});if(this.armatures[t.gameObject.id]=l,t.gameObject&&t.gameObject.transform){const e=t.gameObject.transform;l.x=e.size.width*e.origin.x,l.y=e.size.height*e.origin.y}d.addChildAt(l,0),l.update(),n.armature=l,n.emit("loaded",{resource:n.resource}),l.state.addListener({start:(e,t)=>{n.emit("start",{track:e,name:e.animation.name})},complete:(e,t)=>{n.emit("complete",{track:e,name:e.animation.name})},interrupt:(e,t)=>{n.emit("interrupt",{track:e,name:e.animation.name})},end:(e,t)=>{n.emit("end",{track:e,name:e.animation.name})},event:(e,t)=>{n.emit("event",e,t)}})}))}change(e){this.remove(e),this.add(e)}remove(t){var a,r,i,s,o,c;return n(this,void 0,void 0,(function*(){this.increaseAsyncId(t.gameObject.id);const n=t.component;clearTimeout(n.addHandler);const u=this.armatures[t.gameObject.id],m=null===(r=null===(a=this.renderSystem)||void 0===a?void 0:a.containerManager)||void 0===r?void 0:r.getContainer(t.gameObject.id);if(m&&u&&m.removeChild(u),n.armature){n.armature.destroy({children:!0});const t=yield e.resource.getResource(n.lastResource),a=(null===(s=null===(i=t.data)||void 0===i?void 0:i.image)||void 0===s?void 0:s.src)||(null===(c=null===(o=t.data)||void 0===o?void 0:o.image)||void 0===c?void 0:c.label);yield d(t,a)}n.armature=null,delete this.armatures[t.gameObject.id],t.type,e.OBSERVER_TYPE.CHANGE}))}};l.systemName="SpineSystem",l=i([e.decorators.componentObserver({Spine:["resource"]})],l);var h=l;e.resource.registerResourceType("SPINE"),exports.Spine=s,exports.SpineSystem=h;
@@ -1,7 +1,7 @@
1
- import { Component, OBSERVER_TYPE, decorators, resource } from '@eva/eva.js';
1
+ import { Component, resource, OBSERVER_TYPE, decorators } from '@eva/eva.js';
2
2
  import { Renderer, RendererSystem } from '@eva/plugin-renderer';
3
3
  import { type } from '@eva/inspector-decorator';
4
- import { Texture } from 'pixi.js';
4
+ import { Texture, Assets } from 'pixi.js';
5
5
 
6
6
  /*! *****************************************************************************
7
7
  Copyright (c) Microsoft Corporation. All rights reserved.
@@ -126,7 +126,7 @@ class Spine extends Component {
126
126
  setMix(from, to, duration) {
127
127
  if (!this.armature) ;
128
128
  else {
129
- this.armature.stateData.setMix(from, to, duration);
129
+ this.armature.state.data.setMix(from, to, duration);
130
130
  }
131
131
  }
132
132
  getAnim(track = 0) {
@@ -144,7 +144,7 @@ class Spine extends Component {
144
144
  setDefaultMix(duration) {
145
145
  if (!this.armature) ;
146
146
  else {
147
- this.armature.stateData.defaultMix = duration;
147
+ this.armature.state.data.defaultMix = duration;
148
148
  }
149
149
  }
150
150
  setAttachment(slotName, attachmentName) {
@@ -194,19 +194,20 @@ function retainTexture(name, data) {
194
194
  function releaseTexture(imageSrc) {
195
195
  if (!imageSrc)
196
196
  return;
197
- setTimeout(() => {
197
+ setTimeout(() => __awaiter(this, void 0, void 0, function* () {
198
198
  const cache = texCache[imageSrc];
199
199
  if (cache) {
200
200
  cache.count--;
201
201
  if (cache.count <= 0) {
202
202
  if (cache.tex) {
203
+ yield Assets.unload(imageSrc);
203
204
  cache.tex.destroy(true);
204
205
  cache.tex = null;
205
206
  }
206
207
  delete texCache[imageSrc];
207
208
  }
208
209
  }
209
- }, 100);
210
+ }), 100);
210
211
  }
211
212
 
212
213
  let dataMap = {};
@@ -239,16 +240,28 @@ function getSpineData(res, scale, pixiSpine) {
239
240
  return data.spineData;
240
241
  });
241
242
  }
242
- function releaseSpineData(resourceName, imageSrc) {
243
- const data = dataMap[resourceName];
244
- if (!data) {
245
- return;
246
- }
247
- data.ref--;
248
- if (data.ref <= 0) {
249
- releaseTexture(imageSrc);
250
- delete dataMap[resourceName];
251
- }
243
+ function releaseSpineData(res, imageSrc) {
244
+ return __awaiter(this, void 0, void 0, function* () {
245
+ const resourceName = res.name;
246
+ yield Assets.unload([res.src.image.url, res.src.atlas.url, res.src.ske.url]);
247
+ const resolver = Assets.resolver;
248
+ delete resolver._assetMap[res.src.image.url];
249
+ delete resolver._assetMap[res.src.atlas.url];
250
+ delete resolver._assetMap[res.src.ske.url];
251
+ delete resolver._resolverHash[res.src.image.url];
252
+ delete resolver._resolverHash[res.src.atlas.url];
253
+ delete resolver._resolverHash[res.src.ske.url];
254
+ const data = dataMap[resourceName];
255
+ if (!data) {
256
+ return;
257
+ }
258
+ data.ref--;
259
+ if (data.ref <= 0) {
260
+ releaseTexture(imageSrc);
261
+ resource.destroy(resourceName);
262
+ delete dataMap[resourceName];
263
+ }
264
+ });
252
265
  }
253
266
 
254
267
  const MaxRetryCount = 20;
@@ -394,7 +407,7 @@ let SpineSystem = class SpineSystem extends Renderer {
394
407
  this.add(changed);
395
408
  }
396
409
  remove(changed) {
397
- var _a, _b, _c, _d;
410
+ var _a, _b, _c, _d, _e, _f;
398
411
  return __awaiter(this, void 0, void 0, function* () {
399
412
  this.increaseAsyncId(changed.gameObject.id);
400
413
  const component = changed.component;
@@ -407,7 +420,8 @@ let SpineSystem = class SpineSystem extends Renderer {
407
420
  if (component.armature) {
408
421
  component.armature.destroy({ children: true });
409
422
  const res = yield resource.getResource(component.lastResource);
410
- releaseSpineData(res.name, (_d = (_c = res.data) === null || _c === void 0 ? void 0 : _c.image) === null || _d === void 0 ? void 0 : _d.src);
423
+ const imageSrc = ((_d = (_c = res.data) === null || _c === void 0 ? void 0 : _c.image) === null || _d === void 0 ? void 0 : _d.src) || ((_f = (_e = res.data) === null || _e === void 0 ? void 0 : _e.image) === null || _f === void 0 ? void 0 : _f.label);
424
+ yield releaseSpineData(res, imageSrc);
411
425
  }
412
426
  component.armature = null;
413
427
  delete this.armatures[changed.gameObject.id];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eva/spine-base",
3
- "version": "2.0.0-beta.9",
3
+ "version": "2.0.1-beta.0",
4
4
  "description": "@eva/spine-base",
5
5
  "main": "index.js",
6
6
  "module": "dist/spine-base.esm.js",
@@ -18,9 +18,9 @@
18
18
  "license": "MIT",
19
19
  "homepage": "https://eva.js.org",
20
20
  "dependencies": {
21
- "@eva/eva.js": "2.0.0-beta.9",
22
- "@eva/plugin-renderer": "2.0.0-beta.9",
21
+ "@eva/eva.js": "2.0.1-beta.0",
22
+ "@eva/plugin-renderer": "2.0.1-beta.0",
23
23
  "@eva/inspector-decorator": "^0.0.5",
24
- "pixi.js": "^8.6.5"
24
+ "pixi.js": "^8.8.1"
25
25
  }
26
26
  }