@eva/plugin-renderer-tiling-sprite 1.2.7-editor.10 → 1.2.7-editor.11

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.
@@ -315,34 +315,6 @@ var _EVA_IIFE_tilingSprite = function (exports, eva_js, pluginRenderer, renderer
315
315
  ExecuteMode[ExecuteMode["All"] = 6] = "All";
316
316
  })(ExecuteMode || (ExecuteMode = {}));
317
317
 
318
- var Vector2 = function () {
319
- function Vector2() {}
320
-
321
- __decorate([Field({
322
- step: 0.1
323
- }), __metadata("design:type", Number)], Vector2.prototype, "x", void 0);
324
-
325
- __decorate([Field({
326
- step: 0.1
327
- }), __metadata("design:type", Number)], Vector2.prototype, "y", void 0);
328
-
329
- return Vector2;
330
- }();
331
-
332
- var IntVector2 = function () {
333
- function IntVector2() {}
334
-
335
- __decorate([Field({
336
- step: 1
337
- }), __metadata("design:type", Number)], IntVector2.prototype, "x", void 0);
338
-
339
- __decorate([Field({
340
- step: 1
341
- }), __metadata("design:type", Number)], IntVector2.prototype, "y", void 0);
342
-
343
- return IntVector2;
344
- }();
345
-
346
318
  var TilingSprite$2 = function (_super) {
347
319
  __extends(TilingSprite, _super);
348
320
 
@@ -371,14 +343,18 @@ var _EVA_IIFE_tilingSprite = function (exports, eva_js, pluginRenderer, renderer
371
343
 
372
344
  TilingSprite.componentName = 'TilingSprite';
373
345
 
374
- __decorate([Field(), __metadata("design:type", String)], TilingSprite.prototype, "resource", void 0);
346
+ __decorate([Field({
347
+ type: 'resource'
348
+ }), __metadata("design:type", String)], TilingSprite.prototype, "resource", void 0);
375
349
 
376
- __decorate([Field(function () {
377
- return Vector2;
350
+ __decorate([Field({
351
+ type: 'vector2',
352
+ step: 0.01
378
353
  }), __metadata("design:type", Object)], TilingSprite.prototype, "tileScale", void 0);
379
354
 
380
- __decorate([Field(function () {
381
- return IntVector2;
355
+ __decorate([Field({
356
+ type: 'vector2',
357
+ step: 0.01
382
358
  }), __metadata("design:type", Object)], TilingSprite.prototype, "tilePosition", void 0);
383
359
 
384
360
  return TilingSprite;
@@ -1 +1 @@
1
- window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{},window.EVA.plugin.renderer=window.EVA.plugin.renderer||{};var _EVA_IIFE_tilingSprite=function(e,t,r,n){"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)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},i(e,t)};function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var c=function(){return c=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},c.apply(this,arguments)};function a(e,t,r,n){var i,o=arguments.length,c=o<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 a=e.length-1;a>=0;a--)(i=e[a])&&(c=(o<3?i(c):o>3?i(t,r,c):i(t,r))||c);return o>3&&c&&Object.defineProperty(t,r,c),c}function s(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function u(e,t,r,n){return new(r||(r=Promise))((function(i,o){function c(e){try{s(n.next(e))}catch(e){o(e)}}function a(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(c,a)}s((n=n.apply(e,t||[])).next())}))}function p(e,t){var r,n,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;c;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,n=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!(i=c.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){c.label=o[1];break}if(6===o[0]&&c.label<i[1]){c.label=i[1],i=o;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(o);break}i[2]&&c.ops.pop(),c.trys.pop();continue}o=t.call(e,c)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}var l=function(e){function t(){var t=this.constructor,r=e.call(this,"Symbol keys are not supported yet!")||this;return Object.setPrototypeOf(r,t.prototype),r}return o(t,e),t}(Error);!function(e){function t(){var t=this.constructor,r=e.call(this,"getProperties is not a function!")||this;return Object.setPrototypeOf(r,t.prototype),r}o(t,e)}(Error);var f,d="IDE_PROPERTY_METADATA";function y(e,t,r,n){var i=Reflect.getMetadata("design:type",e,t),o=i===Array,a=function(e){return e===String?"string":e===Number?"number":e===Boolean?"boolean":"unknown"}(i);if("unknown"!==a&&(i=a),n){var s=n();Array.isArray(s)?(o=!0,i=s[0]):i=s}var u=Reflect.getMetadata(d,e.constructor)||{};u[t]=c({type:i,isArray:o},r),Reflect.defineMetadata(d,u,e.constructor)}function g(e,t){return function(r,n){if("symbol"==typeof n)throw new l;var i=function(e,t){return"function"==typeof e?{returnTypeFunc:e,options:t||{}}:{options:e||{}}}(e,t);y(r,n,i.options,i.returnTypeFunc)}}!function(e){e[e.Edit=2]="Edit",e[e.Game=4]="Game",e[e.All=6]="All"}(f||(f={}));var h=function(){function e(){}return a([g({step:.1}),s("design:type",Number)],e.prototype,"x",void 0),a([g({step:.1}),s("design:type",Number)],e.prototype,"y",void 0),e}(),m=function(){function e(){}return a([g({step:1}),s("design:type",Number)],e.prototype,"x",void 0),a([g({step:1}),s("design:type",Number)],e.prototype,"y",void 0),e}(),b=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.resource="",t.tileScale={x:1,y:1},t.tilePosition={x:0,y:0},t}return o(t,e),t.prototype.init=function(e){e&&(this.resource=e.resource,this.tileScale=e.tileScale,this.tilePosition=e.tilePosition)},t.componentName="TilingSprite",a([g(),s("design:type",String)],t.prototype,"resource",void 0),a([g((function(){return h})),s("design:type",Object)],t.prototype,"tileScale",void 0),a([g((function(){return m})),s("design:type",Object)],t.prototype,"tilePosition",void 0),t}(t.Component),v=b,S=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t.name="TilingSprite",t.imgs={},t}return o(i,e),i.prototype.init=function(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)},i.prototype.rendererUpdate=function(e){var t=e.transform.size,r=t.width,n=t.height,i=this.imgs[e.id];i&&(i.tilingSprite.width=r,i.tilingSprite.height=n)},i.prototype.componentChanged=function(e){return u(this,void 0,void 0,(function(){var r,i,o,c,a;return p(this,(function(s){switch(s.label){case 0:return r=e.gameObject.id,"TilingSprite"!==e.componentName?[3,7]:(i=e.component,e.type!==t.OBSERVER_TYPE.ADD?[3,2]:(a=new n.TilingSprite(null),this.imgs[e.gameObject.id]=a,this.containerManager.getContainer(e.gameObject.id).addChildAt(a.tilingSprite,0),this.setProp(e.gameObject.id,i),o=this.increaseAsyncId(r),[4,t.resource.getResource(i.resource)]));case 1:return c=s.sent().data,this.validateAsyncId(r,o)?c?(a.image=c.image,[3,7]):(console.error("GameObject:"+e.gameObject.name+"'s TilingSprite resource load error"),[2]):[2];case 2:return e.type!==t.OBSERVER_TYPE.CHANGE?[3,6]:"resource"!==e.prop.prop[0]?[3,4]:(o=this.increaseAsyncId(r),[4,t.resource.getResource(i.resource)]);case 3:return c=s.sent().data,this.validateAsyncId(r,o)?c?(this.imgs[e.gameObject.id].image=c.image,[3,5]):(console.error("GameObject:"+e.gameObject.name+"'s TilingSprite resource load error"),[2]):[2];case 4:this.setProp(e.gameObject.id,i),s.label=5;case 5:return[3,7];case 6:e.type===t.OBSERVER_TYPE.REMOVE&&(this.increaseAsyncId(r),a=this.imgs[e.gameObject.id],this.containerManager.getContainer(e.gameObject.id).removeChild(a.tilingSprite),a.tilingSprite.destroy({children:!0}),delete this.imgs[e.gameObject.id]),s.label=7;case 7:return[2]}}))}))},i.prototype.setProp=function(e,t){this.imgs[e].tilingSprite.tilePosition=t.tilePosition,this.imgs[e].tilingSprite.tileScale=t.tileScale},i=a([t.decorators.componentObserver({TilingSprite:[{prop:["resource"],deep:!1},{prop:["tileScale"],deep:!0},{prop:["tilePosition"],deep:!0}]})],i)}(r.Renderer),w=S;return e.TilingSprite=v,e.TilingSpriteSystem=w,Object.defineProperty(e,"__esModule",{value:!0}),e}({},EVA,EVA.plugin.renderer,EVA.rendererAdapter);window.EVA.plugin.renderer.tilingSprite=window.EVA.plugin.renderer.tilingSprite||_EVA_IIFE_tilingSprite;
1
+ window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{},window.EVA.plugin.renderer=window.EVA.plugin.renderer||{};var _EVA_IIFE_tilingSprite=function(e,t,r,n){"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)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},i(e,t)};function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var c=function(){return c=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},c.apply(this,arguments)};function a(e,t,r,n){var i,o=arguments.length,c=o<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 a=e.length-1;a>=0;a--)(i=e[a])&&(c=(o<3?i(c):o>3?i(t,r,c):i(t,r))||c);return o>3&&c&&Object.defineProperty(t,r,c),c}function s(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function l(e,t,r,n){return new(r||(r=Promise))((function(i,o){function c(e){try{s(n.next(e))}catch(e){o(e)}}function a(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(c,a)}s((n=n.apply(e,t||[])).next())}))}function u(e,t){var r,n,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;c;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,n=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!(i=c.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){c.label=o[1];break}if(6===o[0]&&c.label<i[1]){c.label=i[1],i=o;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(o);break}i[2]&&c.ops.pop(),c.trys.pop();continue}o=t.call(e,c)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}var p=function(e){function t(){var t=this.constructor,r=e.call(this,"Symbol keys are not supported yet!")||this;return Object.setPrototypeOf(r,t.prototype),r}return o(t,e),t}(Error);!function(e){function t(){var t=this.constructor,r=e.call(this,"getProperties is not a function!")||this;return Object.setPrototypeOf(r,t.prototype),r}o(t,e)}(Error);var f,d="IDE_PROPERTY_METADATA";function y(e,t,r,n){var i=Reflect.getMetadata("design:type",e,t),o=i===Array,a=function(e){return e===String?"string":e===Number?"number":e===Boolean?"boolean":"unknown"}(i);if("unknown"!==a&&(i=a),n){var s=n();Array.isArray(s)?(o=!0,i=s[0]):i=s}var l=Reflect.getMetadata(d,e.constructor)||{};l[t]=c({type:i,isArray:o},r),Reflect.defineMetadata(d,l,e.constructor)}function g(e,t){return function(r,n){if("symbol"==typeof n)throw new p;var i=function(e,t){return"function"==typeof e?{returnTypeFunc:e,options:t||{}}:{options:e||{}}}(e,t);y(r,n,i.options,i.returnTypeFunc)}}!function(e){e[e.Edit=2]="Edit",e[e.Game=4]="Game",e[e.All=6]="All"}(f||(f={}));var h=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.resource="",t.tileScale={x:1,y:1},t.tilePosition={x:0,y:0},t}return o(t,e),t.prototype.init=function(e){e&&(this.resource=e.resource,this.tileScale=e.tileScale,this.tilePosition=e.tilePosition)},t.componentName="TilingSprite",a([g({type:"resource"}),s("design:type",String)],t.prototype,"resource",void 0),a([g({type:"vector2",step:.01}),s("design:type",Object)],t.prototype,"tileScale",void 0),a([g({type:"vector2",step:.01}),s("design:type",Object)],t.prototype,"tilePosition",void 0),t}(t.Component),m=h,b=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t.name="TilingSprite",t.imgs={},t}return o(i,e),i.prototype.init=function(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)},i.prototype.rendererUpdate=function(e){var t=e.transform.size,r=t.width,n=t.height,i=this.imgs[e.id];i&&(i.tilingSprite.width=r,i.tilingSprite.height=n)},i.prototype.componentChanged=function(e){return l(this,void 0,void 0,(function(){var r,i,o,c,a;return u(this,(function(s){switch(s.label){case 0:return r=e.gameObject.id,"TilingSprite"!==e.componentName?[3,7]:(i=e.component,e.type!==t.OBSERVER_TYPE.ADD?[3,2]:(a=new n.TilingSprite(null),this.imgs[e.gameObject.id]=a,this.containerManager.getContainer(e.gameObject.id).addChildAt(a.tilingSprite,0),this.setProp(e.gameObject.id,i),o=this.increaseAsyncId(r),[4,t.resource.getResource(i.resource)]));case 1:return c=s.sent().data,this.validateAsyncId(r,o)?c?(a.image=c.image,[3,7]):(console.error("GameObject:"+e.gameObject.name+"'s TilingSprite resource load error"),[2]):[2];case 2:return e.type!==t.OBSERVER_TYPE.CHANGE?[3,6]:"resource"!==e.prop.prop[0]?[3,4]:(o=this.increaseAsyncId(r),[4,t.resource.getResource(i.resource)]);case 3:return c=s.sent().data,this.validateAsyncId(r,o)?c?(this.imgs[e.gameObject.id].image=c.image,[3,5]):(console.error("GameObject:"+e.gameObject.name+"'s TilingSprite resource load error"),[2]):[2];case 4:this.setProp(e.gameObject.id,i),s.label=5;case 5:return[3,7];case 6:e.type===t.OBSERVER_TYPE.REMOVE&&(this.increaseAsyncId(r),a=this.imgs[e.gameObject.id],this.containerManager.getContainer(e.gameObject.id).removeChild(a.tilingSprite),a.tilingSprite.destroy({children:!0}),delete this.imgs[e.gameObject.id]),s.label=7;case 7:return[2]}}))}))},i.prototype.setProp=function(e,t){this.imgs[e].tilingSprite.tilePosition=t.tilePosition,this.imgs[e].tilingSprite.tileScale=t.tileScale},i=a([t.decorators.componentObserver({TilingSprite:[{prop:["resource"],deep:!1},{prop:["tileScale"],deep:!0},{prop:["tilePosition"],deep:!0}]})],i)}(r.Renderer),v=b;return e.TilingSprite=m,e.TilingSpriteSystem=v,Object.defineProperty(e,"__esModule",{value:!0}),e}({},EVA,EVA.plugin.renderer,EVA.rendererAdapter);window.EVA.plugin.renderer.tilingSprite=window.EVA.plugin.renderer.tilingSprite||_EVA_IIFE_tilingSprite;
@@ -84,32 +84,6 @@ function __generator(thisArg, body) {
84
84
  }
85
85
  }
86
86
 
87
- var Vector2 = (function () {
88
- function Vector2() {
89
- }
90
- __decorate([
91
- inspectorDecorator.Field({ step: 0.1 }),
92
- __metadata("design:type", Number)
93
- ], Vector2.prototype, "x", void 0);
94
- __decorate([
95
- inspectorDecorator.Field({ step: 0.1 }),
96
- __metadata("design:type", Number)
97
- ], Vector2.prototype, "y", void 0);
98
- return Vector2;
99
- }());
100
- var IntVector2 = (function () {
101
- function IntVector2() {
102
- }
103
- __decorate([
104
- inspectorDecorator.Field({ step: 1 }),
105
- __metadata("design:type", Number)
106
- ], IntVector2.prototype, "x", void 0);
107
- __decorate([
108
- inspectorDecorator.Field({ step: 1 }),
109
- __metadata("design:type", Number)
110
- ], IntVector2.prototype, "y", void 0);
111
- return IntVector2;
112
- }());
113
87
  var TilingSprite$2 = (function (_super) {
114
88
  __extends(TilingSprite, _super);
115
89
  function TilingSprite() {
@@ -134,15 +108,15 @@ var TilingSprite$2 = (function (_super) {
134
108
  };
135
109
  TilingSprite.componentName = 'TilingSprite';
136
110
  __decorate([
137
- inspectorDecorator.Field(),
111
+ inspectorDecorator.Field({ type: 'resource' }),
138
112
  __metadata("design:type", String)
139
113
  ], TilingSprite.prototype, "resource", void 0);
140
114
  __decorate([
141
- inspectorDecorator.Field(function () { return Vector2; }),
115
+ inspectorDecorator.Field({ type: 'vector2', step: 0.01 }),
142
116
  __metadata("design:type", Object)
143
117
  ], TilingSprite.prototype, "tileScale", void 0);
144
118
  __decorate([
145
- inspectorDecorator.Field(function () { return IntVector2; }),
119
+ inspectorDecorator.Field({ type: 'vector2', step: 0.01 }),
146
120
  __metadata("design:type", Object)
147
121
  ], TilingSprite.prototype, "tilePosition", void 0);
148
122
  return TilingSprite;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@eva/eva.js"),t=require("@eva/inspector-decorator"),r=require("@eva/plugin-renderer"),i=require("@eva/renderer-adapter"),n=function(e,t){return n=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])},n(e,t)};function o(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function c(e,t,r,i){var n,o=arguments.length,c=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,i);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(c=(o<3?n(c):o>3?n(t,r,c):n(t,r))||c);return o>3&&c&&Object.defineProperty(t,r,c),c}function s(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function a(e,t){var r,i,n,o,c={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;c;)try{if(r=1,i&&(n=2&o[0]?i.return:o[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,o[1])).done)return n;switch(i=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,i=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!(n=c.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){c.label=o[1];break}if(6===o[0]&&c.label<n[1]){c.label=n[1],n=o;break}if(n&&c.label<n[2]){c.label=n[2],c.ops.push(o);break}n[2]&&c.ops.pop(),c.trys.pop();continue}o=t.call(e,c)}catch(e){o=[6,e],i=0}finally{r=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}var p=function(){function e(){}return c([t.Field({step:.1}),s("design:type",Number)],e.prototype,"x",void 0),c([t.Field({step:.1}),s("design:type",Number)],e.prototype,"y",void 0),e}(),l=function(){function e(){}return c([t.Field({step:1}),s("design:type",Number)],e.prototype,"x",void 0),c([t.Field({step:1}),s("design:type",Number)],e.prototype,"y",void 0),e}(),u=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.resource="",t.tileScale={x:1,y:1},t.tilePosition={x:0,y:0},t}return o(r,e),r.prototype.init=function(e){e&&(this.resource=e.resource,this.tileScale=e.tileScale,this.tilePosition=e.tilePosition)},r.componentName="TilingSprite",c([t.Field(),s("design:type",String)],r.prototype,"resource",void 0),c([t.Field((function(){return p})),s("design:type",Object)],r.prototype,"tileScale",void 0),c([t.Field((function(){return l})),s("design:type",Object)],r.prototype,"tilePosition",void 0),r}(e.Component),d=u,f=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="TilingSprite",e.imgs={},e}return o(n,t),n.prototype.init=function(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)},n.prototype.rendererUpdate=function(e){var t=e.transform.size,r=t.width,i=t.height,n=this.imgs[e.id];n&&(n.tilingSprite.width=r,n.tilingSprite.height=i)},n.prototype.componentChanged=function(t){return r=this,n=void 0,c=function(){var r,n,o,c,s;return a(this,(function(a){switch(a.label){case 0:return r=t.gameObject.id,"TilingSprite"!==t.componentName?[3,7]:(n=t.component,t.type!==e.OBSERVER_TYPE.ADD?[3,2]:(s=new i.TilingSprite(null),this.imgs[t.gameObject.id]=s,this.containerManager.getContainer(t.gameObject.id).addChildAt(s.tilingSprite,0),this.setProp(t.gameObject.id,n),o=this.increaseAsyncId(r),[4,e.resource.getResource(n.resource)]));case 1:return c=a.sent().data,this.validateAsyncId(r,o)?c?(s.image=c.image,[3,7]):(console.error("GameObject:"+t.gameObject.name+"'s TilingSprite resource load error"),[2]):[2];case 2:return t.type!==e.OBSERVER_TYPE.CHANGE?[3,6]:"resource"!==t.prop.prop[0]?[3,4]:(o=this.increaseAsyncId(r),[4,e.resource.getResource(n.resource)]);case 3:return c=a.sent().data,this.validateAsyncId(r,o)?c?(this.imgs[t.gameObject.id].image=c.image,[3,5]):(console.error("GameObject:"+t.gameObject.name+"'s TilingSprite resource load error"),[2]):[2];case 4:this.setProp(t.gameObject.id,n),a.label=5;case 5:return[3,7];case 6:t.type===e.OBSERVER_TYPE.REMOVE&&(this.increaseAsyncId(r),s=this.imgs[t.gameObject.id],this.containerManager.getContainer(t.gameObject.id).removeChild(s.tilingSprite),s.tilingSprite.destroy({children:!0}),delete this.imgs[t.gameObject.id]),a.label=7;case 7:return[2]}}))},new((o=void 0)||(o=Promise))((function(e,t){function i(e){try{a(c.next(e))}catch(e){t(e)}}function s(e){try{a(c.throw(e))}catch(e){t(e)}}function a(t){t.done?e(t.value):new o((function(e){e(t.value)})).then(i,s)}a((c=c.apply(r,n||[])).next())}));var r,n,o,c},n.prototype.setProp=function(e,t){this.imgs[e].tilingSprite.tilePosition=t.tilePosition,this.imgs[e].tilingSprite.tileScale=t.tileScale},n=c([e.decorators.componentObserver({TilingSprite:[{prop:["resource"],deep:!1},{prop:["tileScale"],deep:!0},{prop:["tilePosition"],deep:!0}]})],n)}(r.Renderer);exports.TilingSprite=d,exports.TilingSpriteSystem=f;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@eva/eva.js"),t=require("@eva/inspector-decorator"),r=require("@eva/plugin-renderer"),i=require("@eva/renderer-adapter"),n=function(e,t){return n=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])},n(e,t)};function o(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function c(e,t,r,i){var n,o=arguments.length,c=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(c=(o<3?n(c):o>3?n(t,r,c):n(t,r))||c);return o>3&&c&&Object.defineProperty(t,r,c),c}function a(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function s(e,t){var r,i,n,o,c={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;c;)try{if(r=1,i&&(n=2&o[0]?i.return:o[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,o[1])).done)return n;switch(i=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,i=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!(n=c.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){c.label=o[1];break}if(6===o[0]&&c.label<n[1]){c.label=n[1],n=o;break}if(n&&c.label<n[2]){c.label=n[2],c.ops.push(o);break}n[2]&&c.ops.pop(),c.trys.pop();continue}o=t.call(e,c)}catch(e){o=[6,e],i=0}finally{r=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}var l=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.resource="",t.tileScale={x:1,y:1},t.tilePosition={x:0,y:0},t}return o(r,e),r.prototype.init=function(e){e&&(this.resource=e.resource,this.tileScale=e.tileScale,this.tilePosition=e.tilePosition)},r.componentName="TilingSprite",c([t.Field({type:"resource"}),a("design:type",String)],r.prototype,"resource",void 0),c([t.Field({type:"vector2",step:.01}),a("design:type",Object)],r.prototype,"tileScale",void 0),c([t.Field({type:"vector2",step:.01}),a("design:type",Object)],r.prototype,"tilePosition",void 0),r}(e.Component),p=l,u=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="TilingSprite",e.imgs={},e}return o(n,t),n.prototype.init=function(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)},n.prototype.rendererUpdate=function(e){var t=e.transform.size,r=t.width,i=t.height,n=this.imgs[e.id];n&&(n.tilingSprite.width=r,n.tilingSprite.height=i)},n.prototype.componentChanged=function(t){return r=this,n=void 0,c=function(){var r,n,o,c,a;return s(this,(function(s){switch(s.label){case 0:return r=t.gameObject.id,"TilingSprite"!==t.componentName?[3,7]:(n=t.component,t.type!==e.OBSERVER_TYPE.ADD?[3,2]:(a=new i.TilingSprite(null),this.imgs[t.gameObject.id]=a,this.containerManager.getContainer(t.gameObject.id).addChildAt(a.tilingSprite,0),this.setProp(t.gameObject.id,n),o=this.increaseAsyncId(r),[4,e.resource.getResource(n.resource)]));case 1:return c=s.sent().data,this.validateAsyncId(r,o)?c?(a.image=c.image,[3,7]):(console.error("GameObject:"+t.gameObject.name+"'s TilingSprite resource load error"),[2]):[2];case 2:return t.type!==e.OBSERVER_TYPE.CHANGE?[3,6]:"resource"!==t.prop.prop[0]?[3,4]:(o=this.increaseAsyncId(r),[4,e.resource.getResource(n.resource)]);case 3:return c=s.sent().data,this.validateAsyncId(r,o)?c?(this.imgs[t.gameObject.id].image=c.image,[3,5]):(console.error("GameObject:"+t.gameObject.name+"'s TilingSprite resource load error"),[2]):[2];case 4:this.setProp(t.gameObject.id,n),s.label=5;case 5:return[3,7];case 6:t.type===e.OBSERVER_TYPE.REMOVE&&(this.increaseAsyncId(r),a=this.imgs[t.gameObject.id],this.containerManager.getContainer(t.gameObject.id).removeChild(a.tilingSprite),a.tilingSprite.destroy({children:!0}),delete this.imgs[t.gameObject.id]),s.label=7;case 7:return[2]}}))},new((o=void 0)||(o=Promise))((function(e,t){function i(e){try{s(c.next(e))}catch(e){t(e)}}function a(e){try{s(c.throw(e))}catch(e){t(e)}}function s(t){t.done?e(t.value):new o((function(e){e(t.value)})).then(i,a)}s((c=c.apply(r,n||[])).next())}));var r,n,o,c},n.prototype.setProp=function(e,t){this.imgs[e].tilingSprite.tilePosition=t.tilePosition,this.imgs[e].tilingSprite.tileScale=t.tileScale},n=c([e.decorators.componentObserver({TilingSprite:[{prop:["resource"],deep:!1},{prop:["tileScale"],deep:!0},{prop:["tilePosition"],deep:!0}]})],n)}(r.Renderer);exports.TilingSprite=p,exports.TilingSpriteSystem=u;
@@ -80,32 +80,6 @@ function __generator(thisArg, body) {
80
80
  }
81
81
  }
82
82
 
83
- var Vector2 = (function () {
84
- function Vector2() {
85
- }
86
- __decorate([
87
- Field({ step: 0.1 }),
88
- __metadata("design:type", Number)
89
- ], Vector2.prototype, "x", void 0);
90
- __decorate([
91
- Field({ step: 0.1 }),
92
- __metadata("design:type", Number)
93
- ], Vector2.prototype, "y", void 0);
94
- return Vector2;
95
- }());
96
- var IntVector2 = (function () {
97
- function IntVector2() {
98
- }
99
- __decorate([
100
- Field({ step: 1 }),
101
- __metadata("design:type", Number)
102
- ], IntVector2.prototype, "x", void 0);
103
- __decorate([
104
- Field({ step: 1 }),
105
- __metadata("design:type", Number)
106
- ], IntVector2.prototype, "y", void 0);
107
- return IntVector2;
108
- }());
109
83
  var TilingSprite$2 = (function (_super) {
110
84
  __extends(TilingSprite, _super);
111
85
  function TilingSprite() {
@@ -130,15 +104,15 @@ var TilingSprite$2 = (function (_super) {
130
104
  };
131
105
  TilingSprite.componentName = 'TilingSprite';
132
106
  __decorate([
133
- Field(),
107
+ Field({ type: 'resource' }),
134
108
  __metadata("design:type", String)
135
109
  ], TilingSprite.prototype, "resource", void 0);
136
110
  __decorate([
137
- Field(function () { return Vector2; }),
111
+ Field({ type: 'vector2', step: 0.01 }),
138
112
  __metadata("design:type", Object)
139
113
  ], TilingSprite.prototype, "tileScale", void 0);
140
114
  __decorate([
141
- Field(function () { return IntVector2; }),
115
+ Field({ type: 'vector2', step: 0.01 }),
142
116
  __metadata("design:type", Object)
143
117
  ], TilingSprite.prototype, "tilePosition", void 0);
144
118
  return TilingSprite;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eva/plugin-renderer-tiling-sprite",
3
- "version": "1.2.7-editor.10",
3
+ "version": "1.2.7-editor.11",
4
4
  "description": "@eva/plugin-renderer-tiling-sprite",
5
5
  "main": "index.js",
6
6
  "module": "dist/plugin-renderer-tiling-sprite.esm.js",
@@ -18,10 +18,10 @@
18
18
  "license": "MIT",
19
19
  "homepage": "https://eva.js.org",
20
20
  "dependencies": {
21
- "@eva/inspector-decorator": "0.1.0-alpha.2",
22
- "@eva/plugin-renderer": "1.2.7-editor.10",
23
- "@eva/renderer-adapter": "1.2.7-editor.10",
24
- "@eva/eva.js": "1.2.7-editor.10",
21
+ "@eva/inspector-decorator": "0.1.0-alpha.3",
22
+ "@eva/plugin-renderer": "1.2.7-editor.11",
23
+ "@eva/renderer-adapter": "1.2.7-editor.11",
24
+ "@eva/eva.js": "1.2.7-editor.11",
25
25
  "@types/pixi.js": "^4.8.9"
26
26
  }
27
27
  }