react-simple-game-engine 0.1.33 → 0.1.36

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.
@@ -4,9 +4,11 @@ import { WorldManagement } from "./world-management";
4
4
  export declare class LogicComponent<C extends Initialler = Initialler> {
5
5
  private readonly configale;
6
6
  private readonly _isPrefab?;
7
+ private _worldManagement;
7
8
  constructor(configale: Configable<C>, _isPrefab?: boolean | undefined);
8
9
  get isPrefab(): boolean | undefined;
9
- output({ worldManagement, ...extraParams }?: {
10
+ set worldManagement(_worldManagement: WorldManagement);
11
+ output({ worldManagement, ...targetParams }?: {
10
12
  worldManagement?: WorldManagement;
11
13
  } & Configation<C>): C;
12
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"logic-component.d.ts","sourceRoot":"","sources":["../../src/classes/logic-component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAK1D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,qBAAa,cAAc,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU;IAEzD,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC;gBADV,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,EACxB,SAAS,CAAC,qBAAS;IAGtC,IAAI,QAAQ,wBAEX;IAED,MAAM,CAAC,EACL,eAAe,EACf,GAAG,WAAW,EACf,GAAE;QAAE,eAAe,CAAC,EAAE,eAAe,CAAA;KAAE,GAAG,WAAW,CAAC,CAAC,CAAM;CAuC/D"}
1
+ {"version":3,"file":"logic-component.d.ts","sourceRoot":"","sources":["../../src/classes/logic-component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAK1D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,qBAAa,cAAc,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU;IAGzD,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC;IAH7B,OAAO,CAAC,gBAAgB,CAAmB;gBAExB,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,EACxB,SAAS,CAAC,qBAAS;IAGtC,IAAI,QAAQ,wBAEX;IAED,IAAI,eAAe,CAAC,gBAAgB,EAAE,eAAe,EAMpD;IAED,MAAM,CAAC,EACL,eAAe,EACf,GAAG,YAAY,EAChB,GAAE;QACD,eAAe,CAAC,EAAE,eAAe,CAAC;KACnC,GAAG,WAAW,CAAC,CAAC,CAAM;CA4CxB"}
@@ -34,24 +34,39 @@ var LogicComponent = /** @class */ (function () {
34
34
  enumerable: false,
35
35
  configurable: true
36
36
  });
37
+ Object.defineProperty(LogicComponent.prototype, "worldManagement", {
38
+ set: function (_worldManagement) {
39
+ if (this._worldManagement) {
40
+ console.warn("Cant change worldManagement");
41
+ }
42
+ else {
43
+ this._worldManagement = _worldManagement;
44
+ }
45
+ },
46
+ enumerable: false,
47
+ configurable: true
48
+ });
37
49
  LogicComponent.prototype.output = function (_a) {
38
50
  if (_a === void 0) { _a = {}; }
39
- var worldManagement = _a.worldManagement, extraParams = __rest(_a, ["worldManagement"]);
51
+ var worldManagement = _a.worldManagement, targetParams = __rest(_a, ["worldManagement"]);
40
52
  var configale = this.configale;
41
53
  var _b = Array.isArray(configale)
42
54
  ? configale
43
55
  : [configale], Class = _b[0], _c = _b[1], params = _c === void 0 ? {} : _c;
44
56
  var c = new Class();
45
- if (c instanceof EntitySult && worldManagement) {
46
- c.preInitial(worldManagement);
57
+ if (worldManagement) {
58
+ this.worldManagement = worldManagement;
59
+ }
60
+ if (c instanceof EntitySult) {
61
+ c.preInitial(this._worldManagement);
47
62
  }
48
63
  if (c instanceof Entity) {
49
64
  var _d = params, transform = _d.transform, bodyOptions = _d.bodyOptions, props = _d.props, restParams = __rest(_d, ["transform", "bodyOptions", "props"]);
50
- var extraTransform = extraParams.transform, extraBodyOptions = extraParams.bodyOptions, extraProps = extraParams.props, extraRestParams = __rest(extraParams, ["transform", "bodyOptions", "props"]);
65
+ var extraTransform = targetParams.transform, extraBodyOptions = targetParams.bodyOptions, extraProps = targetParams.props, extraRestParams = __rest(targetParams, ["transform", "bodyOptions", "props"]);
51
66
  c.initial(__assign(__assign({ transform: __assign(__assign({}, transform), extraTransform), bodyOptions: __assign(__assign({}, bodyOptions), extraBodyOptions), props: __assign(__assign({}, props), extraProps) }, restParams), extraRestParams));
52
67
  }
53
68
  else {
54
- c.initial(__assign(__assign({}, params), extraParams));
69
+ c.initial(__assign(__assign({}, params), targetParams));
55
70
  }
56
71
  return c;
57
72
  };
@@ -34,7 +34,7 @@ export declare abstract class Scene<UIP = any> {
34
34
  onLoadAssets(): Promise<void>;
35
35
  getPrefab<C extends EntitySult>(Class: {
36
36
  new (...args: any[]): Prefab<C>;
37
- }): Prefab<EntitySult<any>>;
37
+ }): Prefab<C>;
38
38
  bootstrap(camera: Camera): void;
39
39
  protected onDraw(): void;
40
40
  protected onUpdate(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"scene.d.ts","sourceRoot":"","sources":["../../src/classes/scene.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGpD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,aAAK,kBAAkB,GAAG,CAAC,Y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;IAED,OAAO,KAAK,YAAY,QAGvB;IAED,6BAA6B,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAO7D,2BAA2B,CAAC,CAAC,GAAG,GAAG,EACjC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,yBAAyB,CAAC,CAAC,CAAC;IAepC,iBAAiB,CAAC,IAAI,EAAE,kBAAkB;IAI1C,UAAU;IAIV,aAAa,CAAC,GAAG,EAAE,MAAM;IAInB,UAAU,CAAC,KAAK,CAAC,EAAE,MAAM;IAczB,YAAY;IAElB,SAAS,CAAC,CAAC,SAAS,UAAU,EAAE,KAAK,EAAE;QACrC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;KACjC,GAAG,MAAM,CAAC,CAAC,CAAC;IAIb,SAAS,CAAC,MAAM,EAAE,MAAM;IAkBxB,SAAS,CAAC,MAAM;IAChB,SAAS,CAAC,QAAQ;IAElB,MAAM;CAUP"}
@@ -143,6 +143,7 @@ var Scene = /** @class */ (function () {
143
143
  this.worldManagement = new WorldManagement(camera, this);
144
144
  var components = this.getComponents(camera).filter(function (comp) {
145
145
  if (comp.isPrefab) {
146
+ comp.worldManagement = _this.worldManagement;
146
147
  _this.prefabs.push(comp);
147
148
  return false;
148
149
  }
package/lib/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export { P5 } from "./classes/p5";
2
- export { createAssetImage, createAssetSound } from "./utils";
3
2
  export { ParticleSystem } from "./classes/particle-system";
4
3
  export { Particle } from "./classes/particle";
5
4
  export { AnimationSprite } from "./classes/animations/animation";
@@ -8,6 +7,7 @@ export { ColorAnimationSprite } from "./classes/animations/color.animation";
8
7
  export { Entity } from "./classes/entities/entity";
9
8
  export { CircleEntity } from "./classes/entities/circle.entity";
10
9
  export { RectEntity } from "./classes/entities/rect.entity";
10
+ export { Prefab } from "./classes/prefab";
11
11
  export { LogicComponent } from "./classes/logic-component";
12
12
  export { Scene } from "./classes/scene";
13
13
  export { Camera } from "./classes/camera";
@@ -18,6 +18,7 @@ export { EntityTag } from "./decorators/entity-tag.decor";
18
18
  export { SceneTag } from "./decorators/scene-tag.decor";
19
19
  export { SceneUI } from "./decorators/scene-ui.decor";
20
20
  export { ScenesProcess } from "./ui-components/ScenesProcess";
21
+ export { createAssetImage, createAssetSound } from "./utils";
21
22
  export * from "./export-types";
22
23
  export * from "./export-interfaces";
23
24
  export { default as Matter } from "matter-js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAElC,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE7D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAE5E,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC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AE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAEtD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE7D,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AAEpC,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,WAAW,CAAC"}
package/lib/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  export { P5 } from "./classes/p5";
2
- export { createAssetImage, createAssetSound } from "./utils";
3
2
  export { ParticleSystem } from "./classes/particle-system";
4
3
  export { Particle } from "./classes/particle";
5
4
  export { AnimationSprite } from "./classes/animations/animation";
@@ -8,6 +7,7 @@ export { ColorAnimationSprite } from "./classes/animations/color.animation";
8
7
  export { Entity } from "./classes/entities/entity";
9
8
  export { CircleEntity } from "./classes/entities/circle.entity";
10
9
  export { RectEntity } from "./classes/entities/rect.entity";
10
+ export { Prefab } from "./classes/prefab";
11
11
  export { LogicComponent } from "./classes/logic-component";
12
12
  export { Scene } from "./classes/scene";
13
13
  export { Camera } from "./classes/camera";
@@ -18,6 +18,7 @@ export { EntityTag } from "./decorators/entity-tag.decor";
18
18
  export { SceneTag } from "./decorators/scene-tag.decor";
19
19
  export { SceneUI } from "./decorators/scene-ui.decor";
20
20
  export { ScenesProcess } from "./ui-components/ScenesProcess";
21
+ export { createAssetImage, createAssetSound } from "./utils";
21
22
  export * from "./export-types";
22
23
  export * from "./export-interfaces";
23
24
  export { default as Matter } from "matter-js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-simple-game-engine",
3
- "version": "0.1.33",
3
+ "version": "0.1.36",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib",