@eva/plugin-renderer-nine-patch 1.2.7-editor.8 → 1.2.7-fix.4

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,7 +1,6 @@
1
1
  window.EVA = window.EVA || {};
2
2
  window.EVA.plugin = window.EVA.plugin || {};
3
3
  window.EVA.plugin.renderer = window.EVA.plugin.renderer || {};
4
-
5
4
  var _EVA_IIFE_ninePatch = function (exports, eva_js, pluginRenderer, rendererAdapter) {
6
5
  'use strict';
7
6
 
@@ -12,62 +11,33 @@ var _EVA_IIFE_ninePatch = function (exports, eva_js, pluginRenderer, rendererAda
12
11
  d.__proto__ = b;
13
12
  } || function (d, b) {
14
13
  for (var p in b) {
15
- if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
14
+ if (b.hasOwnProperty(p)) d[p] = b[p];
16
15
  }
17
16
  };
18
-
19
17
  return _extendStatics(d, b);
20
18
  };
21
-
22
19
  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
-
25
20
  _extendStatics(d, b);
26
-
27
21
  function __() {
28
22
  this.constructor = d;
29
23
  }
30
-
31
24
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
32
25
  }
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
-
50
26
  function __decorate(decorators, target, key, desc) {
51
27
  var c = arguments.length,
52
- r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
53
- d;
28
+ r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
29
+ d;
54
30
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {
55
31
  if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
56
32
  }
57
33
  return c > 3 && r && Object.defineProperty(target, key, r), r;
58
34
  }
59
-
60
- function __metadata(metadataKey, metadataValue) {
61
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
62
- }
63
-
64
35
  function __awaiter(thisArg, _arguments, P, generator) {
65
36
  function adopt(value) {
66
37
  return value instanceof P ? value : new P(function (resolve) {
67
38
  resolve(value);
68
39
  });
69
40
  }
70
-
71
41
  return new (P || (P = Promise))(function (resolve, reject) {
72
42
  function fulfilled(value) {
73
43
  try {
@@ -76,7 +46,6 @@ var _EVA_IIFE_ninePatch = function (exports, eva_js, pluginRenderer, rendererAda
76
46
  reject(e);
77
47
  }
78
48
  }
79
-
80
49
  function rejected(value) {
81
50
  try {
82
51
  step(generator["throw"](value));
@@ -84,29 +53,26 @@ var _EVA_IIFE_ninePatch = function (exports, eva_js, pluginRenderer, rendererAda
84
53
  reject(e);
85
54
  }
86
55
  }
87
-
88
56
  function step(result) {
89
57
  result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
90
58
  }
91
-
92
59
  step((generator = generator.apply(thisArg, _arguments || [])).next());
93
60
  });
94
61
  }
95
-
96
62
  function __generator(thisArg, body) {
97
63
  var _ = {
98
- label: 0,
99
- sent: function sent() {
100
- if (t[0] & 1) throw t[1];
101
- return t[1];
64
+ label: 0,
65
+ sent: function sent() {
66
+ if (t[0] & 1) throw t[1];
67
+ return t[1];
68
+ },
69
+ trys: [],
70
+ ops: []
102
71
  },
103
- trys: [],
104
- ops: []
105
- },
106
- f,
107
- y,
108
- t,
109
- g;
72
+ f,
73
+ y,
74
+ t,
75
+ g;
110
76
  return g = {
111
77
  next: verb(0),
112
78
  "throw": verb(1),
@@ -114,79 +80,60 @@ var _EVA_IIFE_ninePatch = function (exports, eva_js, pluginRenderer, rendererAda
114
80
  }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
115
81
  return this;
116
82
  }), g;
117
-
118
83
  function verb(n) {
119
84
  return function (v) {
120
85
  return step([n, v]);
121
86
  };
122
87
  }
123
-
124
88
  function step(op) {
125
89
  if (f) throw new TypeError("Generator is already executing.");
126
-
127
90
  while (_) {
128
91
  try {
129
92
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
130
93
  if (y = 0, t) op = [op[0] & 2, t.value];
131
-
132
94
  switch (op[0]) {
133
95
  case 0:
134
96
  case 1:
135
97
  t = op;
136
98
  break;
137
-
138
99
  case 4:
139
100
  _.label++;
140
101
  return {
141
102
  value: op[1],
142
103
  done: false
143
104
  };
144
-
145
105
  case 5:
146
106
  _.label++;
147
107
  y = op[1];
148
108
  op = [0];
149
109
  continue;
150
-
151
110
  case 7:
152
111
  op = _.ops.pop();
153
-
154
112
  _.trys.pop();
155
-
156
113
  continue;
157
-
158
114
  default:
159
115
  if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
160
116
  _ = 0;
161
117
  continue;
162
118
  }
163
-
164
119
  if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
165
120
  _.label = op[1];
166
121
  break;
167
122
  }
168
-
169
123
  if (op[0] === 6 && _.label < t[1]) {
170
124
  _.label = t[1];
171
125
  t = op;
172
126
  break;
173
127
  }
174
-
175
128
  if (t && _.label < t[2]) {
176
129
  _.label = t[2];
177
-
178
130
  _.ops.push(op);
179
-
180
131
  break;
181
132
  }
182
-
183
133
  if (t[2]) _.ops.pop();
184
-
185
134
  _.trys.pop();
186
-
187
135
  continue;
188
136
  }
189
-
190
137
  op = body.call(thisArg, _);
191
138
  } catch (e) {
192
139
  op = [6, e];
@@ -195,7 +142,6 @@ var _EVA_IIFE_ninePatch = function (exports, eva_js, pluginRenderer, rendererAda
195
142
  f = t = 0;
196
143
  }
197
144
  }
198
-
199
145
  if (op[0] & 5) throw op[1];
200
146
  return {
201
147
  value: op[0] ? op[1] : void 0,
@@ -203,124 +149,33 @@ var _EVA_IIFE_ninePatch = function (exports, eva_js, pluginRenderer, rendererAda
203
149
  };
204
150
  }
205
151
  }
206
-
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;
217
- }
218
-
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;
232
- }
233
-
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';
253
- }
254
-
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;
152
+ function getIDEPropsPropertyObj(target, propertyKey) {
153
+ if (!target.constructor.IDEProps) {
154
+ target.constructor.IDEProps = {};
262
155
  }
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
- }
156
+ if (!target.constructor.IDEProps[propertyKey]) {
157
+ target.constructor.IDEProps[propertyKey] = {};
273
158
  }
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);
159
+ var propertyObj = target.constructor.IDEProps[propertyKey];
160
+ return propertyObj;
281
161
  }
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 || {}
162
+ function type(type) {
163
+ return function (target, propertyKey) {
164
+ var prop = getIDEPropsPropertyObj(target, propertyKey);
165
+ prop.key = propertyKey;
166
+ prop.type = type;
293
167
  };
294
168
  }
295
-
296
- function Field(returnTypeFunction, maybeOptions) {
169
+ function step(step) {
297
170
  return function (target, propertyKey) {
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);
171
+ var prop = getIDEPropsPropertyObj(target, propertyKey);
172
+ prop.step = step;
307
173
  };
308
174
  }
309
-
310
- var ExecuteMode;
311
-
312
- (function (ExecuteMode) {
313
- ExecuteMode[ExecuteMode["Edit"] = 2] = "Edit";
314
- ExecuteMode[ExecuteMode["Game"] = 4] = "Game";
315
- ExecuteMode[ExecuteMode["All"] = 6] = "All";
316
- })(ExecuteMode || (ExecuteMode = {}));
317
-
318
175
  var NinePatch$2 = function (_super) {
319
176
  __extends(NinePatch, _super);
320
-
321
177
  function NinePatch() {
322
178
  var _this = _super !== null && _super.apply(this, arguments) || this;
323
-
324
179
  _this.resource = '';
325
180
  _this.spriteName = '';
326
181
  _this.leftWidth = 0;
@@ -329,7 +184,6 @@ var _EVA_IIFE_ninePatch = function (exports, eva_js, pluginRenderer, rendererAda
329
184
  _this.bottomHeight = 0;
330
185
  return _this;
331
186
  }
332
-
333
187
  NinePatch.prototype.init = function (obj) {
334
188
  this.resource = obj.resource;
335
189
  this.spriteName = obj.spriteName;
@@ -338,64 +192,38 @@ var _EVA_IIFE_ninePatch = function (exports, eva_js, pluginRenderer, rendererAda
338
192
  this.rightWidth = obj.rightWidth;
339
193
  this.bottomHeight = obj.bottomHeight;
340
194
  };
341
-
342
195
  NinePatch.componentName = 'NinePatch';
343
-
344
- __decorate([Field({
345
- type: 'resource'
346
- }), __metadata("design:type", String)], NinePatch.prototype, "resource", void 0);
347
-
348
- __decorate([Field(), __metadata("design:type", String)], NinePatch.prototype, "spriteName", void 0);
349
-
350
- __decorate([Field({
351
- step: 1
352
- }), __metadata("design:type", Number)], NinePatch.prototype, "leftWidth", void 0);
353
-
354
- __decorate([Field({
355
- step: 1
356
- }), __metadata("design:type", Number)], NinePatch.prototype, "topHeight", void 0);
357
-
358
- __decorate([Field({
359
- step: 1
360
- }), __metadata("design:type", Number)], NinePatch.prototype, "rightWidth", void 0);
361
-
362
- __decorate([Field({
363
- step: 1
364
- }), __metadata("design:type", Number)], NinePatch.prototype, "bottomHeight", void 0);
365
-
196
+ __decorate([type('string')], NinePatch.prototype, "resource", void 0);
197
+ __decorate([type('string')], NinePatch.prototype, "spriteName", void 0);
198
+ __decorate([type('number'), step(1)], NinePatch.prototype, "leftWidth", void 0);
199
+ __decorate([type('number'), step(1)], NinePatch.prototype, "topHeight", void 0);
200
+ __decorate([type('number'), step(1)], NinePatch.prototype, "rightWidth", void 0);
201
+ __decorate([type('number'), step(1)], NinePatch.prototype, "bottomHeight", void 0);
366
202
  return NinePatch;
367
203
  }(eva_js.Component);
368
-
369
204
  var NinePatch$3 = NinePatch$2;
370
205
  var resourceKeySplit = '_s|r|c_';
371
-
372
206
  var NinePatch = function (_super) {
373
207
  __extends(NinePatch, _super);
374
-
375
208
  function NinePatch() {
376
209
  var _this = _super !== null && _super.apply(this, arguments) || this;
377
-
378
210
  _this.name = 'NinePatch';
379
211
  _this.ninePatch = {};
380
212
  return _this;
381
213
  }
382
-
383
214
  NinePatch.prototype.init = function () {
384
215
  this.renderSystem = this.game.getSystem(pluginRenderer.RendererSystem);
385
216
  this.renderSystem.rendererManager.register(this);
386
217
  };
387
-
388
218
  NinePatch.prototype.rendererUpdate = function (gameObject) {
389
219
  var _a = gameObject.transform.size,
390
- width = _a.width,
391
- height = _a.height;
392
-
220
+ width = _a.width,
221
+ height = _a.height;
393
222
  if (this.ninePatch[gameObject.id]) {
394
223
  this.ninePatch[gameObject.id].width = width;
395
224
  this.ninePatch[gameObject.id].height = height;
396
225
  }
397
226
  };
398
-
399
227
  NinePatch.prototype.componentChanged = function (changed) {
400
228
  return __awaiter(this, void 0, void 0, function () {
401
229
  return __generator(this, function (_a) {
@@ -409,16 +237,13 @@ var _EVA_IIFE_ninePatch = function (exports, eva_js, pluginRenderer, rendererAda
409
237
  this.add(changed);
410
238
  }
411
239
  }
412
-
413
240
  return [2];
414
241
  });
415
242
  });
416
243
  };
417
-
418
244
  NinePatch.prototype.add = function (changed) {
419
245
  return __awaiter(this, void 0, void 0, function () {
420
246
  var component, gameObjectId, asyncId, _a, type, data, img, leftWidth, topHeight, rightWidth, bottomHeight, np;
421
-
422
247
  return __generator(this, function (_b) {
423
248
  switch (_b.label) {
424
249
  case 0:
@@ -426,22 +251,18 @@ var _EVA_IIFE_ninePatch = function (exports, eva_js, pluginRenderer, rendererAda
426
251
  gameObjectId = changed.gameObject.id;
427
252
  asyncId = this.increaseAsyncId(gameObjectId);
428
253
  return [4, eva_js.resource.getResource(component.resource)];
429
-
430
254
  case 1:
431
255
  _a = _b.sent(), type = _a.type, data = _a.data;
432
256
  if (!this.validateAsyncId(gameObjectId, asyncId)) return [2];
433
-
434
257
  if (!data) {
435
258
  console.error("GameObject:" + changed.gameObject.name + "'s NinePatch resource load error");
436
259
  return [2];
437
260
  }
438
-
439
261
  if (type === eva_js.RESOURCE_TYPE.SPRITE) {
440
262
  img = component.resource + resourceKeySplit + component.spriteName;
441
263
  } else {
442
264
  img = data.image;
443
265
  }
444
-
445
266
  leftWidth = component.leftWidth, topHeight = component.topHeight, rightWidth = component.rightWidth, bottomHeight = component.bottomHeight;
446
267
  np = new rendererAdapter.NinePatch(img, leftWidth, topHeight, rightWidth, bottomHeight);
447
268
  this.ninePatch[changed.gameObject.id] = np;
@@ -452,12 +273,10 @@ var _EVA_IIFE_ninePatch = function (exports, eva_js, pluginRenderer, rendererAda
452
273
  });
453
274
  });
454
275
  };
455
-
456
276
  NinePatch.prototype.remove = function (changed) {
457
277
  var gameObjectId = changed.gameObject.id;
458
278
  this.increaseAsyncId(gameObjectId);
459
279
  var sprite = this.ninePatch[gameObjectId];
460
-
461
280
  if (sprite) {
462
281
  this.containerManager.getContainer(changed.gameObject.id).removeChild(sprite);
463
282
  delete this.ninePatch[changed.gameObject.id];
@@ -466,14 +285,12 @@ var _EVA_IIFE_ninePatch = function (exports, eva_js, pluginRenderer, rendererAda
466
285
  });
467
286
  }
468
287
  };
469
-
470
288
  NinePatch.systemName = 'NinePatch';
471
289
  NinePatch = __decorate([eva_js.decorators.componentObserver({
472
290
  NinePatch: ['resource', 'spriteName', 'leftWidth', 'topHeight', 'rightWidth', 'bottomHeight']
473
291
  })], NinePatch);
474
292
  return NinePatch;
475
293
  }(pluginRenderer.Renderer);
476
-
477
294
  var NinePatch$1 = NinePatch;
478
295
  exports.NinePatch = NinePatch$3;
479
296
  exports.NinePatchSystem = NinePatch$1;
@@ -482,5 +299,4 @@ var _EVA_IIFE_ninePatch = function (exports, eva_js, pluginRenderer, rendererAda
482
299
  });
483
300
  return exports;
484
301
  }({}, EVA, EVA.plugin.renderer, EVA.rendererAdapter);
485
-
486
302
  window.EVA.plugin.renderer.ninePatch = window.EVA.plugin.renderer.ninePatch || _EVA_IIFE_ninePatch;
@@ -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)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 l,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 y(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)}}!function(t){t[t.Edit=2]="Edit",t[t.Game=4]="Game",t[t.All=6]="All"}(l||(l={}));var g=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([y({type:"resource"}),s("design:type",String)],e.prototype,"resource",void 0),a([y(),s("design:type",String)],e.prototype,"spriteName",void 0),a([y({step:1}),s("design:type",Number)],e.prototype,"leftWidth",void 0),a([y({step:1}),s("design:type",Number)],e.prototype,"topHeight",void 0),a([y({step:1}),s("design:type",Number)],e.prototype,"rightWidth",void 0),a([y({step:1}),s("design:type",Number)],e.prototype,"bottomHeight",void 0),e}(e.Component),m=g,b=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,l,d,f,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,l=n.topHeight,d=n.rightWidth,f=n.bottomHeight,y=new r.NinePatch(u,h,l,d,f),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),v=b;return t.NinePatch=m,t.NinePatchSystem=v,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 i=function(t,e){return i=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])},i(t,e)};function o(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function c(t,e,n,r){var i,o=arguments.length,c=o<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--)(i=t[a])&&(c=(o<3?i(c):o>3?i(e,n,c):i(e,n))||c);return o>3&&c&&Object.defineProperty(e,n,c),c}function a(t,e,n,r){return new(n||(n=Promise))((function(i,o){function c(t){try{s(r.next(t))}catch(t){o(t)}}function a(t){try{s(r.throw(t))}catch(t){o(t)}}function s(t){var e;t.done?i(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 s(t,e){var n,r,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(n)throw new TypeError("Generator is already executing.");for(;c;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=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++,r=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=e.call(t,c)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function u(t,e){return t.constructor.IDEProps||(t.constructor.IDEProps={}),t.constructor.IDEProps[e]||(t.constructor.IDEProps[e]={}),t.constructor.IDEProps[e]}function h(t){return function(e,n){var r=u(e,n);r.key=n,r.type=t}}function p(t){return function(e,n){u(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 o(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([h("string")],e.prototype,"resource",void 0),c([h("string")],e.prototype,"spriteName",void 0),c([h("number"),p(1)],e.prototype,"leftWidth",void 0),c([h("number"),p(1)],e.prototype,"topHeight",void 0),c([h("number"),p(1)],e.prototype,"rightWidth",void 0),c([h("number"),p(1)],e.prototype,"bottomHeight",void 0),e}(e.Component),l=d,f=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(n.RendererSystem),this.renderSystem.rendererManager.register(this)},i.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)},i.prototype.componentChanged=function(t){return a(this,void 0,void 0,(function(){return s(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]}))}))},i.prototype.add=function(t){return a(this,void 0,void 0,(function(){var n,i,o,c,a,u,h,p,d,l,f,y;return s(this,(function(s){switch(s.label){case 0:return n=t.component,i=t.gameObject.id,o=this.increaseAsyncId(i),[4,e.resource.getResource(n.resource)];case 1:return c=s.sent(),a=c.type,u=c.data,this.validateAsyncId(i,o)?u?(h=a===e.RESOURCE_TYPE.SPRITE?n.resource+"_s|r|c_"+n.spriteName:u.image,p=n.leftWidth,d=n.topHeight,l=n.rightWidth,f=n.bottomHeight,y=new r.NinePatch(h,p,d,l,f),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]}}))}))},i.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}))},i.systemName="NinePatch",i=c([e.decorators.componentObserver({NinePatch:["resource","spriteName","leftWidth","topHeight","rightWidth","bottomHeight"]})],i)}(n.Renderer),y=f;return t.NinePatch=l,t.NinePatchSystem=y,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;
@@ -0,0 +1,126 @@
1
+ import { __extends, __decorate, __awaiter, __generator } from 'tslib';
2
+ import { Component, OBSERVER_TYPE, RESOURCE_TYPE, resource, decorators } from '@eva/eva.js/dist/miniprogram';
3
+ import { type, step } from '@eva/inspector-decorator';
4
+ import { RendererSystem, Renderer } from '@eva/plugin-renderer/dist/miniprogram';
5
+ import { NinePatch as NinePatch$4 } from '@eva/renderer-adapter/dist/miniprogram';
6
+ var NinePatch$2 = function (_super) {
7
+ __extends(NinePatch, _super);
8
+ function NinePatch() {
9
+ var _this = _super !== null && _super.apply(this, arguments) || this;
10
+ _this.resource = '';
11
+ _this.spriteName = '';
12
+ _this.leftWidth = 0;
13
+ _this.topHeight = 0;
14
+ _this.rightWidth = 0;
15
+ _this.bottomHeight = 0;
16
+ return _this;
17
+ }
18
+ NinePatch.prototype.init = function (obj) {
19
+ this.resource = obj.resource;
20
+ this.spriteName = obj.spriteName;
21
+ this.leftWidth = obj.leftWidth;
22
+ this.topHeight = obj.topHeight;
23
+ this.rightWidth = obj.rightWidth;
24
+ this.bottomHeight = obj.bottomHeight;
25
+ };
26
+ NinePatch.componentName = 'NinePatch';
27
+ __decorate([type('string')], NinePatch.prototype, "resource", void 0);
28
+ __decorate([type('string')], NinePatch.prototype, "spriteName", void 0);
29
+ __decorate([type('number'), step(1)], NinePatch.prototype, "leftWidth", void 0);
30
+ __decorate([type('number'), step(1)], NinePatch.prototype, "topHeight", void 0);
31
+ __decorate([type('number'), step(1)], NinePatch.prototype, "rightWidth", void 0);
32
+ __decorate([type('number'), step(1)], NinePatch.prototype, "bottomHeight", void 0);
33
+ return NinePatch;
34
+ }(Component);
35
+ var NinePatch$3 = NinePatch$2;
36
+ var resourceKeySplit = '_s|r|c_';
37
+ var NinePatch = function (_super) {
38
+ __extends(NinePatch, _super);
39
+ function NinePatch() {
40
+ var _this = _super !== null && _super.apply(this, arguments) || this;
41
+ _this.name = 'NinePatch';
42
+ _this.ninePatch = {};
43
+ return _this;
44
+ }
45
+ NinePatch.prototype.init = function () {
46
+ this.renderSystem = this.game.getSystem(RendererSystem);
47
+ this.renderSystem.rendererManager.register(this);
48
+ };
49
+ NinePatch.prototype.rendererUpdate = function (gameObject) {
50
+ var _a = gameObject.transform.size,
51
+ width = _a.width,
52
+ height = _a.height;
53
+ if (this.ninePatch[gameObject.id]) {
54
+ this.ninePatch[gameObject.id].width = width;
55
+ this.ninePatch[gameObject.id].height = height;
56
+ }
57
+ };
58
+ NinePatch.prototype.componentChanged = function (changed) {
59
+ return __awaiter(this, void 0, void 0, function () {
60
+ return __generator(this, function (_a) {
61
+ if (changed.componentName === 'NinePatch') {
62
+ if (changed.type === OBSERVER_TYPE.ADD) {
63
+ this.add(changed);
64
+ } else if (changed.type === OBSERVER_TYPE.REMOVE) {
65
+ this.remove(changed);
66
+ } else {
67
+ this.remove(changed);
68
+ this.add(changed);
69
+ }
70
+ }
71
+ return [2];
72
+ });
73
+ });
74
+ };
75
+ NinePatch.prototype.add = function (changed) {
76
+ return __awaiter(this, void 0, void 0, function () {
77
+ var component, gameObjectId, asyncId, _a, type, data, img, leftWidth, topHeight, rightWidth, bottomHeight, np;
78
+ return __generator(this, function (_b) {
79
+ switch (_b.label) {
80
+ case 0:
81
+ component = changed.component;
82
+ gameObjectId = changed.gameObject.id;
83
+ asyncId = this.increaseAsyncId(gameObjectId);
84
+ return [4, resource.getResource(component.resource)];
85
+ case 1:
86
+ _a = _b.sent(), type = _a.type, data = _a.data;
87
+ if (!this.validateAsyncId(gameObjectId, asyncId)) return [2];
88
+ if (!data) {
89
+ console.error("GameObject:" + changed.gameObject.name + "'s NinePatch resource load error");
90
+ return [2];
91
+ }
92
+ if (type === RESOURCE_TYPE.SPRITE) {
93
+ img = component.resource + resourceKeySplit + component.spriteName;
94
+ } else {
95
+ img = data.image;
96
+ }
97
+ leftWidth = component.leftWidth, topHeight = component.topHeight, rightWidth = component.rightWidth, bottomHeight = component.bottomHeight;
98
+ np = new NinePatch$4(img, leftWidth, topHeight, rightWidth, bottomHeight);
99
+ this.ninePatch[changed.gameObject.id] = np;
100
+ component.ninePatch = np;
101
+ this.containerManager.getContainer(changed.gameObject.id).addChildAt(np, 0);
102
+ return [2];
103
+ }
104
+ });
105
+ });
106
+ };
107
+ NinePatch.prototype.remove = function (changed) {
108
+ var gameObjectId = changed.gameObject.id;
109
+ this.increaseAsyncId(gameObjectId);
110
+ var sprite = this.ninePatch[gameObjectId];
111
+ if (sprite) {
112
+ this.containerManager.getContainer(changed.gameObject.id).removeChild(sprite);
113
+ delete this.ninePatch[changed.gameObject.id];
114
+ sprite.destroy({
115
+ children: true
116
+ });
117
+ }
118
+ };
119
+ NinePatch.systemName = 'NinePatch';
120
+ NinePatch = __decorate([decorators.componentObserver({
121
+ NinePatch: ['resource', 'spriteName', 'leftWidth', 'topHeight', 'rightWidth', 'bottomHeight']
122
+ })], NinePatch);
123
+ return NinePatch;
124
+ }(Renderer);
125
+ var NinePatch$1 = NinePatch;
126
+ export { NinePatch$3 as NinePatch, NinePatch$1 as NinePatchSystem };
@@ -43,10 +43,6 @@ 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
-
50
46
  function __awaiter(thisArg, _arguments, P, generator) {
51
47
  return new (P || (P = Promise))(function (resolve, reject) {
52
48
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -106,28 +102,26 @@ var NinePatch$2 = (function (_super) {
106
102
  };
107
103
  NinePatch.componentName = 'NinePatch';
108
104
  __decorate([
109
- inspectorDecorator.Field({ type: 'resource' }),
110
- __metadata("design:type", String)
105
+ inspectorDecorator.type('string')
111
106
  ], NinePatch.prototype, "resource", void 0);
112
107
  __decorate([
113
- inspectorDecorator.Field(),
114
- __metadata("design:type", String)
108
+ inspectorDecorator.type('string')
115
109
  ], NinePatch.prototype, "spriteName", void 0);
116
110
  __decorate([
117
- inspectorDecorator.Field({ step: 1 }),
118
- __metadata("design:type", Number)
111
+ inspectorDecorator.type('number'),
112
+ inspectorDecorator.step(1)
119
113
  ], NinePatch.prototype, "leftWidth", void 0);
120
114
  __decorate([
121
- inspectorDecorator.Field({ step: 1 }),
122
- __metadata("design:type", Number)
115
+ inspectorDecorator.type('number'),
116
+ inspectorDecorator.step(1)
123
117
  ], NinePatch.prototype, "topHeight", void 0);
124
118
  __decorate([
125
- inspectorDecorator.Field({ step: 1 }),
126
- __metadata("design:type", Number)
119
+ inspectorDecorator.type('number'),
120
+ inspectorDecorator.step(1)
127
121
  ], NinePatch.prototype, "rightWidth", void 0);
128
122
  __decorate([
129
- inspectorDecorator.Field({ step: 1 }),
130
- __metadata("design:type", Number)
123
+ inspectorDecorator.type('number'),
124
+ inspectorDecorator.step(1)
131
125
  ], NinePatch.prototype, "bottomHeight", void 0);
132
126
  return NinePatch;
133
127
  }(eva_js.Component));
@@ -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])},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({type:"resource"}),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;
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,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 s(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 h=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=h,u=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 s(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,h,p,u,d,l,f,y;return s(this,(function(s){switch(s.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=s.sent(),c=a.type,h=a.data,this.validateAsyncId(i,o)?h?(p=c===e.RESOURCE_TYPE.SPRITE?r.resource+"_s|r|c_"+r.spriteName:h.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=p,exports.NinePatchSystem=u;
@@ -1,5 +1,5 @@
1
1
  import { Component, decorators, OBSERVER_TYPE, RESOURCE_TYPE, resource } from '@eva/eva.js';
2
- import { Field } from '@eva/inspector-decorator';
2
+ import { type, step } 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,10 +39,6 @@ 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
-
46
42
  function __awaiter(thisArg, _arguments, P, generator) {
47
43
  return new (P || (P = Promise))(function (resolve, reject) {
48
44
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -102,28 +98,26 @@ var NinePatch$2 = (function (_super) {
102
98
  };
103
99
  NinePatch.componentName = 'NinePatch';
104
100
  __decorate([
105
- Field({ type: 'resource' }),
106
- __metadata("design:type", String)
101
+ type('string')
107
102
  ], NinePatch.prototype, "resource", void 0);
108
103
  __decorate([
109
- Field(),
110
- __metadata("design:type", String)
104
+ type('string')
111
105
  ], NinePatch.prototype, "spriteName", void 0);
112
106
  __decorate([
113
- Field({ step: 1 }),
114
- __metadata("design:type", Number)
107
+ type('number'),
108
+ step(1)
115
109
  ], NinePatch.prototype, "leftWidth", void 0);
116
110
  __decorate([
117
- Field({ step: 1 }),
118
- __metadata("design:type", Number)
111
+ type('number'),
112
+ step(1)
119
113
  ], NinePatch.prototype, "topHeight", void 0);
120
114
  __decorate([
121
- Field({ step: 1 }),
122
- __metadata("design:type", Number)
115
+ type('number'),
116
+ step(1)
123
117
  ], NinePatch.prototype, "rightWidth", void 0);
124
118
  __decorate([
125
- Field({ step: 1 }),
126
- __metadata("design:type", Number)
119
+ type('number'),
120
+ step(1)
127
121
  ], NinePatch.prototype, "bottomHeight", void 0);
128
122
  return NinePatch;
129
123
  }(Component));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eva/plugin-renderer-nine-patch",
3
- "version": "1.2.7-editor.8",
3
+ "version": "1.2.7-fix.4",
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.1.0-alpha.2",
22
- "@eva/plugin-renderer": "1.2.7-editor.8",
23
- "@eva/renderer-adapter": "1.2.7-editor.8",
24
- "@eva/eva.js": "1.2.7-editor.8",
21
+ "@eva/inspector-decorator": "^0.0.5",
22
+ "@eva/plugin-renderer": "1.2.7-fix.4",
23
+ "@eva/renderer-adapter": "1.2.7-fix.4",
24
+ "@eva/eva.js": "1.2.7-fix.4",
25
25
  "@types/pixi.js": "^4.8.9"
26
26
  }
27
27
  }