@eva/eva.js 1.2.6 → 1.2.7-editor.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/EVA.js +376 -191
- package/dist/EVA.min.js +1 -1
- package/dist/eva.js.cjs.js +193 -131
- package/dist/eva.js.cjs.prod.js +2 -2
- package/dist/eva.js.d.ts +16 -7
- package/dist/eva.js.esm.js +194 -131
- package/dist/miniprogram.js +259 -170
- package/package.json +3 -2
package/dist/miniprogram.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
|
|
3
|
-
import { __extends as __extends$1, __spread, __values, __decorate, __awaiter, __generator } from 'tslib';
|
|
3
|
+
import { __extends as __extends$1, __spread, __values, __decorate, __metadata, __awaiter, __generator } from 'tslib';
|
|
4
4
|
import EventEmitter from 'eventemitter3';
|
|
5
5
|
import { isEqual, isObject } from 'lodash-es';
|
|
6
|
-
import {
|
|
6
|
+
import { Field } from '@eva/inspector-decorator';
|
|
7
7
|
import { requestAnimationFrame, windowAlias, navigator, documentAlias, XMLHttpRequestAlias } from '@eva/miniprogram-adapter';
|
|
8
8
|
|
|
9
9
|
function getComponentName(component) {
|
|
@@ -344,6 +344,70 @@ function setSystemObserver(system, S) {
|
|
|
344
344
|
systemInstance[S.systemName] = system;
|
|
345
345
|
}
|
|
346
346
|
|
|
347
|
+
var Vector2 = function () {
|
|
348
|
+
function Vector2() {}
|
|
349
|
+
|
|
350
|
+
__decorate([Field({
|
|
351
|
+
step: 0.1,
|
|
352
|
+
default: 0
|
|
353
|
+
}), __metadata("design:type", Number)], Vector2.prototype, "x", void 0);
|
|
354
|
+
|
|
355
|
+
__decorate([Field({
|
|
356
|
+
step: 0.1,
|
|
357
|
+
default: 0
|
|
358
|
+
}), __metadata("design:type", Number)], Vector2.prototype, "y", void 0);
|
|
359
|
+
|
|
360
|
+
return Vector2;
|
|
361
|
+
}();
|
|
362
|
+
|
|
363
|
+
var IntVector2 = function () {
|
|
364
|
+
function IntVector2() {}
|
|
365
|
+
|
|
366
|
+
__decorate([Field({
|
|
367
|
+
step: 1,
|
|
368
|
+
default: 0
|
|
369
|
+
}), __metadata("design:type", Number)], IntVector2.prototype, "x", void 0);
|
|
370
|
+
|
|
371
|
+
__decorate([Field({
|
|
372
|
+
step: 1,
|
|
373
|
+
default: 0
|
|
374
|
+
}), __metadata("design:type", Number)], IntVector2.prototype, "y", void 0);
|
|
375
|
+
|
|
376
|
+
return IntVector2;
|
|
377
|
+
}();
|
|
378
|
+
|
|
379
|
+
var Size2 = function () {
|
|
380
|
+
function Size2() {}
|
|
381
|
+
|
|
382
|
+
__decorate([Field({
|
|
383
|
+
step: 1,
|
|
384
|
+
default: 0
|
|
385
|
+
}), __metadata("design:type", Number)], Size2.prototype, "width", void 0);
|
|
386
|
+
|
|
387
|
+
__decorate([Field({
|
|
388
|
+
step: 1,
|
|
389
|
+
default: 0
|
|
390
|
+
}), __metadata("design:type", Number)], Size2.prototype, "height", void 0);
|
|
391
|
+
|
|
392
|
+
return Size2;
|
|
393
|
+
}();
|
|
394
|
+
|
|
395
|
+
var Scale = function () {
|
|
396
|
+
function Scale() {}
|
|
397
|
+
|
|
398
|
+
__decorate([Field({
|
|
399
|
+
step: 0.1,
|
|
400
|
+
default: 1
|
|
401
|
+
}), __metadata("design:type", Number)], Scale.prototype, "x", void 0);
|
|
402
|
+
|
|
403
|
+
__decorate([Field({
|
|
404
|
+
step: 0.1,
|
|
405
|
+
default: 1
|
|
406
|
+
}), __metadata("design:type", Number)], Scale.prototype, "y", void 0);
|
|
407
|
+
|
|
408
|
+
return Scale;
|
|
409
|
+
}();
|
|
410
|
+
|
|
347
411
|
var Transform = function (_super) {
|
|
348
412
|
__extends$1(Transform, _super);
|
|
349
413
|
|
|
@@ -352,6 +416,7 @@ var Transform = function (_super) {
|
|
|
352
416
|
|
|
353
417
|
_this.name = 'Transform';
|
|
354
418
|
_this._parent = null;
|
|
419
|
+
_this.childIndex = -1;
|
|
355
420
|
_this.inScene = false;
|
|
356
421
|
_this.children = [];
|
|
357
422
|
_this.position = {
|
|
@@ -428,17 +493,17 @@ var Transform = function (_super) {
|
|
|
428
493
|
});
|
|
429
494
|
|
|
430
495
|
Transform.prototype.addChild = function (child) {
|
|
431
|
-
if (child.parent
|
|
432
|
-
var index = this.children.findIndex(function (item) {
|
|
433
|
-
return item === child;
|
|
434
|
-
});
|
|
435
|
-
this.children.splice(index, 1);
|
|
436
|
-
} else if (child.parent) {
|
|
496
|
+
if (child.parent) {
|
|
437
497
|
child.parent.removeChild(child);
|
|
438
498
|
}
|
|
439
499
|
|
|
440
500
|
child._parent = this;
|
|
441
|
-
|
|
501
|
+
|
|
502
|
+
if (child.childIndex > -1) {
|
|
503
|
+
this.children.splice(child.childIndex, 0, child);
|
|
504
|
+
} else {
|
|
505
|
+
this.children.push(child);
|
|
506
|
+
}
|
|
442
507
|
};
|
|
443
508
|
|
|
444
509
|
Transform.prototype.removeChild = function (child) {
|
|
@@ -458,19 +523,33 @@ var Transform = function (_super) {
|
|
|
458
523
|
|
|
459
524
|
Transform.componentName = 'Transform';
|
|
460
525
|
|
|
461
|
-
__decorate([
|
|
526
|
+
__decorate([Field(function () {
|
|
527
|
+
return IntVector2;
|
|
528
|
+
}), __metadata("design:type", IntVector2)], Transform.prototype, "position", void 0);
|
|
462
529
|
|
|
463
|
-
__decorate([
|
|
530
|
+
__decorate([Field(function () {
|
|
531
|
+
return Size2;
|
|
532
|
+
}), __metadata("design:type", Size2)], Transform.prototype, "size", void 0);
|
|
464
533
|
|
|
465
|
-
__decorate([
|
|
534
|
+
__decorate([Field(function () {
|
|
535
|
+
return Vector2;
|
|
536
|
+
}), __metadata("design:type", Vector2)], Transform.prototype, "origin", void 0);
|
|
466
537
|
|
|
467
|
-
__decorate([
|
|
538
|
+
__decorate([Field(function () {
|
|
539
|
+
return Vector2;
|
|
540
|
+
}), __metadata("design:type", Vector2)], Transform.prototype, "anchor", void 0);
|
|
468
541
|
|
|
469
|
-
__decorate([
|
|
542
|
+
__decorate([Field(function () {
|
|
543
|
+
return Scale;
|
|
544
|
+
}), __metadata("design:type", Vector2)], Transform.prototype, "scale", void 0);
|
|
470
545
|
|
|
471
|
-
__decorate([
|
|
546
|
+
__decorate([Field(function () {
|
|
547
|
+
return Vector2;
|
|
548
|
+
}), __metadata("design:type", Vector2)], Transform.prototype, "skew", void 0);
|
|
472
549
|
|
|
473
|
-
__decorate([
|
|
550
|
+
__decorate([Field({
|
|
551
|
+
step: 0.1
|
|
552
|
+
}), __metadata("design:type", Number)], Transform.prototype, "rotation", void 0);
|
|
474
553
|
|
|
475
554
|
return Transform;
|
|
476
555
|
}(Component$1);
|
|
@@ -568,6 +647,15 @@ var GameObject = function () {
|
|
|
568
647
|
gameObject.scene = this.scene;
|
|
569
648
|
};
|
|
570
649
|
|
|
650
|
+
GameObject.prototype.addChildAt = function (gameObject, index) {
|
|
651
|
+
if (index > this.transform.children.length) {
|
|
652
|
+
throw new Error(gameObject.name + "addChildAt: The index 18 supplied is out of bounds " + this.transform.children.length);
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
this.addChild(gameObject);
|
|
656
|
+
gameObject.transform.childIndex = index;
|
|
657
|
+
};
|
|
658
|
+
|
|
571
659
|
GameObject.prototype.removeChild = function (gameObject) {
|
|
572
660
|
if (!(gameObject instanceof GameObject) || !gameObject.parent || gameObject.parent !== this) {
|
|
573
661
|
return gameObject;
|
|
@@ -1204,26 +1292,21 @@ var getAllGameObjects = function getAllGameObjects(game) {
|
|
|
1204
1292
|
return __spread(mainSceneGameObjects, otherSceneGameObjects);
|
|
1205
1293
|
};
|
|
1206
1294
|
|
|
1207
|
-
var
|
|
1208
|
-
var e_2, _a, e_3, _b
|
|
1209
|
-
|
|
1210
|
-
if (gameObjects === void 0) {
|
|
1211
|
-
gameObjects = [];
|
|
1212
|
-
}
|
|
1295
|
+
var gameObjectResume = function gameObjectResume(gameObjects) {
|
|
1296
|
+
var e_2, _a, e_3, _b;
|
|
1213
1297
|
|
|
1214
1298
|
try {
|
|
1215
1299
|
for (var gameObjects_1 = __values(gameObjects), gameObjects_1_1 = gameObjects_1.next(); !gameObjects_1_1.done; gameObjects_1_1 = gameObjects_1.next()) {
|
|
1216
1300
|
var gameObject = gameObjects_1_1.value;
|
|
1217
1301
|
|
|
1218
1302
|
try {
|
|
1219
|
-
for (var
|
|
1220
|
-
var component =
|
|
1303
|
+
for (var _c = (e_3 = void 0, __values(gameObject.components)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
1304
|
+
var component = _d.value;
|
|
1221
1305
|
|
|
1222
1306
|
try {
|
|
1223
|
-
|
|
1224
|
-
component.update && component.update(e);
|
|
1307
|
+
component.onResume && component.onResume();
|
|
1225
1308
|
} catch (e) {
|
|
1226
|
-
console.error("gameObject: " + gameObject.name + " " + component.name + "
|
|
1309
|
+
console.error("gameObject: " + gameObject.name + ", " + component.name + ", onResume error", e);
|
|
1227
1310
|
}
|
|
1228
1311
|
}
|
|
1229
1312
|
} catch (e_3_1) {
|
|
@@ -1232,7 +1315,7 @@ var gameObjectLoop = function gameObjectLoop(e, gameObjects) {
|
|
|
1232
1315
|
};
|
|
1233
1316
|
} finally {
|
|
1234
1317
|
try {
|
|
1235
|
-
if (
|
|
1318
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
1236
1319
|
} finally {
|
|
1237
1320
|
if (e_3) throw e_3.error;
|
|
1238
1321
|
}
|
|
@@ -1249,19 +1332,23 @@ var gameObjectLoop = function gameObjectLoop(e, gameObjects) {
|
|
|
1249
1332
|
if (e_2) throw e_2.error;
|
|
1250
1333
|
}
|
|
1251
1334
|
}
|
|
1335
|
+
};
|
|
1336
|
+
|
|
1337
|
+
var gameObjectPause = function gameObjectPause(gameObjects) {
|
|
1338
|
+
var e_4, _a, e_5, _b;
|
|
1252
1339
|
|
|
1253
1340
|
try {
|
|
1254
1341
|
for (var gameObjects_2 = __values(gameObjects), gameObjects_2_1 = gameObjects_2.next(); !gameObjects_2_1.done; gameObjects_2_1 = gameObjects_2.next()) {
|
|
1255
1342
|
var gameObject = gameObjects_2_1.value;
|
|
1256
1343
|
|
|
1257
1344
|
try {
|
|
1258
|
-
for (var
|
|
1259
|
-
var component =
|
|
1345
|
+
for (var _c = (e_5 = void 0, __values(gameObject.components)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
1346
|
+
var component = _d.value;
|
|
1260
1347
|
|
|
1261
1348
|
try {
|
|
1262
|
-
component.
|
|
1349
|
+
component.onPause && component.onPause();
|
|
1263
1350
|
} catch (e) {
|
|
1264
|
-
console.error("gameObject: " + gameObject.name + " " + component.name + "
|
|
1351
|
+
console.error("gameObject: " + gameObject.name + ", " + component.name + ", onResume error", e);
|
|
1265
1352
|
}
|
|
1266
1353
|
}
|
|
1267
1354
|
} catch (e_5_1) {
|
|
@@ -1270,7 +1357,7 @@ var gameObjectLoop = function gameObjectLoop(e, gameObjects) {
|
|
|
1270
1357
|
};
|
|
1271
1358
|
} finally {
|
|
1272
1359
|
try {
|
|
1273
|
-
if (
|
|
1360
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
1274
1361
|
} finally {
|
|
1275
1362
|
if (e_5) throw e_5.error;
|
|
1276
1363
|
}
|
|
@@ -1282,102 +1369,18 @@ var gameObjectLoop = function gameObjectLoop(e, gameObjects) {
|
|
|
1282
1369
|
};
|
|
1283
1370
|
} finally {
|
|
1284
1371
|
try {
|
|
1285
|
-
if (gameObjects_2_1 && !gameObjects_2_1.done && (
|
|
1372
|
+
if (gameObjects_2_1 && !gameObjects_2_1.done && (_a = gameObjects_2.return)) _a.call(gameObjects_2);
|
|
1286
1373
|
} finally {
|
|
1287
1374
|
if (e_4) throw e_4.error;
|
|
1288
1375
|
}
|
|
1289
1376
|
}
|
|
1290
1377
|
};
|
|
1291
1378
|
|
|
1292
|
-
var gameObjectResume = function gameObjectResume(gameObjects) {
|
|
1293
|
-
var e_6, _a, e_7, _b;
|
|
1294
|
-
|
|
1295
|
-
try {
|
|
1296
|
-
for (var gameObjects_3 = __values(gameObjects), gameObjects_3_1 = gameObjects_3.next(); !gameObjects_3_1.done; gameObjects_3_1 = gameObjects_3.next()) {
|
|
1297
|
-
var gameObject = gameObjects_3_1.value;
|
|
1298
|
-
|
|
1299
|
-
try {
|
|
1300
|
-
for (var _c = (e_7 = void 0, __values(gameObject.components)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
1301
|
-
var component = _d.value;
|
|
1302
|
-
|
|
1303
|
-
try {
|
|
1304
|
-
component.onResume && component.onResume();
|
|
1305
|
-
} catch (e) {
|
|
1306
|
-
console.error("gameObject: " + gameObject.name + ", " + component.name + ", onResume error", e);
|
|
1307
|
-
}
|
|
1308
|
-
}
|
|
1309
|
-
} catch (e_7_1) {
|
|
1310
|
-
e_7 = {
|
|
1311
|
-
error: e_7_1
|
|
1312
|
-
};
|
|
1313
|
-
} finally {
|
|
1314
|
-
try {
|
|
1315
|
-
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
1316
|
-
} finally {
|
|
1317
|
-
if (e_7) throw e_7.error;
|
|
1318
|
-
}
|
|
1319
|
-
}
|
|
1320
|
-
}
|
|
1321
|
-
} catch (e_6_1) {
|
|
1322
|
-
e_6 = {
|
|
1323
|
-
error: e_6_1
|
|
1324
|
-
};
|
|
1325
|
-
} finally {
|
|
1326
|
-
try {
|
|
1327
|
-
if (gameObjects_3_1 && !gameObjects_3_1.done && (_a = gameObjects_3.return)) _a.call(gameObjects_3);
|
|
1328
|
-
} finally {
|
|
1329
|
-
if (e_6) throw e_6.error;
|
|
1330
|
-
}
|
|
1331
|
-
}
|
|
1332
|
-
};
|
|
1333
|
-
|
|
1334
|
-
var gameObjectPause = function gameObjectPause(gameObjects) {
|
|
1335
|
-
var e_8, _a, e_9, _b;
|
|
1336
|
-
|
|
1337
|
-
try {
|
|
1338
|
-
for (var gameObjects_4 = __values(gameObjects), gameObjects_4_1 = gameObjects_4.next(); !gameObjects_4_1.done; gameObjects_4_1 = gameObjects_4.next()) {
|
|
1339
|
-
var gameObject = gameObjects_4_1.value;
|
|
1340
|
-
|
|
1341
|
-
try {
|
|
1342
|
-
for (var _c = (e_9 = void 0, __values(gameObject.components)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
1343
|
-
var component = _d.value;
|
|
1344
|
-
|
|
1345
|
-
try {
|
|
1346
|
-
component.onPause && component.onPause();
|
|
1347
|
-
} catch (e) {
|
|
1348
|
-
console.error("gameObject: " + gameObject.name + ", " + component.name + ", onResume error", e);
|
|
1349
|
-
}
|
|
1350
|
-
}
|
|
1351
|
-
} catch (e_9_1) {
|
|
1352
|
-
e_9 = {
|
|
1353
|
-
error: e_9_1
|
|
1354
|
-
};
|
|
1355
|
-
} finally {
|
|
1356
|
-
try {
|
|
1357
|
-
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
1358
|
-
} finally {
|
|
1359
|
-
if (e_9) throw e_9.error;
|
|
1360
|
-
}
|
|
1361
|
-
}
|
|
1362
|
-
}
|
|
1363
|
-
} catch (e_8_1) {
|
|
1364
|
-
e_8 = {
|
|
1365
|
-
error: e_8_1
|
|
1366
|
-
};
|
|
1367
|
-
} finally {
|
|
1368
|
-
try {
|
|
1369
|
-
if (gameObjects_4_1 && !gameObjects_4_1.done && (_a = gameObjects_4.return)) _a.call(gameObjects_4);
|
|
1370
|
-
} finally {
|
|
1371
|
-
if (e_8) throw e_8.error;
|
|
1372
|
-
}
|
|
1373
|
-
}
|
|
1374
|
-
};
|
|
1375
|
-
|
|
1376
1379
|
var Game = function (_super) {
|
|
1377
1380
|
__extends$1(Game, _super);
|
|
1378
1381
|
|
|
1379
1382
|
function Game(_a) {
|
|
1380
|
-
var
|
|
1383
|
+
var e_6, _b;
|
|
1381
1384
|
|
|
1382
1385
|
var _c = _a === void 0 ? {} : _a,
|
|
1383
1386
|
systems = _c.systems,
|
|
@@ -1386,7 +1389,9 @@ var Game = function (_super) {
|
|
|
1386
1389
|
_e = _c.autoStart,
|
|
1387
1390
|
autoStart = _e === void 0 ? true : _e,
|
|
1388
1391
|
_f = _c.needScene,
|
|
1389
|
-
needScene = _f === void 0 ? true : _f
|
|
1392
|
+
needScene = _f === void 0 ? true : _f,
|
|
1393
|
+
_g = _c.mode,
|
|
1394
|
+
mode = _g === void 0 ? 'PLAY' : _g;
|
|
1390
1395
|
|
|
1391
1396
|
var _this = _super.call(this) || this;
|
|
1392
1397
|
|
|
@@ -1394,6 +1399,8 @@ var Game = function (_super) {
|
|
|
1394
1399
|
_this.started = false;
|
|
1395
1400
|
_this.multiScenes = [];
|
|
1396
1401
|
_this.systems = [];
|
|
1402
|
+
_this.mode = 'PLAY';
|
|
1403
|
+
_this.mode = mode;
|
|
1397
1404
|
|
|
1398
1405
|
if (windowAlias.__EVA_INSPECTOR_ENV__) {
|
|
1399
1406
|
windowAlias.__EVA_GAME_INSTANCE__ = _this;
|
|
@@ -1413,15 +1420,15 @@ var Game = function (_super) {
|
|
|
1413
1420
|
|
|
1414
1421
|
_this.addSystem(system);
|
|
1415
1422
|
}
|
|
1416
|
-
} catch (
|
|
1417
|
-
|
|
1418
|
-
error:
|
|
1423
|
+
} catch (e_6_1) {
|
|
1424
|
+
e_6 = {
|
|
1425
|
+
error: e_6_1
|
|
1419
1426
|
};
|
|
1420
1427
|
} finally {
|
|
1421
1428
|
try {
|
|
1422
1429
|
if (systems_1_1 && !systems_1_1.done && (_b = systems_1.return)) _b.call(systems_1);
|
|
1423
1430
|
} finally {
|
|
1424
|
-
if (
|
|
1431
|
+
if (e_6) throw e_6.error;
|
|
1425
1432
|
}
|
|
1426
1433
|
}
|
|
1427
1434
|
}
|
|
@@ -1550,9 +1557,9 @@ var Game = function (_super) {
|
|
|
1550
1557
|
var _this = this;
|
|
1551
1558
|
|
|
1552
1559
|
this.ticker.add(function (e) {
|
|
1553
|
-
var
|
|
1560
|
+
var e_7, _a, e_8, _b;
|
|
1554
1561
|
|
|
1555
|
-
_this.scene && gameObjectLoop(e, _this.gameObjects);
|
|
1562
|
+
_this.scene && _this.gameObjectLoop(e, _this.gameObjects);
|
|
1556
1563
|
|
|
1557
1564
|
try {
|
|
1558
1565
|
for (var _c = __values(_this.systems), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
@@ -1565,15 +1572,15 @@ var Game = function (_super) {
|
|
|
1565
1572
|
console.error(system.constructor.systemName + " update error", e);
|
|
1566
1573
|
}
|
|
1567
1574
|
}
|
|
1568
|
-
} catch (
|
|
1569
|
-
|
|
1570
|
-
error:
|
|
1575
|
+
} catch (e_7_1) {
|
|
1576
|
+
e_7 = {
|
|
1577
|
+
error: e_7_1
|
|
1571
1578
|
};
|
|
1572
1579
|
} finally {
|
|
1573
1580
|
try {
|
|
1574
1581
|
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
1575
1582
|
} finally {
|
|
1576
|
-
if (
|
|
1583
|
+
if (e_7) throw e_7.error;
|
|
1577
1584
|
}
|
|
1578
1585
|
}
|
|
1579
1586
|
|
|
@@ -1587,22 +1594,22 @@ var Game = function (_super) {
|
|
|
1587
1594
|
console.error(system.constructor.systemName + " lateUpdate error", e);
|
|
1588
1595
|
}
|
|
1589
1596
|
}
|
|
1590
|
-
} catch (
|
|
1591
|
-
|
|
1592
|
-
error:
|
|
1597
|
+
} catch (e_8_1) {
|
|
1598
|
+
e_8 = {
|
|
1599
|
+
error: e_8_1
|
|
1593
1600
|
};
|
|
1594
1601
|
} finally {
|
|
1595
1602
|
try {
|
|
1596
1603
|
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
1597
1604
|
} finally {
|
|
1598
|
-
if (
|
|
1605
|
+
if (e_8) throw e_8.error;
|
|
1599
1606
|
}
|
|
1600
1607
|
}
|
|
1601
1608
|
});
|
|
1602
1609
|
};
|
|
1603
1610
|
|
|
1604
1611
|
Game.prototype.triggerResume = function () {
|
|
1605
|
-
var
|
|
1612
|
+
var e_9, _a;
|
|
1606
1613
|
|
|
1607
1614
|
gameObjectResume(this.gameObjects);
|
|
1608
1615
|
|
|
@@ -1616,21 +1623,21 @@ var Game = function (_super) {
|
|
|
1616
1623
|
console.error(system.constructor.systemName + ", onResume error", e);
|
|
1617
1624
|
}
|
|
1618
1625
|
}
|
|
1619
|
-
} catch (
|
|
1620
|
-
|
|
1621
|
-
error:
|
|
1626
|
+
} catch (e_9_1) {
|
|
1627
|
+
e_9 = {
|
|
1628
|
+
error: e_9_1
|
|
1622
1629
|
};
|
|
1623
1630
|
} finally {
|
|
1624
1631
|
try {
|
|
1625
1632
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1626
1633
|
} finally {
|
|
1627
|
-
if (
|
|
1634
|
+
if (e_9) throw e_9.error;
|
|
1628
1635
|
}
|
|
1629
1636
|
}
|
|
1630
1637
|
};
|
|
1631
1638
|
|
|
1632
1639
|
Game.prototype.triggerPause = function () {
|
|
1633
|
-
var
|
|
1640
|
+
var e_10, _a;
|
|
1634
1641
|
|
|
1635
1642
|
gameObjectPause(this.gameObjects);
|
|
1636
1643
|
|
|
@@ -1644,36 +1651,36 @@ var Game = function (_super) {
|
|
|
1644
1651
|
console.error(system.constructor.systemName + ", onPause error", e);
|
|
1645
1652
|
}
|
|
1646
1653
|
}
|
|
1647
|
-
} catch (
|
|
1648
|
-
|
|
1649
|
-
error:
|
|
1654
|
+
} catch (e_10_1) {
|
|
1655
|
+
e_10 = {
|
|
1656
|
+
error: e_10_1
|
|
1650
1657
|
};
|
|
1651
1658
|
} finally {
|
|
1652
1659
|
try {
|
|
1653
1660
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1654
1661
|
} finally {
|
|
1655
|
-
if (
|
|
1662
|
+
if (e_10) throw e_10.error;
|
|
1656
1663
|
}
|
|
1657
1664
|
}
|
|
1658
1665
|
};
|
|
1659
1666
|
|
|
1660
1667
|
Game.prototype.destroySystems = function () {
|
|
1661
|
-
var
|
|
1668
|
+
var e_11, _a;
|
|
1662
1669
|
|
|
1663
1670
|
try {
|
|
1664
1671
|
for (var _b = __values(__spread(this.systems)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1665
1672
|
var system = _c.value;
|
|
1666
1673
|
this.removeSystem(system);
|
|
1667
1674
|
}
|
|
1668
|
-
} catch (
|
|
1669
|
-
|
|
1670
|
-
error:
|
|
1675
|
+
} catch (e_11_1) {
|
|
1676
|
+
e_11 = {
|
|
1677
|
+
error: e_11_1
|
|
1671
1678
|
};
|
|
1672
1679
|
} finally {
|
|
1673
1680
|
try {
|
|
1674
1681
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1675
1682
|
} finally {
|
|
1676
|
-
if (
|
|
1683
|
+
if (e_11) throw e_11.error;
|
|
1677
1684
|
}
|
|
1678
1685
|
}
|
|
1679
1686
|
|
|
@@ -1719,19 +1726,100 @@ var Game = function (_super) {
|
|
|
1719
1726
|
});
|
|
1720
1727
|
};
|
|
1721
1728
|
|
|
1729
|
+
Game.prototype.gameObjectLoop = function (e, gameObjects) {
|
|
1730
|
+
var e_12, _a, e_13, _b, e_14, _c, e_15, _d;
|
|
1731
|
+
|
|
1732
|
+
if (gameObjects === void 0) {
|
|
1733
|
+
gameObjects = [];
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1736
|
+
try {
|
|
1737
|
+
for (var gameObjects_3 = __values(gameObjects), gameObjects_3_1 = gameObjects_3.next(); !gameObjects_3_1.done; gameObjects_3_1 = gameObjects_3.next()) {
|
|
1738
|
+
var gameObject = gameObjects_3_1.value;
|
|
1739
|
+
|
|
1740
|
+
try {
|
|
1741
|
+
for (var _e = (e_13 = void 0, __values(gameObject.components)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
1742
|
+
var component = _f.value;
|
|
1743
|
+
|
|
1744
|
+
try {
|
|
1745
|
+
if (this.mode === 'PLAY') {
|
|
1746
|
+
triggerStart(component);
|
|
1747
|
+
component.update && component.update(e);
|
|
1748
|
+
}
|
|
1749
|
+
} catch (e) {
|
|
1750
|
+
console.error("gameObject: " + gameObject.name + " " + component.name + " update error", e);
|
|
1751
|
+
}
|
|
1752
|
+
}
|
|
1753
|
+
} catch (e_13_1) {
|
|
1754
|
+
e_13 = {
|
|
1755
|
+
error: e_13_1
|
|
1756
|
+
};
|
|
1757
|
+
} finally {
|
|
1758
|
+
try {
|
|
1759
|
+
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
1760
|
+
} finally {
|
|
1761
|
+
if (e_13) throw e_13.error;
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
} catch (e_12_1) {
|
|
1766
|
+
e_12 = {
|
|
1767
|
+
error: e_12_1
|
|
1768
|
+
};
|
|
1769
|
+
} finally {
|
|
1770
|
+
try {
|
|
1771
|
+
if (gameObjects_3_1 && !gameObjects_3_1.done && (_a = gameObjects_3.return)) _a.call(gameObjects_3);
|
|
1772
|
+
} finally {
|
|
1773
|
+
if (e_12) throw e_12.error;
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
|
|
1777
|
+
try {
|
|
1778
|
+
for (var gameObjects_4 = __values(gameObjects), gameObjects_4_1 = gameObjects_4.next(); !gameObjects_4_1.done; gameObjects_4_1 = gameObjects_4.next()) {
|
|
1779
|
+
var gameObject = gameObjects_4_1.value;
|
|
1780
|
+
|
|
1781
|
+
try {
|
|
1782
|
+
for (var _g = (e_15 = void 0, __values(gameObject.components)), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
1783
|
+
var component = _h.value;
|
|
1784
|
+
|
|
1785
|
+
try {
|
|
1786
|
+
if (this.mode === 'PLAY') {
|
|
1787
|
+
component.lateUpdate && component.lateUpdate(e);
|
|
1788
|
+
}
|
|
1789
|
+
} catch (e) {
|
|
1790
|
+
console.error("gameObject: " + gameObject.name + " " + component.name + " lateUpdate error", e);
|
|
1791
|
+
}
|
|
1792
|
+
}
|
|
1793
|
+
} catch (e_15_1) {
|
|
1794
|
+
e_15 = {
|
|
1795
|
+
error: e_15_1
|
|
1796
|
+
};
|
|
1797
|
+
} finally {
|
|
1798
|
+
try {
|
|
1799
|
+
if (_h && !_h.done && (_d = _g.return)) _d.call(_g);
|
|
1800
|
+
} finally {
|
|
1801
|
+
if (e_15) throw e_15.error;
|
|
1802
|
+
}
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
} catch (e_14_1) {
|
|
1806
|
+
e_14 = {
|
|
1807
|
+
error: e_14_1
|
|
1808
|
+
};
|
|
1809
|
+
} finally {
|
|
1810
|
+
try {
|
|
1811
|
+
if (gameObjects_4_1 && !gameObjects_4_1.done && (_c = gameObjects_4.return)) _c.call(gameObjects_4);
|
|
1812
|
+
} finally {
|
|
1813
|
+
if (e_14) throw e_14.error;
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1816
|
+
};
|
|
1817
|
+
|
|
1722
1818
|
return Game;
|
|
1723
1819
|
}(EventEmitter);
|
|
1724
1820
|
|
|
1725
1821
|
var Game$1 = Game;
|
|
1726
1822
|
|
|
1727
|
-
function IDEProp(target, propertyKey) {
|
|
1728
|
-
if (!target.constructor.IDEProps) {
|
|
1729
|
-
target.constructor.IDEProps = [];
|
|
1730
|
-
}
|
|
1731
|
-
|
|
1732
|
-
target.constructor.IDEProps.push(propertyKey);
|
|
1733
|
-
}
|
|
1734
|
-
|
|
1735
1823
|
function componentObserver(observerInfo) {
|
|
1736
1824
|
if (observerInfo === void 0) {
|
|
1737
1825
|
observerInfo = {};
|
|
@@ -1942,9 +2030,12 @@ var Signal = function () {
|
|
|
1942
2030
|
return Signal;
|
|
1943
2031
|
}();
|
|
1944
2032
|
|
|
1945
|
-
function
|
|
2033
|
+
var src = function src(str, opts) {
|
|
2034
|
+
if (opts === void 0) {
|
|
2035
|
+
opts = {};
|
|
2036
|
+
}
|
|
2037
|
+
|
|
1946
2038
|
if (!str) return undefined;
|
|
1947
|
-
opts = opts || {};
|
|
1948
2039
|
var o = {
|
|
1949
2040
|
key: ['source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'],
|
|
1950
2041
|
q: {
|
|
@@ -1952,8 +2043,8 @@ function parseURI(str, opts) {
|
|
|
1952
2043
|
parser: /(?:^|&)([^&=]*)=?([^&]*)/g
|
|
1953
2044
|
},
|
|
1954
2045
|
parser: {
|
|
1955
|
-
strict: /^(?:([
|
|
1956
|
-
loose: /^(?:(?![^:@]+:[
|
|
2046
|
+
strict: /^(?:([^:/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\d*))?))?((((?:[^?#/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
|
|
2047
|
+
loose: /^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#/]*\.[^?#/.]+(?:[?#]|$)))*\/?)?([^?#/]*))(?:\?([^#]*))?(?:#(.*))?)/
|
|
1957
2048
|
}
|
|
1958
2049
|
};
|
|
1959
2050
|
var m = o.parser[opts.strictMode ? 'strict' : 'loose'].exec(str);
|
|
@@ -1969,10 +2060,9 @@ function parseURI(str, opts) {
|
|
|
1969
2060
|
if ($1) uri[o.q.name][$1] = $2;
|
|
1970
2061
|
});
|
|
1971
2062
|
return uri;
|
|
1972
|
-
}
|
|
2063
|
+
};
|
|
1973
2064
|
|
|
1974
|
-
var parseUri =
|
|
1975
|
-
var parseUri$1 = parseUri;
|
|
2065
|
+
var parseUri = src;
|
|
1976
2066
|
|
|
1977
2067
|
var AbstractLoadStrategy = function () {
|
|
1978
2068
|
function AbstractLoadStrategy(config) {
|
|
@@ -2795,7 +2885,7 @@ var Resource$1 = function () {
|
|
|
2795
2885
|
if (windowAlias.origin !== windowAlias.location.origin) return 'anonymous';
|
|
2796
2886
|
if (!Resource._tempAnchor) Resource._tempAnchor = documentAlias.createElement('a');
|
|
2797
2887
|
Resource._tempAnchor.href = url;
|
|
2798
|
-
var parsed = parseUri
|
|
2888
|
+
var parsed = parseUri(Resource._tempAnchor.href, {
|
|
2799
2889
|
strictMode: true
|
|
2800
2890
|
});
|
|
2801
2891
|
var samePort = !parsed.port && loc.port === '' || parsed.port === loc.port;
|
|
@@ -3049,13 +3139,13 @@ var Loader = function () {
|
|
|
3049
3139
|
};
|
|
3050
3140
|
|
|
3051
3141
|
Loader.prototype._prepareUrl = function (url, baseUrl) {
|
|
3052
|
-
var parsed = parseUri
|
|
3142
|
+
var parsed = parseUri(url, {
|
|
3053
3143
|
strictMode: true
|
|
3054
3144
|
});
|
|
3055
3145
|
|
|
3056
3146
|
this._urlResolvers.forEach(function (resolver) {
|
|
3057
3147
|
url = resolver(url, parsed);
|
|
3058
|
-
parsed = parseUri
|
|
3148
|
+
parsed = parseUri(url, {
|
|
3059
3149
|
strictMode: true
|
|
3060
3150
|
});
|
|
3061
3151
|
});
|
|
@@ -3673,9 +3763,8 @@ var Resource = function (_super) {
|
|
|
3673
3763
|
|
|
3674
3764
|
var resource = new Resource();
|
|
3675
3765
|
var decorators = {
|
|
3676
|
-
IDEProp: IDEProp,
|
|
3677
3766
|
componentObserver: componentObserver
|
|
3678
3767
|
};
|
|
3679
|
-
var version = '1.2.
|
|
3768
|
+
var version = '1.2.7-editor.2';
|
|
3680
3769
|
console.log("Eva.js version: " + version);
|
|
3681
|
-
export { Component$1 as Component, Game$1 as Game, GameObject$1 as GameObject,
|
|
3770
|
+
export { Component$1 as Component, Game$1 as Game, GameObject$1 as GameObject, LOAD_EVENT, LOAD_SCENE_MODE, ObserverType as OBSERVER_TYPE, RESOURCE_TYPE, RESOURCE_TYPE_STRATEGY, Scene$1 as Scene, System$1 as System, Transform$1 as Transform, componentObserver, decorators, resource, resourceLoader, version };
|