@eva/plugin-renderer-tiling-sprite 1.2.7-editor.7 → 1.2.8-fix.1
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.
- package/dist/EVA.plugin.renderer.tilingSprite.js +19 -156
- package/dist/EVA.plugin.renderer.tilingSprite.min.js +1 -1
- package/dist/plugin-renderer-tiling-sprite.cjs.js +5 -36
- package/dist/plugin-renderer-tiling-sprite.cjs.prod.js +1 -1
- package/dist/plugin-renderer-tiling-sprite.esm.js +6 -37
- package/package.json +5 -5
- package/dist/miniprogram.js +0 -201
|
@@ -12,7 +12,7 @@ var _EVA_IIFE_tilingSprite = function (exports, eva_js, pluginRenderer, renderer
|
|
|
12
12
|
d.__proto__ = b;
|
|
13
13
|
} || function (d, b) {
|
|
14
14
|
for (var p in b) {
|
|
15
|
-
if (
|
|
15
|
+
if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
|
|
@@ -20,8 +20,6 @@ var _EVA_IIFE_tilingSprite = function (exports, eva_js, pluginRenderer, renderer
|
|
|
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
|
-
|
|
25
23
|
_extendStatics(d, b);
|
|
26
24
|
|
|
27
25
|
function __() {
|
|
@@ -31,22 +29,6 @@ var _EVA_IIFE_tilingSprite = function (exports, eva_js, pluginRenderer, renderer
|
|
|
31
29
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
32
30
|
}
|
|
33
31
|
|
|
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
32
|
function __decorate(decorators, target, key, desc) {
|
|
51
33
|
var c = arguments.length,
|
|
52
34
|
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
@@ -57,10 +39,6 @@ var _EVA_IIFE_tilingSprite = function (exports, eva_js, pluginRenderer, renderer
|
|
|
57
39
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
58
40
|
}
|
|
59
41
|
|
|
60
|
-
function __metadata(metadataKey, metadataValue) {
|
|
61
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
42
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
65
43
|
function adopt(value) {
|
|
66
44
|
return value instanceof P ? value : new P(function (resolve) {
|
|
@@ -204,145 +182,34 @@ var _EVA_IIFE_tilingSprite = function (exports, eva_js, pluginRenderer, renderer
|
|
|
204
182
|
}
|
|
205
183
|
}
|
|
206
184
|
|
|
207
|
-
|
|
208
|
-
|
|
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';
|
|
185
|
+
function getIDEPropsPropertyObj(target, propertyKey) {
|
|
186
|
+
if (!target.constructor.IDEProps) {
|
|
187
|
+
target.constructor.IDEProps = {};
|
|
246
188
|
}
|
|
247
189
|
|
|
248
|
-
if (
|
|
249
|
-
|
|
190
|
+
if (!target.constructor.IDEProps[propertyKey]) {
|
|
191
|
+
target.constructor.IDEProps[propertyKey] = {};
|
|
250
192
|
}
|
|
251
193
|
|
|
252
|
-
|
|
194
|
+
var propertyObj = target.constructor.IDEProps[propertyKey];
|
|
195
|
+
return propertyObj;
|
|
253
196
|
}
|
|
254
197
|
|
|
255
|
-
function
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
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 || {}
|
|
198
|
+
function type(type) {
|
|
199
|
+
return function (target, propertyKey) {
|
|
200
|
+
var prop = getIDEPropsPropertyObj(target, propertyKey);
|
|
201
|
+
prop.key = propertyKey;
|
|
202
|
+
prop.type = type;
|
|
293
203
|
};
|
|
294
204
|
}
|
|
295
205
|
|
|
296
|
-
function
|
|
206
|
+
function step(step) {
|
|
297
207
|
return function (target, propertyKey) {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
var _a = getTypeDecoratorParams(returnTypeFunction, maybeOptions),
|
|
303
|
-
options = _a.options,
|
|
304
|
-
returnTypeFunc = _a.returnTypeFunc;
|
|
305
|
-
|
|
306
|
-
defineTypes(target, propertyKey, options, returnTypeFunc);
|
|
208
|
+
var prop = getIDEPropsPropertyObj(target, propertyKey);
|
|
209
|
+
prop.step = step;
|
|
307
210
|
};
|
|
308
211
|
}
|
|
309
212
|
|
|
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
|
-
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
213
|
var TilingSprite$2 = function (_super) {
|
|
347
214
|
__extends(TilingSprite, _super);
|
|
348
215
|
|
|
@@ -371,15 +238,11 @@ var _EVA_IIFE_tilingSprite = function (exports, eva_js, pluginRenderer, renderer
|
|
|
371
238
|
|
|
372
239
|
TilingSprite.componentName = 'TilingSprite';
|
|
373
240
|
|
|
374
|
-
__decorate([
|
|
241
|
+
__decorate([type('string')], TilingSprite.prototype, "resource", void 0);
|
|
375
242
|
|
|
376
|
-
__decorate([
|
|
377
|
-
return Vector2;
|
|
378
|
-
}), __metadata("design:type", Object)], TilingSprite.prototype, "tileScale", void 0);
|
|
243
|
+
__decorate([type('vector2'), step(0.1)], TilingSprite.prototype, "tileScale", void 0);
|
|
379
244
|
|
|
380
|
-
__decorate([
|
|
381
|
-
return IntVector2;
|
|
382
|
-
}), __metadata("design:type", Object)], TilingSprite.prototype, "tilePosition", void 0);
|
|
245
|
+
__decorate([type('vector2'), step(1)], TilingSprite.prototype, "tilePosition", void 0);
|
|
383
246
|
|
|
384
247
|
return TilingSprite;
|
|
385
248
|
}(eva_js.Component);
|
|
@@ -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
|
|
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)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 c(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 s=e.length-1;s>=0;s--)(i=e[s])&&(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,r,n){return new(r||(r=Promise))((function(i,o){function c(e){try{a(n.next(e))}catch(e){o(e)}}function s(e){try{a(n.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))}function a(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: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,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,s])}}}function l(e,t){return e.constructor.IDEProps||(e.constructor.IDEProps={}),e.constructor.IDEProps[t]||(e.constructor.IDEProps[t]={}),e.constructor.IDEProps[t]}function p(e){return function(t,r){var n=l(t,r);n.key=r,n.type=e}}function u(e){return function(t,r){l(t,r).step=e}}var d=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",c([p("string")],t.prototype,"resource",void 0),c([p("vector2"),u(.1)],t.prototype,"tileScale",void 0),c([p("vector2"),u(1)],t.prototype,"tilePosition",void 0),t}(t.Component),g=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 s(this,void 0,void 0,(function(){var r,i,o,c,s;return a(this,(function(a){switch(a.label){case 0:return r=e.gameObject.id,"TilingSprite"!==e.componentName?[3,7]:(i=e.component,e.type!==t.OBSERVER_TYPE.ADD?[3,2]:(s=new n.TilingSprite(null),this.imgs[e.gameObject.id]=s,this.containerManager.getContainer(e.gameObject.id).addChildAt(s.tilingSprite,0),this.setProp(e.gameObject.id,i),o=this.increaseAsyncId(r),[4,t.resource.getResource(i.resource)]));case 1:return c=a.sent().data,this.validateAsyncId(r,o)?c?(s.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=a.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),a.label=5;case 5:return[3,7];case 6:e.type===t.OBSERVER_TYPE.REMOVE&&(this.increaseAsyncId(r),s=this.imgs[e.gameObject.id],this.containerManager.getContainer(e.gameObject.id).removeChild(s.tilingSprite),s.tilingSprite.destroy({children:!0}),delete this.imgs[e.gameObject.id]),a.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=c([t.decorators.componentObserver({TilingSprite:[{prop:["resource"],deep:!1},{prop:["tileScale"],deep:!0},{prop:["tilePosition"],deep:!0}]})],i)}(r.Renderer);return e.TilingSprite=d,e.TilingSpriteSystem=g,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;
|
|
@@ -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); } }
|
|
@@ -84,32 +80,6 @@ function __generator(thisArg, body) {
|
|
|
84
80
|
}
|
|
85
81
|
}
|
|
86
82
|
|
|
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
83
|
var TilingSprite$2 = (function (_super) {
|
|
114
84
|
__extends(TilingSprite, _super);
|
|
115
85
|
function TilingSprite() {
|
|
@@ -134,16 +104,15 @@ var TilingSprite$2 = (function (_super) {
|
|
|
134
104
|
};
|
|
135
105
|
TilingSprite.componentName = 'TilingSprite';
|
|
136
106
|
__decorate([
|
|
137
|
-
inspectorDecorator.
|
|
138
|
-
__metadata("design:type", String)
|
|
107
|
+
inspectorDecorator.type('string')
|
|
139
108
|
], TilingSprite.prototype, "resource", void 0);
|
|
140
109
|
__decorate([
|
|
141
|
-
inspectorDecorator.
|
|
142
|
-
|
|
110
|
+
inspectorDecorator.type('vector2'),
|
|
111
|
+
inspectorDecorator.step(0.1)
|
|
143
112
|
], TilingSprite.prototype, "tileScale", void 0);
|
|
144
113
|
__decorate([
|
|
145
|
-
inspectorDecorator.
|
|
146
|
-
|
|
114
|
+
inspectorDecorator.type('vector2'),
|
|
115
|
+
inspectorDecorator.step(1)
|
|
147
116
|
], TilingSprite.prototype, "tilePosition", void 0);
|
|
148
117
|
return TilingSprite;
|
|
149
118
|
}(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"),i=require("@eva/renderer-adapter"),n=function(e,t){return
|
|
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])})(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){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 s=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.type("string")],r.prototype,"resource",void 0),c([t.type("vector2"),t.step(.1)],r.prototype,"tileScale",void 0),c([t.type("vector2"),t.step(1)],r.prototype,"tilePosition",void 0),r}(e.Component),l=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{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=s,exports.TilingSpriteSystem=l;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component, decorators, OBSERVER_TYPE, resource } from '@eva/eva.js';
|
|
2
|
-
import {
|
|
2
|
+
import { type, step } from '@eva/inspector-decorator';
|
|
3
3
|
import { RendererSystem, Renderer } from '@eva/plugin-renderer';
|
|
4
4
|
import { TilingSprite as TilingSprite$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); } }
|
|
@@ -80,32 +76,6 @@ function __generator(thisArg, body) {
|
|
|
80
76
|
}
|
|
81
77
|
}
|
|
82
78
|
|
|
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
79
|
var TilingSprite$2 = (function (_super) {
|
|
110
80
|
__extends(TilingSprite, _super);
|
|
111
81
|
function TilingSprite() {
|
|
@@ -130,16 +100,15 @@ var TilingSprite$2 = (function (_super) {
|
|
|
130
100
|
};
|
|
131
101
|
TilingSprite.componentName = 'TilingSprite';
|
|
132
102
|
__decorate([
|
|
133
|
-
|
|
134
|
-
__metadata("design:type", String)
|
|
103
|
+
type('string')
|
|
135
104
|
], TilingSprite.prototype, "resource", void 0);
|
|
136
105
|
__decorate([
|
|
137
|
-
|
|
138
|
-
|
|
106
|
+
type('vector2'),
|
|
107
|
+
step(0.1)
|
|
139
108
|
], TilingSprite.prototype, "tileScale", void 0);
|
|
140
109
|
__decorate([
|
|
141
|
-
|
|
142
|
-
|
|
110
|
+
type('vector2'),
|
|
111
|
+
step(1)
|
|
143
112
|
], TilingSprite.prototype, "tilePosition", void 0);
|
|
144
113
|
return TilingSprite;
|
|
145
114
|
}(Component));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eva/plugin-renderer-tiling-sprite",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.8-fix.1",
|
|
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.
|
|
22
|
-
"@eva/plugin-renderer": "1.2.
|
|
23
|
-
"@eva/renderer-adapter": "1.2.
|
|
24
|
-
"@eva/eva.js": "1.2.
|
|
21
|
+
"@eva/inspector-decorator": "^0.0.5",
|
|
22
|
+
"@eva/plugin-renderer": "1.2.8-fix.1",
|
|
23
|
+
"@eva/renderer-adapter": "1.2.8-fix.1",
|
|
24
|
+
"@eva/eva.js": "1.2.8-fix.1",
|
|
25
25
|
"@types/pixi.js": "^4.8.9"
|
|
26
26
|
}
|
|
27
27
|
}
|
package/dist/miniprogram.js
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import { __decorate, __metadata, __extends, __awaiter, __generator } from 'tslib';
|
|
2
|
-
import { Component, OBSERVER_TYPE, resource, decorators } from '@eva/eva.js/dist/miniprogram';
|
|
3
|
-
import { Field } from '@eva/inspector-decorator';
|
|
4
|
-
import { RendererSystem, Renderer } from '@eva/plugin-renderer/dist/miniprogram';
|
|
5
|
-
import { TilingSprite as TilingSprite$4 } from '@eva/renderer-adapter/dist/miniprogram';
|
|
6
|
-
|
|
7
|
-
var Vector2 = function () {
|
|
8
|
-
function Vector2() {}
|
|
9
|
-
|
|
10
|
-
__decorate([Field({
|
|
11
|
-
step: 0.1
|
|
12
|
-
}), __metadata("design:type", Number)], Vector2.prototype, "x", void 0);
|
|
13
|
-
|
|
14
|
-
__decorate([Field({
|
|
15
|
-
step: 0.1
|
|
16
|
-
}), __metadata("design:type", Number)], Vector2.prototype, "y", void 0);
|
|
17
|
-
|
|
18
|
-
return Vector2;
|
|
19
|
-
}();
|
|
20
|
-
|
|
21
|
-
var IntVector2 = function () {
|
|
22
|
-
function IntVector2() {}
|
|
23
|
-
|
|
24
|
-
__decorate([Field({
|
|
25
|
-
step: 1
|
|
26
|
-
}), __metadata("design:type", Number)], IntVector2.prototype, "x", void 0);
|
|
27
|
-
|
|
28
|
-
__decorate([Field({
|
|
29
|
-
step: 1
|
|
30
|
-
}), __metadata("design:type", Number)], IntVector2.prototype, "y", void 0);
|
|
31
|
-
|
|
32
|
-
return IntVector2;
|
|
33
|
-
}();
|
|
34
|
-
|
|
35
|
-
var TilingSprite$2 = function (_super) {
|
|
36
|
-
__extends(TilingSprite, _super);
|
|
37
|
-
|
|
38
|
-
function TilingSprite() {
|
|
39
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
40
|
-
|
|
41
|
-
_this.resource = '';
|
|
42
|
-
_this.tileScale = {
|
|
43
|
-
x: 1,
|
|
44
|
-
y: 1
|
|
45
|
-
};
|
|
46
|
-
_this.tilePosition = {
|
|
47
|
-
x: 0,
|
|
48
|
-
y: 0
|
|
49
|
-
};
|
|
50
|
-
return _this;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
TilingSprite.prototype.init = function (obj) {
|
|
54
|
-
if (obj) {
|
|
55
|
-
this.resource = obj.resource;
|
|
56
|
-
this.tileScale = obj.tileScale;
|
|
57
|
-
this.tilePosition = obj.tilePosition;
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
TilingSprite.componentName = 'TilingSprite';
|
|
62
|
-
|
|
63
|
-
__decorate([Field(), __metadata("design:type", String)], TilingSprite.prototype, "resource", void 0);
|
|
64
|
-
|
|
65
|
-
__decorate([Field(function () {
|
|
66
|
-
return Vector2;
|
|
67
|
-
}), __metadata("design:type", Object)], TilingSprite.prototype, "tileScale", void 0);
|
|
68
|
-
|
|
69
|
-
__decorate([Field(function () {
|
|
70
|
-
return IntVector2;
|
|
71
|
-
}), __metadata("design:type", Object)], TilingSprite.prototype, "tilePosition", void 0);
|
|
72
|
-
|
|
73
|
-
return TilingSprite;
|
|
74
|
-
}(Component);
|
|
75
|
-
|
|
76
|
-
var TilingSprite$3 = TilingSprite$2;
|
|
77
|
-
|
|
78
|
-
var TilingSprite = function (_super) {
|
|
79
|
-
__extends(TilingSprite, _super);
|
|
80
|
-
|
|
81
|
-
function TilingSprite() {
|
|
82
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
83
|
-
|
|
84
|
-
_this.name = 'TilingSprite';
|
|
85
|
-
_this.imgs = {};
|
|
86
|
-
return _this;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
TilingSprite.prototype.init = function () {
|
|
90
|
-
this.renderSystem = this.game.getSystem(RendererSystem);
|
|
91
|
-
this.renderSystem.rendererManager.register(this);
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
TilingSprite.prototype.rendererUpdate = function (gameObject) {
|
|
95
|
-
var _a = gameObject.transform.size,
|
|
96
|
-
width = _a.width,
|
|
97
|
-
height = _a.height;
|
|
98
|
-
var img = this.imgs[gameObject.id];
|
|
99
|
-
|
|
100
|
-
if (img) {
|
|
101
|
-
img.tilingSprite.width = width;
|
|
102
|
-
img.tilingSprite.height = height;
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
TilingSprite.prototype.componentChanged = function (changed) {
|
|
107
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
108
|
-
var gameObjectId, component, sprite, asyncId, data, asyncId, data, sprite;
|
|
109
|
-
return __generator(this, function (_a) {
|
|
110
|
-
switch (_a.label) {
|
|
111
|
-
case 0:
|
|
112
|
-
gameObjectId = changed.gameObject.id;
|
|
113
|
-
if (!(changed.componentName === 'TilingSprite')) return [3, 7];
|
|
114
|
-
component = changed.component;
|
|
115
|
-
if (!(changed.type === OBSERVER_TYPE.ADD)) return [3, 2];
|
|
116
|
-
sprite = new TilingSprite$4(null);
|
|
117
|
-
this.imgs[changed.gameObject.id] = sprite;
|
|
118
|
-
this.containerManager.getContainer(changed.gameObject.id).addChildAt(sprite.tilingSprite, 0);
|
|
119
|
-
this.setProp(changed.gameObject.id, component);
|
|
120
|
-
asyncId = this.increaseAsyncId(gameObjectId);
|
|
121
|
-
return [4, resource.getResource(component.resource)];
|
|
122
|
-
|
|
123
|
-
case 1:
|
|
124
|
-
data = _a.sent().data;
|
|
125
|
-
if (!this.validateAsyncId(gameObjectId, asyncId)) return [2];
|
|
126
|
-
|
|
127
|
-
if (!data) {
|
|
128
|
-
console.error("GameObject:" + changed.gameObject.name + "'s TilingSprite resource load error");
|
|
129
|
-
return [2];
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
sprite.image = data.image;
|
|
133
|
-
return [3, 7];
|
|
134
|
-
|
|
135
|
-
case 2:
|
|
136
|
-
if (!(changed.type === OBSERVER_TYPE.CHANGE)) return [3, 6];
|
|
137
|
-
if (!(changed.prop.prop[0] === 'resource')) return [3, 4];
|
|
138
|
-
asyncId = this.increaseAsyncId(gameObjectId);
|
|
139
|
-
return [4, resource.getResource(component.resource)];
|
|
140
|
-
|
|
141
|
-
case 3:
|
|
142
|
-
data = _a.sent().data;
|
|
143
|
-
if (!this.validateAsyncId(gameObjectId, asyncId)) return [2];
|
|
144
|
-
|
|
145
|
-
if (!data) {
|
|
146
|
-
console.error("GameObject:" + changed.gameObject.name + "'s TilingSprite resource load error");
|
|
147
|
-
return [2];
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
this.imgs[changed.gameObject.id].image = data.image;
|
|
151
|
-
return [3, 5];
|
|
152
|
-
|
|
153
|
-
case 4:
|
|
154
|
-
this.setProp(changed.gameObject.id, component);
|
|
155
|
-
_a.label = 5;
|
|
156
|
-
|
|
157
|
-
case 5:
|
|
158
|
-
return [3, 7];
|
|
159
|
-
|
|
160
|
-
case 6:
|
|
161
|
-
if (changed.type === OBSERVER_TYPE.REMOVE) {
|
|
162
|
-
this.increaseAsyncId(gameObjectId);
|
|
163
|
-
sprite = this.imgs[changed.gameObject.id];
|
|
164
|
-
this.containerManager.getContainer(changed.gameObject.id).removeChild(sprite.tilingSprite);
|
|
165
|
-
sprite.tilingSprite.destroy({
|
|
166
|
-
children: true
|
|
167
|
-
});
|
|
168
|
-
delete this.imgs[changed.gameObject.id];
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
_a.label = 7;
|
|
172
|
-
|
|
173
|
-
case 7:
|
|
174
|
-
return [2];
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
});
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
TilingSprite.prototype.setProp = function (id, component) {
|
|
181
|
-
this.imgs[id].tilingSprite.tilePosition = component.tilePosition;
|
|
182
|
-
this.imgs[id].tilingSprite.tileScale = component.tileScale;
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
TilingSprite = __decorate([decorators.componentObserver({
|
|
186
|
-
TilingSprite: [{
|
|
187
|
-
prop: ['resource'],
|
|
188
|
-
deep: false
|
|
189
|
-
}, {
|
|
190
|
-
prop: ['tileScale'],
|
|
191
|
-
deep: true
|
|
192
|
-
}, {
|
|
193
|
-
prop: ['tilePosition'],
|
|
194
|
-
deep: true
|
|
195
|
-
}]
|
|
196
|
-
})], TilingSprite);
|
|
197
|
-
return TilingSprite;
|
|
198
|
-
}(Renderer);
|
|
199
|
-
|
|
200
|
-
var TilingSprite$1 = TilingSprite;
|
|
201
|
-
export { TilingSprite$3 as TilingSprite, TilingSprite$1 as TilingSpriteSystem };
|