@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.cjs.js
CHANGED
|
@@ -7,7 +7,7 @@ var lodashEs = require('lodash-es');
|
|
|
7
7
|
var inspectorDecorator = require('@eva/inspector-decorator');
|
|
8
8
|
var resourceLoader$1 = require('resource-loader');
|
|
9
9
|
|
|
10
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e[
|
|
10
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
|
|
11
11
|
|
|
12
12
|
var EventEmitter__default = /*#__PURE__*/_interopDefaultLegacy(EventEmitter);
|
|
13
13
|
|
|
@@ -47,6 +47,10 @@ function __decorate(decorators, target, key, desc) {
|
|
|
47
47
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
function __metadata(metadataKey, metadataValue) {
|
|
51
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
52
|
+
}
|
|
53
|
+
|
|
50
54
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
51
55
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
52
56
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
@@ -370,12 +374,65 @@ function setSystemObserver(system, S) {
|
|
|
370
374
|
systemInstance[S.systemName] = system;
|
|
371
375
|
}
|
|
372
376
|
|
|
377
|
+
var Vector2 = (function () {
|
|
378
|
+
function Vector2() {
|
|
379
|
+
}
|
|
380
|
+
__decorate([
|
|
381
|
+
inspectorDecorator.Field({ step: 0.1, default: 0 }),
|
|
382
|
+
__metadata("design:type", Number)
|
|
383
|
+
], Vector2.prototype, "x", void 0);
|
|
384
|
+
__decorate([
|
|
385
|
+
inspectorDecorator.Field({ step: 0.1, default: 0 }),
|
|
386
|
+
__metadata("design:type", Number)
|
|
387
|
+
], Vector2.prototype, "y", void 0);
|
|
388
|
+
return Vector2;
|
|
389
|
+
}());
|
|
390
|
+
var IntVector2 = (function () {
|
|
391
|
+
function IntVector2() {
|
|
392
|
+
}
|
|
393
|
+
__decorate([
|
|
394
|
+
inspectorDecorator.Field({ step: 1, default: 0 }),
|
|
395
|
+
__metadata("design:type", Number)
|
|
396
|
+
], IntVector2.prototype, "x", void 0);
|
|
397
|
+
__decorate([
|
|
398
|
+
inspectorDecorator.Field({ step: 1, default: 0 }),
|
|
399
|
+
__metadata("design:type", Number)
|
|
400
|
+
], IntVector2.prototype, "y", void 0);
|
|
401
|
+
return IntVector2;
|
|
402
|
+
}());
|
|
403
|
+
var Size2 = (function () {
|
|
404
|
+
function Size2() {
|
|
405
|
+
}
|
|
406
|
+
__decorate([
|
|
407
|
+
inspectorDecorator.Field({ step: 1, default: 0 }),
|
|
408
|
+
__metadata("design:type", Number)
|
|
409
|
+
], Size2.prototype, "width", void 0);
|
|
410
|
+
__decorate([
|
|
411
|
+
inspectorDecorator.Field({ step: 1, default: 0 }),
|
|
412
|
+
__metadata("design:type", Number)
|
|
413
|
+
], Size2.prototype, "height", void 0);
|
|
414
|
+
return Size2;
|
|
415
|
+
}());
|
|
416
|
+
var Scale = (function () {
|
|
417
|
+
function Scale() {
|
|
418
|
+
}
|
|
419
|
+
__decorate([
|
|
420
|
+
inspectorDecorator.Field({ step: 0.1, default: 1 }),
|
|
421
|
+
__metadata("design:type", Number)
|
|
422
|
+
], Scale.prototype, "x", void 0);
|
|
423
|
+
__decorate([
|
|
424
|
+
inspectorDecorator.Field({ step: 0.1, default: 1 }),
|
|
425
|
+
__metadata("design:type", Number)
|
|
426
|
+
], Scale.prototype, "y", void 0);
|
|
427
|
+
return Scale;
|
|
428
|
+
}());
|
|
373
429
|
var Transform = (function (_super) {
|
|
374
430
|
__extends(Transform, _super);
|
|
375
431
|
function Transform() {
|
|
376
432
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
377
433
|
_this.name = 'Transform';
|
|
378
434
|
_this._parent = null;
|
|
435
|
+
_this.childIndex = -1;
|
|
379
436
|
_this.inScene = false;
|
|
380
437
|
_this.children = [];
|
|
381
438
|
_this.position = { x: 0, y: 0 };
|
|
@@ -422,15 +479,16 @@ var Transform = (function (_super) {
|
|
|
422
479
|
configurable: true
|
|
423
480
|
});
|
|
424
481
|
Transform.prototype.addChild = function (child) {
|
|
425
|
-
if (child.parent
|
|
426
|
-
var index = this.children.findIndex(function (item) { return item === child; });
|
|
427
|
-
this.children.splice(index, 1);
|
|
428
|
-
}
|
|
429
|
-
else if (child.parent) {
|
|
482
|
+
if (child.parent) {
|
|
430
483
|
child.parent.removeChild(child);
|
|
431
484
|
}
|
|
432
485
|
child._parent = this;
|
|
433
|
-
|
|
486
|
+
if (child.childIndex > -1) {
|
|
487
|
+
this.children.splice(child.childIndex, 0, child);
|
|
488
|
+
}
|
|
489
|
+
else {
|
|
490
|
+
this.children.push(child);
|
|
491
|
+
}
|
|
434
492
|
};
|
|
435
493
|
Transform.prototype.removeChild = function (child) {
|
|
436
494
|
var index = this.children.findIndex(function (item) { return item === child; });
|
|
@@ -444,32 +502,32 @@ var Transform = (function (_super) {
|
|
|
444
502
|
};
|
|
445
503
|
Transform.componentName = 'Transform';
|
|
446
504
|
__decorate([
|
|
447
|
-
inspectorDecorator.
|
|
448
|
-
|
|
505
|
+
inspectorDecorator.Field(function () { return IntVector2; }),
|
|
506
|
+
__metadata("design:type", IntVector2)
|
|
449
507
|
], Transform.prototype, "position", void 0);
|
|
450
508
|
__decorate([
|
|
451
|
-
inspectorDecorator.
|
|
452
|
-
|
|
509
|
+
inspectorDecorator.Field(function () { return Size2; }),
|
|
510
|
+
__metadata("design:type", Size2)
|
|
453
511
|
], Transform.prototype, "size", void 0);
|
|
454
512
|
__decorate([
|
|
455
|
-
inspectorDecorator.
|
|
456
|
-
|
|
513
|
+
inspectorDecorator.Field(function () { return Vector2; }),
|
|
514
|
+
__metadata("design:type", Vector2)
|
|
457
515
|
], Transform.prototype, "origin", void 0);
|
|
458
516
|
__decorate([
|
|
459
|
-
inspectorDecorator.
|
|
460
|
-
|
|
517
|
+
inspectorDecorator.Field(function () { return Vector2; }),
|
|
518
|
+
__metadata("design:type", Vector2)
|
|
461
519
|
], Transform.prototype, "anchor", void 0);
|
|
462
520
|
__decorate([
|
|
463
|
-
inspectorDecorator.
|
|
464
|
-
|
|
521
|
+
inspectorDecorator.Field(function () { return Scale; }),
|
|
522
|
+
__metadata("design:type", Vector2)
|
|
465
523
|
], Transform.prototype, "scale", void 0);
|
|
466
524
|
__decorate([
|
|
467
|
-
inspectorDecorator.
|
|
468
|
-
|
|
525
|
+
inspectorDecorator.Field(function () { return Vector2; }),
|
|
526
|
+
__metadata("design:type", Vector2)
|
|
469
527
|
], Transform.prototype, "skew", void 0);
|
|
470
528
|
__decorate([
|
|
471
|
-
inspectorDecorator.
|
|
472
|
-
|
|
529
|
+
inspectorDecorator.Field({ step: 0.1 }),
|
|
530
|
+
__metadata("design:type", Number)
|
|
473
531
|
], Transform.prototype, "rotation", void 0);
|
|
474
532
|
return Transform;
|
|
475
533
|
}(Component$1));
|
|
@@ -556,6 +614,13 @@ var GameObject = (function () {
|
|
|
556
614
|
gameObject.transform.parent = this.transform;
|
|
557
615
|
gameObject.scene = this.scene;
|
|
558
616
|
};
|
|
617
|
+
GameObject.prototype.addChildAt = function (gameObject, index) {
|
|
618
|
+
if (index > this.transform.children.length) {
|
|
619
|
+
throw new Error(gameObject.name + "addChildAt: The index 18 supplied is out of bounds " + this.transform.children.length);
|
|
620
|
+
}
|
|
621
|
+
this.addChild(gameObject);
|
|
622
|
+
gameObject.transform.childIndex = index;
|
|
623
|
+
};
|
|
559
624
|
GameObject.prototype.removeChild = function (gameObject) {
|
|
560
625
|
if (!(gameObject instanceof GameObject) || !gameObject.parent || gameObject.parent !== this) {
|
|
561
626
|
return gameObject;
|
|
@@ -1067,28 +1132,26 @@ var getAllGameObjects = function (game) {
|
|
|
1067
1132
|
}
|
|
1068
1133
|
return __spread(mainSceneGameObjects, otherSceneGameObjects);
|
|
1069
1134
|
};
|
|
1070
|
-
var
|
|
1071
|
-
var e_2, _a, e_3, _b
|
|
1072
|
-
if (gameObjects === void 0) { gameObjects = []; }
|
|
1135
|
+
var gameObjectResume = function (gameObjects) {
|
|
1136
|
+
var e_2, _a, e_3, _b;
|
|
1073
1137
|
try {
|
|
1074
1138
|
for (var gameObjects_1 = __values(gameObjects), gameObjects_1_1 = gameObjects_1.next(); !gameObjects_1_1.done; gameObjects_1_1 = gameObjects_1.next()) {
|
|
1075
1139
|
var gameObject = gameObjects_1_1.value;
|
|
1076
1140
|
try {
|
|
1077
|
-
for (var
|
|
1078
|
-
var component =
|
|
1141
|
+
for (var _c = (e_3 = void 0, __values(gameObject.components)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
1142
|
+
var component = _d.value;
|
|
1079
1143
|
try {
|
|
1080
|
-
|
|
1081
|
-
component.update && component.update(e);
|
|
1144
|
+
component.onResume && component.onResume();
|
|
1082
1145
|
}
|
|
1083
1146
|
catch (e) {
|
|
1084
|
-
console.error("gameObject: " + gameObject.name + " " + component.name + "
|
|
1147
|
+
console.error("gameObject: " + gameObject.name + ", " + component.name + ", onResume error", e);
|
|
1085
1148
|
}
|
|
1086
1149
|
}
|
|
1087
1150
|
}
|
|
1088
1151
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1089
1152
|
finally {
|
|
1090
1153
|
try {
|
|
1091
|
-
if (
|
|
1154
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
1092
1155
|
}
|
|
1093
1156
|
finally { if (e_3) throw e_3.error; }
|
|
1094
1157
|
}
|
|
@@ -1101,77 +1164,14 @@ var gameObjectLoop = function (e, gameObjects) {
|
|
|
1101
1164
|
}
|
|
1102
1165
|
finally { if (e_2) throw e_2.error; }
|
|
1103
1166
|
}
|
|
1104
|
-
try {
|
|
1105
|
-
for (var gameObjects_2 = __values(gameObjects), gameObjects_2_1 = gameObjects_2.next(); !gameObjects_2_1.done; gameObjects_2_1 = gameObjects_2.next()) {
|
|
1106
|
-
var gameObject = gameObjects_2_1.value;
|
|
1107
|
-
try {
|
|
1108
|
-
for (var _g = (e_5 = void 0, __values(gameObject.components)), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
1109
|
-
var component = _h.value;
|
|
1110
|
-
try {
|
|
1111
|
-
component.lateUpdate && component.lateUpdate(e);
|
|
1112
|
-
}
|
|
1113
|
-
catch (e) {
|
|
1114
|
-
console.error("gameObject: " + gameObject.name + " " + component.name + " lateUpdate error", e);
|
|
1115
|
-
}
|
|
1116
|
-
}
|
|
1117
|
-
}
|
|
1118
|
-
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
1119
|
-
finally {
|
|
1120
|
-
try {
|
|
1121
|
-
if (_h && !_h.done && (_d = _g.return)) _d.call(_g);
|
|
1122
|
-
}
|
|
1123
|
-
finally { if (e_5) throw e_5.error; }
|
|
1124
|
-
}
|
|
1125
|
-
}
|
|
1126
|
-
}
|
|
1127
|
-
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
1128
|
-
finally {
|
|
1129
|
-
try {
|
|
1130
|
-
if (gameObjects_2_1 && !gameObjects_2_1.done && (_c = gameObjects_2.return)) _c.call(gameObjects_2);
|
|
1131
|
-
}
|
|
1132
|
-
finally { if (e_4) throw e_4.error; }
|
|
1133
|
-
}
|
|
1134
|
-
};
|
|
1135
|
-
var gameObjectResume = function (gameObjects) {
|
|
1136
|
-
var e_6, _a, e_7, _b;
|
|
1137
|
-
try {
|
|
1138
|
-
for (var gameObjects_3 = __values(gameObjects), gameObjects_3_1 = gameObjects_3.next(); !gameObjects_3_1.done; gameObjects_3_1 = gameObjects_3.next()) {
|
|
1139
|
-
var gameObject = gameObjects_3_1.value;
|
|
1140
|
-
try {
|
|
1141
|
-
for (var _c = (e_7 = void 0, __values(gameObject.components)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
1142
|
-
var component = _d.value;
|
|
1143
|
-
try {
|
|
1144
|
-
component.onResume && component.onResume();
|
|
1145
|
-
}
|
|
1146
|
-
catch (e) {
|
|
1147
|
-
console.error("gameObject: " + gameObject.name + ", " + component.name + ", onResume error", e);
|
|
1148
|
-
}
|
|
1149
|
-
}
|
|
1150
|
-
}
|
|
1151
|
-
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
1152
|
-
finally {
|
|
1153
|
-
try {
|
|
1154
|
-
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
1155
|
-
}
|
|
1156
|
-
finally { if (e_7) throw e_7.error; }
|
|
1157
|
-
}
|
|
1158
|
-
}
|
|
1159
|
-
}
|
|
1160
|
-
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
1161
|
-
finally {
|
|
1162
|
-
try {
|
|
1163
|
-
if (gameObjects_3_1 && !gameObjects_3_1.done && (_a = gameObjects_3.return)) _a.call(gameObjects_3);
|
|
1164
|
-
}
|
|
1165
|
-
finally { if (e_6) throw e_6.error; }
|
|
1166
|
-
}
|
|
1167
1167
|
};
|
|
1168
1168
|
var gameObjectPause = function (gameObjects) {
|
|
1169
|
-
var
|
|
1169
|
+
var e_4, _a, e_5, _b;
|
|
1170
1170
|
try {
|
|
1171
|
-
for (var
|
|
1172
|
-
var gameObject =
|
|
1171
|
+
for (var gameObjects_2 = __values(gameObjects), gameObjects_2_1 = gameObjects_2.next(); !gameObjects_2_1.done; gameObjects_2_1 = gameObjects_2.next()) {
|
|
1172
|
+
var gameObject = gameObjects_2_1.value;
|
|
1173
1173
|
try {
|
|
1174
|
-
for (var _c = (
|
|
1174
|
+
for (var _c = (e_5 = void 0, __values(gameObject.components)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
1175
1175
|
var component = _d.value;
|
|
1176
1176
|
try {
|
|
1177
1177
|
component.onPause && component.onPause();
|
|
@@ -1181,33 +1181,35 @@ var gameObjectPause = function (gameObjects) {
|
|
|
1181
1181
|
}
|
|
1182
1182
|
}
|
|
1183
1183
|
}
|
|
1184
|
-
catch (
|
|
1184
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
1185
1185
|
finally {
|
|
1186
1186
|
try {
|
|
1187
1187
|
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
1188
1188
|
}
|
|
1189
|
-
finally { if (
|
|
1189
|
+
finally { if (e_5) throw e_5.error; }
|
|
1190
1190
|
}
|
|
1191
1191
|
}
|
|
1192
1192
|
}
|
|
1193
|
-
catch (
|
|
1193
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
1194
1194
|
finally {
|
|
1195
1195
|
try {
|
|
1196
|
-
if (
|
|
1196
|
+
if (gameObjects_2_1 && !gameObjects_2_1.done && (_a = gameObjects_2.return)) _a.call(gameObjects_2);
|
|
1197
1197
|
}
|
|
1198
|
-
finally { if (
|
|
1198
|
+
finally { if (e_4) throw e_4.error; }
|
|
1199
1199
|
}
|
|
1200
1200
|
};
|
|
1201
1201
|
var Game = (function (_super) {
|
|
1202
1202
|
__extends(Game, _super);
|
|
1203
1203
|
function Game(_a) {
|
|
1204
|
-
var
|
|
1205
|
-
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;
|
|
1204
|
+
var e_6, _b;
|
|
1205
|
+
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;
|
|
1206
1206
|
var _this = _super.call(this) || this;
|
|
1207
1207
|
_this.playing = false;
|
|
1208
1208
|
_this.started = false;
|
|
1209
1209
|
_this.multiScenes = [];
|
|
1210
1210
|
_this.systems = [];
|
|
1211
|
+
_this.mode = 'PLAY';
|
|
1212
|
+
_this.mode = mode;
|
|
1211
1213
|
if (window.__EVA_INSPECTOR_ENV__) {
|
|
1212
1214
|
window.__EVA_GAME_INSTANCE__ = _this;
|
|
1213
1215
|
}
|
|
@@ -1220,12 +1222,12 @@ var Game = (function (_super) {
|
|
|
1220
1222
|
_this.addSystem(system);
|
|
1221
1223
|
}
|
|
1222
1224
|
}
|
|
1223
|
-
catch (
|
|
1225
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
1224
1226
|
finally {
|
|
1225
1227
|
try {
|
|
1226
1228
|
if (systems_1_1 && !systems_1_1.done && (_b = systems_1.return)) _b.call(systems_1);
|
|
1227
1229
|
}
|
|
1228
|
-
finally { if (
|
|
1230
|
+
finally { if (e_6) throw e_6.error; }
|
|
1229
1231
|
}
|
|
1230
1232
|
}
|
|
1231
1233
|
if (needScene) {
|
|
@@ -1337,8 +1339,8 @@ var Game = (function (_super) {
|
|
|
1337
1339
|
Game.prototype.initTicker = function () {
|
|
1338
1340
|
var _this = this;
|
|
1339
1341
|
this.ticker.add(function (e) {
|
|
1340
|
-
var
|
|
1341
|
-
_this.scene && gameObjectLoop(e, _this.gameObjects);
|
|
1342
|
+
var e_7, _a, e_8, _b;
|
|
1343
|
+
_this.scene && _this.gameObjectLoop(e, _this.gameObjects);
|
|
1342
1344
|
try {
|
|
1343
1345
|
for (var _c = __values(_this.systems), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
1344
1346
|
var system = _d.value;
|
|
@@ -1351,12 +1353,12 @@ var Game = (function (_super) {
|
|
|
1351
1353
|
}
|
|
1352
1354
|
}
|
|
1353
1355
|
}
|
|
1354
|
-
catch (
|
|
1356
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
1355
1357
|
finally {
|
|
1356
1358
|
try {
|
|
1357
1359
|
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
1358
1360
|
}
|
|
1359
|
-
finally { if (
|
|
1361
|
+
finally { if (e_7) throw e_7.error; }
|
|
1360
1362
|
}
|
|
1361
1363
|
try {
|
|
1362
1364
|
for (var _e = __values(_this.systems), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
@@ -1369,17 +1371,17 @@ var Game = (function (_super) {
|
|
|
1369
1371
|
}
|
|
1370
1372
|
}
|
|
1371
1373
|
}
|
|
1372
|
-
catch (
|
|
1374
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
1373
1375
|
finally {
|
|
1374
1376
|
try {
|
|
1375
1377
|
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
1376
1378
|
}
|
|
1377
|
-
finally { if (
|
|
1379
|
+
finally { if (e_8) throw e_8.error; }
|
|
1378
1380
|
}
|
|
1379
1381
|
});
|
|
1380
1382
|
};
|
|
1381
1383
|
Game.prototype.triggerResume = function () {
|
|
1382
|
-
var
|
|
1384
|
+
var e_9, _a;
|
|
1383
1385
|
gameObjectResume(this.gameObjects);
|
|
1384
1386
|
try {
|
|
1385
1387
|
for (var _b = __values(this.systems), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
@@ -1392,16 +1394,16 @@ var Game = (function (_super) {
|
|
|
1392
1394
|
}
|
|
1393
1395
|
}
|
|
1394
1396
|
}
|
|
1395
|
-
catch (
|
|
1397
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
1396
1398
|
finally {
|
|
1397
1399
|
try {
|
|
1398
1400
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1399
1401
|
}
|
|
1400
|
-
finally { if (
|
|
1402
|
+
finally { if (e_9) throw e_9.error; }
|
|
1401
1403
|
}
|
|
1402
1404
|
};
|
|
1403
1405
|
Game.prototype.triggerPause = function () {
|
|
1404
|
-
var
|
|
1406
|
+
var e_10, _a;
|
|
1405
1407
|
gameObjectPause(this.gameObjects);
|
|
1406
1408
|
try {
|
|
1407
1409
|
for (var _b = __values(this.systems), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
@@ -1414,28 +1416,28 @@ var Game = (function (_super) {
|
|
|
1414
1416
|
}
|
|
1415
1417
|
}
|
|
1416
1418
|
}
|
|
1417
|
-
catch (
|
|
1419
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
1418
1420
|
finally {
|
|
1419
1421
|
try {
|
|
1420
1422
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1421
1423
|
}
|
|
1422
|
-
finally { if (
|
|
1424
|
+
finally { if (e_10) throw e_10.error; }
|
|
1423
1425
|
}
|
|
1424
1426
|
};
|
|
1425
1427
|
Game.prototype.destroySystems = function () {
|
|
1426
|
-
var
|
|
1428
|
+
var e_11, _a;
|
|
1427
1429
|
try {
|
|
1428
1430
|
for (var _b = __values(__spread(this.systems)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1429
1431
|
var system = _c.value;
|
|
1430
1432
|
this.removeSystem(system);
|
|
1431
1433
|
}
|
|
1432
1434
|
}
|
|
1433
|
-
catch (
|
|
1435
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
1434
1436
|
finally {
|
|
1435
1437
|
try {
|
|
1436
1438
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1437
1439
|
}
|
|
1438
|
-
finally { if (
|
|
1440
|
+
finally { if (e_11) throw e_11.error; }
|
|
1439
1441
|
}
|
|
1440
1442
|
this.systems.length = 0;
|
|
1441
1443
|
};
|
|
@@ -1464,17 +1466,79 @@ var Game = (function (_super) {
|
|
|
1464
1466
|
}
|
|
1465
1467
|
this.emit('sceneChanged', { scene: scene, mode: mode, params: params });
|
|
1466
1468
|
};
|
|
1469
|
+
Game.prototype.gameObjectLoop = function (e, gameObjects) {
|
|
1470
|
+
var e_12, _a, e_13, _b, e_14, _c, e_15, _d;
|
|
1471
|
+
if (gameObjects === void 0) { gameObjects = []; }
|
|
1472
|
+
try {
|
|
1473
|
+
for (var gameObjects_3 = __values(gameObjects), gameObjects_3_1 = gameObjects_3.next(); !gameObjects_3_1.done; gameObjects_3_1 = gameObjects_3.next()) {
|
|
1474
|
+
var gameObject = gameObjects_3_1.value;
|
|
1475
|
+
try {
|
|
1476
|
+
for (var _e = (e_13 = void 0, __values(gameObject.components)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
1477
|
+
var component = _f.value;
|
|
1478
|
+
try {
|
|
1479
|
+
if (this.mode === 'PLAY') {
|
|
1480
|
+
triggerStart(component);
|
|
1481
|
+
component.update && component.update(e);
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
catch (e) {
|
|
1485
|
+
console.error("gameObject: " + gameObject.name + " " + component.name + " update error", e);
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
catch (e_13_1) { e_13 = { error: e_13_1 }; }
|
|
1490
|
+
finally {
|
|
1491
|
+
try {
|
|
1492
|
+
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
1493
|
+
}
|
|
1494
|
+
finally { if (e_13) throw e_13.error; }
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
1499
|
+
finally {
|
|
1500
|
+
try {
|
|
1501
|
+
if (gameObjects_3_1 && !gameObjects_3_1.done && (_a = gameObjects_3.return)) _a.call(gameObjects_3);
|
|
1502
|
+
}
|
|
1503
|
+
finally { if (e_12) throw e_12.error; }
|
|
1504
|
+
}
|
|
1505
|
+
try {
|
|
1506
|
+
for (var gameObjects_4 = __values(gameObjects), gameObjects_4_1 = gameObjects_4.next(); !gameObjects_4_1.done; gameObjects_4_1 = gameObjects_4.next()) {
|
|
1507
|
+
var gameObject = gameObjects_4_1.value;
|
|
1508
|
+
try {
|
|
1509
|
+
for (var _g = (e_15 = void 0, __values(gameObject.components)), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
1510
|
+
var component = _h.value;
|
|
1511
|
+
try {
|
|
1512
|
+
if (this.mode === 'PLAY') {
|
|
1513
|
+
component.lateUpdate && component.lateUpdate(e);
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
catch (e) {
|
|
1517
|
+
console.error("gameObject: " + gameObject.name + " " + component.name + " lateUpdate error", e);
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
catch (e_15_1) { e_15 = { error: e_15_1 }; }
|
|
1522
|
+
finally {
|
|
1523
|
+
try {
|
|
1524
|
+
if (_h && !_h.done && (_d = _g.return)) _d.call(_g);
|
|
1525
|
+
}
|
|
1526
|
+
finally { if (e_15) throw e_15.error; }
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
catch (e_14_1) { e_14 = { error: e_14_1 }; }
|
|
1531
|
+
finally {
|
|
1532
|
+
try {
|
|
1533
|
+
if (gameObjects_4_1 && !gameObjects_4_1.done && (_c = gameObjects_4.return)) _c.call(gameObjects_4);
|
|
1534
|
+
}
|
|
1535
|
+
finally { if (e_14) throw e_14.error; }
|
|
1536
|
+
}
|
|
1537
|
+
};
|
|
1467
1538
|
return Game;
|
|
1468
1539
|
}(EventEmitter__default));
|
|
1469
1540
|
var Game$1 = Game;
|
|
1470
1541
|
|
|
1471
|
-
function IDEProp(target, propertyKey) {
|
|
1472
|
-
if (!target.constructor.IDEProps) {
|
|
1473
|
-
target.constructor.IDEProps = [];
|
|
1474
|
-
}
|
|
1475
|
-
target.constructor.IDEProps.push(propertyKey);
|
|
1476
|
-
}
|
|
1477
|
-
|
|
1478
1542
|
function componentObserver(observerInfo) {
|
|
1479
1543
|
if (observerInfo === void 0) { observerInfo = {}; }
|
|
1480
1544
|
return function (constructor) {
|
|
@@ -1903,16 +1967,14 @@ var Resource = (function (_super) {
|
|
|
1903
1967
|
var resource = new Resource();
|
|
1904
1968
|
|
|
1905
1969
|
var decorators = {
|
|
1906
|
-
IDEProp: IDEProp,
|
|
1907
1970
|
componentObserver: componentObserver,
|
|
1908
1971
|
};
|
|
1909
|
-
var version = '1.2.
|
|
1972
|
+
var version = '1.2.7-editor.2';
|
|
1910
1973
|
console.log("Eva.js version: " + version);
|
|
1911
1974
|
|
|
1912
1975
|
exports.Component = Component$1;
|
|
1913
1976
|
exports.Game = Game$1;
|
|
1914
1977
|
exports.GameObject = GameObject$1;
|
|
1915
|
-
exports.IDEProp = IDEProp;
|
|
1916
1978
|
exports.RESOURCE_TYPE_STRATEGY = RESOURCE_TYPE_STRATEGY;
|
|
1917
1979
|
exports.Scene = Scene$1;
|
|
1918
1980
|
exports.System = System$1;
|