@eva/spine-base 1.2.7-editor.5 → 1.2.7-editor.6
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.
|
@@ -325,6 +325,14 @@ var _EVA_IIFE_spineBase = function (exports, eva_js, pluginRenderer, pixi_js) {
|
|
|
325
325
|
};
|
|
326
326
|
}
|
|
327
327
|
|
|
328
|
+
var ExecuteMode;
|
|
329
|
+
|
|
330
|
+
(function (ExecuteMode) {
|
|
331
|
+
ExecuteMode[ExecuteMode["Edit"] = 2] = "Edit";
|
|
332
|
+
ExecuteMode[ExecuteMode["Game"] = 4] = "Game";
|
|
333
|
+
ExecuteMode[ExecuteMode["All"] = 6] = "All";
|
|
334
|
+
})(ExecuteMode || (ExecuteMode = {}));
|
|
335
|
+
|
|
328
336
|
var Spine = function (_super) {
|
|
329
337
|
__extends(Spine, _super);
|
|
330
338
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function _extends(){return _extends=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},_extends.apply(this,arguments)}window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{};var _EVA_IIFE_spineBase=function(t,e,n,r){"use strict";var o=function(t,e){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},o(t,e)};function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var i=function(){return i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)};function s(t,e,n,r){var o,a=arguments.length,i=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(i=(a<3?o(i):a>3?o(e,n,i):o(e,n))||i);return a>3&&i&&Object.defineProperty(e,n,i),i}function u(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function c(t,e,n,r){return new(n||(n=Promise))((function(o,a){function i(t){try{u(r.next(t))}catch(t){a(t)}}function s(t){try{u(r.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,s)}u((r=r.apply(t,e||[])).next())}))}function p(t,e){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}var l=function(t){function e(){var e=this.constructor,n=t.call(this,"Symbol keys are not supported yet!")||this;return Object.setPrototypeOf(n,e.prototype),n}return a(e,t),e}(Error);!function(t){function e(){var e=this.constructor,n=t.call(this,"getProperties is not a function!")||this;return Object.setPrototypeOf(n,e.prototype),n}a(e,t)}(Error);var f="IDE_PROPERTY_METADATA";function m(t,e,n,r){var o=Reflect.getMetadata("design:type",t,e),a=o===Array,s=function(t){return t===String?"string":t===Number?"number":t===Boolean?"boolean":"unknown"}(o);if("unknown"!==s&&(o=s),r){var u=r();Array.isArray(u)?(a=!0,o=u[0]):o=u}var c=Reflect.getMetadata(f,t.constructor)||{};c[e]=i({type:o,isArray:a},n),Reflect.defineMetadata(f,c,t.constructor)}function d(t,e){return function(n,r){if("symbol"==typeof r)throw new l;var o=function(t,e){return"function"==typeof t?{returnTypeFunc:t,options:e||{}}:{options:t||{}}}(t,e);m(n,r,o.options,o.returnTypeFunc)}}var y=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.resource="",e.animationName="",e.autoPlay=!0,e.waitExecuteInfos=[],e}return a(e,t),Object.defineProperty(e.prototype,"armature",{get:function(){return this._armature},set:function(t){var e,n;if(this._armature=t,t){this.autoPlay&&this.play(this.animationName);try{for(var r=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(this.waitExecuteInfos),o=r.next();!o.done;o=r.next()){var a=o.value;if(a.playType){var i=a.name,s=a.loop,u=a.track;this.play(i,s,u)}else this.stop(a.track)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}this.waitExecuteInfos=[]}},enumerable:!1,configurable:!0}),e.prototype.init=function(t){t&&_extends(this,t)},e.prototype.onDestroy=function(){this.destroied=!0},e.prototype.play=function(t,e,n){try{t&&(this.animationName=t),this.armature?(void 0===n&&(n=0),this.armature.state.setAnimation(n,this.animationName,e)):this.waitExecuteInfos.push({playType:!0,name:t,loop:null!=e?e:this.autoPlay,track:n})}catch(t){console.log(t)}},e.prototype.stop=function(t){this.armature?(void 0===t&&(t=0),this.armature.state.setEmptyAnimation(t,0)):this.waitExecuteInfos.push({playType:!1,track:t})},e.prototype.addAnimation=function(t,e,n,r){try{this.armature&&(void 0===r&&(r=0),this.armature.state.addAnimation(r,t,n,e))}catch(t){console.log(t)}},e.prototype.setMix=function(t,e,n){this.armature&&this.armature.stateData.setMix(t,e,n)},e.prototype.getAnim=function(t){void 0===t&&(t=0);try{if(this.armature)return this.armature.state.tracks[t].animation.name}catch(t){console.log(t)}},e.prototype.setDefaultMix=function(t){this.armature&&(this.armature.stateData.defaultMix=t)},e.prototype.setAttachment=function(t,e){this.armature&&this.armature.skeleton.setAttachment(t,e)},e.prototype.getBone=function(t){if(this.armature)return this.armature.skeleton.findBone(t)},e.componentName="Spine",s([d({type:"resource"}),u("design:type",String)],e.prototype,"resource",void 0),s([d(),u("design:type",String)],e.prototype,"animationName",void 0),s([d(),u("design:type",Boolean)],e.prototype,"autoPlay",void 0),e}(e.Component),h=y,v={};function g(t){var e=t.image;return{tex:r.Texture.from(e),count:0}}var b={};function E(t,e,n,r){var o=null,a=function(t,e){var n=v[t];return n||(n=g(e),v[t]=n),n.tex}(e.image.src,e);new r.core.TextureAtlas(e.atlas,(function(t,e){e(a.baseTexture)}),(function(t){if(t){var a=new r.core.AtlasAttachmentLoader(t),i=new r.core.SkeletonJson(a);n&&(i.scale=n),o=i.readSkeletonData(e.ske)}}));var i={spineData:o,ref:0,imageSrc:e.image.src};return b[t]=i,i}function w(t,e){return c(this,void 0,void 0,(function(){var n;return p(this,(function(r){if(!(n=b[t.name]))if(t.complete)n=E(t.name,t.data,t.scale,e);else if(!n)return[2];return function(t,e){var n=v[t];n||(n=g(e),v[t]=n),n.count++,n.tex}(t.data.image.src,t.data),n.ref++,[2,n.spineData]}))}))}function O(t,e){var n=b[t];n&&(n.ref--,n.ref<=0&&(!function(t){t&&setTimeout((function(){var e=v[t];e&&(e.count--,e.count<=0&&(e.tex&&(e.tex.destroy(!0),e.tex=null),delete v[t]))}),100)}(e),delete b[t]))}var x=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e.armatures={},e}return a(r,t),r.prototype.init=function(t){var r=this,o=t.pixiSpine;this.renderSystem=this.game.getSystem(n.RendererSystem),this.renderSystem.rendererManager.register(this),this.pixiSpine=o,this.game.canvas.addEventListener("webglcontextrestored",(function(){var t=r.game.gameObjects,n=[];for(var o in r.armatures)for(var a=+o,i=0;i<t.length;++i){var s=t[i];if(s.id===a){var u=s.getComponent(h);u&&(r.remove({type:e.OBSERVER_TYPE.REMOVE,gameObject:s,component:u,componentName:h.componentName}),n.push({type:e.OBSERVER_TYPE.ADD,gameObject:s,component:u,componentName:h.componentName}));break}}setTimeout((function(){n.forEach((function(t){r.add(t)}))}),1e3)}),!1)},r.prototype.update=function(e){for(var n in this.armatures)this.armatures[n].update(.001*e.deltaTime),this.armatures[n].updateTransform();t.prototype.update.call(this)},r.prototype.componentChanged=function(t){return c(this,void 0,void 0,(function(){return p(this,(function(n){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);return[2]}))}))},r.prototype.add=function(t,n){var r,o;return c(this,void 0,void 0,(function(){var a,i,s,u,c,l,f,m,d=this;return p(this,(function(p){switch(p.label){case 0:return a=t.component,clearTimeout(a.addHandler),i=t.gameObject.id,s=this.increaseAsyncId(i),[4,e.resource.getResource(a.resource)];case 1:return u=p.sent(),this.validateAsyncId(i,s)?[4,w(u,this.pixiSpine)]:[2];case 2:return c=p.sent(),this.validateAsyncId(i,s)?c?(this.remove(t),(l=null===(o=null===(r=this.renderSystem)||void 0===r?void 0:r.containerManager)||void 0===o?void 0:o.getContainer(t.gameObject.id))?(a.lastResource=a.resource,f=new this.pixiSpine.Spine(c),this.armatures[t.gameObject.id]=f,t.gameObject&&t.gameObject.transform&&(m=t.gameObject.transform,f.x=m.size.width*m.origin.x,f.y=m.size.height*m.origin.y),l.addChildAt(f,0),f.update(),f.updateTransform(),a.armature=f,a.emit("loaded",{resource:a.resource}),f.state.addListener({start:function(t,e){a.emit("start",{track:t,name:t.animation.name})},complete:function(t,e){a.emit("complete",{track:t,name:t.animation.name})},interrupt:function(t,e){a.emit("interrupt",{track:t,name:t.animation.name})},end:function(t,e){a.emit("end",{track:t,name:t.animation.name})},event:function(t,e){a.emit("event",t,e)}}),[2]):[2]):(a.addHandler=setTimeout((function(){a.destroied||(void 0===n&&(n=20),--n>0?d.add(t,n):console.log("retry exceed max times",a.resource))}),1e3),[2]):[2]}}))}))},r.prototype.change=function(t){this.remove(t),this.add(t)},r.prototype.remove=function(t){var n,r,o,a;return c(this,void 0,void 0,(function(){var i,s,u,c;return p(this,(function(p){switch(p.label){case 0:return this.increaseAsyncId(t.gameObject.id),i=t.component,clearTimeout(i.addHandler),s=this.armatures[t.gameObject.id],(u=null===(r=null===(n=this.renderSystem)||void 0===n?void 0:n.containerManager)||void 0===r?void 0:r.getContainer(t.gameObject.id))&&s&&u.removeChild(s),i.armature?(i.armature.destroy({children:!0}),[4,e.resource.getResource(i.lastResource)]):[3,2];case 1:O((c=p.sent()).name,null===(a=null===(o=c.data)||void 0===o?void 0:o.image)||void 0===a?void 0:a.src),p.label=2;case 2:return i.armature=null,delete this.armatures[t.gameObject.id],t.type,e.OBSERVER_TYPE.CHANGE,[2]}}))}))},r.systemName="SpineSystem",r=s([e.decorators.componentObserver({Spine:["resource"]})],r)}(n.Renderer),S=x;return e.resource.registerResourceType("SPINE"),t.Spine=h,t.SpineSystem=S,Object.defineProperty(t,"__esModule",{value:!0}),t}({},EVA,EVA.plugin.renderer,PIXI);window.EVA.plugin.spineBase=window.EVA.plugin.spineBase||_EVA_IIFE_spineBase;
|
|
1
|
+
function _extends(){return _extends=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},_extends.apply(this,arguments)}window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{};var _EVA_IIFE_spineBase=function(t,e,n,r){"use strict";var o=function(t,e){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},o(t,e)};function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var i=function(){return i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)};function s(t,e,n,r){var o,a=arguments.length,i=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(i=(a<3?o(i):a>3?o(e,n,i):o(e,n))||i);return a>3&&i&&Object.defineProperty(e,n,i),i}function u(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function c(t,e,n,r){return new(n||(n=Promise))((function(o,a){function i(t){try{u(r.next(t))}catch(t){a(t)}}function s(t){try{u(r.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,s)}u((r=r.apply(t,e||[])).next())}))}function p(t,e){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}var l=function(t){function e(){var e=this.constructor,n=t.call(this,"Symbol keys are not supported yet!")||this;return Object.setPrototypeOf(n,e.prototype),n}return a(e,t),e}(Error);!function(t){function e(){var e=this.constructor,n=t.call(this,"getProperties is not a function!")||this;return Object.setPrototypeOf(n,e.prototype),n}a(e,t)}(Error);var f,m="IDE_PROPERTY_METADATA";function d(t,e,n,r){var o=Reflect.getMetadata("design:type",t,e),a=o===Array,s=function(t){return t===String?"string":t===Number?"number":t===Boolean?"boolean":"unknown"}(o);if("unknown"!==s&&(o=s),r){var u=r();Array.isArray(u)?(a=!0,o=u[0]):o=u}var c=Reflect.getMetadata(m,t.constructor)||{};c[e]=i({type:o,isArray:a},n),Reflect.defineMetadata(m,c,t.constructor)}function y(t,e){return function(n,r){if("symbol"==typeof r)throw new l;var o=function(t,e){return"function"==typeof t?{returnTypeFunc:t,options:e||{}}:{options:t||{}}}(t,e);d(n,r,o.options,o.returnTypeFunc)}}!function(t){t[t.Edit=2]="Edit",t[t.Game=4]="Game",t[t.All=6]="All"}(f||(f={}));var h=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.resource="",e.animationName="",e.autoPlay=!0,e.waitExecuteInfos=[],e}return a(e,t),Object.defineProperty(e.prototype,"armature",{get:function(){return this._armature},set:function(t){var e,n;if(this._armature=t,t){this.autoPlay&&this.play(this.animationName);try{for(var r=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(this.waitExecuteInfos),o=r.next();!o.done;o=r.next()){var a=o.value;if(a.playType){var i=a.name,s=a.loop,u=a.track;this.play(i,s,u)}else this.stop(a.track)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}this.waitExecuteInfos=[]}},enumerable:!1,configurable:!0}),e.prototype.init=function(t){t&&_extends(this,t)},e.prototype.onDestroy=function(){this.destroied=!0},e.prototype.play=function(t,e,n){try{t&&(this.animationName=t),this.armature?(void 0===n&&(n=0),this.armature.state.setAnimation(n,this.animationName,e)):this.waitExecuteInfos.push({playType:!0,name:t,loop:null!=e?e:this.autoPlay,track:n})}catch(t){console.log(t)}},e.prototype.stop=function(t){this.armature?(void 0===t&&(t=0),this.armature.state.setEmptyAnimation(t,0)):this.waitExecuteInfos.push({playType:!1,track:t})},e.prototype.addAnimation=function(t,e,n,r){try{this.armature&&(void 0===r&&(r=0),this.armature.state.addAnimation(r,t,n,e))}catch(t){console.log(t)}},e.prototype.setMix=function(t,e,n){this.armature&&this.armature.stateData.setMix(t,e,n)},e.prototype.getAnim=function(t){void 0===t&&(t=0);try{if(this.armature)return this.armature.state.tracks[t].animation.name}catch(t){console.log(t)}},e.prototype.setDefaultMix=function(t){this.armature&&(this.armature.stateData.defaultMix=t)},e.prototype.setAttachment=function(t,e){this.armature&&this.armature.skeleton.setAttachment(t,e)},e.prototype.getBone=function(t){if(this.armature)return this.armature.skeleton.findBone(t)},e.componentName="Spine",s([y({type:"resource"}),u("design:type",String)],e.prototype,"resource",void 0),s([y(),u("design:type",String)],e.prototype,"animationName",void 0),s([y(),u("design:type",Boolean)],e.prototype,"autoPlay",void 0),e}(e.Component),v=h,g={};function b(t){var e=t.image;return{tex:r.Texture.from(e),count:0}}var E={};function w(t,e,n,r){var o=null,a=function(t,e){var n=g[t];return n||(n=b(e),g[t]=n),n.tex}(e.image.src,e);new r.core.TextureAtlas(e.atlas,(function(t,e){e(a.baseTexture)}),(function(t){if(t){var a=new r.core.AtlasAttachmentLoader(t),i=new r.core.SkeletonJson(a);n&&(i.scale=n),o=i.readSkeletonData(e.ske)}}));var i={spineData:o,ref:0,imageSrc:e.image.src};return E[t]=i,i}function O(t,e){return c(this,void 0,void 0,(function(){var n;return p(this,(function(r){if(!(n=E[t.name]))if(t.complete)n=w(t.name,t.data,t.scale,e);else if(!n)return[2];return function(t,e){var n=g[t];n||(n=b(e),g[t]=n),n.count++,n.tex}(t.data.image.src,t.data),n.ref++,[2,n.spineData]}))}))}function x(t,e){var n=E[t];n&&(n.ref--,n.ref<=0&&(!function(t){t&&setTimeout((function(){var e=g[t];e&&(e.count--,e.count<=0&&(e.tex&&(e.tex.destroy(!0),e.tex=null),delete g[t]))}),100)}(e),delete E[t]))}var A=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e.armatures={},e}return a(r,t),r.prototype.init=function(t){var r=this,o=t.pixiSpine;this.renderSystem=this.game.getSystem(n.RendererSystem),this.renderSystem.rendererManager.register(this),this.pixiSpine=o,this.game.canvas.addEventListener("webglcontextrestored",(function(){var t=r.game.gameObjects,n=[];for(var o in r.armatures)for(var a=+o,i=0;i<t.length;++i){var s=t[i];if(s.id===a){var u=s.getComponent(v);u&&(r.remove({type:e.OBSERVER_TYPE.REMOVE,gameObject:s,component:u,componentName:v.componentName}),n.push({type:e.OBSERVER_TYPE.ADD,gameObject:s,component:u,componentName:v.componentName}));break}}setTimeout((function(){n.forEach((function(t){r.add(t)}))}),1e3)}),!1)},r.prototype.update=function(e){for(var n in this.armatures)this.armatures[n].update(.001*e.deltaTime),this.armatures[n].updateTransform();t.prototype.update.call(this)},r.prototype.componentChanged=function(t){return c(this,void 0,void 0,(function(){return p(this,(function(n){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);return[2]}))}))},r.prototype.add=function(t,n){var r,o;return c(this,void 0,void 0,(function(){var a,i,s,u,c,l,f,m,d=this;return p(this,(function(p){switch(p.label){case 0:return a=t.component,clearTimeout(a.addHandler),i=t.gameObject.id,s=this.increaseAsyncId(i),[4,e.resource.getResource(a.resource)];case 1:return u=p.sent(),this.validateAsyncId(i,s)?[4,O(u,this.pixiSpine)]:[2];case 2:return c=p.sent(),this.validateAsyncId(i,s)?c?(this.remove(t),(l=null===(o=null===(r=this.renderSystem)||void 0===r?void 0:r.containerManager)||void 0===o?void 0:o.getContainer(t.gameObject.id))?(a.lastResource=a.resource,f=new this.pixiSpine.Spine(c),this.armatures[t.gameObject.id]=f,t.gameObject&&t.gameObject.transform&&(m=t.gameObject.transform,f.x=m.size.width*m.origin.x,f.y=m.size.height*m.origin.y),l.addChildAt(f,0),f.update(),f.updateTransform(),a.armature=f,a.emit("loaded",{resource:a.resource}),f.state.addListener({start:function(t,e){a.emit("start",{track:t,name:t.animation.name})},complete:function(t,e){a.emit("complete",{track:t,name:t.animation.name})},interrupt:function(t,e){a.emit("interrupt",{track:t,name:t.animation.name})},end:function(t,e){a.emit("end",{track:t,name:t.animation.name})},event:function(t,e){a.emit("event",t,e)}}),[2]):[2]):(a.addHandler=setTimeout((function(){a.destroied||(void 0===n&&(n=20),--n>0?d.add(t,n):console.log("retry exceed max times",a.resource))}),1e3),[2]):[2]}}))}))},r.prototype.change=function(t){this.remove(t),this.add(t)},r.prototype.remove=function(t){var n,r,o,a;return c(this,void 0,void 0,(function(){var i,s,u,c;return p(this,(function(p){switch(p.label){case 0:return this.increaseAsyncId(t.gameObject.id),i=t.component,clearTimeout(i.addHandler),s=this.armatures[t.gameObject.id],(u=null===(r=null===(n=this.renderSystem)||void 0===n?void 0:n.containerManager)||void 0===r?void 0:r.getContainer(t.gameObject.id))&&s&&u.removeChild(s),i.armature?(i.armature.destroy({children:!0}),[4,e.resource.getResource(i.lastResource)]):[3,2];case 1:x((c=p.sent()).name,null===(a=null===(o=c.data)||void 0===o?void 0:o.image)||void 0===a?void 0:a.src),p.label=2;case 2:return i.armature=null,delete this.armatures[t.gameObject.id],t.type,e.OBSERVER_TYPE.CHANGE,[2]}}))}))},r.systemName="SpineSystem",r=s([e.decorators.componentObserver({Spine:["resource"]})],r)}(n.Renderer),S=A;return e.resource.registerResourceType("SPINE"),t.Spine=v,t.SpineSystem=S,Object.defineProperty(t,"__esModule",{value:!0}),t}({},EVA,EVA.plugin.renderer,PIXI);window.EVA.plugin.spineBase=window.EVA.plugin.spineBase||_EVA_IIFE_spineBase;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eva/spine-base",
|
|
3
|
-
"version": "1.2.7-editor.
|
|
3
|
+
"version": "1.2.7-editor.6",
|
|
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": "1.2.7-editor.
|
|
22
|
-
"@eva/plugin-renderer": "1.2.7-editor.
|
|
23
|
-
"@eva/inspector-decorator": "0.1.0-alpha.
|
|
21
|
+
"@eva/eva.js": "1.2.7-editor.6",
|
|
22
|
+
"@eva/plugin-renderer": "1.2.7-editor.6",
|
|
23
|
+
"@eva/inspector-decorator": "0.1.0-alpha.2",
|
|
24
24
|
"pixi.js": "^4.8.9"
|
|
25
25
|
}
|
|
26
26
|
}
|