@eva/eva.js 1.2.7-editor.9 → 1.2.8-alpha.0
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 +182 -383
- package/dist/EVA.min.js +1 -1
- package/dist/eva.js.cjs.js +130 -195
- package/dist/eva.js.cjs.prod.js +2 -2
- package/dist/eva.js.d.ts +8 -18
- package/dist/eva.js.esm.js +131 -197
- package/dist/miniprogram.js +3683 -0
- package/package.json +2 -3
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 { type, step } 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,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); } }
|
|
@@ -366,65 +362,12 @@ function setSystemObserver(system, S) {
|
|
|
366
362
|
systemInstance[S.systemName] = system;
|
|
367
363
|
}
|
|
368
364
|
|
|
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
|
-
}());
|
|
421
365
|
var Transform = (function (_super) {
|
|
422
366
|
__extends(Transform, _super);
|
|
423
367
|
function Transform() {
|
|
424
368
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
425
369
|
_this.name = 'Transform';
|
|
426
370
|
_this._parent = null;
|
|
427
|
-
_this.childIndex = -1;
|
|
428
371
|
_this.inScene = false;
|
|
429
372
|
_this.children = [];
|
|
430
373
|
_this.position = { x: 0, y: 0 };
|
|
@@ -471,16 +414,15 @@ var Transform = (function (_super) {
|
|
|
471
414
|
configurable: true
|
|
472
415
|
});
|
|
473
416
|
Transform.prototype.addChild = function (child) {
|
|
474
|
-
if (child.parent) {
|
|
417
|
+
if (child.parent === this) {
|
|
418
|
+
var index = this.children.findIndex(function (item) { return item === child; });
|
|
419
|
+
this.children.splice(index, 1);
|
|
420
|
+
}
|
|
421
|
+
else if (child.parent) {
|
|
475
422
|
child.parent.removeChild(child);
|
|
476
423
|
}
|
|
477
424
|
child._parent = this;
|
|
478
|
-
|
|
479
|
-
this.children.splice(child.childIndex, 0, child);
|
|
480
|
-
}
|
|
481
|
-
else {
|
|
482
|
-
this.children.push(child);
|
|
483
|
-
}
|
|
425
|
+
this.children.push(child);
|
|
484
426
|
};
|
|
485
427
|
Transform.prototype.removeChild = function (child) {
|
|
486
428
|
var index = this.children.findIndex(function (item) { return item === child; });
|
|
@@ -494,32 +436,32 @@ var Transform = (function (_super) {
|
|
|
494
436
|
};
|
|
495
437
|
Transform.componentName = 'Transform';
|
|
496
438
|
__decorate([
|
|
497
|
-
|
|
498
|
-
|
|
439
|
+
type('vector2'),
|
|
440
|
+
step(1)
|
|
499
441
|
], Transform.prototype, "position", void 0);
|
|
500
442
|
__decorate([
|
|
501
|
-
|
|
502
|
-
|
|
443
|
+
type('size'),
|
|
444
|
+
step(1)
|
|
503
445
|
], Transform.prototype, "size", void 0);
|
|
504
446
|
__decorate([
|
|
505
|
-
|
|
506
|
-
|
|
447
|
+
type('vector2'),
|
|
448
|
+
step(0.1)
|
|
507
449
|
], Transform.prototype, "origin", void 0);
|
|
508
450
|
__decorate([
|
|
509
|
-
|
|
510
|
-
|
|
451
|
+
type('vector2'),
|
|
452
|
+
step(0.1)
|
|
511
453
|
], Transform.prototype, "anchor", void 0);
|
|
512
454
|
__decorate([
|
|
513
|
-
|
|
514
|
-
|
|
455
|
+
type('vector2'),
|
|
456
|
+
step(0.1)
|
|
515
457
|
], Transform.prototype, "scale", void 0);
|
|
516
458
|
__decorate([
|
|
517
|
-
|
|
518
|
-
|
|
459
|
+
type('vector2'),
|
|
460
|
+
step(0.1)
|
|
519
461
|
], Transform.prototype, "skew", void 0);
|
|
520
462
|
__decorate([
|
|
521
|
-
|
|
522
|
-
|
|
463
|
+
type('number'),
|
|
464
|
+
step(0.1)
|
|
523
465
|
], Transform.prototype, "rotation", void 0);
|
|
524
466
|
return Transform;
|
|
525
467
|
}(Component$1));
|
|
@@ -606,13 +548,6 @@ var GameObject = (function () {
|
|
|
606
548
|
gameObject.transform.parent = this.transform;
|
|
607
549
|
gameObject.scene = this.scene;
|
|
608
550
|
};
|
|
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
|
-
};
|
|
616
551
|
GameObject.prototype.removeChild = function (gameObject) {
|
|
617
552
|
if (!(gameObject instanceof GameObject) || !gameObject.parent || gameObject.parent !== this) {
|
|
618
553
|
return gameObject;
|
|
@@ -1124,26 +1059,28 @@ var getAllGameObjects = function (game) {
|
|
|
1124
1059
|
}
|
|
1125
1060
|
return __spread(mainSceneGameObjects, otherSceneGameObjects);
|
|
1126
1061
|
};
|
|
1127
|
-
var
|
|
1128
|
-
var e_2, _a, e_3, _b;
|
|
1062
|
+
var gameObjectLoop = function (e, gameObjects) {
|
|
1063
|
+
var e_2, _a, e_3, _b, e_4, _c, e_5, _d;
|
|
1064
|
+
if (gameObjects === void 0) { gameObjects = []; }
|
|
1129
1065
|
try {
|
|
1130
1066
|
for (var gameObjects_1 = __values(gameObjects), gameObjects_1_1 = gameObjects_1.next(); !gameObjects_1_1.done; gameObjects_1_1 = gameObjects_1.next()) {
|
|
1131
1067
|
var gameObject = gameObjects_1_1.value;
|
|
1132
1068
|
try {
|
|
1133
|
-
for (var
|
|
1134
|
-
var component =
|
|
1069
|
+
for (var _e = (e_3 = void 0, __values(gameObject.components)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
1070
|
+
var component = _f.value;
|
|
1135
1071
|
try {
|
|
1136
|
-
component
|
|
1072
|
+
triggerStart(component);
|
|
1073
|
+
component.update && component.update(e);
|
|
1137
1074
|
}
|
|
1138
1075
|
catch (e) {
|
|
1139
|
-
console.error("gameObject: " + gameObject.name + "
|
|
1076
|
+
console.error("gameObject: " + gameObject.name + " " + component.name + " update error", e);
|
|
1140
1077
|
}
|
|
1141
1078
|
}
|
|
1142
1079
|
}
|
|
1143
1080
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1144
1081
|
finally {
|
|
1145
1082
|
try {
|
|
1146
|
-
if (
|
|
1083
|
+
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
1147
1084
|
}
|
|
1148
1085
|
finally { if (e_3) throw e_3.error; }
|
|
1149
1086
|
}
|
|
@@ -1156,27 +1093,24 @@ var gameObjectResume = function (gameObjects) {
|
|
|
1156
1093
|
}
|
|
1157
1094
|
finally { if (e_2) throw e_2.error; }
|
|
1158
1095
|
}
|
|
1159
|
-
};
|
|
1160
|
-
var gameObjectPause = function (gameObjects) {
|
|
1161
|
-
var e_4, _a, e_5, _b;
|
|
1162
1096
|
try {
|
|
1163
1097
|
for (var gameObjects_2 = __values(gameObjects), gameObjects_2_1 = gameObjects_2.next(); !gameObjects_2_1.done; gameObjects_2_1 = gameObjects_2.next()) {
|
|
1164
1098
|
var gameObject = gameObjects_2_1.value;
|
|
1165
1099
|
try {
|
|
1166
|
-
for (var
|
|
1167
|
-
var component =
|
|
1100
|
+
for (var _g = (e_5 = void 0, __values(gameObject.components)), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
1101
|
+
var component = _h.value;
|
|
1168
1102
|
try {
|
|
1169
|
-
component.
|
|
1103
|
+
component.lateUpdate && component.lateUpdate(e);
|
|
1170
1104
|
}
|
|
1171
1105
|
catch (e) {
|
|
1172
|
-
console.error("gameObject: " + gameObject.name + "
|
|
1106
|
+
console.error("gameObject: " + gameObject.name + " " + component.name + " lateUpdate error", e);
|
|
1173
1107
|
}
|
|
1174
1108
|
}
|
|
1175
1109
|
}
|
|
1176
1110
|
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
1177
1111
|
finally {
|
|
1178
1112
|
try {
|
|
1179
|
-
if (
|
|
1113
|
+
if (_h && !_h.done && (_d = _g.return)) _d.call(_g);
|
|
1180
1114
|
}
|
|
1181
1115
|
finally { if (e_5) throw e_5.error; }
|
|
1182
1116
|
}
|
|
@@ -1185,23 +1119,87 @@ var gameObjectPause = function (gameObjects) {
|
|
|
1185
1119
|
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
1186
1120
|
finally {
|
|
1187
1121
|
try {
|
|
1188
|
-
if (gameObjects_2_1 && !gameObjects_2_1.done && (
|
|
1122
|
+
if (gameObjects_2_1 && !gameObjects_2_1.done && (_c = gameObjects_2.return)) _c.call(gameObjects_2);
|
|
1189
1123
|
}
|
|
1190
1124
|
finally { if (e_4) throw e_4.error; }
|
|
1191
1125
|
}
|
|
1192
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
|
+
};
|
|
1160
|
+
var gameObjectPause = function (gameObjects) {
|
|
1161
|
+
var e_8, _a, e_9, _b;
|
|
1162
|
+
try {
|
|
1163
|
+
for (var gameObjects_4 = __values(gameObjects), gameObjects_4_1 = gameObjects_4.next(); !gameObjects_4_1.done; gameObjects_4_1 = gameObjects_4.next()) {
|
|
1164
|
+
var gameObject = gameObjects_4_1.value;
|
|
1165
|
+
try {
|
|
1166
|
+
for (var _c = (e_9 = void 0, __values(gameObject.components)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
1167
|
+
var component = _d.value;
|
|
1168
|
+
try {
|
|
1169
|
+
component.onPause && component.onPause();
|
|
1170
|
+
}
|
|
1171
|
+
catch (e) {
|
|
1172
|
+
console.error("gameObject: " + gameObject.name + ", " + component.name + ", onResume error", e);
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
1177
|
+
finally {
|
|
1178
|
+
try {
|
|
1179
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
1180
|
+
}
|
|
1181
|
+
finally { if (e_9) throw e_9.error; }
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
1186
|
+
finally {
|
|
1187
|
+
try {
|
|
1188
|
+
if (gameObjects_4_1 && !gameObjects_4_1.done && (_a = gameObjects_4.return)) _a.call(gameObjects_4);
|
|
1189
|
+
}
|
|
1190
|
+
finally { if (e_8) throw e_8.error; }
|
|
1191
|
+
}
|
|
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_10, _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;
|
|
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;
|
|
1205
1203
|
if (window.__EVA_INSPECTOR_ENV__) {
|
|
1206
1204
|
window.__EVA_GAME_INSTANCE__ = _this;
|
|
1207
1205
|
}
|
|
@@ -1214,12 +1212,12 @@ var Game = (function (_super) {
|
|
|
1214
1212
|
_this.addSystem(system);
|
|
1215
1213
|
}
|
|
1216
1214
|
}
|
|
1217
|
-
catch (
|
|
1215
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
1218
1216
|
finally {
|
|
1219
1217
|
try {
|
|
1220
1218
|
if (systems_1_1 && !systems_1_1.done && (_b = systems_1.return)) _b.call(systems_1);
|
|
1221
1219
|
}
|
|
1222
|
-
finally { if (
|
|
1220
|
+
finally { if (e_10) throw e_10.error; }
|
|
1223
1221
|
}
|
|
1224
1222
|
}
|
|
1225
1223
|
if (needScene) {
|
|
@@ -1331,8 +1329,8 @@ var Game = (function (_super) {
|
|
|
1331
1329
|
Game.prototype.initTicker = function () {
|
|
1332
1330
|
var _this = this;
|
|
1333
1331
|
this.ticker.add(function (e) {
|
|
1334
|
-
var
|
|
1335
|
-
_this.scene &&
|
|
1332
|
+
var e_11, _a, e_12, _b;
|
|
1333
|
+
_this.scene && gameObjectLoop(e, _this.gameObjects);
|
|
1336
1334
|
try {
|
|
1337
1335
|
for (var _c = __values(_this.systems), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
1338
1336
|
var system = _d.value;
|
|
@@ -1345,12 +1343,12 @@ var Game = (function (_super) {
|
|
|
1345
1343
|
}
|
|
1346
1344
|
}
|
|
1347
1345
|
}
|
|
1348
|
-
catch (
|
|
1346
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
1349
1347
|
finally {
|
|
1350
1348
|
try {
|
|
1351
1349
|
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
1352
1350
|
}
|
|
1353
|
-
finally { if (
|
|
1351
|
+
finally { if (e_11) throw e_11.error; }
|
|
1354
1352
|
}
|
|
1355
1353
|
try {
|
|
1356
1354
|
for (var _e = __values(_this.systems), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
@@ -1363,17 +1361,17 @@ var Game = (function (_super) {
|
|
|
1363
1361
|
}
|
|
1364
1362
|
}
|
|
1365
1363
|
}
|
|
1366
|
-
catch (
|
|
1364
|
+
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
1367
1365
|
finally {
|
|
1368
1366
|
try {
|
|
1369
1367
|
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
1370
1368
|
}
|
|
1371
|
-
finally { if (
|
|
1369
|
+
finally { if (e_12) throw e_12.error; }
|
|
1372
1370
|
}
|
|
1373
1371
|
});
|
|
1374
1372
|
};
|
|
1375
1373
|
Game.prototype.triggerResume = function () {
|
|
1376
|
-
var
|
|
1374
|
+
var e_13, _a;
|
|
1377
1375
|
gameObjectResume(this.gameObjects);
|
|
1378
1376
|
try {
|
|
1379
1377
|
for (var _b = __values(this.systems), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
@@ -1386,16 +1384,16 @@ var Game = (function (_super) {
|
|
|
1386
1384
|
}
|
|
1387
1385
|
}
|
|
1388
1386
|
}
|
|
1389
|
-
catch (
|
|
1387
|
+
catch (e_13_1) { e_13 = { error: e_13_1 }; }
|
|
1390
1388
|
finally {
|
|
1391
1389
|
try {
|
|
1392
1390
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1393
1391
|
}
|
|
1394
|
-
finally { if (
|
|
1392
|
+
finally { if (e_13) throw e_13.error; }
|
|
1395
1393
|
}
|
|
1396
1394
|
};
|
|
1397
1395
|
Game.prototype.triggerPause = function () {
|
|
1398
|
-
var
|
|
1396
|
+
var e_14, _a;
|
|
1399
1397
|
gameObjectPause(this.gameObjects);
|
|
1400
1398
|
try {
|
|
1401
1399
|
for (var _b = __values(this.systems), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
@@ -1408,28 +1406,28 @@ var Game = (function (_super) {
|
|
|
1408
1406
|
}
|
|
1409
1407
|
}
|
|
1410
1408
|
}
|
|
1411
|
-
catch (
|
|
1409
|
+
catch (e_14_1) { e_14 = { error: e_14_1 }; }
|
|
1412
1410
|
finally {
|
|
1413
1411
|
try {
|
|
1414
1412
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1415
1413
|
}
|
|
1416
|
-
finally { if (
|
|
1414
|
+
finally { if (e_14) throw e_14.error; }
|
|
1417
1415
|
}
|
|
1418
1416
|
};
|
|
1419
1417
|
Game.prototype.destroySystems = function () {
|
|
1420
|
-
var
|
|
1418
|
+
var e_15, _a;
|
|
1421
1419
|
try {
|
|
1422
1420
|
for (var _b = __values(__spread(this.systems)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1423
1421
|
var system = _c.value;
|
|
1424
1422
|
this.removeSystem(system);
|
|
1425
1423
|
}
|
|
1426
1424
|
}
|
|
1427
|
-
catch (
|
|
1425
|
+
catch (e_15_1) { e_15 = { error: e_15_1 }; }
|
|
1428
1426
|
finally {
|
|
1429
1427
|
try {
|
|
1430
1428
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1431
1429
|
}
|
|
1432
|
-
finally { if (
|
|
1430
|
+
finally { if (e_15) throw e_15.error; }
|
|
1433
1431
|
}
|
|
1434
1432
|
this.systems.length = 0;
|
|
1435
1433
|
};
|
|
@@ -1458,82 +1456,17 @@ var Game = (function (_super) {
|
|
|
1458
1456
|
}
|
|
1459
1457
|
this.emit('sceneChanged', { scene: scene, mode: mode, params: params });
|
|
1460
1458
|
};
|
|
1461
|
-
Game.prototype.shouldUpdate = function (component) {
|
|
1462
|
-
return this.mode === 'PLAY' || (this.mode === 'EDIT' && shouldExecuteInEditMode(component.constructor));
|
|
1463
|
-
};
|
|
1464
|
-
Game.prototype.gameObjectLoop = function (e, gameObjects) {
|
|
1465
|
-
var e_12, _a, e_13, _b, e_14, _c, e_15, _d;
|
|
1466
|
-
if (gameObjects === void 0) { gameObjects = []; }
|
|
1467
|
-
try {
|
|
1468
|
-
for (var gameObjects_3 = __values(gameObjects), gameObjects_3_1 = gameObjects_3.next(); !gameObjects_3_1.done; gameObjects_3_1 = gameObjects_3.next()) {
|
|
1469
|
-
var gameObject = gameObjects_3_1.value;
|
|
1470
|
-
try {
|
|
1471
|
-
for (var _e = (e_13 = void 0, __values(gameObject.components)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
1472
|
-
var component = _f.value;
|
|
1473
|
-
try {
|
|
1474
|
-
if (this.shouldUpdate(component)) {
|
|
1475
|
-
triggerStart(component);
|
|
1476
|
-
component.update && component.update(e);
|
|
1477
|
-
}
|
|
1478
|
-
}
|
|
1479
|
-
catch (e) {
|
|
1480
|
-
console.error("gameObject: " + gameObject.name + " " + component.name + " update error", e);
|
|
1481
|
-
}
|
|
1482
|
-
}
|
|
1483
|
-
}
|
|
1484
|
-
catch (e_13_1) { e_13 = { error: e_13_1 }; }
|
|
1485
|
-
finally {
|
|
1486
|
-
try {
|
|
1487
|
-
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
1488
|
-
}
|
|
1489
|
-
finally { if (e_13) throw e_13.error; }
|
|
1490
|
-
}
|
|
1491
|
-
}
|
|
1492
|
-
}
|
|
1493
|
-
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
1494
|
-
finally {
|
|
1495
|
-
try {
|
|
1496
|
-
if (gameObjects_3_1 && !gameObjects_3_1.done && (_a = gameObjects_3.return)) _a.call(gameObjects_3);
|
|
1497
|
-
}
|
|
1498
|
-
finally { if (e_12) throw e_12.error; }
|
|
1499
|
-
}
|
|
1500
|
-
try {
|
|
1501
|
-
for (var gameObjects_4 = __values(gameObjects), gameObjects_4_1 = gameObjects_4.next(); !gameObjects_4_1.done; gameObjects_4_1 = gameObjects_4.next()) {
|
|
1502
|
-
var gameObject = gameObjects_4_1.value;
|
|
1503
|
-
try {
|
|
1504
|
-
for (var _g = (e_15 = void 0, __values(gameObject.components)), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
1505
|
-
var component = _h.value;
|
|
1506
|
-
try {
|
|
1507
|
-
if (this.shouldUpdate(component)) {
|
|
1508
|
-
component.lateUpdate && component.lateUpdate(e);
|
|
1509
|
-
}
|
|
1510
|
-
}
|
|
1511
|
-
catch (e) {
|
|
1512
|
-
console.error("gameObject: " + gameObject.name + " " + component.name + " lateUpdate error", e);
|
|
1513
|
-
}
|
|
1514
|
-
}
|
|
1515
|
-
}
|
|
1516
|
-
catch (e_15_1) { e_15 = { error: e_15_1 }; }
|
|
1517
|
-
finally {
|
|
1518
|
-
try {
|
|
1519
|
-
if (_h && !_h.done && (_d = _g.return)) _d.call(_g);
|
|
1520
|
-
}
|
|
1521
|
-
finally { if (e_15) throw e_15.error; }
|
|
1522
|
-
}
|
|
1523
|
-
}
|
|
1524
|
-
}
|
|
1525
|
-
catch (e_14_1) { e_14 = { error: e_14_1 }; }
|
|
1526
|
-
finally {
|
|
1527
|
-
try {
|
|
1528
|
-
if (gameObjects_4_1 && !gameObjects_4_1.done && (_c = gameObjects_4.return)) _c.call(gameObjects_4);
|
|
1529
|
-
}
|
|
1530
|
-
finally { if (e_14) throw e_14.error; }
|
|
1531
|
-
}
|
|
1532
|
-
};
|
|
1533
1459
|
return Game;
|
|
1534
1460
|
}(EventEmitter));
|
|
1535
1461
|
var Game$1 = Game;
|
|
1536
1462
|
|
|
1463
|
+
function IDEProp(target, propertyKey) {
|
|
1464
|
+
if (!target.constructor.IDEProps) {
|
|
1465
|
+
target.constructor.IDEProps = [];
|
|
1466
|
+
}
|
|
1467
|
+
target.constructor.IDEProps.push(propertyKey);
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1537
1470
|
function componentObserver(observerInfo) {
|
|
1538
1471
|
if (observerInfo === void 0) { observerInfo = {}; }
|
|
1539
1472
|
return function (constructor) {
|
|
@@ -1962,9 +1895,10 @@ var Resource = (function (_super) {
|
|
|
1962
1895
|
var resource = new Resource();
|
|
1963
1896
|
|
|
1964
1897
|
var decorators = {
|
|
1898
|
+
IDEProp: IDEProp,
|
|
1965
1899
|
componentObserver: componentObserver,
|
|
1966
1900
|
};
|
|
1967
|
-
var version = '1.2.
|
|
1901
|
+
var version = '1.2.8-alpha.0';
|
|
1968
1902
|
console.log("Eva.js version: " + version);
|
|
1969
1903
|
|
|
1970
|
-
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 };
|
|
1904
|
+
export { Component$1 as Component, Game$1 as Game, GameObject$1 as GameObject, IDEProp, 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 };
|