@eva/plugin-renderer-nine-patch 1.2.6 → 1.2.7-editor.2

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.
@@ -12,7 +12,7 @@ var _EVA_IIFE_ninePatch = function (exports, eva_js, pluginRenderer, rendererAda
12
12
  d.__proto__ = b;
13
13
  } || function (d, b) {
14
14
  for (var p in b) {
15
- if (b.hasOwnProperty(p)) d[p] = b[p];
15
+ if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
16
16
  }
17
17
  };
18
18
 
@@ -20,6 +20,8 @@ var _EVA_IIFE_ninePatch = function (exports, eva_js, pluginRenderer, rendererAda
20
20
  };
21
21
 
22
22
  function __extends(d, b) {
23
+ if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
24
+
23
25
  _extendStatics(d, b);
24
26
 
25
27
  function __() {
@@ -29,6 +31,22 @@ var _EVA_IIFE_ninePatch = function (exports, eva_js, pluginRenderer, rendererAda
29
31
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
30
32
  }
31
33
 
34
+ var _assign = function __assign() {
35
+ _assign = Object.assign || function __assign(t) {
36
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
37
+ s = arguments[i];
38
+
39
+ for (var p in s) {
40
+ if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
41
+ }
42
+ }
43
+
44
+ return t;
45
+ };
46
+
47
+ return _assign.apply(this, arguments);
48
+ };
49
+
32
50
  function __decorate(decorators, target, key, desc) {
33
51
  var c = arguments.length,
34
52
  r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
@@ -39,6 +57,10 @@ var _EVA_IIFE_ninePatch = function (exports, eva_js, pluginRenderer, rendererAda
39
57
  return c > 3 && r && Object.defineProperty(target, key, r), r;
40
58
  }
41
59
 
60
+ function __metadata(metadataKey, metadataValue) {
61
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
62
+ }
63
+
42
64
  function __awaiter(thisArg, _arguments, P, generator) {
43
65
  function adopt(value) {
44
66
  return value instanceof P ? value : new P(function (resolve) {
@@ -182,31 +204,106 @@ var _EVA_IIFE_ninePatch = function (exports, eva_js, pluginRenderer, rendererAda
182
204
  }
183
205
  }
184
206
 
185
- function getIDEPropsPropertyObj(target, propertyKey) {
186
- if (!target.constructor.IDEProps) {
187
- target.constructor.IDEProps = {};
207
+ var SymbolKeysNotSupportedError = function (_super) {
208
+ __extends(SymbolKeysNotSupportedError, _super);
209
+
210
+ function SymbolKeysNotSupportedError() {
211
+ var _newTarget = this.constructor;
212
+
213
+ var _this = _super.call(this, 'Symbol keys are not supported yet!') || this;
214
+
215
+ Object.setPrototypeOf(_this, _newTarget.prototype);
216
+ return _this;
188
217
  }
189
218
 
190
- if (!target.constructor.IDEProps[propertyKey]) {
191
- target.constructor.IDEProps[propertyKey] = {};
219
+ return SymbolKeysNotSupportedError;
220
+ }(Error);
221
+
222
+ (function (_super) {
223
+ __extends(StaticGetPropertiesIsNotAFunctionError, _super);
224
+
225
+ function StaticGetPropertiesIsNotAFunctionError() {
226
+ var _newTarget = this.constructor;
227
+
228
+ var _this = _super.call(this, 'getProperties is not a function!') || this;
229
+
230
+ Object.setPrototypeOf(_this, _newTarget.prototype);
231
+ return _this;
192
232
  }
193
233
 
194
- var propertyObj = target.constructor.IDEProps[propertyKey];
195
- return propertyObj;
234
+ return StaticGetPropertiesIsNotAFunctionError;
235
+ })(Error);
236
+
237
+ var IDE_PROPERTY_METADATA = 'IDE_PROPERTY_METADATA';
238
+
239
+ function transformBasicType(type) {
240
+ if (type === String) {
241
+ return 'string';
242
+ }
243
+
244
+ if (type === Number) {
245
+ return 'number';
246
+ }
247
+
248
+ if (type === Boolean) {
249
+ return 'boolean';
250
+ }
251
+
252
+ return 'unknown';
196
253
  }
197
254
 
198
- function type(type) {
199
- return function (target, propertyKey) {
200
- var prop = getIDEPropsPropertyObj(target, propertyKey);
201
- prop.key = propertyKey;
202
- prop.type = type;
255
+ function defineTypes(target, key, options, returnTypeFunction) {
256
+ var type = Reflect.getMetadata('design:type', target, key);
257
+ var isArray = type === Array;
258
+ var str = transformBasicType(type);
259
+
260
+ if (str !== 'unknown') {
261
+ type = str;
262
+ }
263
+
264
+ if (returnTypeFunction) {
265
+ var returnType = returnTypeFunction();
266
+
267
+ if (Array.isArray(returnType)) {
268
+ isArray = true;
269
+ type = returnType[0];
270
+ } else {
271
+ type = returnType;
272
+ }
273
+ }
274
+
275
+ var properties = Reflect.getMetadata(IDE_PROPERTY_METADATA, target.constructor) || {};
276
+ properties[key] = _assign({
277
+ type: type,
278
+ isArray: isArray
279
+ }, options);
280
+ Reflect.defineMetadata(IDE_PROPERTY_METADATA, properties, target.constructor);
281
+ }
282
+
283
+ function getTypeDecoratorParams(returnTypeFuncOrOptions, maybeOptions) {
284
+ if (typeof returnTypeFuncOrOptions === 'function') {
285
+ return {
286
+ returnTypeFunc: returnTypeFuncOrOptions,
287
+ options: maybeOptions || {}
288
+ };
289
+ }
290
+
291
+ return {
292
+ options: returnTypeFuncOrOptions || {}
203
293
  };
204
294
  }
205
295
 
206
- function step(step) {
296
+ function Field(returnTypeFunction, maybeOptions) {
207
297
  return function (target, propertyKey) {
208
- var prop = getIDEPropsPropertyObj(target, propertyKey);
209
- prop.step = step;
298
+ if (typeof propertyKey === 'symbol') {
299
+ throw new SymbolKeysNotSupportedError();
300
+ }
301
+
302
+ var _a = getTypeDecoratorParams(returnTypeFunction, maybeOptions),
303
+ options = _a.options,
304
+ returnTypeFunc = _a.returnTypeFunc;
305
+
306
+ defineTypes(target, propertyKey, options, returnTypeFunc);
210
307
  };
211
308
  }
212
309
 
@@ -236,17 +333,25 @@ var _EVA_IIFE_ninePatch = function (exports, eva_js, pluginRenderer, rendererAda
236
333
 
237
334
  NinePatch.componentName = 'NinePatch';
238
335
 
239
- __decorate([type('string')], NinePatch.prototype, "resource", void 0);
336
+ __decorate([Field(), __metadata("design:type", String)], NinePatch.prototype, "resource", void 0);
240
337
 
241
- __decorate([type('string')], NinePatch.prototype, "spriteName", void 0);
338
+ __decorate([Field(), __metadata("design:type", String)], NinePatch.prototype, "spriteName", void 0);
242
339
 
243
- __decorate([type('number'), step(1)], NinePatch.prototype, "leftWidth", void 0);
340
+ __decorate([Field({
341
+ step: 1
342
+ }), __metadata("design:type", Number)], NinePatch.prototype, "leftWidth", void 0);
244
343
 
245
- __decorate([type('number'), step(1)], NinePatch.prototype, "topHeight", void 0);
344
+ __decorate([Field({
345
+ step: 1
346
+ }), __metadata("design:type", Number)], NinePatch.prototype, "topHeight", void 0);
246
347
 
247
- __decorate([type('number'), step(1)], NinePatch.prototype, "rightWidth", void 0);
348
+ __decorate([Field({
349
+ step: 1
350
+ }), __metadata("design:type", Number)], NinePatch.prototype, "rightWidth", void 0);
248
351
 
249
- __decorate([type('number'), step(1)], NinePatch.prototype, "bottomHeight", void 0);
352
+ __decorate([Field({
353
+ step: 1
354
+ }), __metadata("design:type", Number)], NinePatch.prototype, "bottomHeight", void 0);
250
355
 
251
356
  return NinePatch;
252
357
  }(eva_js.Component);
@@ -302,16 +407,19 @@ var _EVA_IIFE_ninePatch = function (exports, eva_js, pluginRenderer, rendererAda
302
407
 
303
408
  NinePatch.prototype.add = function (changed) {
304
409
  return __awaiter(this, void 0, void 0, function () {
305
- var component, _a, type, data, img, leftWidth, topHeight, rightWidth, bottomHeight, np;
410
+ var component, gameObjectId, asyncId, _a, type, data, img, leftWidth, topHeight, rightWidth, bottomHeight, np;
306
411
 
307
412
  return __generator(this, function (_b) {
308
413
  switch (_b.label) {
309
414
  case 0:
310
415
  component = changed.component;
416
+ gameObjectId = changed.gameObject.id;
417
+ asyncId = this.increaseAsyncId(gameObjectId);
311
418
  return [4, eva_js.resource.getResource(component.resource)];
312
419
 
313
420
  case 1:
314
421
  _a = _b.sent(), type = _a.type, data = _a.data;
422
+ if (!this.validateAsyncId(gameObjectId, asyncId)) return [2];
315
423
 
316
424
  if (!data) {
317
425
  console.error("GameObject:" + changed.gameObject.name + "'s NinePatch resource load error");
@@ -336,7 +444,9 @@ var _EVA_IIFE_ninePatch = function (exports, eva_js, pluginRenderer, rendererAda
336
444
  };
337
445
 
338
446
  NinePatch.prototype.remove = function (changed) {
339
- var sprite = this.ninePatch[changed.gameObject.id];
447
+ var gameObjectId = changed.gameObject.id;
448
+ this.increaseAsyncId(gameObjectId);
449
+ var sprite = this.ninePatch[gameObjectId];
340
450
 
341
451
  if (sprite) {
342
452
  this.containerManager.getContainer(changed.gameObject.id).removeChild(sprite);
@@ -1 +1 @@
1
- window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{},window.EVA.plugin.renderer=window.EVA.plugin.renderer||{};var _EVA_IIFE_ninePatch=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)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function i(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function c(t,e,n,r){var o,i=arguments.length,c=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(c=(i<3?o(c):i>3?o(e,n,c):o(e,n))||c);return i>3&&c&&Object.defineProperty(e,n,c),c}function a(t,e,n,r){return new(n||(n=Promise))((function(o,i){function c(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(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(c,a)}u((r=r.apply(t,e||[])).next())}))}function u(t,e){var n,r,o,i,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;c;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=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++,r=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=e.call(t,c)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function h(t,e){return t.constructor.IDEProps||(t.constructor.IDEProps={}),t.constructor.IDEProps[e]||(t.constructor.IDEProps[e]={}),t.constructor.IDEProps[e]}function s(t){return function(e,n){var r=h(e,n);r.key=n,r.type=t}}function p(t){return function(e,n){h(e,n).step=t}}var d=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.resource="",e.spriteName="",e.leftWidth=0,e.topHeight=0,e.rightWidth=0,e.bottomHeight=0,e}return i(e,t),e.prototype.init=function(t){this.resource=t.resource,this.spriteName=t.spriteName,this.leftWidth=t.leftWidth,this.topHeight=t.topHeight,this.rightWidth=t.rightWidth,this.bottomHeight=t.bottomHeight},e.componentName="NinePatch",c([s("string")],e.prototype,"resource",void 0),c([s("string")],e.prototype,"spriteName",void 0),c([s("number"),p(1)],e.prototype,"leftWidth",void 0),c([s("number"),p(1)],e.prototype,"topHeight",void 0),c([s("number"),p(1)],e.prototype,"rightWidth",void 0),c([s("number"),p(1)],e.prototype,"bottomHeight",void 0),e}(e.Component),l=function(t){function o(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="NinePatch",e.ninePatch={},e}return i(o,t),o.prototype.init=function(){this.renderSystem=this.game.getSystem(n.RendererSystem),this.renderSystem.rendererManager.register(this)},o.prototype.rendererUpdate=function(t){var e=t.transform.size,n=e.width,r=e.height;this.ninePatch[t.id]&&(this.ninePatch[t.id].width=n,this.ninePatch[t.id].height=r)},o.prototype.componentChanged=function(t){return a(this,void 0,void 0,(function(){return u(this,(function(n){return"NinePatch"===t.componentName&&(t.type===e.OBSERVER_TYPE.ADD?this.add(t):t.type===e.OBSERVER_TYPE.REMOVE?this.remove(t):(this.remove(t),this.add(t))),[2]}))}))},o.prototype.add=function(t){return a(this,void 0,void 0,(function(){var n,o,i,c,a,h,s,p,d,l;return u(this,(function(u){switch(u.label){case 0:return n=t.component,[4,e.resource.getResource(n.resource)];case 1:return o=u.sent(),i=o.type,(c=o.data)?(a=i===e.RESOURCE_TYPE.SPRITE?n.resource+"_s|r|c_"+n.spriteName:c.image,h=n.leftWidth,s=n.topHeight,p=n.rightWidth,d=n.bottomHeight,l=new r.NinePatch(a,h,s,p,d),this.ninePatch[t.gameObject.id]=l,n.ninePatch=l,this.containerManager.getContainer(t.gameObject.id).addChildAt(l,0),[2]):(console.error("GameObject:"+t.gameObject.name+"'s NinePatch resource load error"),[2])}}))}))},o.prototype.remove=function(t){var e=this.ninePatch[t.gameObject.id];e&&(this.containerManager.getContainer(t.gameObject.id).removeChild(e),delete this.ninePatch[t.gameObject.id],e.destroy({children:!0}))},o.systemName="NinePatch",o=c([e.decorators.componentObserver({NinePatch:["resource","spriteName","leftWidth","topHeight","rightWidth","bottomHeight"]})],o)}(n.Renderer);return t.NinePatch=d,t.NinePatchSystem=l,Object.defineProperty(t,"__esModule",{value:!0}),t}({},EVA,EVA.plugin.renderer,EVA.rendererAdapter);window.EVA.plugin.renderer.ninePatch=window.EVA.plugin.renderer.ninePatch||_EVA_IIFE_ninePatch;
1
+ window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{},window.EVA.plugin.renderer=window.EVA.plugin.renderer||{};var _EVA_IIFE_ninePatch=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 i(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 c=function(){return c=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},c.apply(this,arguments)};function a(t,e,n,r){var o,i=arguments.length,c=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(c=(i<3?o(c):i>3?o(e,n,c):o(e,n))||c);return i>3&&c&&Object.defineProperty(e,n,c),c}function s(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function u(t,e,n,r){return new(n||(n=Promise))((function(o,i){function c(t){try{s(r.next(t))}catch(t){i(t)}}function a(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((r=r.apply(t,e||[])).next())}))}function p(t,e){var n,r,o,i,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;c;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=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++,r=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=e.call(t,c)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var h=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 i(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}i(e,t)}(Error);var d="IDE_PROPERTY_METADATA";function f(t,e,n,r){var o=Reflect.getMetadata("design:type",t,e),i=o===Array,a=function(t){return t===String?"string":t===Number?"number":t===Boolean?"boolean":"unknown"}(o);if("unknown"!==a&&(o=a),r){var s=r();Array.isArray(s)?(i=!0,o=s[0]):o=s}var u=Reflect.getMetadata(d,t.constructor)||{};u[e]=c({type:o,isArray:i},n),Reflect.defineMetadata(d,u,t.constructor)}function l(t,e){return function(n,r){if("symbol"==typeof r)throw new h;var o=function(t,e){return"function"==typeof t?{returnTypeFunc:t,options:e||{}}:{options:t||{}}}(t,e);f(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.spriteName="",e.leftWidth=0,e.topHeight=0,e.rightWidth=0,e.bottomHeight=0,e}return i(e,t),e.prototype.init=function(t){this.resource=t.resource,this.spriteName=t.spriteName,this.leftWidth=t.leftWidth,this.topHeight=t.topHeight,this.rightWidth=t.rightWidth,this.bottomHeight=t.bottomHeight},e.componentName="NinePatch",a([l(),s("design:type",String)],e.prototype,"resource",void 0),a([l(),s("design:type",String)],e.prototype,"spriteName",void 0),a([l({step:1}),s("design:type",Number)],e.prototype,"leftWidth",void 0),a([l({step:1}),s("design:type",Number)],e.prototype,"topHeight",void 0),a([l({step:1}),s("design:type",Number)],e.prototype,"rightWidth",void 0),a([l({step:1}),s("design:type",Number)],e.prototype,"bottomHeight",void 0),e}(e.Component),g=y,m=function(t){function o(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="NinePatch",e.ninePatch={},e}return i(o,t),o.prototype.init=function(){this.renderSystem=this.game.getSystem(n.RendererSystem),this.renderSystem.rendererManager.register(this)},o.prototype.rendererUpdate=function(t){var e=t.transform.size,n=e.width,r=e.height;this.ninePatch[t.id]&&(this.ninePatch[t.id].width=n,this.ninePatch[t.id].height=r)},o.prototype.componentChanged=function(t){return u(this,void 0,void 0,(function(){return p(this,(function(n){return"NinePatch"===t.componentName&&(t.type===e.OBSERVER_TYPE.ADD?this.add(t):t.type===e.OBSERVER_TYPE.REMOVE?this.remove(t):(this.remove(t),this.add(t))),[2]}))}))},o.prototype.add=function(t){return u(this,void 0,void 0,(function(){var n,o,i,c,a,s,u,h,d,f,l,y;return p(this,(function(p){switch(p.label){case 0:return n=t.component,o=t.gameObject.id,i=this.increaseAsyncId(o),[4,e.resource.getResource(n.resource)];case 1:return c=p.sent(),a=c.type,s=c.data,this.validateAsyncId(o,i)?s?(u=a===e.RESOURCE_TYPE.SPRITE?n.resource+"_s|r|c_"+n.spriteName:s.image,h=n.leftWidth,d=n.topHeight,f=n.rightWidth,l=n.bottomHeight,y=new r.NinePatch(u,h,d,f,l),this.ninePatch[t.gameObject.id]=y,n.ninePatch=y,this.containerManager.getContainer(t.gameObject.id).addChildAt(y,0),[2]):(console.error("GameObject:"+t.gameObject.name+"'s NinePatch resource load error"),[2]):[2]}}))}))},o.prototype.remove=function(t){var e=t.gameObject.id;this.increaseAsyncId(e);var n=this.ninePatch[e];n&&(this.containerManager.getContainer(t.gameObject.id).removeChild(n),delete this.ninePatch[t.gameObject.id],n.destroy({children:!0}))},o.systemName="NinePatch",o=a([e.decorators.componentObserver({NinePatch:["resource","spriteName","leftWidth","topHeight","rightWidth","bottomHeight"]})],o)}(n.Renderer),b=m;return t.NinePatch=g,t.NinePatchSystem=b,Object.defineProperty(t,"__esModule",{value:!0}),t}({},EVA,EVA.plugin.renderer,EVA.rendererAdapter);window.EVA.plugin.renderer.ninePatch=window.EVA.plugin.renderer.ninePatch||_EVA_IIFE_ninePatch;
@@ -1,6 +1,6 @@
1
- import { __extends, __decorate, __awaiter, __generator } from 'tslib';
1
+ import { __extends, __decorate, __metadata, __awaiter, __generator } from 'tslib';
2
2
  import { Component, OBSERVER_TYPE, RESOURCE_TYPE, resource, decorators } from '@eva/eva.js/dist/miniprogram';
3
- import { type, step } from '@eva/inspector-decorator';
3
+ import { Field } from '@eva/inspector-decorator';
4
4
  import { RendererSystem, Renderer } from '@eva/plugin-renderer/dist/miniprogram';
5
5
  import { NinePatch as NinePatch$4 } from '@eva/renderer-adapter/dist/miniprogram';
6
6
 
@@ -30,17 +30,25 @@ var NinePatch$2 = function (_super) {
30
30
 
31
31
  NinePatch.componentName = 'NinePatch';
32
32
 
33
- __decorate([type('string')], NinePatch.prototype, "resource", void 0);
33
+ __decorate([Field(), __metadata("design:type", String)], NinePatch.prototype, "resource", void 0);
34
34
 
35
- __decorate([type('string')], NinePatch.prototype, "spriteName", void 0);
35
+ __decorate([Field(), __metadata("design:type", String)], NinePatch.prototype, "spriteName", void 0);
36
36
 
37
- __decorate([type('number'), step(1)], NinePatch.prototype, "leftWidth", void 0);
37
+ __decorate([Field({
38
+ step: 1
39
+ }), __metadata("design:type", Number)], NinePatch.prototype, "leftWidth", void 0);
38
40
 
39
- __decorate([type('number'), step(1)], NinePatch.prototype, "topHeight", void 0);
41
+ __decorate([Field({
42
+ step: 1
43
+ }), __metadata("design:type", Number)], NinePatch.prototype, "topHeight", void 0);
40
44
 
41
- __decorate([type('number'), step(1)], NinePatch.prototype, "rightWidth", void 0);
45
+ __decorate([Field({
46
+ step: 1
47
+ }), __metadata("design:type", Number)], NinePatch.prototype, "rightWidth", void 0);
42
48
 
43
- __decorate([type('number'), step(1)], NinePatch.prototype, "bottomHeight", void 0);
49
+ __decorate([Field({
50
+ step: 1
51
+ }), __metadata("design:type", Number)], NinePatch.prototype, "bottomHeight", void 0);
44
52
 
45
53
  return NinePatch;
46
54
  }(Component);
@@ -96,16 +104,19 @@ var NinePatch = function (_super) {
96
104
 
97
105
  NinePatch.prototype.add = function (changed) {
98
106
  return __awaiter(this, void 0, void 0, function () {
99
- var component, _a, type, data, img, leftWidth, topHeight, rightWidth, bottomHeight, np;
107
+ var component, gameObjectId, asyncId, _a, type, data, img, leftWidth, topHeight, rightWidth, bottomHeight, np;
100
108
 
101
109
  return __generator(this, function (_b) {
102
110
  switch (_b.label) {
103
111
  case 0:
104
112
  component = changed.component;
113
+ gameObjectId = changed.gameObject.id;
114
+ asyncId = this.increaseAsyncId(gameObjectId);
105
115
  return [4, resource.getResource(component.resource)];
106
116
 
107
117
  case 1:
108
118
  _a = _b.sent(), type = _a.type, data = _a.data;
119
+ if (!this.validateAsyncId(gameObjectId, asyncId)) return [2];
109
120
 
110
121
  if (!data) {
111
122
  console.error("GameObject:" + changed.gameObject.name + "'s NinePatch resource load error");
@@ -130,7 +141,9 @@ var NinePatch = function (_super) {
130
141
  };
131
142
 
132
143
  NinePatch.prototype.remove = function (changed) {
133
- var sprite = this.ninePatch[changed.gameObject.id];
144
+ var gameObjectId = changed.gameObject.id;
145
+ this.increaseAsyncId(gameObjectId);
146
+ var sprite = this.ninePatch[gameObjectId];
134
147
 
135
148
  if (sprite) {
136
149
  this.containerManager.getContainer(changed.gameObject.id).removeChild(sprite);
@@ -43,6 +43,10 @@ function __decorate(decorators, target, key, desc) {
43
43
  return c > 3 && r && Object.defineProperty(target, key, r), r;
44
44
  }
45
45
 
46
+ function __metadata(metadataKey, metadataValue) {
47
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
48
+ }
49
+
46
50
  function __awaiter(thisArg, _arguments, P, generator) {
47
51
  return new (P || (P = Promise))(function (resolve, reject) {
48
52
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -102,26 +106,28 @@ var NinePatch$2 = (function (_super) {
102
106
  };
103
107
  NinePatch.componentName = 'NinePatch';
104
108
  __decorate([
105
- inspectorDecorator.type('string')
109
+ inspectorDecorator.Field(),
110
+ __metadata("design:type", String)
106
111
  ], NinePatch.prototype, "resource", void 0);
107
112
  __decorate([
108
- inspectorDecorator.type('string')
113
+ inspectorDecorator.Field(),
114
+ __metadata("design:type", String)
109
115
  ], NinePatch.prototype, "spriteName", void 0);
110
116
  __decorate([
111
- inspectorDecorator.type('number'),
112
- inspectorDecorator.step(1)
117
+ inspectorDecorator.Field({ step: 1 }),
118
+ __metadata("design:type", Number)
113
119
  ], NinePatch.prototype, "leftWidth", void 0);
114
120
  __decorate([
115
- inspectorDecorator.type('number'),
116
- inspectorDecorator.step(1)
121
+ inspectorDecorator.Field({ step: 1 }),
122
+ __metadata("design:type", Number)
117
123
  ], NinePatch.prototype, "topHeight", void 0);
118
124
  __decorate([
119
- inspectorDecorator.type('number'),
120
- inspectorDecorator.step(1)
125
+ inspectorDecorator.Field({ step: 1 }),
126
+ __metadata("design:type", Number)
121
127
  ], NinePatch.prototype, "rightWidth", void 0);
122
128
  __decorate([
123
- inspectorDecorator.type('number'),
124
- inspectorDecorator.step(1)
129
+ inspectorDecorator.Field({ step: 1 }),
130
+ __metadata("design:type", Number)
125
131
  ], NinePatch.prototype, "bottomHeight", void 0);
126
132
  return NinePatch;
127
133
  }(eva_js.Component));
@@ -168,14 +174,18 @@ var NinePatch = (function (_super) {
168
174
  };
169
175
  NinePatch.prototype.add = function (changed) {
170
176
  return __awaiter(this, void 0, void 0, function () {
171
- var component, _a, type, data, img, leftWidth, topHeight, rightWidth, bottomHeight, np;
177
+ var component, gameObjectId, asyncId, _a, type, data, img, leftWidth, topHeight, rightWidth, bottomHeight, np;
172
178
  return __generator(this, function (_b) {
173
179
  switch (_b.label) {
174
180
  case 0:
175
181
  component = changed.component;
182
+ gameObjectId = changed.gameObject.id;
183
+ asyncId = this.increaseAsyncId(gameObjectId);
176
184
  return [4, eva_js.resource.getResource(component.resource)];
177
185
  case 1:
178
186
  _a = _b.sent(), type = _a.type, data = _a.data;
187
+ if (!this.validateAsyncId(gameObjectId, asyncId))
188
+ return [2];
179
189
  if (!data) {
180
190
  console.error("GameObject:" + changed.gameObject.name + "'s NinePatch resource load error");
181
191
  return [2];
@@ -199,7 +209,9 @@ var NinePatch = (function (_super) {
199
209
  });
200
210
  };
201
211
  NinePatch.prototype.remove = function (changed) {
202
- var sprite = this.ninePatch[changed.gameObject.id];
212
+ var gameObjectId = changed.gameObject.id;
213
+ this.increaseAsyncId(gameObjectId);
214
+ var sprite = this.ninePatch[gameObjectId];
203
215
  if (sprite) {
204
216
  this.containerManager.getContainer(changed.gameObject.id).removeChild(sprite);
205
217
  delete this.ninePatch[changed.gameObject.id];
@@ -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"),n=require("@eva/renderer-adapter"),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 o(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function a(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var c=e.length-1;c>=0;c--)(i=e[c])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a}function c(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{h(n.next(e))}catch(e){o(e)}}function c(e){try{h(n.throw(e))}catch(e){o(e)}}function h(e){e.done?i(e.value):new r((function(t){t(e.value)})).then(a,c)}h((n=n.apply(e,t||[])).next())}))}function h(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(o){return function(c){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)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 a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}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,c])}}}var s=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.resource="",t.spriteName="",t.leftWidth=0,t.topHeight=0,t.rightWidth=0,t.bottomHeight=0,t}return o(r,e),r.prototype.init=function(e){this.resource=e.resource,this.spriteName=e.spriteName,this.leftWidth=e.leftWidth,this.topHeight=e.topHeight,this.rightWidth=e.rightWidth,this.bottomHeight=e.bottomHeight},r.componentName="NinePatch",a([t.type("string")],r.prototype,"resource",void 0),a([t.type("string")],r.prototype,"spriteName",void 0),a([t.type("number"),t.step(1)],r.prototype,"leftWidth",void 0),a([t.type("number"),t.step(1)],r.prototype,"topHeight",void 0),a([t.type("number"),t.step(1)],r.prototype,"rightWidth",void 0),a([t.type("number"),t.step(1)],r.prototype,"bottomHeight",void 0),r}(e.Component),p=function(t){function i(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="NinePatch",e.ninePatch={},e}return o(i,t),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;this.ninePatch[e.id]&&(this.ninePatch[e.id].width=r,this.ninePatch[e.id].height=n)},i.prototype.componentChanged=function(t){return c(this,void 0,void 0,(function(){return h(this,(function(r){return"NinePatch"===t.componentName&&(t.type===e.OBSERVER_TYPE.ADD?this.add(t):t.type===e.OBSERVER_TYPE.REMOVE?this.remove(t):(this.remove(t),this.add(t))),[2]}))}))},i.prototype.add=function(t){return c(this,void 0,void 0,(function(){var r,i,o,a,c,s,p,u,d,l;return h(this,(function(h){switch(h.label){case 0:return r=t.component,[4,e.resource.getResource(r.resource)];case 1:return i=h.sent(),o=i.type,(a=i.data)?(c=o===e.RESOURCE_TYPE.SPRITE?r.resource+"_s|r|c_"+r.spriteName:a.image,s=r.leftWidth,p=r.topHeight,u=r.rightWidth,d=r.bottomHeight,l=new n.NinePatch(c,s,p,u,d),this.ninePatch[t.gameObject.id]=l,r.ninePatch=l,this.containerManager.getContainer(t.gameObject.id).addChildAt(l,0),[2]):(console.error("GameObject:"+t.gameObject.name+"'s NinePatch resource load error"),[2])}}))}))},i.prototype.remove=function(e){var t=this.ninePatch[e.gameObject.id];t&&(this.containerManager.getContainer(e.gameObject.id).removeChild(t),delete this.ninePatch[e.gameObject.id],t.destroy({children:!0}))},i.systemName="NinePatch",i=a([e.decorators.componentObserver({NinePatch:["resource","spriteName","leftWidth","topHeight","rightWidth","bottomHeight"]})],i)}(r.Renderer);exports.NinePatch=s,exports.NinePatchSystem=p;
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"),n=require("@eva/renderer-adapter"),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])},i(e,t)};function o(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function a(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var c=e.length-1;c>=0;c--)(i=e[c])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a}function c(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function s(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function c(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){e.done?i(e.value):new r((function(t){t(e.value)})).then(a,c)}s((n=n.apply(e,t||[])).next())}))}function h(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(o){return function(c){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)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 a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}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,c])}}}var p=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.resource="",t.spriteName="",t.leftWidth=0,t.topHeight=0,t.rightWidth=0,t.bottomHeight=0,t}return o(r,e),r.prototype.init=function(e){this.resource=e.resource,this.spriteName=e.spriteName,this.leftWidth=e.leftWidth,this.topHeight=e.topHeight,this.rightWidth=e.rightWidth,this.bottomHeight=e.bottomHeight},r.componentName="NinePatch",a([t.Field(),c("design:type",String)],r.prototype,"resource",void 0),a([t.Field(),c("design:type",String)],r.prototype,"spriteName",void 0),a([t.Field({step:1}),c("design:type",Number)],r.prototype,"leftWidth",void 0),a([t.Field({step:1}),c("design:type",Number)],r.prototype,"topHeight",void 0),a([t.Field({step:1}),c("design:type",Number)],r.prototype,"rightWidth",void 0),a([t.Field({step:1}),c("design:type",Number)],r.prototype,"bottomHeight",void 0),r}(e.Component),u=p,d=function(t){function i(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="NinePatch",e.ninePatch={},e}return o(i,t),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;this.ninePatch[e.id]&&(this.ninePatch[e.id].width=r,this.ninePatch[e.id].height=n)},i.prototype.componentChanged=function(t){return s(this,void 0,void 0,(function(){return h(this,(function(r){return"NinePatch"===t.componentName&&(t.type===e.OBSERVER_TYPE.ADD?this.add(t):t.type===e.OBSERVER_TYPE.REMOVE?this.remove(t):(this.remove(t),this.add(t))),[2]}))}))},i.prototype.add=function(t){return s(this,void 0,void 0,(function(){var r,i,o,a,c,s,p,u,d,l,f,y;return h(this,(function(h){switch(h.label){case 0:return r=t.component,i=t.gameObject.id,o=this.increaseAsyncId(i),[4,e.resource.getResource(r.resource)];case 1:return a=h.sent(),c=a.type,s=a.data,this.validateAsyncId(i,o)?s?(p=c===e.RESOURCE_TYPE.SPRITE?r.resource+"_s|r|c_"+r.spriteName:s.image,u=r.leftWidth,d=r.topHeight,l=r.rightWidth,f=r.bottomHeight,y=new n.NinePatch(p,u,d,l,f),this.ninePatch[t.gameObject.id]=y,r.ninePatch=y,this.containerManager.getContainer(t.gameObject.id).addChildAt(y,0),[2]):(console.error("GameObject:"+t.gameObject.name+"'s NinePatch resource load error"),[2]):[2]}}))}))},i.prototype.remove=function(e){var t=e.gameObject.id;this.increaseAsyncId(t);var r=this.ninePatch[t];r&&(this.containerManager.getContainer(e.gameObject.id).removeChild(r),delete this.ninePatch[e.gameObject.id],r.destroy({children:!0}))},i.systemName="NinePatch",i=a([e.decorators.componentObserver({NinePatch:["resource","spriteName","leftWidth","topHeight","rightWidth","bottomHeight"]})],i)}(r.Renderer);exports.NinePatch=u,exports.NinePatchSystem=d;
@@ -40,8 +40,8 @@ export declare class NinePatchSystem extends Renderer {
40
40
  init(): void;
41
41
  rendererUpdate(gameObject: GameObject): void;
42
42
  componentChanged(changed: ComponentChanged): Promise<void>;
43
- add(changed: any): Promise<void>;
44
- remove(changed: any): void;
43
+ add(changed: ComponentChanged): Promise<void>;
44
+ remove(changed: ComponentChanged): void;
45
45
  }
46
46
 
47
47
  export { }
@@ -1,5 +1,5 @@
1
1
  import { Component, decorators, OBSERVER_TYPE, RESOURCE_TYPE, resource } from '@eva/eva.js';
2
- import { type, step } from '@eva/inspector-decorator';
2
+ import { Field } from '@eva/inspector-decorator';
3
3
  import { RendererSystem, Renderer } from '@eva/plugin-renderer';
4
4
  import { NinePatch as NinePatch$4 } from '@eva/renderer-adapter';
5
5
 
@@ -39,6 +39,10 @@ function __decorate(decorators, target, key, desc) {
39
39
  return c > 3 && r && Object.defineProperty(target, key, r), r;
40
40
  }
41
41
 
42
+ function __metadata(metadataKey, metadataValue) {
43
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
44
+ }
45
+
42
46
  function __awaiter(thisArg, _arguments, P, generator) {
43
47
  return new (P || (P = Promise))(function (resolve, reject) {
44
48
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -98,26 +102,28 @@ var NinePatch$2 = (function (_super) {
98
102
  };
99
103
  NinePatch.componentName = 'NinePatch';
100
104
  __decorate([
101
- type('string')
105
+ Field(),
106
+ __metadata("design:type", String)
102
107
  ], NinePatch.prototype, "resource", void 0);
103
108
  __decorate([
104
- type('string')
109
+ Field(),
110
+ __metadata("design:type", String)
105
111
  ], NinePatch.prototype, "spriteName", void 0);
106
112
  __decorate([
107
- type('number'),
108
- step(1)
113
+ Field({ step: 1 }),
114
+ __metadata("design:type", Number)
109
115
  ], NinePatch.prototype, "leftWidth", void 0);
110
116
  __decorate([
111
- type('number'),
112
- step(1)
117
+ Field({ step: 1 }),
118
+ __metadata("design:type", Number)
113
119
  ], NinePatch.prototype, "topHeight", void 0);
114
120
  __decorate([
115
- type('number'),
116
- step(1)
121
+ Field({ step: 1 }),
122
+ __metadata("design:type", Number)
117
123
  ], NinePatch.prototype, "rightWidth", void 0);
118
124
  __decorate([
119
- type('number'),
120
- step(1)
125
+ Field({ step: 1 }),
126
+ __metadata("design:type", Number)
121
127
  ], NinePatch.prototype, "bottomHeight", void 0);
122
128
  return NinePatch;
123
129
  }(Component));
@@ -164,14 +170,18 @@ var NinePatch = (function (_super) {
164
170
  };
165
171
  NinePatch.prototype.add = function (changed) {
166
172
  return __awaiter(this, void 0, void 0, function () {
167
- var component, _a, type, data, img, leftWidth, topHeight, rightWidth, bottomHeight, np;
173
+ var component, gameObjectId, asyncId, _a, type, data, img, leftWidth, topHeight, rightWidth, bottomHeight, np;
168
174
  return __generator(this, function (_b) {
169
175
  switch (_b.label) {
170
176
  case 0:
171
177
  component = changed.component;
178
+ gameObjectId = changed.gameObject.id;
179
+ asyncId = this.increaseAsyncId(gameObjectId);
172
180
  return [4, resource.getResource(component.resource)];
173
181
  case 1:
174
182
  _a = _b.sent(), type = _a.type, data = _a.data;
183
+ if (!this.validateAsyncId(gameObjectId, asyncId))
184
+ return [2];
175
185
  if (!data) {
176
186
  console.error("GameObject:" + changed.gameObject.name + "'s NinePatch resource load error");
177
187
  return [2];
@@ -195,7 +205,9 @@ var NinePatch = (function (_super) {
195
205
  });
196
206
  };
197
207
  NinePatch.prototype.remove = function (changed) {
198
- var sprite = this.ninePatch[changed.gameObject.id];
208
+ var gameObjectId = changed.gameObject.id;
209
+ this.increaseAsyncId(gameObjectId);
210
+ var sprite = this.ninePatch[gameObjectId];
199
211
  if (sprite) {
200
212
  this.containerManager.getContainer(changed.gameObject.id).removeChild(sprite);
201
213
  delete this.ninePatch[changed.gameObject.id];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eva/plugin-renderer-nine-patch",
3
- "version": "1.2.6",
3
+ "version": "1.2.7-editor.2",
4
4
  "description": "@eva/plugin-renderer-nine-patch",
5
5
  "main": "index.js",
6
6
  "module": "dist/plugin-renderer-nine-patch.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.0.5",
22
- "@eva/plugin-renderer": "1.2.6",
23
- "@eva/renderer-adapter": "1.2.6",
24
- "@eva/eva.js": "1.2.6",
21
+ "@eva/inspector-decorator": "0.1.0-alpha.1",
22
+ "@eva/plugin-renderer": "1.2.7-editor.2",
23
+ "@eva/renderer-adapter": "1.2.7-editor.2",
24
+ "@eva/eva.js": "1.2.7-editor.2",
25
25
  "@types/pixi.js": "^4.8.9"
26
26
  }
27
27
  }