@eva/plugin-renderer-tiling-sprite 1.2.7-editor.1 → 1.2.7-editor.10
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 +156 -19
- package/dist/EVA.plugin.renderer.tilingSprite.min.js +1 -1
- package/dist/plugin-renderer-tiling-sprite.cjs.js +36 -5
- package/dist/plugin-renderer-tiling-sprite.cjs.prod.js +1 -1
- package/dist/plugin-renderer-tiling-sprite.esm.js +37 -6
- package/package.json +5 -5
- package/dist/miniprogram.js +0 -169
|
@@ -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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
|
|
@@ -20,6 +20,8 @@ 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
|
+
|
|
23
25
|
_extendStatics(d, b);
|
|
24
26
|
|
|
25
27
|
function __() {
|
|
@@ -29,6 +31,22 @@ var _EVA_IIFE_tilingSprite = function (exports, eva_js, pluginRenderer, renderer
|
|
|
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_tilingSprite = function (exports, eva_js, pluginRenderer, renderer
|
|
|
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,34 +204,145 @@ var _EVA_IIFE_tilingSprite = function (exports, eva_js, pluginRenderer, renderer
|
|
|
182
204
|
}
|
|
183
205
|
}
|
|
184
206
|
|
|
185
|
-
function
|
|
186
|
-
|
|
187
|
-
|
|
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';
|
|
188
246
|
}
|
|
189
247
|
|
|
190
|
-
if (
|
|
191
|
-
|
|
248
|
+
if (type === Boolean) {
|
|
249
|
+
return 'boolean';
|
|
192
250
|
}
|
|
193
251
|
|
|
194
|
-
|
|
195
|
-
return propertyObj;
|
|
252
|
+
return 'unknown';
|
|
196
253
|
}
|
|
197
254
|
|
|
198
|
-
function
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
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
|
|
296
|
+
function Field(returnTypeFunction, maybeOptions) {
|
|
207
297
|
return function (target, propertyKey) {
|
|
208
|
-
|
|
209
|
-
|
|
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
|
|
|
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
|
+
|
|
213
346
|
var TilingSprite$2 = function (_super) {
|
|
214
347
|
__extends(TilingSprite, _super);
|
|
215
348
|
|
|
@@ -238,11 +371,15 @@ var _EVA_IIFE_tilingSprite = function (exports, eva_js, pluginRenderer, renderer
|
|
|
238
371
|
|
|
239
372
|
TilingSprite.componentName = 'TilingSprite';
|
|
240
373
|
|
|
241
|
-
__decorate([
|
|
374
|
+
__decorate([Field(), __metadata("design:type", String)], TilingSprite.prototype, "resource", void 0);
|
|
242
375
|
|
|
243
|
-
__decorate([
|
|
376
|
+
__decorate([Field(function () {
|
|
377
|
+
return Vector2;
|
|
378
|
+
}), __metadata("design:type", Object)], TilingSprite.prototype, "tileScale", void 0);
|
|
244
379
|
|
|
245
|
-
__decorate([
|
|
380
|
+
__decorate([Field(function () {
|
|
381
|
+
return IntVector2;
|
|
382
|
+
}), __metadata("design:type", Object)], TilingSprite.prototype, "tilePosition", void 0);
|
|
246
383
|
|
|
247
384
|
return TilingSprite;
|
|
248
385
|
}(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)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},i(e,t)};function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var c=function(){return c=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},c.apply(this,arguments)};function a(e,t,r,n){var i,o=arguments.length,c=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(c=(o<3?i(c):o>3?i(t,r,c):i(t,r))||c);return o>3&&c&&Object.defineProperty(t,r,c),c}function s(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function u(e,t,r,n){return new(r||(r=Promise))((function(i,o){function c(e){try{s(n.next(e))}catch(e){o(e)}}function a(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(c,a)}s((n=n.apply(e,t||[])).next())}))}function p(e,t){var r,n,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;c;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,n=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!(i=c.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){c.label=o[1];break}if(6===o[0]&&c.label<i[1]){c.label=i[1],i=o;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(o);break}i[2]&&c.ops.pop(),c.trys.pop();continue}o=t.call(e,c)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}var l=function(e){function t(){var t=this.constructor,r=e.call(this,"Symbol keys are not supported yet!")||this;return Object.setPrototypeOf(r,t.prototype),r}return o(t,e),t}(Error);!function(e){function t(){var t=this.constructor,r=e.call(this,"getProperties is not a function!")||this;return Object.setPrototypeOf(r,t.prototype),r}o(t,e)}(Error);var f,d="IDE_PROPERTY_METADATA";function y(e,t,r,n){var i=Reflect.getMetadata("design:type",e,t),o=i===Array,a=function(e){return e===String?"string":e===Number?"number":e===Boolean?"boolean":"unknown"}(i);if("unknown"!==a&&(i=a),n){var s=n();Array.isArray(s)?(o=!0,i=s[0]):i=s}var u=Reflect.getMetadata(d,e.constructor)||{};u[t]=c({type:i,isArray:o},r),Reflect.defineMetadata(d,u,e.constructor)}function g(e,t){return function(r,n){if("symbol"==typeof n)throw new l;var i=function(e,t){return"function"==typeof e?{returnTypeFunc:e,options:t||{}}:{options:e||{}}}(e,t);y(r,n,i.options,i.returnTypeFunc)}}!function(e){e[e.Edit=2]="Edit",e[e.Game=4]="Game",e[e.All=6]="All"}(f||(f={}));var h=function(){function e(){}return a([g({step:.1}),s("design:type",Number)],e.prototype,"x",void 0),a([g({step:.1}),s("design:type",Number)],e.prototype,"y",void 0),e}(),m=function(){function e(){}return a([g({step:1}),s("design:type",Number)],e.prototype,"x",void 0),a([g({step:1}),s("design:type",Number)],e.prototype,"y",void 0),e}(),b=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.resource="",t.tileScale={x:1,y:1},t.tilePosition={x:0,y:0},t}return o(t,e),t.prototype.init=function(e){e&&(this.resource=e.resource,this.tileScale=e.tileScale,this.tilePosition=e.tilePosition)},t.componentName="TilingSprite",a([g(),s("design:type",String)],t.prototype,"resource",void 0),a([g((function(){return h})),s("design:type",Object)],t.prototype,"tileScale",void 0),a([g((function(){return m})),s("design:type",Object)],t.prototype,"tilePosition",void 0),t}(t.Component),v=b,S=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t.name="TilingSprite",t.imgs={},t}return o(i,e),i.prototype.init=function(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)},i.prototype.rendererUpdate=function(e){var t=e.transform.size,r=t.width,n=t.height,i=this.imgs[e.id];i&&(i.tilingSprite.width=r,i.tilingSprite.height=n)},i.prototype.componentChanged=function(e){return u(this,void 0,void 0,(function(){var r,i,o,c,a;return p(this,(function(s){switch(s.label){case 0:return r=e.gameObject.id,"TilingSprite"!==e.componentName?[3,7]:(i=e.component,e.type!==t.OBSERVER_TYPE.ADD?[3,2]:(a=new n.TilingSprite(null),this.imgs[e.gameObject.id]=a,this.containerManager.getContainer(e.gameObject.id).addChildAt(a.tilingSprite,0),this.setProp(e.gameObject.id,i),o=this.increaseAsyncId(r),[4,t.resource.getResource(i.resource)]));case 1:return c=s.sent().data,this.validateAsyncId(r,o)?c?(a.image=c.image,[3,7]):(console.error("GameObject:"+e.gameObject.name+"'s TilingSprite resource load error"),[2]):[2];case 2:return e.type!==t.OBSERVER_TYPE.CHANGE?[3,6]:"resource"!==e.prop.prop[0]?[3,4]:(o=this.increaseAsyncId(r),[4,t.resource.getResource(i.resource)]);case 3:return c=s.sent().data,this.validateAsyncId(r,o)?c?(this.imgs[e.gameObject.id].image=c.image,[3,5]):(console.error("GameObject:"+e.gameObject.name+"'s TilingSprite resource load error"),[2]):[2];case 4:this.setProp(e.gameObject.id,i),s.label=5;case 5:return[3,7];case 6:e.type===t.OBSERVER_TYPE.REMOVE&&(this.increaseAsyncId(r),a=this.imgs[e.gameObject.id],this.containerManager.getContainer(e.gameObject.id).removeChild(a.tilingSprite),a.tilingSprite.destroy({children:!0}),delete this.imgs[e.gameObject.id]),s.label=7;case 7:return[2]}}))}))},i.prototype.setProp=function(e,t){this.imgs[e].tilingSprite.tilePosition=t.tilePosition,this.imgs[e].tilingSprite.tileScale=t.tileScale},i=a([t.decorators.componentObserver({TilingSprite:[{prop:["resource"],deep:!1},{prop:["tileScale"],deep:!0},{prop:["tilePosition"],deep:!0}]})],i)}(r.Renderer),w=S;return e.TilingSprite=v,e.TilingSpriteSystem=w,Object.defineProperty(e,"__esModule",{value:!0}),e}({},EVA,EVA.plugin.renderer,EVA.rendererAdapter);window.EVA.plugin.renderer.tilingSprite=window.EVA.plugin.renderer.tilingSprite||_EVA_IIFE_tilingSprite;
|
|
@@ -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); } }
|
|
@@ -80,6 +84,32 @@ function __generator(thisArg, body) {
|
|
|
80
84
|
}
|
|
81
85
|
}
|
|
82
86
|
|
|
87
|
+
var Vector2 = (function () {
|
|
88
|
+
function Vector2() {
|
|
89
|
+
}
|
|
90
|
+
__decorate([
|
|
91
|
+
inspectorDecorator.Field({ step: 0.1 }),
|
|
92
|
+
__metadata("design:type", Number)
|
|
93
|
+
], Vector2.prototype, "x", void 0);
|
|
94
|
+
__decorate([
|
|
95
|
+
inspectorDecorator.Field({ step: 0.1 }),
|
|
96
|
+
__metadata("design:type", Number)
|
|
97
|
+
], Vector2.prototype, "y", void 0);
|
|
98
|
+
return Vector2;
|
|
99
|
+
}());
|
|
100
|
+
var IntVector2 = (function () {
|
|
101
|
+
function IntVector2() {
|
|
102
|
+
}
|
|
103
|
+
__decorate([
|
|
104
|
+
inspectorDecorator.Field({ step: 1 }),
|
|
105
|
+
__metadata("design:type", Number)
|
|
106
|
+
], IntVector2.prototype, "x", void 0);
|
|
107
|
+
__decorate([
|
|
108
|
+
inspectorDecorator.Field({ step: 1 }),
|
|
109
|
+
__metadata("design:type", Number)
|
|
110
|
+
], IntVector2.prototype, "y", void 0);
|
|
111
|
+
return IntVector2;
|
|
112
|
+
}());
|
|
83
113
|
var TilingSprite$2 = (function (_super) {
|
|
84
114
|
__extends(TilingSprite, _super);
|
|
85
115
|
function TilingSprite() {
|
|
@@ -104,15 +134,16 @@ var TilingSprite$2 = (function (_super) {
|
|
|
104
134
|
};
|
|
105
135
|
TilingSprite.componentName = 'TilingSprite';
|
|
106
136
|
__decorate([
|
|
107
|
-
inspectorDecorator.
|
|
137
|
+
inspectorDecorator.Field(),
|
|
138
|
+
__metadata("design:type", String)
|
|
108
139
|
], TilingSprite.prototype, "resource", void 0);
|
|
109
140
|
__decorate([
|
|
110
|
-
inspectorDecorator.
|
|
111
|
-
|
|
141
|
+
inspectorDecorator.Field(function () { return Vector2; }),
|
|
142
|
+
__metadata("design:type", Object)
|
|
112
143
|
], TilingSprite.prototype, "tileScale", void 0);
|
|
113
144
|
__decorate([
|
|
114
|
-
inspectorDecorator.
|
|
115
|
-
|
|
145
|
+
inspectorDecorator.Field(function () { return IntVector2; }),
|
|
146
|
+
__metadata("design:type", Object)
|
|
116
147
|
], TilingSprite.prototype, "tilePosition", void 0);
|
|
117
148
|
return TilingSprite;
|
|
118
149
|
}(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])},n(e,t)};function o(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function c(e,t,r,i){var n,o=arguments.length,c=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,i);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(c=(o<3?n(c):o>3?n(t,r,c):n(t,r))||c);return o>3&&c&&Object.defineProperty(t,r,c),c}function s(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function a(e,t){var r,i,n,o,c={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;c;)try{if(r=1,i&&(n=2&o[0]?i.return:o[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,o[1])).done)return n;switch(i=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,i=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!(n=c.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){c.label=o[1];break}if(6===o[0]&&c.label<n[1]){c.label=n[1],n=o;break}if(n&&c.label<n[2]){c.label=n[2],c.ops.push(o);break}n[2]&&c.ops.pop(),c.trys.pop();continue}o=t.call(e,c)}catch(e){o=[6,e],i=0}finally{r=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}var p=function(){function e(){}return c([t.Field({step:.1}),s("design:type",Number)],e.prototype,"x",void 0),c([t.Field({step:.1}),s("design:type",Number)],e.prototype,"y",void 0),e}(),l=function(){function e(){}return c([t.Field({step:1}),s("design:type",Number)],e.prototype,"x",void 0),c([t.Field({step:1}),s("design:type",Number)],e.prototype,"y",void 0),e}(),u=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.resource="",t.tileScale={x:1,y:1},t.tilePosition={x:0,y:0},t}return o(r,e),r.prototype.init=function(e){e&&(this.resource=e.resource,this.tileScale=e.tileScale,this.tilePosition=e.tilePosition)},r.componentName="TilingSprite",c([t.Field(),s("design:type",String)],r.prototype,"resource",void 0),c([t.Field((function(){return p})),s("design:type",Object)],r.prototype,"tileScale",void 0),c([t.Field((function(){return l})),s("design:type",Object)],r.prototype,"tilePosition",void 0),r}(e.Component),d=u,f=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="TilingSprite",e.imgs={},e}return o(n,t),n.prototype.init=function(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)},n.prototype.rendererUpdate=function(e){var t=e.transform.size,r=t.width,i=t.height,n=this.imgs[e.id];n&&(n.tilingSprite.width=r,n.tilingSprite.height=i)},n.prototype.componentChanged=function(t){return r=this,n=void 0,c=function(){var r,n,o,c,s;return a(this,(function(a){switch(a.label){case 0:return r=t.gameObject.id,"TilingSprite"!==t.componentName?[3,7]:(n=t.component,t.type!==e.OBSERVER_TYPE.ADD?[3,2]:(s=new i.TilingSprite(null),this.imgs[t.gameObject.id]=s,this.containerManager.getContainer(t.gameObject.id).addChildAt(s.tilingSprite,0),this.setProp(t.gameObject.id,n),o=this.increaseAsyncId(r),[4,e.resource.getResource(n.resource)]));case 1:return c=a.sent().data,this.validateAsyncId(r,o)?c?(s.image=c.image,[3,7]):(console.error("GameObject:"+t.gameObject.name+"'s TilingSprite resource load error"),[2]):[2];case 2:return t.type!==e.OBSERVER_TYPE.CHANGE?[3,6]:"resource"!==t.prop.prop[0]?[3,4]:(o=this.increaseAsyncId(r),[4,e.resource.getResource(n.resource)]);case 3:return c=a.sent().data,this.validateAsyncId(r,o)?c?(this.imgs[t.gameObject.id].image=c.image,[3,5]):(console.error("GameObject:"+t.gameObject.name+"'s TilingSprite resource load error"),[2]):[2];case 4:this.setProp(t.gameObject.id,n),a.label=5;case 5:return[3,7];case 6:t.type===e.OBSERVER_TYPE.REMOVE&&(this.increaseAsyncId(r),s=this.imgs[t.gameObject.id],this.containerManager.getContainer(t.gameObject.id).removeChild(s.tilingSprite),s.tilingSprite.destroy({children:!0}),delete this.imgs[t.gameObject.id]),a.label=7;case 7:return[2]}}))},new((o=void 0)||(o=Promise))((function(e,t){function i(e){try{a(c.next(e))}catch(e){t(e)}}function s(e){try{a(c.throw(e))}catch(e){t(e)}}function a(t){t.done?e(t.value):new o((function(e){e(t.value)})).then(i,s)}a((c=c.apply(r,n||[])).next())}));var r,n,o,c},n.prototype.setProp=function(e,t){this.imgs[e].tilingSprite.tilePosition=t.tilePosition,this.imgs[e].tilingSprite.tileScale=t.tileScale},n=c([e.decorators.componentObserver({TilingSprite:[{prop:["resource"],deep:!1},{prop:["tileScale"],deep:!0},{prop:["tilePosition"],deep:!0}]})],n)}(r.Renderer);exports.TilingSprite=d,exports.TilingSpriteSystem=f;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component, decorators, OBSERVER_TYPE, resource } from '@eva/eva.js';
|
|
2
|
-
import {
|
|
2
|
+
import { Field } 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,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); } }
|
|
@@ -76,6 +80,32 @@ function __generator(thisArg, body) {
|
|
|
76
80
|
}
|
|
77
81
|
}
|
|
78
82
|
|
|
83
|
+
var Vector2 = (function () {
|
|
84
|
+
function Vector2() {
|
|
85
|
+
}
|
|
86
|
+
__decorate([
|
|
87
|
+
Field({ step: 0.1 }),
|
|
88
|
+
__metadata("design:type", Number)
|
|
89
|
+
], Vector2.prototype, "x", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
Field({ step: 0.1 }),
|
|
92
|
+
__metadata("design:type", Number)
|
|
93
|
+
], Vector2.prototype, "y", void 0);
|
|
94
|
+
return Vector2;
|
|
95
|
+
}());
|
|
96
|
+
var IntVector2 = (function () {
|
|
97
|
+
function IntVector2() {
|
|
98
|
+
}
|
|
99
|
+
__decorate([
|
|
100
|
+
Field({ step: 1 }),
|
|
101
|
+
__metadata("design:type", Number)
|
|
102
|
+
], IntVector2.prototype, "x", void 0);
|
|
103
|
+
__decorate([
|
|
104
|
+
Field({ step: 1 }),
|
|
105
|
+
__metadata("design:type", Number)
|
|
106
|
+
], IntVector2.prototype, "y", void 0);
|
|
107
|
+
return IntVector2;
|
|
108
|
+
}());
|
|
79
109
|
var TilingSprite$2 = (function (_super) {
|
|
80
110
|
__extends(TilingSprite, _super);
|
|
81
111
|
function TilingSprite() {
|
|
@@ -100,15 +130,16 @@ var TilingSprite$2 = (function (_super) {
|
|
|
100
130
|
};
|
|
101
131
|
TilingSprite.componentName = 'TilingSprite';
|
|
102
132
|
__decorate([
|
|
103
|
-
|
|
133
|
+
Field(),
|
|
134
|
+
__metadata("design:type", String)
|
|
104
135
|
], TilingSprite.prototype, "resource", void 0);
|
|
105
136
|
__decorate([
|
|
106
|
-
|
|
107
|
-
|
|
137
|
+
Field(function () { return Vector2; }),
|
|
138
|
+
__metadata("design:type", Object)
|
|
108
139
|
], TilingSprite.prototype, "tileScale", void 0);
|
|
109
140
|
__decorate([
|
|
110
|
-
|
|
111
|
-
|
|
141
|
+
Field(function () { return IntVector2; }),
|
|
142
|
+
__metadata("design:type", Object)
|
|
112
143
|
], TilingSprite.prototype, "tilePosition", void 0);
|
|
113
144
|
return TilingSprite;
|
|
114
145
|
}(Component));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eva/plugin-renderer-tiling-sprite",
|
|
3
|
-
"version": "1.2.7-editor.
|
|
3
|
+
"version": "1.2.7-editor.10",
|
|
4
4
|
"description": "@eva/plugin-renderer-tiling-sprite",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/plugin-renderer-tiling-sprite.esm.js",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"homepage": "https://eva.js.org",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@eva/inspector-decorator": "0.1.0-alpha.
|
|
22
|
-
"@eva/plugin-renderer": "1.2.7-editor.
|
|
23
|
-
"@eva/renderer-adapter": "1.2.7-editor.
|
|
24
|
-
"@eva/eva.js": "1.2.7-editor.
|
|
21
|
+
"@eva/inspector-decorator": "0.1.0-alpha.2",
|
|
22
|
+
"@eva/plugin-renderer": "1.2.7-editor.10",
|
|
23
|
+
"@eva/renderer-adapter": "1.2.7-editor.10",
|
|
24
|
+
"@eva/eva.js": "1.2.7-editor.10",
|
|
25
25
|
"@types/pixi.js": "^4.8.9"
|
|
26
26
|
}
|
|
27
27
|
}
|
package/dist/miniprogram.js
DELETED
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import { __extends, __decorate, __awaiter, __generator } from 'tslib';
|
|
2
|
-
import { Component, OBSERVER_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 { TilingSprite as TilingSprite$4 } from '@eva/renderer-adapter/dist/miniprogram';
|
|
6
|
-
|
|
7
|
-
var TilingSprite$2 = function (_super) {
|
|
8
|
-
__extends(TilingSprite, _super);
|
|
9
|
-
|
|
10
|
-
function TilingSprite() {
|
|
11
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
12
|
-
|
|
13
|
-
_this.resource = '';
|
|
14
|
-
_this.tileScale = {
|
|
15
|
-
x: 1,
|
|
16
|
-
y: 1
|
|
17
|
-
};
|
|
18
|
-
_this.tilePosition = {
|
|
19
|
-
x: 0,
|
|
20
|
-
y: 0
|
|
21
|
-
};
|
|
22
|
-
return _this;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
TilingSprite.prototype.init = function (obj) {
|
|
26
|
-
if (obj) {
|
|
27
|
-
this.resource = obj.resource;
|
|
28
|
-
this.tileScale = obj.tileScale;
|
|
29
|
-
this.tilePosition = obj.tilePosition;
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
TilingSprite.componentName = 'TilingSprite';
|
|
34
|
-
|
|
35
|
-
__decorate([type('string')], TilingSprite.prototype, "resource", void 0);
|
|
36
|
-
|
|
37
|
-
__decorate([type('vector2'), step(0.1)], TilingSprite.prototype, "tileScale", void 0);
|
|
38
|
-
|
|
39
|
-
__decorate([type('vector2'), step(1)], TilingSprite.prototype, "tilePosition", void 0);
|
|
40
|
-
|
|
41
|
-
return TilingSprite;
|
|
42
|
-
}(Component);
|
|
43
|
-
|
|
44
|
-
var TilingSprite$3 = TilingSprite$2;
|
|
45
|
-
|
|
46
|
-
var TilingSprite = function (_super) {
|
|
47
|
-
__extends(TilingSprite, _super);
|
|
48
|
-
|
|
49
|
-
function TilingSprite() {
|
|
50
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
51
|
-
|
|
52
|
-
_this.name = 'TilingSprite';
|
|
53
|
-
_this.imgs = {};
|
|
54
|
-
return _this;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
TilingSprite.prototype.init = function () {
|
|
58
|
-
this.renderSystem = this.game.getSystem(RendererSystem);
|
|
59
|
-
this.renderSystem.rendererManager.register(this);
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
TilingSprite.prototype.rendererUpdate = function (gameObject) {
|
|
63
|
-
var _a = gameObject.transform.size,
|
|
64
|
-
width = _a.width,
|
|
65
|
-
height = _a.height;
|
|
66
|
-
var img = this.imgs[gameObject.id];
|
|
67
|
-
|
|
68
|
-
if (img) {
|
|
69
|
-
img.tilingSprite.width = width;
|
|
70
|
-
img.tilingSprite.height = height;
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
TilingSprite.prototype.componentChanged = function (changed) {
|
|
75
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
76
|
-
var gameObjectId, component, sprite, asyncId, data, asyncId, data, sprite;
|
|
77
|
-
return __generator(this, function (_a) {
|
|
78
|
-
switch (_a.label) {
|
|
79
|
-
case 0:
|
|
80
|
-
gameObjectId = changed.gameObject.id;
|
|
81
|
-
if (!(changed.componentName === 'TilingSprite')) return [3, 7];
|
|
82
|
-
component = changed.component;
|
|
83
|
-
if (!(changed.type === OBSERVER_TYPE.ADD)) return [3, 2];
|
|
84
|
-
sprite = new TilingSprite$4(null);
|
|
85
|
-
this.imgs[changed.gameObject.id] = sprite;
|
|
86
|
-
this.containerManager.getContainer(changed.gameObject.id).addChildAt(sprite.tilingSprite, 0);
|
|
87
|
-
this.setProp(changed.gameObject.id, component);
|
|
88
|
-
asyncId = this.increaseAsyncId(gameObjectId);
|
|
89
|
-
return [4, resource.getResource(component.resource)];
|
|
90
|
-
|
|
91
|
-
case 1:
|
|
92
|
-
data = _a.sent().data;
|
|
93
|
-
if (!this.validateAsyncId(gameObjectId, asyncId)) return [2];
|
|
94
|
-
|
|
95
|
-
if (!data) {
|
|
96
|
-
console.error("GameObject:" + changed.gameObject.name + "'s TilingSprite resource load error");
|
|
97
|
-
return [2];
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
sprite.image = data.image;
|
|
101
|
-
return [3, 7];
|
|
102
|
-
|
|
103
|
-
case 2:
|
|
104
|
-
if (!(changed.type === OBSERVER_TYPE.CHANGE)) return [3, 6];
|
|
105
|
-
if (!(changed.prop.prop[0] === 'resource')) return [3, 4];
|
|
106
|
-
asyncId = this.increaseAsyncId(gameObjectId);
|
|
107
|
-
return [4, resource.getResource(component.resource)];
|
|
108
|
-
|
|
109
|
-
case 3:
|
|
110
|
-
data = _a.sent().data;
|
|
111
|
-
if (!this.validateAsyncId(gameObjectId, asyncId)) return [2];
|
|
112
|
-
|
|
113
|
-
if (!data) {
|
|
114
|
-
console.error("GameObject:" + changed.gameObject.name + "'s TilingSprite resource load error");
|
|
115
|
-
return [2];
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
this.imgs[changed.gameObject.id].image = data.image;
|
|
119
|
-
return [3, 5];
|
|
120
|
-
|
|
121
|
-
case 4:
|
|
122
|
-
this.setProp(changed.gameObject.id, component);
|
|
123
|
-
_a.label = 5;
|
|
124
|
-
|
|
125
|
-
case 5:
|
|
126
|
-
return [3, 7];
|
|
127
|
-
|
|
128
|
-
case 6:
|
|
129
|
-
if (changed.type === OBSERVER_TYPE.REMOVE) {
|
|
130
|
-
this.increaseAsyncId(gameObjectId);
|
|
131
|
-
sprite = this.imgs[changed.gameObject.id];
|
|
132
|
-
this.containerManager.getContainer(changed.gameObject.id).removeChild(sprite.tilingSprite);
|
|
133
|
-
sprite.tilingSprite.destroy({
|
|
134
|
-
children: true
|
|
135
|
-
});
|
|
136
|
-
delete this.imgs[changed.gameObject.id];
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
_a.label = 7;
|
|
140
|
-
|
|
141
|
-
case 7:
|
|
142
|
-
return [2];
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
TilingSprite.prototype.setProp = function (id, component) {
|
|
149
|
-
this.imgs[id].tilingSprite.tilePosition = component.tilePosition;
|
|
150
|
-
this.imgs[id].tilingSprite.tileScale = component.tileScale;
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
TilingSprite = __decorate([decorators.componentObserver({
|
|
154
|
-
TilingSprite: [{
|
|
155
|
-
prop: ['resource'],
|
|
156
|
-
deep: false
|
|
157
|
-
}, {
|
|
158
|
-
prop: ['tileScale'],
|
|
159
|
-
deep: true
|
|
160
|
-
}, {
|
|
161
|
-
prop: ['tilePosition'],
|
|
162
|
-
deep: true
|
|
163
|
-
}]
|
|
164
|
-
})], TilingSprite);
|
|
165
|
-
return TilingSprite;
|
|
166
|
-
}(Renderer);
|
|
167
|
-
|
|
168
|
-
var TilingSprite$1 = TilingSprite;
|
|
169
|
-
export { TilingSprite$3 as TilingSprite, TilingSprite$1 as TilingSpriteSystem };
|