@eva/eva.js 1.2.6 → 1.2.7-editor.10

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 CHANGED
@@ -3,6 +3,13 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
3
3
  var _EVA_IIFE_EVA = function (exports) {
4
4
  'use strict';
5
5
 
6
+ function createCommonjsModule(fn) {
7
+ var module = {
8
+ exports: {}
9
+ };
10
+ return fn(module, module.exports), module.exports;
11
+ }
12
+
6
13
  var _extendStatics$ = function extendStatics$1(d, b) {
7
14
  _extendStatics$ = Object.setPrototypeOf || {
8
15
  __proto__: []
@@ -10,7 +17,7 @@ var _EVA_IIFE_EVA = function (exports) {
10
17
  d.__proto__ = b;
11
18
  } || function (d, b) {
12
19
  for (var p in b) {
13
- if (b.hasOwnProperty(p)) d[p] = b[p];
20
+ if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
14
21
  }
15
22
  };
16
23
 
@@ -18,6 +25,8 @@ var _EVA_IIFE_EVA = function (exports) {
18
25
  };
19
26
 
20
27
  function __extends$1(d, b) {
28
+ if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
29
+
21
30
  _extendStatics$(d, b);
22
31
 
23
32
  function __() {
@@ -27,6 +36,22 @@ var _EVA_IIFE_EVA = function (exports) {
27
36
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
28
37
  }
29
38
 
39
+ var _assign = function __assign() {
40
+ _assign = Object.assign || function __assign(t) {
41
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
42
+ s = arguments[i];
43
+
44
+ for (var p in s) {
45
+ if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
46
+ }
47
+ }
48
+
49
+ return t;
50
+ };
51
+
52
+ return _assign.apply(this, arguments);
53
+ };
54
+
30
55
  function __decorate(decorators, target, key, desc) {
31
56
  var c = arguments.length,
32
57
  r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
@@ -37,6 +62,10 @@ var _EVA_IIFE_EVA = function (exports) {
37
62
  return c > 3 && r && Object.defineProperty(target, key, r), r;
38
63
  }
39
64
 
65
+ function __metadata(metadataKey, metadataValue) {
66
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
67
+ }
68
+
40
69
  function __awaiter(thisArg, _arguments, P, generator) {
41
70
  function adopt(value) {
42
71
  return value instanceof P ? value : new P(function (resolve) {
@@ -232,13 +261,6 @@ var _EVA_IIFE_EVA = function (exports) {
232
261
  return ar;
233
262
  }
234
263
 
235
- function createCommonjsModule(fn) {
236
- var module = {
237
- exports: {}
238
- };
239
- return fn(module, module.exports), module.exports;
240
- }
241
-
242
264
  var eventemitter3 = createCommonjsModule(function (module) {
243
265
  var has = Object.prototype.hasOwnProperty,
244
266
  prefix = '~';
@@ -1801,34 +1823,187 @@ var _EVA_IIFE_EVA = function (exports) {
1801
1823
  systemInstance[S.systemName] = system;
1802
1824
  }
1803
1825
 
1804
- function getIDEPropsPropertyObj(target, propertyKey) {
1805
- if (!target.constructor.IDEProps) {
1806
- target.constructor.IDEProps = {};
1826
+ var SymbolKeysNotSupportedError = function (_super) {
1827
+ __extends$1(SymbolKeysNotSupportedError, _super);
1828
+
1829
+ function SymbolKeysNotSupportedError() {
1830
+ var _newTarget = this.constructor;
1831
+
1832
+ var _this = _super.call(this, 'Symbol keys are not supported yet!') || this;
1833
+
1834
+ Object.setPrototypeOf(_this, _newTarget.prototype);
1835
+ return _this;
1836
+ }
1837
+
1838
+ return SymbolKeysNotSupportedError;
1839
+ }(Error);
1840
+
1841
+ (function (_super) {
1842
+ __extends$1(StaticGetPropertiesIsNotAFunctionError, _super);
1843
+
1844
+ function StaticGetPropertiesIsNotAFunctionError() {
1845
+ var _newTarget = this.constructor;
1846
+
1847
+ var _this = _super.call(this, 'getProperties is not a function!') || this;
1848
+
1849
+ Object.setPrototypeOf(_this, _newTarget.prototype);
1850
+ return _this;
1851
+ }
1852
+
1853
+ return StaticGetPropertiesIsNotAFunctionError;
1854
+ })(Error);
1855
+
1856
+ var IDE_PROPERTY_METADATA = 'IDE_PROPERTY_METADATA';
1857
+ var COMPONENT_EXECUTE_MODE_METADATA = 'COMPONENT_EXECUTE_MODE_METADATA';
1858
+
1859
+ function transformBasicType(type) {
1860
+ if (type === String) {
1861
+ return 'string';
1862
+ }
1863
+
1864
+ if (type === Number) {
1865
+ return 'number';
1866
+ }
1867
+
1868
+ if (type === Boolean) {
1869
+ return 'boolean';
1870
+ }
1871
+
1872
+ return 'unknown';
1873
+ }
1874
+
1875
+ function defineTypes(target, key, options, returnTypeFunction) {
1876
+ var type = Reflect.getMetadata('design:type', target, key);
1877
+ var isArray = type === Array;
1878
+ var str = transformBasicType(type);
1879
+
1880
+ if (str !== 'unknown') {
1881
+ type = str;
1807
1882
  }
1808
1883
 
1809
- if (!target.constructor.IDEProps[propertyKey]) {
1810
- target.constructor.IDEProps[propertyKey] = {};
1884
+ if (returnTypeFunction) {
1885
+ var returnType = returnTypeFunction();
1886
+
1887
+ if (Array.isArray(returnType)) {
1888
+ isArray = true;
1889
+ type = returnType[0];
1890
+ } else {
1891
+ type = returnType;
1892
+ }
1811
1893
  }
1812
1894
 
1813
- var propertyObj = target.constructor.IDEProps[propertyKey];
1814
- return propertyObj;
1895
+ var properties = Reflect.getMetadata(IDE_PROPERTY_METADATA, target.constructor) || {};
1896
+ properties[key] = _assign({
1897
+ type: type,
1898
+ isArray: isArray
1899
+ }, options);
1900
+ Reflect.defineMetadata(IDE_PROPERTY_METADATA, properties, target.constructor);
1815
1901
  }
1816
1902
 
1817
- function type(type) {
1818
- return function (target, propertyKey) {
1819
- var prop = getIDEPropsPropertyObj(target, propertyKey);
1820
- prop.key = propertyKey;
1821
- prop.type = type;
1903
+ function getTypeDecoratorParams(returnTypeFuncOrOptions, maybeOptions) {
1904
+ if (typeof returnTypeFuncOrOptions === 'function') {
1905
+ return {
1906
+ returnTypeFunc: returnTypeFuncOrOptions,
1907
+ options: maybeOptions || {}
1908
+ };
1909
+ }
1910
+
1911
+ return {
1912
+ options: returnTypeFuncOrOptions || {}
1822
1913
  };
1823
1914
  }
1824
1915
 
1825
- function step(step) {
1916
+ function Field(returnTypeFunction, maybeOptions) {
1826
1917
  return function (target, propertyKey) {
1827
- var prop = getIDEPropsPropertyObj(target, propertyKey);
1828
- prop.step = step;
1918
+ if (typeof propertyKey === 'symbol') {
1919
+ throw new SymbolKeysNotSupportedError();
1920
+ }
1921
+
1922
+ var _a = getTypeDecoratorParams(returnTypeFunction, maybeOptions),
1923
+ options = _a.options,
1924
+ returnTypeFunc = _a.returnTypeFunc;
1925
+
1926
+ defineTypes(target, propertyKey, options, returnTypeFunc);
1829
1927
  };
1830
1928
  }
1831
1929
 
1930
+ var ExecuteMode;
1931
+
1932
+ (function (ExecuteMode) {
1933
+ ExecuteMode[ExecuteMode["Edit"] = 2] = "Edit";
1934
+ ExecuteMode[ExecuteMode["Game"] = 4] = "Game";
1935
+ ExecuteMode[ExecuteMode["All"] = 6] = "All";
1936
+ })(ExecuteMode || (ExecuteMode = {}));
1937
+
1938
+ var shouldExecuteInEditMode = function shouldExecuteInEditMode(target) {
1939
+ var mode = Reflect.getMetadata(COMPONENT_EXECUTE_MODE_METADATA, target);
1940
+ return !!(mode & ExecuteMode.Edit);
1941
+ };
1942
+
1943
+ var Vector2 = function () {
1944
+ function Vector2() {}
1945
+
1946
+ __decorate([Field({
1947
+ step: 0.1,
1948
+ default: 0
1949
+ }), __metadata("design:type", Number)], Vector2.prototype, "x", void 0);
1950
+
1951
+ __decorate([Field({
1952
+ step: 0.1,
1953
+ default: 0
1954
+ }), __metadata("design:type", Number)], Vector2.prototype, "y", void 0);
1955
+
1956
+ return Vector2;
1957
+ }();
1958
+
1959
+ var IntVector2 = function () {
1960
+ function IntVector2() {}
1961
+
1962
+ __decorate([Field({
1963
+ step: 1,
1964
+ default: 0
1965
+ }), __metadata("design:type", Number)], IntVector2.prototype, "x", void 0);
1966
+
1967
+ __decorate([Field({
1968
+ step: 1,
1969
+ default: 0
1970
+ }), __metadata("design:type", Number)], IntVector2.prototype, "y", void 0);
1971
+
1972
+ return IntVector2;
1973
+ }();
1974
+
1975
+ var Size2 = function () {
1976
+ function Size2() {}
1977
+
1978
+ __decorate([Field({
1979
+ step: 1,
1980
+ default: 0
1981
+ }), __metadata("design:type", Number)], Size2.prototype, "width", void 0);
1982
+
1983
+ __decorate([Field({
1984
+ step: 1,
1985
+ default: 0
1986
+ }), __metadata("design:type", Number)], Size2.prototype, "height", void 0);
1987
+
1988
+ return Size2;
1989
+ }();
1990
+
1991
+ var Scale = function () {
1992
+ function Scale() {}
1993
+
1994
+ __decorate([Field({
1995
+ step: 0.1,
1996
+ default: 1
1997
+ }), __metadata("design:type", Number)], Scale.prototype, "x", void 0);
1998
+
1999
+ __decorate([Field({
2000
+ step: 0.1,
2001
+ default: 1
2002
+ }), __metadata("design:type", Number)], Scale.prototype, "y", void 0);
2003
+
2004
+ return Scale;
2005
+ }();
2006
+
1832
2007
  var Transform = function (_super) {
1833
2008
  __extends$1(Transform, _super);
1834
2009
 
@@ -1837,6 +2012,7 @@ var _EVA_IIFE_EVA = function (exports) {
1837
2012
 
1838
2013
  _this.name = 'Transform';
1839
2014
  _this._parent = null;
2015
+ _this.childIndex = -1;
1840
2016
  _this.inScene = false;
1841
2017
  _this.children = [];
1842
2018
  _this.position = {
@@ -1913,17 +2089,17 @@ var _EVA_IIFE_EVA = function (exports) {
1913
2089
  });
1914
2090
 
1915
2091
  Transform.prototype.addChild = function (child) {
1916
- if (child.parent === this) {
1917
- var index = this.children.findIndex(function (item) {
1918
- return item === child;
1919
- });
1920
- this.children.splice(index, 1);
1921
- } else if (child.parent) {
2092
+ if (child.parent) {
1922
2093
  child.parent.removeChild(child);
1923
2094
  }
1924
2095
 
1925
2096
  child._parent = this;
1926
- this.children.push(child);
2097
+
2098
+ if (child.childIndex > -1) {
2099
+ this.children.splice(child.childIndex, 0, child);
2100
+ } else {
2101
+ this.children.push(child);
2102
+ }
1927
2103
  };
1928
2104
 
1929
2105
  Transform.prototype.removeChild = function (child) {
@@ -1943,19 +2119,33 @@ var _EVA_IIFE_EVA = function (exports) {
1943
2119
 
1944
2120
  Transform.componentName = 'Transform';
1945
2121
 
1946
- __decorate([type('vector2'), step(1)], Transform.prototype, "position", void 0);
2122
+ __decorate([Field(function () {
2123
+ return IntVector2;
2124
+ }), __metadata("design:type", IntVector2)], Transform.prototype, "position", void 0);
1947
2125
 
1948
- __decorate([type('size'), step(1)], Transform.prototype, "size", void 0);
2126
+ __decorate([Field(function () {
2127
+ return Size2;
2128
+ }), __metadata("design:type", Size2)], Transform.prototype, "size", void 0);
1949
2129
 
1950
- __decorate([type('vector2'), step(0.1)], Transform.prototype, "origin", void 0);
2130
+ __decorate([Field(function () {
2131
+ return Vector2;
2132
+ }), __metadata("design:type", Vector2)], Transform.prototype, "origin", void 0);
1951
2133
 
1952
- __decorate([type('vector2'), step(0.1)], Transform.prototype, "anchor", void 0);
2134
+ __decorate([Field(function () {
2135
+ return Vector2;
2136
+ }), __metadata("design:type", Vector2)], Transform.prototype, "anchor", void 0);
1953
2137
 
1954
- __decorate([type('vector2'), step(0.1)], Transform.prototype, "scale", void 0);
2138
+ __decorate([Field(function () {
2139
+ return Scale;
2140
+ }), __metadata("design:type", Vector2)], Transform.prototype, "scale", void 0);
1955
2141
 
1956
- __decorate([type('vector2'), step(0.1)], Transform.prototype, "skew", void 0);
2142
+ __decorate([Field(function () {
2143
+ return Vector2;
2144
+ }), __metadata("design:type", Vector2)], Transform.prototype, "skew", void 0);
1957
2145
 
1958
- __decorate([type('number'), step(0.1)], Transform.prototype, "rotation", void 0);
2146
+ __decorate([Field({
2147
+ step: 0.1
2148
+ }), __metadata("design:type", Number)], Transform.prototype, "rotation", void 0);
1959
2149
 
1960
2150
  return Transform;
1961
2151
  }(Component$1);
@@ -2053,6 +2243,15 @@ var _EVA_IIFE_EVA = function (exports) {
2053
2243
  gameObject.scene = this.scene;
2054
2244
  };
2055
2245
 
2246
+ GameObject.prototype.addChildAt = function (gameObject, index) {
2247
+ if (index > this.transform.children.length) {
2248
+ throw new Error(gameObject.name + 'addChildAt: The index 18 supplied is out of bounds ' + this.transform.children.length);
2249
+ }
2250
+
2251
+ gameObject.transform.childIndex = index;
2252
+ this.addChild(gameObject);
2253
+ };
2254
+
2056
2255
  GameObject.prototype.removeChild = function (gameObject) {
2057
2256
  if (!(gameObject instanceof GameObject) || !gameObject.parent || gameObject.parent !== this) {
2058
2257
  return gameObject;
@@ -2689,26 +2888,21 @@ var _EVA_IIFE_EVA = function (exports) {
2689
2888
  return __spread(mainSceneGameObjects, otherSceneGameObjects);
2690
2889
  };
2691
2890
 
2692
- var gameObjectLoop = function gameObjectLoop(e, gameObjects) {
2693
- var e_2, _a, e_3, _b, e_4, _c, e_5, _d;
2694
-
2695
- if (gameObjects === void 0) {
2696
- gameObjects = [];
2697
- }
2891
+ var gameObjectResume = function gameObjectResume(gameObjects) {
2892
+ var e_2, _a, e_3, _b;
2698
2893
 
2699
2894
  try {
2700
2895
  for (var gameObjects_1 = __values(gameObjects), gameObjects_1_1 = gameObjects_1.next(); !gameObjects_1_1.done; gameObjects_1_1 = gameObjects_1.next()) {
2701
2896
  var gameObject = gameObjects_1_1.value;
2702
2897
 
2703
2898
  try {
2704
- for (var _e = (e_3 = void 0, __values(gameObject.components)), _f = _e.next(); !_f.done; _f = _e.next()) {
2705
- var component = _f.value;
2899
+ for (var _c = (e_3 = void 0, __values(gameObject.components)), _d = _c.next(); !_d.done; _d = _c.next()) {
2900
+ var component = _d.value;
2706
2901
 
2707
2902
  try {
2708
- triggerStart(component);
2709
- component.update && component.update(e);
2903
+ component.onResume && component.onResume();
2710
2904
  } catch (e) {
2711
- console.error("gameObject: " + gameObject.name + " " + component.name + " update error", e);
2905
+ console.error("gameObject: " + gameObject.name + ", " + component.name + ", onResume error", e);
2712
2906
  }
2713
2907
  }
2714
2908
  } catch (e_3_1) {
@@ -2717,7 +2911,7 @@ var _EVA_IIFE_EVA = function (exports) {
2717
2911
  };
2718
2912
  } finally {
2719
2913
  try {
2720
- if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
2914
+ if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
2721
2915
  } finally {
2722
2916
  if (e_3) throw e_3.error;
2723
2917
  }
@@ -2734,19 +2928,23 @@ var _EVA_IIFE_EVA = function (exports) {
2734
2928
  if (e_2) throw e_2.error;
2735
2929
  }
2736
2930
  }
2931
+ };
2932
+
2933
+ var gameObjectPause = function gameObjectPause(gameObjects) {
2934
+ var e_4, _a, e_5, _b;
2737
2935
 
2738
2936
  try {
2739
2937
  for (var gameObjects_2 = __values(gameObjects), gameObjects_2_1 = gameObjects_2.next(); !gameObjects_2_1.done; gameObjects_2_1 = gameObjects_2.next()) {
2740
2938
  var gameObject = gameObjects_2_1.value;
2741
2939
 
2742
2940
  try {
2743
- for (var _g = (e_5 = void 0, __values(gameObject.components)), _h = _g.next(); !_h.done; _h = _g.next()) {
2744
- var component = _h.value;
2941
+ for (var _c = (e_5 = void 0, __values(gameObject.components)), _d = _c.next(); !_d.done; _d = _c.next()) {
2942
+ var component = _d.value;
2745
2943
 
2746
2944
  try {
2747
- component.lateUpdate && component.lateUpdate(e);
2945
+ component.onPause && component.onPause();
2748
2946
  } catch (e) {
2749
- console.error("gameObject: " + gameObject.name + " " + component.name + " lateUpdate error", e);
2947
+ console.error("gameObject: " + gameObject.name + ", " + component.name + ", onResume error", e);
2750
2948
  }
2751
2949
  }
2752
2950
  } catch (e_5_1) {
@@ -2755,7 +2953,7 @@ var _EVA_IIFE_EVA = function (exports) {
2755
2953
  };
2756
2954
  } finally {
2757
2955
  try {
2758
- if (_h && !_h.done && (_d = _g.return)) _d.call(_g);
2956
+ if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
2759
2957
  } finally {
2760
2958
  if (e_5) throw e_5.error;
2761
2959
  }
@@ -2767,102 +2965,18 @@ var _EVA_IIFE_EVA = function (exports) {
2767
2965
  };
2768
2966
  } finally {
2769
2967
  try {
2770
- if (gameObjects_2_1 && !gameObjects_2_1.done && (_c = gameObjects_2.return)) _c.call(gameObjects_2);
2968
+ if (gameObjects_2_1 && !gameObjects_2_1.done && (_a = gameObjects_2.return)) _a.call(gameObjects_2);
2771
2969
  } finally {
2772
2970
  if (e_4) throw e_4.error;
2773
2971
  }
2774
2972
  }
2775
2973
  };
2776
2974
 
2777
- var gameObjectResume = function gameObjectResume(gameObjects) {
2778
- var e_6, _a, e_7, _b;
2779
-
2780
- try {
2781
- for (var gameObjects_3 = __values(gameObjects), gameObjects_3_1 = gameObjects_3.next(); !gameObjects_3_1.done; gameObjects_3_1 = gameObjects_3.next()) {
2782
- var gameObject = gameObjects_3_1.value;
2783
-
2784
- try {
2785
- for (var _c = (e_7 = void 0, __values(gameObject.components)), _d = _c.next(); !_d.done; _d = _c.next()) {
2786
- var component = _d.value;
2787
-
2788
- try {
2789
- component.onResume && component.onResume();
2790
- } catch (e) {
2791
- console.error("gameObject: " + gameObject.name + ", " + component.name + ", onResume error", e);
2792
- }
2793
- }
2794
- } catch (e_7_1) {
2795
- e_7 = {
2796
- error: e_7_1
2797
- };
2798
- } finally {
2799
- try {
2800
- if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
2801
- } finally {
2802
- if (e_7) throw e_7.error;
2803
- }
2804
- }
2805
- }
2806
- } catch (e_6_1) {
2807
- e_6 = {
2808
- error: e_6_1
2809
- };
2810
- } finally {
2811
- try {
2812
- if (gameObjects_3_1 && !gameObjects_3_1.done && (_a = gameObjects_3.return)) _a.call(gameObjects_3);
2813
- } finally {
2814
- if (e_6) throw e_6.error;
2815
- }
2816
- }
2817
- };
2818
-
2819
- var gameObjectPause = function gameObjectPause(gameObjects) {
2820
- var e_8, _a, e_9, _b;
2821
-
2822
- try {
2823
- for (var gameObjects_4 = __values(gameObjects), gameObjects_4_1 = gameObjects_4.next(); !gameObjects_4_1.done; gameObjects_4_1 = gameObjects_4.next()) {
2824
- var gameObject = gameObjects_4_1.value;
2825
-
2826
- try {
2827
- for (var _c = (e_9 = void 0, __values(gameObject.components)), _d = _c.next(); !_d.done; _d = _c.next()) {
2828
- var component = _d.value;
2829
-
2830
- try {
2831
- component.onPause && component.onPause();
2832
- } catch (e) {
2833
- console.error("gameObject: " + gameObject.name + ", " + component.name + ", onResume error", e);
2834
- }
2835
- }
2836
- } catch (e_9_1) {
2837
- e_9 = {
2838
- error: e_9_1
2839
- };
2840
- } finally {
2841
- try {
2842
- if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
2843
- } finally {
2844
- if (e_9) throw e_9.error;
2845
- }
2846
- }
2847
- }
2848
- } catch (e_8_1) {
2849
- e_8 = {
2850
- error: e_8_1
2851
- };
2852
- } finally {
2853
- try {
2854
- if (gameObjects_4_1 && !gameObjects_4_1.done && (_a = gameObjects_4.return)) _a.call(gameObjects_4);
2855
- } finally {
2856
- if (e_8) throw e_8.error;
2857
- }
2858
- }
2859
- };
2860
-
2861
2975
  var Game = function (_super) {
2862
2976
  __extends$1(Game, _super);
2863
2977
 
2864
2978
  function Game(_a) {
2865
- var e_10, _b;
2979
+ var e_6, _b;
2866
2980
 
2867
2981
  var _c = _a === void 0 ? {} : _a,
2868
2982
  systems = _c.systems,
@@ -2871,7 +2985,9 @@ var _EVA_IIFE_EVA = function (exports) {
2871
2985
  _e = _c.autoStart,
2872
2986
  autoStart = _e === void 0 ? true : _e,
2873
2987
  _f = _c.needScene,
2874
- needScene = _f === void 0 ? true : _f;
2988
+ needScene = _f === void 0 ? true : _f,
2989
+ _g = _c.mode,
2990
+ mode = _g === void 0 ? 'PLAY' : _g;
2875
2991
 
2876
2992
  var _this = _super.call(this) || this;
2877
2993
 
@@ -2879,6 +2995,8 @@ var _EVA_IIFE_EVA = function (exports) {
2879
2995
  _this.started = false;
2880
2996
  _this.multiScenes = [];
2881
2997
  _this.systems = [];
2998
+ _this.mode = 'PLAY';
2999
+ _this.mode = mode;
2882
3000
 
2883
3001
  if (window.__EVA_INSPECTOR_ENV__) {
2884
3002
  window.__EVA_GAME_INSTANCE__ = _this;
@@ -2898,15 +3016,15 @@ var _EVA_IIFE_EVA = function (exports) {
2898
3016
 
2899
3017
  _this.addSystem(system);
2900
3018
  }
2901
- } catch (e_10_1) {
2902
- e_10 = {
2903
- error: e_10_1
3019
+ } catch (e_6_1) {
3020
+ e_6 = {
3021
+ error: e_6_1
2904
3022
  };
2905
3023
  } finally {
2906
3024
  try {
2907
3025
  if (systems_1_1 && !systems_1_1.done && (_b = systems_1.return)) _b.call(systems_1);
2908
3026
  } finally {
2909
- if (e_10) throw e_10.error;
3027
+ if (e_6) throw e_6.error;
2910
3028
  }
2911
3029
  }
2912
3030
  }
@@ -3035,9 +3153,9 @@ var _EVA_IIFE_EVA = function (exports) {
3035
3153
  var _this = this;
3036
3154
 
3037
3155
  this.ticker.add(function (e) {
3038
- var e_11, _a, e_12, _b;
3156
+ var e_7, _a, e_8, _b;
3039
3157
 
3040
- _this.scene && gameObjectLoop(e, _this.gameObjects);
3158
+ _this.scene && _this.gameObjectLoop(e, _this.gameObjects);
3041
3159
 
3042
3160
  try {
3043
3161
  for (var _c = __values(_this.systems), _d = _c.next(); !_d.done; _d = _c.next()) {
@@ -3050,15 +3168,15 @@ var _EVA_IIFE_EVA = function (exports) {
3050
3168
  console.error(system.constructor.systemName + " update error", e);
3051
3169
  }
3052
3170
  }
3053
- } catch (e_11_1) {
3054
- e_11 = {
3055
- error: e_11_1
3171
+ } catch (e_7_1) {
3172
+ e_7 = {
3173
+ error: e_7_1
3056
3174
  };
3057
3175
  } finally {
3058
3176
  try {
3059
3177
  if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
3060
3178
  } finally {
3061
- if (e_11) throw e_11.error;
3179
+ if (e_7) throw e_7.error;
3062
3180
  }
3063
3181
  }
3064
3182
 
@@ -3072,22 +3190,22 @@ var _EVA_IIFE_EVA = function (exports) {
3072
3190
  console.error(system.constructor.systemName + " lateUpdate error", e);
3073
3191
  }
3074
3192
  }
3075
- } catch (e_12_1) {
3076
- e_12 = {
3077
- error: e_12_1
3193
+ } catch (e_8_1) {
3194
+ e_8 = {
3195
+ error: e_8_1
3078
3196
  };
3079
3197
  } finally {
3080
3198
  try {
3081
3199
  if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
3082
3200
  } finally {
3083
- if (e_12) throw e_12.error;
3201
+ if (e_8) throw e_8.error;
3084
3202
  }
3085
3203
  }
3086
3204
  });
3087
3205
  };
3088
3206
 
3089
3207
  Game.prototype.triggerResume = function () {
3090
- var e_13, _a;
3208
+ var e_9, _a;
3091
3209
 
3092
3210
  gameObjectResume(this.gameObjects);
3093
3211
 
@@ -3101,21 +3219,21 @@ var _EVA_IIFE_EVA = function (exports) {
3101
3219
  console.error(system.constructor.systemName + ", onResume error", e);
3102
3220
  }
3103
3221
  }
3104
- } catch (e_13_1) {
3105
- e_13 = {
3106
- error: e_13_1
3222
+ } catch (e_9_1) {
3223
+ e_9 = {
3224
+ error: e_9_1
3107
3225
  };
3108
3226
  } finally {
3109
3227
  try {
3110
3228
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
3111
3229
  } finally {
3112
- if (e_13) throw e_13.error;
3230
+ if (e_9) throw e_9.error;
3113
3231
  }
3114
3232
  }
3115
3233
  };
3116
3234
 
3117
3235
  Game.prototype.triggerPause = function () {
3118
- var e_14, _a;
3236
+ var e_10, _a;
3119
3237
 
3120
3238
  gameObjectPause(this.gameObjects);
3121
3239
 
@@ -3129,36 +3247,36 @@ var _EVA_IIFE_EVA = function (exports) {
3129
3247
  console.error(system.constructor.systemName + ", onPause error", e);
3130
3248
  }
3131
3249
  }
3132
- } catch (e_14_1) {
3133
- e_14 = {
3134
- error: e_14_1
3250
+ } catch (e_10_1) {
3251
+ e_10 = {
3252
+ error: e_10_1
3135
3253
  };
3136
3254
  } finally {
3137
3255
  try {
3138
3256
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
3139
3257
  } finally {
3140
- if (e_14) throw e_14.error;
3258
+ if (e_10) throw e_10.error;
3141
3259
  }
3142
3260
  }
3143
3261
  };
3144
3262
 
3145
3263
  Game.prototype.destroySystems = function () {
3146
- var e_15, _a;
3264
+ var e_11, _a;
3147
3265
 
3148
3266
  try {
3149
3267
  for (var _b = __values(__spread(this.systems)), _c = _b.next(); !_c.done; _c = _b.next()) {
3150
3268
  var system = _c.value;
3151
3269
  this.removeSystem(system);
3152
3270
  }
3153
- } catch (e_15_1) {
3154
- e_15 = {
3155
- error: e_15_1
3271
+ } catch (e_11_1) {
3272
+ e_11 = {
3273
+ error: e_11_1
3156
3274
  };
3157
3275
  } finally {
3158
3276
  try {
3159
3277
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
3160
3278
  } finally {
3161
- if (e_15) throw e_15.error;
3279
+ if (e_11) throw e_11.error;
3162
3280
  }
3163
3281
  }
3164
3282
 
@@ -3204,19 +3322,104 @@ var _EVA_IIFE_EVA = function (exports) {
3204
3322
  });
3205
3323
  };
3206
3324
 
3325
+ Game.prototype.shouldUpdate = function (component) {
3326
+ return this.mode === 'PLAY' || this.mode === 'EDIT' && shouldExecuteInEditMode(component.constructor);
3327
+ };
3328
+
3329
+ Game.prototype.gameObjectLoop = function (e, gameObjects) {
3330
+ var e_12, _a, e_13, _b, e_14, _c, e_15, _d;
3331
+
3332
+ if (gameObjects === void 0) {
3333
+ gameObjects = [];
3334
+ }
3335
+
3336
+ try {
3337
+ for (var gameObjects_3 = __values(gameObjects), gameObjects_3_1 = gameObjects_3.next(); !gameObjects_3_1.done; gameObjects_3_1 = gameObjects_3.next()) {
3338
+ var gameObject = gameObjects_3_1.value;
3339
+
3340
+ try {
3341
+ for (var _e = (e_13 = void 0, __values(gameObject.components)), _f = _e.next(); !_f.done; _f = _e.next()) {
3342
+ var component = _f.value;
3343
+
3344
+ try {
3345
+ if (this.shouldUpdate(component)) {
3346
+ triggerStart(component);
3347
+ component.update && component.update(e);
3348
+ }
3349
+ } catch (e) {
3350
+ console.error("gameObject: " + gameObject.name + " " + component.name + " update error", e);
3351
+ }
3352
+ }
3353
+ } catch (e_13_1) {
3354
+ e_13 = {
3355
+ error: e_13_1
3356
+ };
3357
+ } finally {
3358
+ try {
3359
+ if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
3360
+ } finally {
3361
+ if (e_13) throw e_13.error;
3362
+ }
3363
+ }
3364
+ }
3365
+ } catch (e_12_1) {
3366
+ e_12 = {
3367
+ error: e_12_1
3368
+ };
3369
+ } finally {
3370
+ try {
3371
+ if (gameObjects_3_1 && !gameObjects_3_1.done && (_a = gameObjects_3.return)) _a.call(gameObjects_3);
3372
+ } finally {
3373
+ if (e_12) throw e_12.error;
3374
+ }
3375
+ }
3376
+
3377
+ try {
3378
+ for (var gameObjects_4 = __values(gameObjects), gameObjects_4_1 = gameObjects_4.next(); !gameObjects_4_1.done; gameObjects_4_1 = gameObjects_4.next()) {
3379
+ var gameObject = gameObjects_4_1.value;
3380
+
3381
+ try {
3382
+ for (var _g = (e_15 = void 0, __values(gameObject.components)), _h = _g.next(); !_h.done; _h = _g.next()) {
3383
+ var component = _h.value;
3384
+
3385
+ try {
3386
+ if (this.shouldUpdate(component)) {
3387
+ component.lateUpdate && component.lateUpdate(e);
3388
+ }
3389
+ } catch (e) {
3390
+ console.error("gameObject: " + gameObject.name + " " + component.name + " lateUpdate error", e);
3391
+ }
3392
+ }
3393
+ } catch (e_15_1) {
3394
+ e_15 = {
3395
+ error: e_15_1
3396
+ };
3397
+ } finally {
3398
+ try {
3399
+ if (_h && !_h.done && (_d = _g.return)) _d.call(_g);
3400
+ } finally {
3401
+ if (e_15) throw e_15.error;
3402
+ }
3403
+ }
3404
+ }
3405
+ } catch (e_14_1) {
3406
+ e_14 = {
3407
+ error: e_14_1
3408
+ };
3409
+ } finally {
3410
+ try {
3411
+ if (gameObjects_4_1 && !gameObjects_4_1.done && (_c = gameObjects_4.return)) _c.call(gameObjects_4);
3412
+ } finally {
3413
+ if (e_14) throw e_14.error;
3414
+ }
3415
+ }
3416
+ };
3417
+
3207
3418
  return Game;
3208
3419
  }(EE);
3209
3420
 
3210
3421
  var Game$1 = Game;
3211
3422
 
3212
- function IDEProp(target, propertyKey) {
3213
- if (!target.constructor.IDEProps) {
3214
- target.constructor.IDEProps = [];
3215
- }
3216
-
3217
- target.constructor.IDEProps.push(propertyKey);
3218
- }
3219
-
3220
3423
  function componentObserver(observerInfo) {
3221
3424
  if (observerInfo === void 0) {
3222
3425
  observerInfo = {};
@@ -3427,9 +3630,12 @@ var _EVA_IIFE_EVA = function (exports) {
3427
3630
  return Signal;
3428
3631
  }();
3429
3632
 
3430
- function parseURI(str, opts) {
3633
+ var src = function src(str, opts) {
3634
+ if (opts === void 0) {
3635
+ opts = {};
3636
+ }
3637
+
3431
3638
  if (!str) return undefined;
3432
- opts = opts || {};
3433
3639
  var o = {
3434
3640
  key: ['source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'],
3435
3641
  q: {
@@ -3437,8 +3643,8 @@ var _EVA_IIFE_EVA = function (exports) {
3437
3643
  parser: /(?:^|&)([^&=]*)=?([^&]*)/g
3438
3644
  },
3439
3645
  parser: {
3440
- strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
3441
- loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
3646
+ strict: /^(?:([^:/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\d*))?))?((((?:[^?#/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
3647
+ loose: /^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#/]*\.[^?#/.]+(?:[?#]|$)))*\/?)?([^?#/]*))(?:\?([^#]*))?(?:#(.*))?)/
3442
3648
  }
3443
3649
  };
3444
3650
  var m = o.parser[opts.strictMode ? 'strict' : 'loose'].exec(str);
@@ -3454,10 +3660,9 @@ var _EVA_IIFE_EVA = function (exports) {
3454
3660
  if ($1) uri[o.q.name][$1] = $2;
3455
3661
  });
3456
3662
  return uri;
3457
- }
3663
+ };
3458
3664
 
3459
- var parseUri = parseURI;
3460
- var parseUri$1 = parseUri;
3665
+ var parseUri = src;
3461
3666
 
3462
3667
  var AbstractLoadStrategy = function () {
3463
3668
  function AbstractLoadStrategy(config) {
@@ -4280,7 +4485,7 @@ var _EVA_IIFE_EVA = function (exports) {
4280
4485
  if (window.origin !== window.location.origin) return 'anonymous';
4281
4486
  if (!Resource._tempAnchor) Resource._tempAnchor = document.createElement('a');
4282
4487
  Resource._tempAnchor.href = url;
4283
- var parsed = parseUri$1(Resource._tempAnchor.href, {
4488
+ var parsed = parseUri(Resource._tempAnchor.href, {
4284
4489
  strictMode: true
4285
4490
  });
4286
4491
  var samePort = !parsed.port && loc.port === '' || parsed.port === loc.port;
@@ -4534,13 +4739,13 @@ var _EVA_IIFE_EVA = function (exports) {
4534
4739
  };
4535
4740
 
4536
4741
  Loader.prototype._prepareUrl = function (url, baseUrl) {
4537
- var parsed = parseUri$1(url, {
4742
+ var parsed = parseUri(url, {
4538
4743
  strictMode: true
4539
4744
  });
4540
4745
 
4541
4746
  this._urlResolvers.forEach(function (resolver) {
4542
4747
  url = resolver(url, parsed);
4543
- parsed = parseUri$1(url, {
4748
+ parsed = parseUri(url, {
4544
4749
  strictMode: true
4545
4750
  });
4546
4751
  });
@@ -5158,15 +5363,13 @@ var _EVA_IIFE_EVA = function (exports) {
5158
5363
 
5159
5364
  var resource = new Resource();
5160
5365
  var decorators = {
5161
- IDEProp: IDEProp,
5162
5366
  componentObserver: componentObserver
5163
5367
  };
5164
- var version = '1.2.6';
5368
+ var version = '1.2.7-editor.9';
5165
5369
  console.log("Eva.js version: " + version);
5166
5370
  exports.Component = Component$1;
5167
5371
  exports.Game = Game$1;
5168
5372
  exports.GameObject = GameObject$1;
5169
- exports.IDEProp = IDEProp;
5170
5373
  exports.RESOURCE_TYPE_STRATEGY = RESOURCE_TYPE_STRATEGY;
5171
5374
  exports.Scene = Scene$1;
5172
5375
  exports.System = System$1;