@eva/plugin-renderer-img 1.2.3 → 1.2.6-alpha.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 +1 @@
1
- var _EVA_IIFE_img=function(e,t,r,n,o){"use strict";var i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function c(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function s(e,t,r,n){var o,i=arguments.length,c=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(c=(i<3?o(c):i>3?o(t,r,c):o(t,r))||c);return i>3&&c&&Object.defineProperty(t,r,c),c}function a(e,t,r,n){return new(r||(r=Promise))((function(o,i){function c(e){try{a(n.next(e))}catch(e){i(e)}}function s(e){try{a(n.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))}function u(e,t){var r,n,o,i,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;c;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return c.label++,{value:i[1],done:!1};case 5:c.label++,n=i[1],i=[0];continue;case 7:i=c.ops.pop(),c.trys.pop();continue;default:if(!(o=c.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){c=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){c.label=i[1];break}if(6===i[0]&&c.label<o[1]){c.label=o[1],o=i;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(i);break}o[2]&&c.ops.pop(),c.trys.pop();continue}i=t.call(e,c)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function p(e){return function(t,r){var n=function(e,t){return e.constructor.IDEProps||(e.constructor.IDEProps={}),e.constructor.IDEProps[t]||(e.constructor.IDEProps[t]={}),e.constructor.IDEProps[t]}(t,r);n.key=r,n.type=e}}var l=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.resource="",t}return c(t,e),t.prototype.init=function(e){e&&e.resource&&(this.resource=e.resource)},t.componentName="Img",s([p("string")],t.prototype,"resource",void 0),t}(t.Component);t.resource.registerInstance(t.RESOURCE_TYPE.IMAGE,(function(e){var t=e.data,r=(void 0===t?{}:t).image;if(r)return o.Texture.from(r)})),t.resource.registerDestroy(t.RESOURCE_TYPE.IMAGE,(function(e){var t=e.instance;t&&t.destroy(!0)}));var f=function(e){function o(){var t=null!==e&&e.apply(this,arguments)||this;return t.name="Img",t.imgs={},t}return c(o,e),o.prototype.init=function(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)},o.prototype.rendererUpdate=function(e){var t=e.transform.size,r=t.width,n=t.height;this.imgs[e.id]&&(this.imgs[e.id].sprite.width=r,this.imgs[e.id].sprite.height=n)},o.prototype.componentChanged=function(e){var r,o;return a(this,void 0,void 0,(function(){var i,c,s,a;return u(this,(function(u){switch(u.label){case 0:return"Img"!==e.componentName?[3,4]:(i=e.component,e.type!==t.OBSERVER_TYPE.ADD?[3,1]:(c=new n.Sprite(null),t.resource.getResource(i.resource).then((function(t){var r=t.instance;r||console.error("GameObject:"+e.gameObject.name+"'s Img resource load error"),c.image=r})),this.imgs[e.gameObject.id]=c,this.containerManager.getContainer(e.gameObject.id).addChildAt(c.sprite,0),[3,4]));case 1:return e.type!==t.OBSERVER_TYPE.CHANGE?[3,3]:[4,t.resource.getResource(i.resource)];case 2:return(s=u.sent().instance)||console.error("GameObject:"+e.gameObject.name+"'s Img resource load error"),this.imgs[e.gameObject.id].image=s,[3,4];case 3:if(e.type===t.OBSERVER_TYPE.REMOVE){if(!(a=this.imgs[e.gameObject.id]))return[2];null===(o=null===(r=this.containerManager)||void 0===r?void 0:r.getContainer(e.gameObject.id))||void 0===o||o.removeChild(a.sprite),a.sprite.destroy({children:!0}),delete this.imgs[e.gameObject.id]}u.label=4;case 4:return[2]}}))}))},o.systemName="Img",o=s([t.decorators.componentObserver({Img:[{prop:["resource"],deep:!1}]})],o)}(r.Renderer);return e.Img=l,e.ImgSystem=f,Object.defineProperty(e,"__esModule",{value:!0}),e}({},EVA,EVA.plugin.renderer,EVA.rendererAdapter,PIXI);
1
+ window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{},window.EVA.plugin.renderer=window.EVA.plugin.renderer||{};var _EVA_IIFE_img=function(e,r,t,n,o){"use strict";var i=function(e,r){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)r.hasOwnProperty(t)&&(e[t]=r[t])})(e,r)};function c(e,r){function t(){this.constructor=e}i(e,r),e.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t)}function s(e,r,t,n){var o,i=arguments.length,c=i<3?r:null===n?n=Object.getOwnPropertyDescriptor(r,t):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,r,t,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(c=(i<3?o(c):i>3?o(r,t,c):o(r,t))||c);return i>3&&c&&Object.defineProperty(r,t,c),c}function u(e,r,t,n){return new(t||(t=Promise))((function(o,i){function c(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var r;e.done?o(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(c,s)}u((n=n.apply(e,r||[])).next())}))}function a(e,r){var t,n,o,i,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;c;)try{if(t=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return c.label++,{value:i[1],done:!1};case 5:c.label++,n=i[1],i=[0];continue;case 7:i=c.ops.pop(),c.trys.pop();continue;default:if(!(o=c.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){c=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){c.label=i[1];break}if(6===i[0]&&c.label<o[1]){c.label=o[1],o=i;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(i);break}o[2]&&c.ops.pop(),c.trys.pop();continue}i=r.call(e,c)}catch(e){i=[6,e],n=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function p(e){return function(r,t){var n=function(e,r){return e.constructor.IDEProps||(e.constructor.IDEProps={}),e.constructor.IDEProps[r]||(e.constructor.IDEProps[r]={}),e.constructor.IDEProps[r]}(r,t);n.key=t,n.type=e}}var l=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.resource="",r}return c(r,e),r.prototype.init=function(e){e&&e.resource&&(this.resource=e.resource)},r.componentName="Img",s([p("string")],r.prototype,"resource",void 0),r}(r.Component);r.resource.registerInstance(r.RESOURCE_TYPE.IMAGE,(function(e){var r=e.data,t=(void 0===r?{}:r).image;if(t)return o.Texture.from(t)})),r.resource.registerDestroy(r.RESOURCE_TYPE.IMAGE,(function(e){var r=e.instance;r&&r.destroy(!0)}));var f=function(e){function o(){var r=null!==e&&e.apply(this,arguments)||this;return r.name="Img",r.imgs={},r}return c(o,e),o.prototype.init=function(){this.renderSystem=this.game.getSystem(t.RendererSystem),this.renderSystem.rendererManager.register(this)},o.prototype.rendererUpdate=function(e){var r=e.transform.size,t=r.width,n=r.height;this.imgs[e.id]&&(this.imgs[e.id].sprite.width=t,this.imgs[e.id].sprite.height=n)},o.prototype.componentChanged=function(e){var t,o;return u(this,void 0,void 0,(function(){var i,c,s,u;return a(this,(function(a){switch(a.label){case 0:return"Img"!==e.componentName?[3,4]:(i=e.component,e.type!==r.OBSERVER_TYPE.ADD?[3,1]:(c=new n.Sprite(null),r.resource.getResource(i.resource).then((function(r){var t=r.instance;t||console.error("GameObject:"+e.gameObject.name+"'s Img resource load error"),c.image=t})),this.imgs[e.gameObject.id]=c,this.containerManager.getContainer(e.gameObject.id).addChildAt(c.sprite,0),[3,4]));case 1:return e.type!==r.OBSERVER_TYPE.CHANGE?[3,3]:[4,r.resource.getResource(i.resource)];case 2:return(s=a.sent().instance)||console.error("GameObject:"+e.gameObject.name+"'s Img resource load error"),this.imgs[e.gameObject.id].image=s,[3,4];case 3:if(e.type===r.OBSERVER_TYPE.REMOVE){if(!(u=this.imgs[e.gameObject.id]))return[2];null===(o=null===(t=this.containerManager)||void 0===t?void 0:t.getContainer(e.gameObject.id))||void 0===o||o.removeChild(u.sprite),u.sprite.destroy({children:!0}),delete this.imgs[e.gameObject.id]}a.label=4;case 4:return[2]}}))}))},o.systemName="Img",o=s([r.decorators.componentObserver({Img:[{prop:["resource"],deep:!1}]})],o)}(t.Renderer);return e.Img=l,e.ImgSystem=f,Object.defineProperty(e,"__esModule",{value:!0}),e}({},EVA,EVA.plugin.renderer,EVA.rendererAdapter,PIXI);window.EVA.plugin.renderer.img=window.EVA.plugin.renderer.img||_EVA_IIFE_img;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eva/plugin-renderer-img",
3
- "version": "1.2.3",
3
+ "version": "1.2.6-alpha.0",
4
4
  "description": "@eva/plugin-renderer-img",
5
5
  "main": "index.js",
6
6
  "module": "dist/plugin-renderer-img.esm.js",
@@ -19,9 +19,9 @@
19
19
  "homepage": "https://eva.js.org",
20
20
  "dependencies": {
21
21
  "@eva/inspector-decorator": "^0.0.5",
22
- "@eva/plugin-renderer": "1.2.3",
23
- "@eva/renderer-adapter": "1.2.3",
24
- "@eva/eva.js": "1.2.3",
22
+ "@eva/plugin-renderer": "1.2.6-alpha.0",
23
+ "@eva/renderer-adapter": "1.2.6-alpha.0",
24
+ "@eva/eva.js": "1.2.6-alpha.0",
25
25
  "pixi.js": "^4.8.7"
26
26
  }
27
27
  }