@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/eva.js.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import EventEmitter from 'eventemitter3';
|
|
2
2
|
import { isEqual, isObject } from 'lodash-es';
|
|
3
|
-
import {
|
|
3
|
+
import { Field } from '@eva/inspector-decorator';
|
|
4
4
|
import { AbstractLoadStrategy, AudioLoadStrategy, ImageLoadStrategy, XhrResponseType, MediaElementLoadStrategy, VideoLoadStrategy, XhrLoadStrategy, Loader, Resource as Resource$1, ResourceType, ResourceState } from 'resource-loader';
|
|
5
5
|
|
|
6
6
|
/*! *****************************************************************************
|
|
@@ -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); } }
|
|
@@ -362,12 +366,65 @@ function setSystemObserver(system, S) {
|
|
|
362
366
|
systemInstance[S.systemName] = system;
|
|
363
367
|
}
|
|
364
368
|
|
|
369
|
+
var Vector2 = (function () {
|
|
370
|
+
function Vector2() {
|
|
371
|
+
}
|
|
372
|
+
__decorate([
|
|
373
|
+
Field({ step: 0.1, default: 0 }),
|
|
374
|
+
__metadata("design:type", Number)
|
|
375
|
+
], Vector2.prototype, "x", void 0);
|
|
376
|
+
__decorate([
|
|
377
|
+
Field({ step: 0.1, default: 0 }),
|
|
378
|
+
__metadata("design:type", Number)
|
|
379
|
+
], Vector2.prototype, "y", void 0);
|
|
380
|
+
return Vector2;
|
|
381
|
+
}());
|
|
382
|
+
var IntVector2 = (function () {
|
|
383
|
+
function IntVector2() {
|
|
384
|
+
}
|
|
385
|
+
__decorate([
|
|
386
|
+
Field({ step: 1, default: 0 }),
|
|
387
|
+
__metadata("design:type", Number)
|
|
388
|
+
], IntVector2.prototype, "x", void 0);
|
|
389
|
+
__decorate([
|
|
390
|
+
Field({ step: 1, default: 0 }),
|
|
391
|
+
__metadata("design:type", Number)
|
|
392
|
+
], IntVector2.prototype, "y", void 0);
|
|
393
|
+
return IntVector2;
|
|
394
|
+
}());
|
|
395
|
+
var Size2 = (function () {
|
|
396
|
+
function Size2() {
|
|
397
|
+
}
|
|
398
|
+
__decorate([
|
|
399
|
+
Field({ step: 1, default: 0 }),
|
|
400
|
+
__metadata("design:type", Number)
|
|
401
|
+
], Size2.prototype, "width", void 0);
|
|
402
|
+
__decorate([
|
|
403
|
+
Field({ step: 1, default: 0 }),
|
|
404
|
+
__metadata("design:type", Number)
|
|
405
|
+
], Size2.prototype, "height", void 0);
|
|
406
|
+
return Size2;
|
|
407
|
+
}());
|
|
408
|
+
var Scale = (function () {
|
|
409
|
+
function Scale() {
|
|
410
|
+
}
|
|
411
|
+
__decorate([
|
|
412
|
+
Field({ step: 0.1, default: 1 }),
|
|
413
|
+
__metadata("design:type", Number)
|
|
414
|
+
], Scale.prototype, "x", void 0);
|
|
415
|
+
__decorate([
|
|
416
|
+
Field({ step: 0.1, default: 1 }),
|
|
417
|
+
__metadata("design:type", Number)
|
|
418
|
+
], Scale.prototype, "y", void 0);
|
|
419
|
+
return Scale;
|
|
420
|
+
}());
|
|
365
421
|
var Transform = (function (_super) {
|
|
366
422
|
__extends(Transform, _super);
|
|
367
423
|
function Transform() {
|
|
368
424
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
369
425
|
_this.name = 'Transform';
|
|
370
426
|
_this._parent = null;
|
|
427
|
+
_this.childIndex = -1;
|
|
371
428
|
_this.inScene = false;
|
|
372
429
|
_this.children = [];
|
|
373
430
|
_this.position = { x: 0, y: 0 };
|
|
@@ -414,15 +471,16 @@ var Transform = (function (_super) {
|
|
|
414
471
|
configurable: true
|
|
415
472
|
});
|
|
416
473
|
Transform.prototype.addChild = function (child) {
|
|
417
|
-
if (child.parent
|
|
418
|
-
var index = this.children.findIndex(function (item) { return item === child; });
|
|
419
|
-
this.children.splice(index, 1);
|
|
420
|
-
}
|
|
421
|
-
else if (child.parent) {
|
|
474
|
+
if (child.parent) {
|
|
422
475
|
child.parent.removeChild(child);
|
|
423
476
|
}
|
|
424
477
|
child._parent = this;
|
|
425
|
-
|
|
478
|
+
if (child.childIndex > -1) {
|
|
479
|
+
this.children.splice(child.childIndex, 0, child);
|
|
480
|
+
}
|
|
481
|
+
else {
|
|
482
|
+
this.children.push(child);
|
|
483
|
+
}
|
|
426
484
|
};
|
|
427
485
|
Transform.prototype.removeChild = function (child) {
|
|
428
486
|
var index = this.children.findIndex(function (item) { return item === child; });
|
|
@@ -436,32 +494,32 @@ var Transform = (function (_super) {
|
|
|
436
494
|
};
|
|
437
495
|
Transform.componentName = 'Transform';
|
|
438
496
|
__decorate([
|
|
439
|
-
|
|
440
|
-
|
|
497
|
+
Field(function () { return IntVector2; }),
|
|
498
|
+
__metadata("design:type", IntVector2)
|
|
441
499
|
], Transform.prototype, "position", void 0);
|
|
442
500
|
__decorate([
|
|
443
|
-
|
|
444
|
-
|
|
501
|
+
Field(function () { return Size2; }),
|
|
502
|
+
__metadata("design:type", Size2)
|
|
445
503
|
], Transform.prototype, "size", void 0);
|
|
446
504
|
__decorate([
|
|
447
|
-
|
|
448
|
-
|
|
505
|
+
Field(function () { return Vector2; }),
|
|
506
|
+
__metadata("design:type", Vector2)
|
|
449
507
|
], Transform.prototype, "origin", void 0);
|
|
450
508
|
__decorate([
|
|
451
|
-
|
|
452
|
-
|
|
509
|
+
Field(function () { return Vector2; }),
|
|
510
|
+
__metadata("design:type", Vector2)
|
|
453
511
|
], Transform.prototype, "anchor", void 0);
|
|
454
512
|
__decorate([
|
|
455
|
-
|
|
456
|
-
|
|
513
|
+
Field(function () { return Scale; }),
|
|
514
|
+
__metadata("design:type", Vector2)
|
|
457
515
|
], Transform.prototype, "scale", void 0);
|
|
458
516
|
__decorate([
|
|
459
|
-
|
|
460
|
-
|
|
517
|
+
Field(function () { return Vector2; }),
|
|
518
|
+
__metadata("design:type", Vector2)
|
|
461
519
|
], Transform.prototype, "skew", void 0);
|
|
462
520
|
__decorate([
|
|
463
|
-
|
|
464
|
-
|
|
521
|
+
Field({ step: 0.1 }),
|
|
522
|
+
__metadata("design:type", Number)
|
|
465
523
|
], Transform.prototype, "rotation", void 0);
|
|
466
524
|
return Transform;
|
|
467
525
|
}(Component$1));
|
|
@@ -548,6 +606,13 @@ var GameObject = (function () {
|
|
|
548
606
|
gameObject.transform.parent = this.transform;
|
|
549
607
|
gameObject.scene = this.scene;
|
|
550
608
|
};
|
|
609
|
+
GameObject.prototype.addChildAt = function (gameObject, index) {
|
|
610
|
+
if (index > this.transform.children.length) {
|
|
611
|
+
throw new Error(gameObject.name + "addChildAt: The index 18 supplied is out of bounds " + this.transform.children.length);
|
|
612
|
+
}
|
|
613
|
+
this.addChild(gameObject);
|
|
614
|
+
gameObject.transform.childIndex = index;
|
|
615
|
+
};
|
|
551
616
|
GameObject.prototype.removeChild = function (gameObject) {
|
|
552
617
|
if (!(gameObject instanceof GameObject) || !gameObject.parent || gameObject.parent !== this) {
|
|
553
618
|
return gameObject;
|
|
@@ -1059,28 +1124,26 @@ var getAllGameObjects = function (game) {
|
|
|
1059
1124
|
}
|
|
1060
1125
|
return __spread(mainSceneGameObjects, otherSceneGameObjects);
|
|
1061
1126
|
};
|
|
1062
|
-
var
|
|
1063
|
-
var e_2, _a, e_3, _b
|
|
1064
|
-
if (gameObjects === void 0) { gameObjects = []; }
|
|
1127
|
+
var gameObjectResume = function (gameObjects) {
|
|
1128
|
+
var e_2, _a, e_3, _b;
|
|
1065
1129
|
try {
|
|
1066
1130
|
for (var gameObjects_1 = __values(gameObjects), gameObjects_1_1 = gameObjects_1.next(); !gameObjects_1_1.done; gameObjects_1_1 = gameObjects_1.next()) {
|
|
1067
1131
|
var gameObject = gameObjects_1_1.value;
|
|
1068
1132
|
try {
|
|
1069
|
-
for (var
|
|
1070
|
-
var component =
|
|
1133
|
+
for (var _c = (e_3 = void 0, __values(gameObject.components)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
1134
|
+
var component = _d.value;
|
|
1071
1135
|
try {
|
|
1072
|
-
|
|
1073
|
-
component.update && component.update(e);
|
|
1136
|
+
component.onResume && component.onResume();
|
|
1074
1137
|
}
|
|
1075
1138
|
catch (e) {
|
|
1076
|
-
console.error("gameObject: " + gameObject.name + " " + component.name + "
|
|
1139
|
+
console.error("gameObject: " + gameObject.name + ", " + component.name + ", onResume error", e);
|
|
1077
1140
|
}
|
|
1078
1141
|
}
|
|
1079
1142
|
}
|
|
1080
1143
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1081
1144
|
finally {
|
|
1082
1145
|
try {
|
|
1083
|
-
if (
|
|
1146
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
1084
1147
|
}
|
|
1085
1148
|
finally { if (e_3) throw e_3.error; }
|
|
1086
1149
|
}
|
|
@@ -1093,77 +1156,14 @@ var gameObjectLoop = function (e, gameObjects) {
|
|
|
1093
1156
|
}
|
|
1094
1157
|
finally { if (e_2) throw e_2.error; }
|
|
1095
1158
|
}
|
|
1096
|
-
try {
|
|
1097
|
-
for (var gameObjects_2 = __values(gameObjects), gameObjects_2_1 = gameObjects_2.next(); !gameObjects_2_1.done; gameObjects_2_1 = gameObjects_2.next()) {
|
|
1098
|
-
var gameObject = gameObjects_2_1.value;
|
|
1099
|
-
try {
|
|
1100
|
-
for (var _g = (e_5 = void 0, __values(gameObject.components)), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
1101
|
-
var component = _h.value;
|
|
1102
|
-
try {
|
|
1103
|
-
component.lateUpdate && component.lateUpdate(e);
|
|
1104
|
-
}
|
|
1105
|
-
catch (e) {
|
|
1106
|
-
console.error("gameObject: " + gameObject.name + " " + component.name + " lateUpdate error", e);
|
|
1107
|
-
}
|
|
1108
|
-
}
|
|
1109
|
-
}
|
|
1110
|
-
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
1111
|
-
finally {
|
|
1112
|
-
try {
|
|
1113
|
-
if (_h && !_h.done && (_d = _g.return)) _d.call(_g);
|
|
1114
|
-
}
|
|
1115
|
-
finally { if (e_5) throw e_5.error; }
|
|
1116
|
-
}
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
1120
|
-
finally {
|
|
1121
|
-
try {
|
|
1122
|
-
if (gameObjects_2_1 && !gameObjects_2_1.done && (_c = gameObjects_2.return)) _c.call(gameObjects_2);
|
|
1123
|
-
}
|
|
1124
|
-
finally { if (e_4) throw e_4.error; }
|
|
1125
|
-
}
|
|
1126
|
-
};
|
|
1127
|
-
var gameObjectResume = function (gameObjects) {
|
|
1128
|
-
var e_6, _a, e_7, _b;
|
|
1129
|
-
try {
|
|
1130
|
-
for (var gameObjects_3 = __values(gameObjects), gameObjects_3_1 = gameObjects_3.next(); !gameObjects_3_1.done; gameObjects_3_1 = gameObjects_3.next()) {
|
|
1131
|
-
var gameObject = gameObjects_3_1.value;
|
|
1132
|
-
try {
|
|
1133
|
-
for (var _c = (e_7 = void 0, __values(gameObject.components)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
1134
|
-
var component = _d.value;
|
|
1135
|
-
try {
|
|
1136
|
-
component.onResume && component.onResume();
|
|
1137
|
-
}
|
|
1138
|
-
catch (e) {
|
|
1139
|
-
console.error("gameObject: " + gameObject.name + ", " + component.name + ", onResume error", e);
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1142
|
-
}
|
|
1143
|
-
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
1144
|
-
finally {
|
|
1145
|
-
try {
|
|
1146
|
-
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
1147
|
-
}
|
|
1148
|
-
finally { if (e_7) throw e_7.error; }
|
|
1149
|
-
}
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1152
|
-
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
1153
|
-
finally {
|
|
1154
|
-
try {
|
|
1155
|
-
if (gameObjects_3_1 && !gameObjects_3_1.done && (_a = gameObjects_3.return)) _a.call(gameObjects_3);
|
|
1156
|
-
}
|
|
1157
|
-
finally { if (e_6) throw e_6.error; }
|
|
1158
|
-
}
|
|
1159
1159
|
};
|
|
1160
1160
|
var gameObjectPause = function (gameObjects) {
|
|
1161
|
-
var
|
|
1161
|
+
var e_4, _a, e_5, _b;
|
|
1162
1162
|
try {
|
|
1163
|
-
for (var
|
|
1164
|
-
var gameObject =
|
|
1163
|
+
for (var gameObjects_2 = __values(gameObjects), gameObjects_2_1 = gameObjects_2.next(); !gameObjects_2_1.done; gameObjects_2_1 = gameObjects_2.next()) {
|
|
1164
|
+
var gameObject = gameObjects_2_1.value;
|
|
1165
1165
|
try {
|
|
1166
|
-
for (var _c = (
|
|
1166
|
+
for (var _c = (e_5 = void 0, __values(gameObject.components)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
1167
1167
|
var component = _d.value;
|
|
1168
1168
|
try {
|
|
1169
1169
|
component.onPause && component.onPause();
|
|
@@ -1173,33 +1173,35 @@ var gameObjectPause = function (gameObjects) {
|
|
|
1173
1173
|
}
|
|
1174
1174
|
}
|
|
1175
1175
|
}
|
|
1176
|
-
catch (
|
|
1176
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
1177
1177
|
finally {
|
|
1178
1178
|
try {
|
|
1179
1179
|
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
1180
1180
|
}
|
|
1181
|
-
finally { if (
|
|
1181
|
+
finally { if (e_5) throw e_5.error; }
|
|
1182
1182
|
}
|
|
1183
1183
|
}
|
|
1184
1184
|
}
|
|
1185
|
-
catch (
|
|
1185
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
1186
1186
|
finally {
|
|
1187
1187
|
try {
|
|
1188
|
-
if (
|
|
1188
|
+
if (gameObjects_2_1 && !gameObjects_2_1.done && (_a = gameObjects_2.return)) _a.call(gameObjects_2);
|
|
1189
1189
|
}
|
|
1190
|
-
finally { if (
|
|
1190
|
+
finally { if (e_4) throw e_4.error; }
|
|
1191
1191
|
}
|
|
1192
1192
|
};
|
|
1193
1193
|
var Game = (function (_super) {
|
|
1194
1194
|
__extends(Game, _super);
|
|
1195
1195
|
function Game(_a) {
|
|
1196
|
-
var
|
|
1197
|
-
var _c = _a === void 0 ? {} : _a, systems = _c.systems, _d = _c.frameRate, frameRate = _d === void 0 ? 60 : _d, _e = _c.autoStart, autoStart = _e === void 0 ? true : _e, _f = _c.needScene, needScene = _f === void 0 ? true : _f;
|
|
1196
|
+
var e_6, _b;
|
|
1197
|
+
var _c = _a === void 0 ? {} : _a, systems = _c.systems, _d = _c.frameRate, frameRate = _d === void 0 ? 60 : _d, _e = _c.autoStart, autoStart = _e === void 0 ? true : _e, _f = _c.needScene, needScene = _f === void 0 ? true : _f, _g = _c.mode, mode = _g === void 0 ? 'PLAY' : _g;
|
|
1198
1198
|
var _this = _super.call(this) || this;
|
|
1199
1199
|
_this.playing = false;
|
|
1200
1200
|
_this.started = false;
|
|
1201
1201
|
_this.multiScenes = [];
|
|
1202
1202
|
_this.systems = [];
|
|
1203
|
+
_this.mode = 'PLAY';
|
|
1204
|
+
_this.mode = mode;
|
|
1203
1205
|
if (window.__EVA_INSPECTOR_ENV__) {
|
|
1204
1206
|
window.__EVA_GAME_INSTANCE__ = _this;
|
|
1205
1207
|
}
|
|
@@ -1212,12 +1214,12 @@ var Game = (function (_super) {
|
|
|
1212
1214
|
_this.addSystem(system);
|
|
1213
1215
|
}
|
|
1214
1216
|
}
|
|
1215
|
-
catch (
|
|
1217
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
1216
1218
|
finally {
|
|
1217
1219
|
try {
|
|
1218
1220
|
if (systems_1_1 && !systems_1_1.done && (_b = systems_1.return)) _b.call(systems_1);
|
|
1219
1221
|
}
|
|
1220
|
-
finally { if (
|
|
1222
|
+
finally { if (e_6) throw e_6.error; }
|
|
1221
1223
|
}
|
|
1222
1224
|
}
|
|
1223
1225
|
if (needScene) {
|
|
@@ -1329,8 +1331,8 @@ var Game = (function (_super) {
|
|
|
1329
1331
|
Game.prototype.initTicker = function () {
|
|
1330
1332
|
var _this = this;
|
|
1331
1333
|
this.ticker.add(function (e) {
|
|
1332
|
-
var
|
|
1333
|
-
_this.scene && gameObjectLoop(e, _this.gameObjects);
|
|
1334
|
+
var e_7, _a, e_8, _b;
|
|
1335
|
+
_this.scene && _this.gameObjectLoop(e, _this.gameObjects);
|
|
1334
1336
|
try {
|
|
1335
1337
|
for (var _c = __values(_this.systems), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
1336
1338
|
var system = _d.value;
|
|
@@ -1343,12 +1345,12 @@ var Game = (function (_super) {
|
|
|
1343
1345
|
}
|
|
1344
1346
|
}
|
|
1345
1347
|
}
|
|
1346
|
-
catch (
|
|
1348
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
1347
1349
|
finally {
|
|
1348
1350
|
try {
|
|
1349
1351
|
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
1350
1352
|
}
|
|
1351
|
-
finally { if (
|
|
1353
|
+
finally { if (e_7) throw e_7.error; }
|
|
1352
1354
|
}
|
|
1353
1355
|
try {
|
|
1354
1356
|
for (var _e = __values(_this.systems), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
@@ -1361,17 +1363,17 @@ var Game = (function (_super) {
|
|
|
1361
1363
|
}
|
|
1362
1364
|
}
|
|
1363
1365
|
}
|
|
1364
|
-
catch (
|
|
1366
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
1365
1367
|
finally {
|
|
1366
1368
|
try {
|
|
1367
1369
|
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
1368
1370
|
}
|
|
1369
|
-
finally { if (
|
|
1371
|
+
finally { if (e_8) throw e_8.error; }
|
|
1370
1372
|
}
|
|
1371
1373
|
});
|
|
1372
1374
|
};
|
|
1373
1375
|
Game.prototype.triggerResume = function () {
|
|
1374
|
-
var
|
|
1376
|
+
var e_9, _a;
|
|
1375
1377
|
gameObjectResume(this.gameObjects);
|
|
1376
1378
|
try {
|
|
1377
1379
|
for (var _b = __values(this.systems), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
@@ -1384,16 +1386,16 @@ var Game = (function (_super) {
|
|
|
1384
1386
|
}
|
|
1385
1387
|
}
|
|
1386
1388
|
}
|
|
1387
|
-
catch (
|
|
1389
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
1388
1390
|
finally {
|
|
1389
1391
|
try {
|
|
1390
1392
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1391
1393
|
}
|
|
1392
|
-
finally { if (
|
|
1394
|
+
finally { if (e_9) throw e_9.error; }
|
|
1393
1395
|
}
|
|
1394
1396
|
};
|
|
1395
1397
|
Game.prototype.triggerPause = function () {
|
|
1396
|
-
var
|
|
1398
|
+
var e_10, _a;
|
|
1397
1399
|
gameObjectPause(this.gameObjects);
|
|
1398
1400
|
try {
|
|
1399
1401
|
for (var _b = __values(this.systems), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
@@ -1406,28 +1408,28 @@ var Game = (function (_super) {
|
|
|
1406
1408
|
}
|
|
1407
1409
|
}
|
|
1408
1410
|
}
|
|
1409
|
-
catch (
|
|
1411
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
1410
1412
|
finally {
|
|
1411
1413
|
try {
|
|
1412
1414
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1413
1415
|
}
|
|
1414
|
-
finally { if (
|
|
1416
|
+
finally { if (e_10) throw e_10.error; }
|
|
1415
1417
|
}
|
|
1416
1418
|
};
|
|
1417
1419
|
Game.prototype.destroySystems = function () {
|
|
1418
|
-
var
|
|
1420
|
+
var e_11, _a;
|
|
1419
1421
|
try {
|
|
1420
1422
|
for (var _b = __values(__spread(this.systems)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1421
1423
|
var system = _c.value;
|
|
1422
1424
|
this.removeSystem(system);
|
|
1423
1425
|
}
|
|
1424
1426
|
}
|
|
1425
|
-
catch (
|
|
1427
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
1426
1428
|
finally {
|
|
1427
1429
|
try {
|
|
1428
1430
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1429
1431
|
}
|
|
1430
|
-
finally { if (
|
|
1432
|
+
finally { if (e_11) throw e_11.error; }
|
|
1431
1433
|
}
|
|
1432
1434
|
this.systems.length = 0;
|
|
1433
1435
|
};
|
|
@@ -1456,17 +1458,79 @@ var Game = (function (_super) {
|
|
|
1456
1458
|
}
|
|
1457
1459
|
this.emit('sceneChanged', { scene: scene, mode: mode, params: params });
|
|
1458
1460
|
};
|
|
1461
|
+
Game.prototype.gameObjectLoop = function (e, gameObjects) {
|
|
1462
|
+
var e_12, _a, e_13, _b, e_14, _c, e_15, _d;
|
|
1463
|
+
if (gameObjects === void 0) { gameObjects = []; }
|
|
1464
|
+
try {
|
|
1465
|
+
for (var gameObjects_3 = __values(gameObjects), gameObjects_3_1 = gameObjects_3.next(); !gameObjects_3_1.done; gameObjects_3_1 = gameObjects_3.next()) {
|
|
1466
|
+
var gameObject = gameObjects_3_1.value;
|
|
1467
|
+
try {
|
|
1468
|
+
for (var _e = (e_13 = void 0, __values(gameObject.components)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
1469
|
+
var component = _f.value;
|
|
1470
|
+
try {
|
|
1471
|
+
if (this.mode === 'PLAY') {
|
|
1472
|
+
triggerStart(component);
|
|
1473
|
+
component.update && component.update(e);
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
catch (e) {
|
|
1477
|
+
console.error("gameObject: " + gameObject.name + " " + component.name + " update error", e);
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
catch (e_13_1) { e_13 = { error: e_13_1 }; }
|
|
1482
|
+
finally {
|
|
1483
|
+
try {
|
|
1484
|
+
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
1485
|
+
}
|
|
1486
|
+
finally { if (e_13) throw e_13.error; }
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
1491
|
+
finally {
|
|
1492
|
+
try {
|
|
1493
|
+
if (gameObjects_3_1 && !gameObjects_3_1.done && (_a = gameObjects_3.return)) _a.call(gameObjects_3);
|
|
1494
|
+
}
|
|
1495
|
+
finally { if (e_12) throw e_12.error; }
|
|
1496
|
+
}
|
|
1497
|
+
try {
|
|
1498
|
+
for (var gameObjects_4 = __values(gameObjects), gameObjects_4_1 = gameObjects_4.next(); !gameObjects_4_1.done; gameObjects_4_1 = gameObjects_4.next()) {
|
|
1499
|
+
var gameObject = gameObjects_4_1.value;
|
|
1500
|
+
try {
|
|
1501
|
+
for (var _g = (e_15 = void 0, __values(gameObject.components)), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
1502
|
+
var component = _h.value;
|
|
1503
|
+
try {
|
|
1504
|
+
if (this.mode === 'PLAY') {
|
|
1505
|
+
component.lateUpdate && component.lateUpdate(e);
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
catch (e) {
|
|
1509
|
+
console.error("gameObject: " + gameObject.name + " " + component.name + " lateUpdate error", e);
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
catch (e_15_1) { e_15 = { error: e_15_1 }; }
|
|
1514
|
+
finally {
|
|
1515
|
+
try {
|
|
1516
|
+
if (_h && !_h.done && (_d = _g.return)) _d.call(_g);
|
|
1517
|
+
}
|
|
1518
|
+
finally { if (e_15) throw e_15.error; }
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
catch (e_14_1) { e_14 = { error: e_14_1 }; }
|
|
1523
|
+
finally {
|
|
1524
|
+
try {
|
|
1525
|
+
if (gameObjects_4_1 && !gameObjects_4_1.done && (_c = gameObjects_4.return)) _c.call(gameObjects_4);
|
|
1526
|
+
}
|
|
1527
|
+
finally { if (e_14) throw e_14.error; }
|
|
1528
|
+
}
|
|
1529
|
+
};
|
|
1459
1530
|
return Game;
|
|
1460
1531
|
}(EventEmitter));
|
|
1461
1532
|
var Game$1 = Game;
|
|
1462
1533
|
|
|
1463
|
-
function IDEProp(target, propertyKey) {
|
|
1464
|
-
if (!target.constructor.IDEProps) {
|
|
1465
|
-
target.constructor.IDEProps = [];
|
|
1466
|
-
}
|
|
1467
|
-
target.constructor.IDEProps.push(propertyKey);
|
|
1468
|
-
}
|
|
1469
|
-
|
|
1470
1534
|
function componentObserver(observerInfo) {
|
|
1471
1535
|
if (observerInfo === void 0) { observerInfo = {}; }
|
|
1472
1536
|
return function (constructor) {
|
|
@@ -1895,10 +1959,9 @@ var Resource = (function (_super) {
|
|
|
1895
1959
|
var resource = new Resource();
|
|
1896
1960
|
|
|
1897
1961
|
var decorators = {
|
|
1898
|
-
IDEProp: IDEProp,
|
|
1899
1962
|
componentObserver: componentObserver,
|
|
1900
1963
|
};
|
|
1901
|
-
var version = '1.2.
|
|
1964
|
+
var version = '1.2.7-editor.2';
|
|
1902
1965
|
console.log("Eva.js version: " + version);
|
|
1903
1966
|
|
|
1904
|
-
export { Component$1 as Component, Game$1 as Game, GameObject$1 as GameObject,
|
|
1967
|
+
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 };
|