@eva/plugin-renderer-tiling-sprite 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.
- package/dist/EVA.plugin.renderer.tilingSprite.js +34 -241
- package/dist/EVA.plugin.renderer.tilingSprite.min.js +1 -1
- package/dist/miniprogram.js +137 -0
- 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
|
@@ -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_tilingSprite = function (exports, eva_js, pluginRenderer, rendererAdapter) {
|
|
6
5
|
'use strict';
|
|
7
6
|
|
|
@@ -12,62 +11,33 @@ var _EVA_IIFE_tilingSprite = function (exports, eva_js, pluginRenderer, renderer
|
|
|
12
11
|
d.__proto__ = b;
|
|
13
12
|
} || function (d, b) {
|
|
14
13
|
for (var p in b) {
|
|
15
|
-
if (
|
|
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
|
-
|
|
53
|
-
|
|
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_tilingSprite = function (exports, eva_js, pluginRenderer, renderer
|
|
|
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_tilingSprite = function (exports, eva_js, pluginRenderer, renderer
|
|
|
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
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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_tilingSprite = function (exports, eva_js, pluginRenderer, renderer
|
|
|
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_tilingSprite = function (exports, eva_js, pluginRenderer, renderer
|
|
|
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,152 +149,33 @@ var _EVA_IIFE_tilingSprite = function (exports, eva_js, pluginRenderer, renderer
|
|
|
203
149
|
};
|
|
204
150
|
}
|
|
205
151
|
}
|
|
206
|
-
|
|
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;
|
|
152
|
+
function getIDEPropsPropertyObj(target, propertyKey) {
|
|
153
|
+
if (!target.constructor.IDEProps) {
|
|
154
|
+
target.constructor.IDEProps = {};
|
|
217
155
|
}
|
|
218
|
-
|
|
219
|
-
|
|
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;
|
|
156
|
+
if (!target.constructor.IDEProps[propertyKey]) {
|
|
157
|
+
target.constructor.IDEProps[propertyKey] = {};
|
|
232
158
|
}
|
|
233
|
-
|
|
234
|
-
return
|
|
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';
|
|
159
|
+
var propertyObj = target.constructor.IDEProps[propertyKey];
|
|
160
|
+
return propertyObj;
|
|
253
161
|
}
|
|
254
|
-
|
|
255
|
-
|
|
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 || {}
|
|
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
|
-
|
|
299
|
-
|
|
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
|
-
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
175
|
var TilingSprite$2 = function (_super) {
|
|
347
176
|
__extends(TilingSprite, _super);
|
|
348
|
-
|
|
349
177
|
function TilingSprite() {
|
|
350
178
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
351
|
-
|
|
352
179
|
_this.resource = '';
|
|
353
180
|
_this.tileScale = {
|
|
354
181
|
x: 1,
|
|
@@ -360,7 +187,6 @@ var _EVA_IIFE_tilingSprite = function (exports, eva_js, pluginRenderer, renderer
|
|
|
360
187
|
};
|
|
361
188
|
return _this;
|
|
362
189
|
}
|
|
363
|
-
|
|
364
190
|
TilingSprite.prototype.init = function (obj) {
|
|
365
191
|
if (obj) {
|
|
366
192
|
this.resource = obj.resource;
|
|
@@ -368,52 +194,35 @@ var _EVA_IIFE_tilingSprite = function (exports, eva_js, pluginRenderer, renderer
|
|
|
368
194
|
this.tilePosition = obj.tilePosition;
|
|
369
195
|
}
|
|
370
196
|
};
|
|
371
|
-
|
|
372
197
|
TilingSprite.componentName = 'TilingSprite';
|
|
373
|
-
|
|
374
|
-
__decorate([
|
|
375
|
-
|
|
376
|
-
__decorate([Field(function () {
|
|
377
|
-
return Vector2;
|
|
378
|
-
}), __metadata("design:type", Object)], TilingSprite.prototype, "tileScale", void 0);
|
|
379
|
-
|
|
380
|
-
__decorate([Field(function () {
|
|
381
|
-
return IntVector2;
|
|
382
|
-
}), __metadata("design:type", Object)], TilingSprite.prototype, "tilePosition", void 0);
|
|
383
|
-
|
|
198
|
+
__decorate([type('string')], TilingSprite.prototype, "resource", void 0);
|
|
199
|
+
__decorate([type('vector2'), step(0.1)], TilingSprite.prototype, "tileScale", void 0);
|
|
200
|
+
__decorate([type('vector2'), step(1)], TilingSprite.prototype, "tilePosition", void 0);
|
|
384
201
|
return TilingSprite;
|
|
385
202
|
}(eva_js.Component);
|
|
386
|
-
|
|
387
203
|
var TilingSprite$3 = TilingSprite$2;
|
|
388
|
-
|
|
389
204
|
var TilingSprite = function (_super) {
|
|
390
205
|
__extends(TilingSprite, _super);
|
|
391
|
-
|
|
392
206
|
function TilingSprite() {
|
|
393
207
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
394
|
-
|
|
395
208
|
_this.name = 'TilingSprite';
|
|
396
209
|
_this.imgs = {};
|
|
397
210
|
return _this;
|
|
398
211
|
}
|
|
399
|
-
|
|
400
212
|
TilingSprite.prototype.init = function () {
|
|
401
213
|
this.renderSystem = this.game.getSystem(pluginRenderer.RendererSystem);
|
|
402
214
|
this.renderSystem.rendererManager.register(this);
|
|
403
215
|
};
|
|
404
|
-
|
|
405
216
|
TilingSprite.prototype.rendererUpdate = function (gameObject) {
|
|
406
217
|
var _a = gameObject.transform.size,
|
|
407
|
-
|
|
408
|
-
|
|
218
|
+
width = _a.width,
|
|
219
|
+
height = _a.height;
|
|
409
220
|
var img = this.imgs[gameObject.id];
|
|
410
|
-
|
|
411
221
|
if (img) {
|
|
412
222
|
img.tilingSprite.width = width;
|
|
413
223
|
img.tilingSprite.height = height;
|
|
414
224
|
}
|
|
415
225
|
};
|
|
416
|
-
|
|
417
226
|
TilingSprite.prototype.componentChanged = function (changed) {
|
|
418
227
|
return __awaiter(this, void 0, void 0, function () {
|
|
419
228
|
var gameObjectId, component, sprite, asyncId, data, asyncId, data, sprite;
|
|
@@ -430,44 +239,34 @@ var _EVA_IIFE_tilingSprite = function (exports, eva_js, pluginRenderer, renderer
|
|
|
430
239
|
this.setProp(changed.gameObject.id, component);
|
|
431
240
|
asyncId = this.increaseAsyncId(gameObjectId);
|
|
432
241
|
return [4, eva_js.resource.getResource(component.resource)];
|
|
433
|
-
|
|
434
242
|
case 1:
|
|
435
243
|
data = _a.sent().data;
|
|
436
244
|
if (!this.validateAsyncId(gameObjectId, asyncId)) return [2];
|
|
437
|
-
|
|
438
245
|
if (!data) {
|
|
439
246
|
console.error("GameObject:" + changed.gameObject.name + "'s TilingSprite resource load error");
|
|
440
247
|
return [2];
|
|
441
248
|
}
|
|
442
|
-
|
|
443
249
|
sprite.image = data.image;
|
|
444
250
|
return [3, 7];
|
|
445
|
-
|
|
446
251
|
case 2:
|
|
447
252
|
if (!(changed.type === eva_js.OBSERVER_TYPE.CHANGE)) return [3, 6];
|
|
448
253
|
if (!(changed.prop.prop[0] === 'resource')) return [3, 4];
|
|
449
254
|
asyncId = this.increaseAsyncId(gameObjectId);
|
|
450
255
|
return [4, eva_js.resource.getResource(component.resource)];
|
|
451
|
-
|
|
452
256
|
case 3:
|
|
453
257
|
data = _a.sent().data;
|
|
454
258
|
if (!this.validateAsyncId(gameObjectId, asyncId)) return [2];
|
|
455
|
-
|
|
456
259
|
if (!data) {
|
|
457
260
|
console.error("GameObject:" + changed.gameObject.name + "'s TilingSprite resource load error");
|
|
458
261
|
return [2];
|
|
459
262
|
}
|
|
460
|
-
|
|
461
263
|
this.imgs[changed.gameObject.id].image = data.image;
|
|
462
264
|
return [3, 5];
|
|
463
|
-
|
|
464
265
|
case 4:
|
|
465
266
|
this.setProp(changed.gameObject.id, component);
|
|
466
267
|
_a.label = 5;
|
|
467
|
-
|
|
468
268
|
case 5:
|
|
469
269
|
return [3, 7];
|
|
470
|
-
|
|
471
270
|
case 6:
|
|
472
271
|
if (changed.type === eva_js.OBSERVER_TYPE.REMOVE) {
|
|
473
272
|
this.increaseAsyncId(gameObjectId);
|
|
@@ -478,21 +277,17 @@ var _EVA_IIFE_tilingSprite = function (exports, eva_js, pluginRenderer, renderer
|
|
|
478
277
|
});
|
|
479
278
|
delete this.imgs[changed.gameObject.id];
|
|
480
279
|
}
|
|
481
|
-
|
|
482
280
|
_a.label = 7;
|
|
483
|
-
|
|
484
281
|
case 7:
|
|
485
282
|
return [2];
|
|
486
283
|
}
|
|
487
284
|
});
|
|
488
285
|
});
|
|
489
286
|
};
|
|
490
|
-
|
|
491
287
|
TilingSprite.prototype.setProp = function (id, component) {
|
|
492
288
|
this.imgs[id].tilingSprite.tilePosition = component.tilePosition;
|
|
493
289
|
this.imgs[id].tilingSprite.tileScale = component.tileScale;
|
|
494
290
|
};
|
|
495
|
-
|
|
496
291
|
TilingSprite = __decorate([eva_js.decorators.componentObserver({
|
|
497
292
|
TilingSprite: [{
|
|
498
293
|
prop: ['resource'],
|
|
@@ -507,7 +302,6 @@ var _EVA_IIFE_tilingSprite = function (exports, eva_js, pluginRenderer, renderer
|
|
|
507
302
|
})], TilingSprite);
|
|
508
303
|
return TilingSprite;
|
|
509
304
|
}(pluginRenderer.Renderer);
|
|
510
|
-
|
|
511
305
|
var TilingSprite$1 = TilingSprite;
|
|
512
306
|
exports.TilingSprite = TilingSprite$3;
|
|
513
307
|
exports.TilingSpriteSystem = TilingSprite$1;
|
|
@@ -516,5 +310,4 @@ var _EVA_IIFE_tilingSprite = function (exports, eva_js, pluginRenderer, renderer
|
|
|
516
310
|
});
|
|
517
311
|
return exports;
|
|
518
312
|
}({}, EVA, EVA.plugin.renderer, EVA.rendererAdapter);
|
|
519
|
-
|
|
520
313
|
window.EVA.plugin.renderer.tilingSprite = window.EVA.plugin.renderer.tilingSprite || _EVA_IIFE_tilingSprite;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{},window.EVA.plugin.renderer=window.EVA.plugin.renderer||{};var _EVA_IIFE_tilingSprite=function(e,t,r,n){"use strict";var i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)
|
|
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])},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 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=d,f=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),h=f;return e.TilingSprite=g,e.TilingSpriteSystem=h,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;
|
|
@@ -0,0 +1,137 @@
|
|
|
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
|
+
var TilingSprite$2 = function (_super) {
|
|
7
|
+
__extends(TilingSprite, _super);
|
|
8
|
+
function TilingSprite() {
|
|
9
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
10
|
+
_this.resource = '';
|
|
11
|
+
_this.tileScale = {
|
|
12
|
+
x: 1,
|
|
13
|
+
y: 1
|
|
14
|
+
};
|
|
15
|
+
_this.tilePosition = {
|
|
16
|
+
x: 0,
|
|
17
|
+
y: 0
|
|
18
|
+
};
|
|
19
|
+
return _this;
|
|
20
|
+
}
|
|
21
|
+
TilingSprite.prototype.init = function (obj) {
|
|
22
|
+
if (obj) {
|
|
23
|
+
this.resource = obj.resource;
|
|
24
|
+
this.tileScale = obj.tileScale;
|
|
25
|
+
this.tilePosition = obj.tilePosition;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
TilingSprite.componentName = 'TilingSprite';
|
|
29
|
+
__decorate([type('string')], TilingSprite.prototype, "resource", void 0);
|
|
30
|
+
__decorate([type('vector2'), step(0.1)], TilingSprite.prototype, "tileScale", void 0);
|
|
31
|
+
__decorate([type('vector2'), step(1)], TilingSprite.prototype, "tilePosition", void 0);
|
|
32
|
+
return TilingSprite;
|
|
33
|
+
}(Component);
|
|
34
|
+
var TilingSprite$3 = TilingSprite$2;
|
|
35
|
+
var TilingSprite = function (_super) {
|
|
36
|
+
__extends(TilingSprite, _super);
|
|
37
|
+
function TilingSprite() {
|
|
38
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
39
|
+
_this.name = 'TilingSprite';
|
|
40
|
+
_this.imgs = {};
|
|
41
|
+
return _this;
|
|
42
|
+
}
|
|
43
|
+
TilingSprite.prototype.init = function () {
|
|
44
|
+
this.renderSystem = this.game.getSystem(RendererSystem);
|
|
45
|
+
this.renderSystem.rendererManager.register(this);
|
|
46
|
+
};
|
|
47
|
+
TilingSprite.prototype.rendererUpdate = function (gameObject) {
|
|
48
|
+
var _a = gameObject.transform.size,
|
|
49
|
+
width = _a.width,
|
|
50
|
+
height = _a.height;
|
|
51
|
+
var img = this.imgs[gameObject.id];
|
|
52
|
+
if (img) {
|
|
53
|
+
img.tilingSprite.width = width;
|
|
54
|
+
img.tilingSprite.height = height;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
TilingSprite.prototype.componentChanged = function (changed) {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
59
|
+
var gameObjectId, component, sprite, asyncId, data, asyncId, data, sprite;
|
|
60
|
+
return __generator(this, function (_a) {
|
|
61
|
+
switch (_a.label) {
|
|
62
|
+
case 0:
|
|
63
|
+
gameObjectId = changed.gameObject.id;
|
|
64
|
+
if (!(changed.componentName === 'TilingSprite')) return [3, 7];
|
|
65
|
+
component = changed.component;
|
|
66
|
+
if (!(changed.type === OBSERVER_TYPE.ADD)) return [3, 2];
|
|
67
|
+
sprite = new TilingSprite$4(null);
|
|
68
|
+
this.imgs[changed.gameObject.id] = sprite;
|
|
69
|
+
this.containerManager.getContainer(changed.gameObject.id).addChildAt(sprite.tilingSprite, 0);
|
|
70
|
+
this.setProp(changed.gameObject.id, component);
|
|
71
|
+
asyncId = this.increaseAsyncId(gameObjectId);
|
|
72
|
+
return [4, resource.getResource(component.resource)];
|
|
73
|
+
case 1:
|
|
74
|
+
data = _a.sent().data;
|
|
75
|
+
if (!this.validateAsyncId(gameObjectId, asyncId)) return [2];
|
|
76
|
+
if (!data) {
|
|
77
|
+
console.error("GameObject:" + changed.gameObject.name + "'s TilingSprite resource load error");
|
|
78
|
+
return [2];
|
|
79
|
+
}
|
|
80
|
+
sprite.image = data.image;
|
|
81
|
+
return [3, 7];
|
|
82
|
+
case 2:
|
|
83
|
+
if (!(changed.type === OBSERVER_TYPE.CHANGE)) return [3, 6];
|
|
84
|
+
if (!(changed.prop.prop[0] === 'resource')) return [3, 4];
|
|
85
|
+
asyncId = this.increaseAsyncId(gameObjectId);
|
|
86
|
+
return [4, resource.getResource(component.resource)];
|
|
87
|
+
case 3:
|
|
88
|
+
data = _a.sent().data;
|
|
89
|
+
if (!this.validateAsyncId(gameObjectId, asyncId)) return [2];
|
|
90
|
+
if (!data) {
|
|
91
|
+
console.error("GameObject:" + changed.gameObject.name + "'s TilingSprite resource load error");
|
|
92
|
+
return [2];
|
|
93
|
+
}
|
|
94
|
+
this.imgs[changed.gameObject.id].image = data.image;
|
|
95
|
+
return [3, 5];
|
|
96
|
+
case 4:
|
|
97
|
+
this.setProp(changed.gameObject.id, component);
|
|
98
|
+
_a.label = 5;
|
|
99
|
+
case 5:
|
|
100
|
+
return [3, 7];
|
|
101
|
+
case 6:
|
|
102
|
+
if (changed.type === OBSERVER_TYPE.REMOVE) {
|
|
103
|
+
this.increaseAsyncId(gameObjectId);
|
|
104
|
+
sprite = this.imgs[changed.gameObject.id];
|
|
105
|
+
this.containerManager.getContainer(changed.gameObject.id).removeChild(sprite.tilingSprite);
|
|
106
|
+
sprite.tilingSprite.destroy({
|
|
107
|
+
children: true
|
|
108
|
+
});
|
|
109
|
+
delete this.imgs[changed.gameObject.id];
|
|
110
|
+
}
|
|
111
|
+
_a.label = 7;
|
|
112
|
+
case 7:
|
|
113
|
+
return [2];
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
TilingSprite.prototype.setProp = function (id, component) {
|
|
119
|
+
this.imgs[id].tilingSprite.tilePosition = component.tilePosition;
|
|
120
|
+
this.imgs[id].tilingSprite.tileScale = component.tileScale;
|
|
121
|
+
};
|
|
122
|
+
TilingSprite = __decorate([decorators.componentObserver({
|
|
123
|
+
TilingSprite: [{
|
|
124
|
+
prop: ['resource'],
|
|
125
|
+
deep: false
|
|
126
|
+
}, {
|
|
127
|
+
prop: ['tileScale'],
|
|
128
|
+
deep: true
|
|
129
|
+
}, {
|
|
130
|
+
prop: ['tilePosition'],
|
|
131
|
+
deep: true
|
|
132
|
+
}]
|
|
133
|
+
})], TilingSprite);
|
|
134
|
+
return TilingSprite;
|
|
135
|
+
}(Renderer);
|
|
136
|
+
var TilingSprite$1 = TilingSprite;
|
|
137
|
+
export { TilingSprite$3 as TilingSprite, TilingSprite$1 as TilingSpriteSystem };
|
|
@@ -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 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
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@eva/eva.js"),t=require("@eva/inspector-decorator"),r=require("@eva/plugin-renderer"),i=require("@eva/renderer-adapter"),n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},n(e,t)};function o(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function c(e,t,r,i){var n,o=arguments.length,c=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(c=(o<3?n(c):o>3?n(t,r,c):n(t,r))||c);return o>3&&c&&Object.defineProperty(t,r,c),c}function a(e,t){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=s,p=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=l,exports.TilingSpriteSystem=p;
|
|
@@ -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.7-
|
|
3
|
+
"version": "1.2.7-fix.4",
|
|
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.7-
|
|
23
|
-
"@eva/renderer-adapter": "1.2.7-
|
|
24
|
-
"@eva/eva.js": "1.2.7-
|
|
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
|
}
|