@eva/spine-base 2.0.1 → 2.0.2-beta.1

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 +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)}globalThis.EVA=globalThis.EVA||{},globalThis.EVA.plugin=globalThis.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.keepResource=!1,this._slotGameObjects=new Map,this._pendingSlotObjects=[],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{const r=null!=t?t:this.autoPlay;e&&(this.animationName=e),this.armature?(void 0===n&&(n=0),this.armature.state.setAnimation(n,this.animationName,r)):this.waitExecuteInfos.push({playType:!0,name:e,loop:r,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.state.data.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.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)}addSlotObject(e,t,n){if(!this.armature)return void console.warn("Spine armature is not ready, cannot addSlotObject");if(!this._containerManager)return void console.warn("ContainerManager is not available");const r=this._containerManager.getContainer(t.id);r?this._doAddSlotObject(e,t,r,n):this._pendingSlotObjects.push({slot:e,gameObject:t,options:n})}_doAddSlotObject(e,t,n,a){const i=new r.Container;i.addChild(n),this.armature.addSlotObject(e,i,a),this._slotGameObjects.set(t,{slot:e,wrapper:i}),this._syncTransformTree(t)}_syncTransformTree(e){var t;if(this._containerManager&&(this._containerManager.updateTransform({name:e.id,transform:e.transform}),null===(t=e.transform)||void 0===t?void 0:t.children))for(const t of e.transform.children)t.gameObject&&this._syncTransformTree(t.gameObject)}_flushPendingSlotObjects(){if(0===this._pendingSlotObjects.length)return;if(!this.armature||!this._containerManager)return;const e=[];for(const t of this._pendingSlotObjects){const n=this._containerManager.getContainer(t.gameObject.id);n?this._doAddSlotObject(t.slot,t.gameObject,n,t.options):e.push(t)}this._pendingSlotObjects=e}removeSlotObject(e){this._pendingSlotObjects=this._pendingSlotObjects.filter((t=>t.gameObject!==e));const t=this._slotGameObjects.get(e);t&&this.armature&&(this.armature.removeSlotObject(t.wrapper),t.wrapper.destroy({children:!1})),this._slotGameObjects.delete(e)}_destroySlotGameObjects(){for(const[e,t]of this._slotGameObjects)e.destroyed||(this.armature&&this.armature.removeSlotObject(t.wrapper),t.wrapper.destroy({children:!1}),e.destroy());this._slotGameObjects.clear(),this._pendingSlotObjects=[]}}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),a([o("boolean")],s.prototype,"keepResource",void 0);let c={};function d(e,t,n){return i(this,void 0,void 0,(function*(){let r=c[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 d={spineData:s.readSkeletonData(a),ref:0,imageSrc:t.image.label};return c[e]=d,d}(e.name,e.data,t,n);else if(!r)return;return r.ref++,r.spineData}))}let m=class extends n.Renderer{constructor(){super(...arguments),this.armatures={},this._spineComponents={}}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);for(let e in this._spineComponents)this._spineComponents[e]._flushPendingSlotObjects();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,o;return i(this,void 0,void 0,(function*(){const i=e.component;clearTimeout(i.addHandler);const s=e.gameObject.id,c=this.increaseAsyncId(s),m=yield t.resource.getResource(i.resource);if(!this.validateAsyncId(s,c))return;const l=yield d(m,i.scale,this.pixiSpine);if(!this.validateAsyncId(s,c))return;if(!l)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 u=null===(a=null===(r=this.renderSystem)||void 0===r?void 0:r.containerManager)||void 0===a?void 0:a.getContainer(e.gameObject.id);if(!u)return;i.lastResource=i.resource;const h=new this.pixiSpine.Spine({skeletonData:l,autoUpdate:!1});if(this.armatures[e.gameObject.id]=h,this._spineComponents[e.gameObject.id]=i,e.gameObject&&e.gameObject.transform){const t=e.gameObject.transform;h.x=t.size.width*t.origin.x,h.y=t.size.height*t.origin.y}u.addChildAt(h,0),h.update(),i._containerManager=null===(o=this.renderSystem)||void 0===o?void 0:o.containerManager,i.armature=h,i.emit("loaded",{resource:i.resource}),h.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,s,d;return i(this,void 0,void 0,(function*(){this.increaseAsyncId(e.gameObject.id);const m=e.component;clearTimeout(m.addHandler);const l=this.armatures[e.gameObject.id],u=null===(r=null===(n=this.renderSystem)||void 0===n?void 0:n.containerManager)||void 0===r?void 0:r.getContainer(e.gameObject.id);if(u&&l&&u.removeChild(l),m.armature&&(m._destroySlotGameObjects(),m.armature.destroy({children:!0}),!m.keepResource)){const e=yield t.resource.getResource(m.lastResource);(null===(o=null===(a=e.data)||void 0===a?void 0:a.image)||void 0===o?void 0:o.src)||null===(d=null===(s=e.data)||void 0===s?void 0:s.image)||void 0===d||d.label,function(e){const n=e.name,r=c[n];r&&(r.ref--,setTimeout((()=>i(this,void 0,void 0,(function*(){r.ref<=0&&(t.resource.destroy(n),delete c[n])}))),100))}(e)}m.armature=null,delete this.armatures[e.gameObject.id],delete this._spineComponents[e.gameObject.id],e.type,t.OBSERVER_TYPE.CHANGE}))}};m.systemName="SpineSystem",m=a([t.decorators.componentObserver({Spine:["resource"]})],m);var l=m;return t.resource.registerResourceType("SPINE"),e.Spine=s,e.SpineSystem=l,Object.defineProperty(e,"__esModule",{value:!0}),e}({},EVA,EVA.plugin.renderer,PIXI);globalThis.EVA.plugin.spineBase=globalThis.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 n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_extends.apply(null,arguments)}globalThis.EVA=globalThis.EVA||{},globalThis.EVA.plugin=globalThis.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.keepResource=!1,this._slotGameObjects=new Map,this._pendingSlotObjects=[],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{const r=null!=t?t:this.autoPlay;e&&(this.animationName=e),this.armature?(void 0===n&&(n=0),this.armature.state.setAnimation(n,this.animationName,r)):this.waitExecuteInfos.push({playType:!0,name:e,loop:r,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.state.data.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.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)}addSlotObject(e,t,n){if(!this.armature)return void console.warn("Spine armature is not ready, cannot addSlotObject");if(!this._containerManager)return void console.warn("ContainerManager is not available");const r=this._containerManager.getContainer(t.id);r?this._doAddSlotObject(e,t,r,n):this._pendingSlotObjects.push({slot:e,gameObject:t,options:n})}_doAddSlotObject(e,t,n,a){const i=new r.Container;i.addChild(n),this.armature.addSlotObject(e,i,a),this._slotGameObjects.set(t,{slot:e,wrapper:i}),this._syncTransformTree(t)}_syncTransformTree(e){var t;if(this._containerManager&&(this._containerManager.updateTransform({name:e.id,transform:e.transform}),null===(t=e.transform)||void 0===t?void 0:t.children))for(const t of e.transform.children)t.gameObject&&this._syncTransformTree(t.gameObject)}_flushPendingSlotObjects(){if(0===this._pendingSlotObjects.length)return;if(!this.armature||!this._containerManager)return;const e=[];for(const t of this._pendingSlotObjects){const n=this._containerManager.getContainer(t.gameObject.id);n?this._doAddSlotObject(t.slot,t.gameObject,n,t.options):e.push(t)}this._pendingSlotObjects=e}removeSlotObject(e){this._pendingSlotObjects=this._pendingSlotObjects.filter(t=>t.gameObject!==e);const t=this._slotGameObjects.get(e);t&&this.armature&&(this.armature.removeSlotObject(t.wrapper),t.wrapper.destroy({children:!1})),this._slotGameObjects.delete(e)}_destroySlotGameObjects(){for(const[e,t]of this._slotGameObjects)e.destroyed||(this.armature&&this.armature.removeSlotObject(t.wrapper),t.wrapper.destroy({children:!1}),e.destroy());this._slotGameObjects.clear(),this._pendingSlotObjects=[]}}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),a([o("boolean")],s.prototype,"keepResource",void 0);let c={};function d(e,t,n){return i(this,void 0,void 0,function*(){let r=c[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 d={spineData:s.readSkeletonData(a),ref:0,imageSrc:t.image.label};return c[e]=d,d}(e.name,e.data,t,n);else if(!r)return;return r.ref++,r.spineData})}let m=class extends n.Renderer{constructor(){super(...arguments),this.armatures={},this._spineComponents={}}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);for(let e in this._spineComponents)this._spineComponents[e]._flushPendingSlotObjects();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,o;return i(this,void 0,void 0,function*(){const i=e.component;clearTimeout(i.addHandler);const s=e.gameObject.id,c=this.increaseAsyncId(s),m=yield t.resource.getResource(i.resource);if(!this.validateAsyncId(s,c))return;const l=yield d(m,i.scale,this.pixiSpine);if(!this.validateAsyncId(s,c))return;if(!l)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 u=null===(a=null===(r=this.renderSystem)||void 0===r?void 0:r.containerManager)||void 0===a?void 0:a.getContainer(e.gameObject.id);if(!u)return;i.lastResource=i.resource;const h=new this.pixiSpine.Spine({skeletonData:l,autoUpdate:!1});if(this.armatures[e.gameObject.id]=h,this._spineComponents[e.gameObject.id]=i,e.gameObject&&e.gameObject.transform){const t=e.gameObject.transform;h.x=t.size.width*t.origin.x,h.y=t.size.height*t.origin.y}u.addChildAt(h,0),h.update(),i._containerManager=null===(o=this.renderSystem)||void 0===o?void 0:o.containerManager,i.armature=h,i.emit("loaded",{resource:i.resource}),h.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,s,d;return i(this,void 0,void 0,function*(){this.increaseAsyncId(e.gameObject.id);const m=e.component;clearTimeout(m.addHandler);const l=this.armatures[e.gameObject.id],u=null===(r=null===(n=this.renderSystem)||void 0===n?void 0:n.containerManager)||void 0===r?void 0:r.getContainer(e.gameObject.id);if(u&&l&&u.removeChild(l),m.armature&&(m._destroySlotGameObjects(),m.armature.destroy({children:!0}),!m.keepResource)){const e=yield t.resource.getResource(m.lastResource);(null===(o=null===(a=e.data)||void 0===a?void 0:a.image)||void 0===o?void 0:o.src)||null===(d=null===(s=e.data)||void 0===s?void 0:s.image)||void 0===d||d.label,function(e){const n=e.name,r=c[n];r&&(r.ref--,setTimeout(()=>i(this,void 0,void 0,function*(){r.ref<=0&&(t.resource.destroy(n),delete c[n])}),100))}(e)}m.armature=null,delete this.armatures[e.gameObject.id],delete this._spineComponents[e.gameObject.id],e.type,t.OBSERVER_TYPE.CHANGE})}};m.systemName="SpineSystem",m=a([t.decorators.componentObserver({Spine:["resource"]})],m);var l=m;return t.resource.registerResourceType("SPINE"),e.Spine=s,e.SpineSystem=l,Object.defineProperty(e,"__esModule",{value:!0}),e}({},EVA,EVA.plugin.renderer,PIXI);globalThis.EVA.plugin.spineBase=globalThis.EVA.plugin.spineBase||_EVA_IIFE_spineBase;
@@ -7,19 +7,19 @@ var pluginRenderer = require('@eva/plugin-renderer');
7
7
  var pixi_js = require('pixi.js');
8
8
  var inspectorDecorator = require('@eva/inspector-decorator');
9
9
 
10
- /*! *****************************************************************************
11
- Copyright (c) Microsoft Corporation. All rights reserved.
12
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
13
- this file except in compliance with the License. You may obtain a copy of the
14
- License at http://www.apache.org/licenses/LICENSE-2.0
10
+ /******************************************************************************
11
+ Copyright (c) Microsoft Corporation.
15
12
 
16
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
18
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
19
- MERCHANTABLITY OR NON-INFRINGEMENT.
13
+ Permission to use, copy, modify, and/or distribute this software for any
14
+ purpose with or without fee is hereby granted.
20
15
 
21
- See the Apache Version 2.0 License for specific language governing permissions
22
- and limitations under the License.
16
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
17
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
18
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
19
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
20
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
21
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22
+ PERFORMANCE OF THIS SOFTWARE.
23
23
  ***************************************************************************** */
24
24
 
25
25
  function __decorate(decorators, target, key, desc) {
@@ -30,13 +30,19 @@ function __decorate(decorators, target, key, desc) {
30
30
  }
31
31
 
32
32
  function __awaiter(thisArg, _arguments, P, generator) {
33
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
33
34
  return new (P || (P = Promise))(function (resolve, reject) {
34
35
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
35
36
  function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
36
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
37
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
37
38
  step((generator = generator.apply(thisArg, _arguments || [])).next());
38
39
  });
39
- }
40
+ }
41
+
42
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
43
+ var e = new Error(message);
44
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
45
+ };
40
46
 
41
47
  /**
42
48
  * Spine 骨骼动画组件
@@ -1,16 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@eva/eva.js"),t=require("@eva/plugin-renderer"),n=require("pixi.js"),a=require("@eva/inspector-decorator");
2
- /*! *****************************************************************************
3
- Copyright (c) Microsoft Corporation. All rights reserved.
4
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
5
- this file except in compliance with the License. You may obtain a copy of the
6
- License at http://www.apache.org/licenses/LICENSE-2.0
7
-
8
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
9
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
10
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
11
- MERCHANTABLITY OR NON-INFRINGEMENT.
12
-
13
- See the Apache Version 2.0 License for specific language governing permissions
14
- and limitations under the License.
15
- ***************************************************************************** */
16
- function r(e,t,n,a){var r,i=arguments.length,o=i<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(o=(i<3?r(o):i>3?r(t,n,o):r(t,n))||o);return i>3&&o&&Object.defineProperty(t,n,o),o}function i(e,t,n,a){return new(n||(n=Promise))((function(r,i){function o(e){try{c(a.next(e))}catch(e){i(e)}}function s(e){try{c(a.throw(e))}catch(e){i(e)}}function c(e){e.done?r(e.value):new n((function(t){t(e.value)})).then(o,s)}c((a=a.apply(e,t||[])).next())}))}class o extends e.Component{constructor(){super(...arguments),this.resource="",this.scale=1,this.animationName="",this.autoPlay=!0,this.keepResource=!1,this._slotGameObjects=new Map,this._pendingSlotObjects=[],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:a}=e;this.play(t,n,a)}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,n){try{const a=null!=t?t:this.autoPlay;e&&(this.animationName=e),this.armature?(void 0===n&&(n=0),this.armature.state.setAnimation(n,this.animationName,a)):this.waitExecuteInfos.push({playType:!0,name:e,loop:a,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,a){try{this.armature&&(void 0===a&&(a=0),this.armature.state.addAnimation(a,e,n,t))}catch(e){console.log(e)}}setMix(e,t,n){this.armature&&this.armature.state.data.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.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)}addSlotObject(e,t,n){if(!this.armature)return void console.warn("Spine armature is not ready, cannot addSlotObject");if(!this._containerManager)return void console.warn("ContainerManager is not available");const a=this._containerManager.getContainer(t.id);a?this._doAddSlotObject(e,t,a,n):this._pendingSlotObjects.push({slot:e,gameObject:t,options:n})}_doAddSlotObject(e,t,a,r){const i=new n.Container;i.addChild(a),this.armature.addSlotObject(e,i,r),this._slotGameObjects.set(t,{slot:e,wrapper:i}),this._syncTransformTree(t)}_syncTransformTree(e){var t;if(this._containerManager&&(this._containerManager.updateTransform({name:e.id,transform:e.transform}),null===(t=e.transform)||void 0===t?void 0:t.children))for(const t of e.transform.children)t.gameObject&&this._syncTransformTree(t.gameObject)}_flushPendingSlotObjects(){if(0===this._pendingSlotObjects.length)return;if(!this.armature||!this._containerManager)return;const e=[];for(const t of this._pendingSlotObjects){const n=this._containerManager.getContainer(t.gameObject.id);n?this._doAddSlotObject(t.slot,t.gameObject,n,t.options):e.push(t)}this._pendingSlotObjects=e}removeSlotObject(e){this._pendingSlotObjects=this._pendingSlotObjects.filter((t=>t.gameObject!==e));const t=this._slotGameObjects.get(e);t&&this.armature&&(this.armature.removeSlotObject(t.wrapper),t.wrapper.destroy({children:!1})),this._slotGameObjects.delete(e)}_destroySlotGameObjects(){for(const[e,t]of this._slotGameObjects)e.destroyed||(this.armature&&this.armature.removeSlotObject(t.wrapper),t.wrapper.destroy({children:!1}),e.destroy());this._slotGameObjects.clear(),this._pendingSlotObjects=[]}}o.componentName="Spine",r([a.type("string")],o.prototype,"resource",void 0),r([a.type("number")],o.prototype,"scale",void 0),r([a.type("string")],o.prototype,"animationName",void 0),r([a.type("boolean")],o.prototype,"autoPlay",void 0),r([a.type("boolean")],o.prototype,"keepResource",void 0);let s={};function c(e,t,n){return i(this,void 0,void 0,(function*(){let a=s[e.name];if(!a)if(e.complete)a=function(e,t,n,a){const r=t.ske,i=t.atlas,o=new a.AtlasAttachmentLoader(i),c=r instanceof Uint8Array?new a.SkeletonBinary(o):new a.SkeletonJson(o);c.scale=n||1;const d={spineData:c.readSkeletonData(r),ref:0,imageSrc:t.image.label};return s[e]=d,d}(e.name,e.data,t,n);else if(!a)return;return a.ref++,a.spineData}))}let d=class extends t.Renderer{constructor(){super(...arguments),this.armatures={},this._spineComponents={}}init({pixiSpine:n}){this.renderSystem=this.game.getSystem(t.RendererSystem),this.renderSystem.rendererManager.register(this),this.pixiSpine=n,this.game.canvas.addEventListener("webglcontextrestored",(()=>{const t=this.game.gameObjects;let n=[];for(let a in this.armatures){const r=+a;for(let a=0;a<t.length;++a){let i=t[a];if(i.id===r){let t=i.getComponent(o);t&&(this.remove({type:e.OBSERVER_TYPE.REMOVE,gameObject:i,component:t,componentName:o.componentName}),n.push({type:e.OBSERVER_TYPE.ADD,gameObject:i,component:t,componentName:o.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);for(let e in this._spineComponents)this._spineComponents[e]._flushPendingSlotObjects();super.update()}componentChanged(t){return i(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,n){var a,r,o;return i(this,void 0,void 0,(function*(){const i=t.component;clearTimeout(i.addHandler);const s=t.gameObject.id,d=this.increaseAsyncId(s),m=yield e.resource.getResource(i.resource);if(!this.validateAsyncId(s,d))return;const l=yield c(m,i.scale,this.pixiSpine);if(!this.validateAsyncId(s,d))return;if(!l)return void(i.addHandler=setTimeout((()=>{i.destroied||(void 0===n&&(n=20),--n>0?this.add(t,n):console.log("retry exceed max times",i.resource))}),1e3));this.remove(t);const u=null===(r=null===(a=this.renderSystem)||void 0===a?void 0:a.containerManager)||void 0===r?void 0:r.getContainer(t.gameObject.id);if(!u)return;i.lastResource=i.resource;const h=new this.pixiSpine.Spine({skeletonData:l,autoUpdate:!1});if(this.armatures[t.gameObject.id]=h,this._spineComponents[t.gameObject.id]=i,t.gameObject&&t.gameObject.transform){const e=t.gameObject.transform;h.x=e.size.width*e.origin.x,h.y=e.size.height*e.origin.y}u.addChildAt(h,0),h.update(),i._containerManager=null===(o=this.renderSystem)||void 0===o?void 0:o.containerManager,i.armature=h,i.emit("loaded",{resource:i.resource}),h.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(t){var n,a,r,o,c,d;return i(this,void 0,void 0,(function*(){this.increaseAsyncId(t.gameObject.id);const m=t.component;clearTimeout(m.addHandler);const l=this.armatures[t.gameObject.id],u=null===(a=null===(n=this.renderSystem)||void 0===n?void 0:n.containerManager)||void 0===a?void 0:a.getContainer(t.gameObject.id);if(u&&l&&u.removeChild(l),m.armature&&(m._destroySlotGameObjects(),m.armature.destroy({children:!0}),!m.keepResource)){const t=yield e.resource.getResource(m.lastResource);(null===(o=null===(r=t.data)||void 0===r?void 0:r.image)||void 0===o?void 0:o.src)||null===(d=null===(c=t.data)||void 0===c?void 0:c.image)||void 0===d||d.label,function(t){const n=t.name,a=s[n];a&&(a.ref--,setTimeout((()=>i(this,void 0,void 0,(function*(){a.ref<=0&&(e.resource.destroy(n),delete s[n])}))),100))}(t)}m.armature=null,delete this.armatures[t.gameObject.id],delete this._spineComponents[t.gameObject.id],t.type,e.OBSERVER_TYPE.CHANGE}))}};d.systemName="SpineSystem",d=r([e.decorators.componentObserver({Spine:["resource"]})],d);var m=d;e.resource.registerResourceType("SPINE"),exports.Spine=o,exports.SpineSystem=m;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@eva/eva.js"),t=require("@eva/plugin-renderer"),r=require("pixi.js"),n=require("@eva/inspector-decorator");function a(e,t,r,n){var a,i=arguments.length,o=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(o=(i<3?a(o):i>3?a(t,r,o):a(t,r))||o);return i>3&&o&&Object.defineProperty(t,r,o),o}function i(e,t,r,n){return new(r||(r=Promise))(function(a,i){function o(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,s)}c((n=n.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;class o extends e.Component{constructor(){super(...arguments),this.resource="",this.scale=1,this.animationName="",this.autoPlay=!0,this.keepResource=!1,this._slotGameObjects=new Map,this._pendingSlotObjects=[],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:n}=e;this.play(t,r,n)}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,r){try{const n=null!=t?t:this.autoPlay;e&&(this.animationName=e),this.armature?(void 0===r&&(r=0),this.armature.state.setAnimation(r,this.animationName,n)):this.waitExecuteInfos.push({playType:!0,name:e,loop:n,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,n){try{this.armature&&(void 0===n&&(n=0),this.armature.state.addAnimation(n,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)}addSlotObject(e,t,r){if(!this.armature)return void console.warn("Spine armature is not ready, cannot addSlotObject");if(!this._containerManager)return void console.warn("ContainerManager is not available");const n=this._containerManager.getContainer(t.id);n?this._doAddSlotObject(e,t,n,r):this._pendingSlotObjects.push({slot:e,gameObject:t,options:r})}_doAddSlotObject(e,t,n,a){const i=new r.Container;i.addChild(n),this.armature.addSlotObject(e,i,a),this._slotGameObjects.set(t,{slot:e,wrapper:i}),this._syncTransformTree(t)}_syncTransformTree(e){var t;if(this._containerManager&&(this._containerManager.updateTransform({name:e.id,transform:e.transform}),null===(t=e.transform)||void 0===t?void 0:t.children))for(const t of e.transform.children)t.gameObject&&this._syncTransformTree(t.gameObject)}_flushPendingSlotObjects(){if(0===this._pendingSlotObjects.length)return;if(!this.armature||!this._containerManager)return;const e=[];for(const t of this._pendingSlotObjects){const r=this._containerManager.getContainer(t.gameObject.id);r?this._doAddSlotObject(t.slot,t.gameObject,r,t.options):e.push(t)}this._pendingSlotObjects=e}removeSlotObject(e){this._pendingSlotObjects=this._pendingSlotObjects.filter(t=>t.gameObject!==e);const t=this._slotGameObjects.get(e);t&&this.armature&&(this.armature.removeSlotObject(t.wrapper),t.wrapper.destroy({children:!1})),this._slotGameObjects.delete(e)}_destroySlotGameObjects(){for(const[e,t]of this._slotGameObjects)e.destroyed||(this.armature&&this.armature.removeSlotObject(t.wrapper),t.wrapper.destroy({children:!1}),e.destroy());this._slotGameObjects.clear(),this._pendingSlotObjects=[]}}o.componentName="Spine",a([n.type("string")],o.prototype,"resource",void 0),a([n.type("number")],o.prototype,"scale",void 0),a([n.type("string")],o.prototype,"animationName",void 0),a([n.type("boolean")],o.prototype,"autoPlay",void 0),a([n.type("boolean")],o.prototype,"keepResource",void 0);let s={};function c(e,t,r){return i(this,void 0,void 0,function*(){let n=s[e.name];if(!n)if(e.complete)n=function(e,t,r,n){const a=t.ske,i=t.atlas,o=new n.AtlasAttachmentLoader(i),c=a instanceof Uint8Array?new n.SkeletonBinary(o):new n.SkeletonJson(o);c.scale=r||1;const d={spineData:c.readSkeletonData(a),ref:0,imageSrc:t.image.label};return s[e]=d,d}(e.name,e.data,t,r);else if(!n)return;return n.ref++,n.spineData})}let d=class extends t.Renderer{constructor(){super(...arguments),this.armatures={},this._spineComponents={}}init({pixiSpine:r}){this.renderSystem=this.game.getSystem(t.RendererSystem),this.renderSystem.rendererManager.register(this),this.pixiSpine=r,this.game.canvas.addEventListener("webglcontextrestored",()=>{const t=this.game.gameObjects;let r=[];for(let n in this.armatures){const a=+n;for(let n=0;n<t.length;++n){let i=t[n];if(i.id===a){let t=i.getComponent(o);t&&(this.remove({type:e.OBSERVER_TYPE.REMOVE,gameObject:i,component:t,componentName:o.componentName}),r.push({type:e.OBSERVER_TYPE.ADD,gameObject:i,component:t,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);for(let e in this._spineComponents)this._spineComponents[e]._flushPendingSlotObjects();super.update()}componentChanged(t){return i(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,r){var n,a,o;return i(this,void 0,void 0,function*(){const i=t.component;clearTimeout(i.addHandler);const s=t.gameObject.id,d=this.increaseAsyncId(s),m=yield e.resource.getResource(i.resource);if(!this.validateAsyncId(s,d))return;const l=yield c(m,i.scale,this.pixiSpine);if(!this.validateAsyncId(s,d))return;if(!l)return void(i.addHandler=setTimeout(()=>{i.destroied||(void 0===r&&(r=20),--r>0?this.add(t,r):console.log("retry exceed max times",i.resource))},1e3));this.remove(t);const u=null===(a=null===(n=this.renderSystem)||void 0===n?void 0:n.containerManager)||void 0===a?void 0:a.getContainer(t.gameObject.id);if(!u)return;i.lastResource=i.resource;const h=new this.pixiSpine.Spine({skeletonData:l,autoUpdate:!1});if(this.armatures[t.gameObject.id]=h,this._spineComponents[t.gameObject.id]=i,t.gameObject&&t.gameObject.transform){const e=t.gameObject.transform;h.x=e.size.width*e.origin.x,h.y=e.size.height*e.origin.y}u.addChildAt(h,0),h.update(),i._containerManager=null===(o=this.renderSystem)||void 0===o?void 0:o.containerManager,i.armature=h,i.emit("loaded",{resource:i.resource}),h.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(t){var r,n,a,o,c,d;return i(this,void 0,void 0,function*(){this.increaseAsyncId(t.gameObject.id);const m=t.component;clearTimeout(m.addHandler);const l=this.armatures[t.gameObject.id],u=null===(n=null===(r=this.renderSystem)||void 0===r?void 0:r.containerManager)||void 0===n?void 0:n.getContainer(t.gameObject.id);if(u&&l&&u.removeChild(l),m.armature&&(m._destroySlotGameObjects(),m.armature.destroy({children:!0}),!m.keepResource)){const t=yield e.resource.getResource(m.lastResource);(null===(o=null===(a=t.data)||void 0===a?void 0:a.image)||void 0===o?void 0:o.src)||null===(d=null===(c=t.data)||void 0===c?void 0:c.image)||void 0===d||d.label,function(t){const r=t.name,n=s[r];n&&(n.ref--,setTimeout(()=>i(this,void 0,void 0,function*(){n.ref<=0&&(e.resource.destroy(r),delete s[r])}),100))}(t)}m.armature=null,delete this.armatures[t.gameObject.id],delete this._spineComponents[t.gameObject.id],t.type,e.OBSERVER_TYPE.CHANGE})}};d.systemName="SpineSystem",d=a([e.decorators.componentObserver({Spine:["resource"]})],d);var m=d;e.resource.registerResourceType("SPINE"),exports.Spine=o,exports.SpineSystem=m;
@@ -3,19 +3,19 @@ import { Renderer, RendererSystem } from '@eva/plugin-renderer';
3
3
  import { Container } from 'pixi.js';
4
4
  import { type } from '@eva/inspector-decorator';
5
5
 
6
- /*! *****************************************************************************
7
- Copyright (c) Microsoft Corporation. All rights reserved.
8
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
9
- this file except in compliance with the License. You may obtain a copy of the
10
- License at http://www.apache.org/licenses/LICENSE-2.0
6
+ /******************************************************************************
7
+ Copyright (c) Microsoft Corporation.
11
8
 
12
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
13
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
14
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
15
- MERCHANTABLITY OR NON-INFRINGEMENT.
9
+ Permission to use, copy, modify, and/or distribute this software for any
10
+ purpose with or without fee is hereby granted.
16
11
 
17
- See the Apache Version 2.0 License for specific language governing permissions
18
- and limitations under the License.
12
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
13
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
14
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
15
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
16
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
17
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
18
+ PERFORMANCE OF THIS SOFTWARE.
19
19
  ***************************************************************************** */
20
20
 
21
21
  function __decorate(decorators, target, key, desc) {
@@ -26,13 +26,19 @@ function __decorate(decorators, target, key, desc) {
26
26
  }
27
27
 
28
28
  function __awaiter(thisArg, _arguments, P, generator) {
29
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
29
30
  return new (P || (P = Promise))(function (resolve, reject) {
30
31
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
31
32
  function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
32
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
33
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
33
34
  step((generator = generator.apply(thisArg, _arguments || [])).next());
34
35
  });
35
- }
36
+ }
37
+
38
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
39
+ var e = new Error(message);
40
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
41
+ };
36
42
 
37
43
  /**
38
44
  * Spine 骨骼动画组件
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eva/spine-base",
3
- "version": "2.0.1",
3
+ "version": "2.0.2-beta.1",
4
4
  "description": "@eva/spine-base",
5
5
  "main": "index.js",
6
6
  "module": "dist/spine-base.esm.js",
@@ -18,8 +18,8 @@
18
18
  "license": "MIT",
19
19
  "homepage": "https://eva.js.org",
20
20
  "dependencies": {
21
- "@eva/eva.js": "2.0.1",
22
- "@eva/plugin-renderer": "2.0.1",
21
+ "@eva/eva.js": "2.0.2-beta.1",
22
+ "@eva/plugin-renderer": "2.0.2-beta.1",
23
23
  "@eva/inspector-decorator": "^0.0.5",
24
24
  "pixi.js": "^8.17.0"
25
25
  }