react-simple-game-engine 0.2.136 → 0.3.1
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/lib/classes/animations/animation.d.ts +2 -0
- package/lib/classes/animations/animation.d.ts.map +1 -1
- package/lib/classes/animations/animation.js +10 -0
- package/lib/classes/animations/animator.d.ts +2 -2
- package/lib/classes/animations/animator.d.ts.map +1 -1
- package/lib/classes/animations/animator.js +0 -1
- package/lib/classes/entities/{entity-sult.d.ts → entity-suit.d.ts} +8 -8
- package/lib/classes/entities/{entity-sult.d.ts.map → entity-suit.d.ts.map} +1 -1
- package/lib/classes/entities/{entity-sult.js → entity-suit.js} +25 -25
- package/lib/classes/entities/entity.d.ts +3 -3
- package/lib/classes/entities/entity.js +2 -2
- package/lib/classes/logic-component.d.ts +6 -6
- package/lib/classes/logic-component.d.ts.map +1 -1
- package/lib/classes/logic-component.js +8 -8
- package/lib/classes/p5.js +2 -2
- package/lib/classes/particle-system.d.ts +2 -2
- package/lib/classes/particle-system.js +2 -2
- package/lib/classes/particle.d.ts +2 -2
- package/lib/classes/particle.d.ts.map +1 -1
- package/lib/classes/prefab.d.ts +4 -4
- package/lib/classes/prefab.d.ts.map +1 -1
- package/lib/classes/prefab.js +2 -2
- package/lib/classes/scene.d.ts +7 -7
- package/lib/classes/scene.d.ts.map +1 -1
- package/lib/classes/scene.js +20 -20
- package/lib/classes/sound.js +1 -1
- package/lib/classes/sprites/avatar.sprite.d.ts +3 -3
- package/lib/classes/sprites/avatar.sprite.d.ts.map +1 -1
- package/lib/classes/watcher.js +4 -4
- package/lib/classes/world-management.d.ts +7 -7
- package/lib/classes/world-management.d.ts.map +1 -1
- package/lib/classes/world-management.js +3 -3
- package/lib/decorators/sound-from.decor.d.ts +1 -1
- package/lib/decorators/sound-from.decor.d.ts.map +1 -1
- package/lib/decorators/sound-from.decor.js +5 -5
- package/lib/decorators/sprite-from.decor.d.ts +1 -1
- package/lib/decorators/sprite-from.decor.d.ts.map +1 -1
- package/lib/decorators/sprite-from.decor.js +5 -5
- package/lib/export-interfaces.d.ts +1 -1
- package/lib/export-interfaces.d.ts.map +1 -1
- package/lib/export-types.d.ts +6 -4
- package/lib/export-types.d.ts.map +1 -1
- package/lib/hooks/entity.d.ts +2 -2
- package/lib/hooks/watcher.js +4 -4
- package/lib/ui-components/control.js +2 -2
- package/lib/ui-components/float-container.js +2 -2
- package/lib/ui-components/game-bootstrap.js +4 -4
- package/lib/ui-components/logger.js +3 -3
- package/lib/ui-components/modal.js +3 -3
- package/lib/ui-components/scaler-container.js +2 -2
- package/lib/ui-components/scene-runner.js +4 -4
- package/lib/utils.d.ts +1 -1
- package/lib/utils.js +5 -5
- package/package.json +1 -1
package/lib/classes/scene.js
CHANGED
@@ -306,16 +306,16 @@ var Scene = /** @class */ (function () {
|
|
306
306
|
};
|
307
307
|
Scene.prototype.createSprites = function () {
|
308
308
|
var _this_1 = this;
|
309
|
-
var
|
309
|
+
var sources = [];
|
310
310
|
for (var _i = 0; _i < arguments.length; _i++) {
|
311
|
-
|
311
|
+
sources[_i] = arguments[_i];
|
312
312
|
}
|
313
|
-
return parallel(
|
313
|
+
return parallel(sources, function (source) { return __awaiter(_this_1, void 0, void 0, function () {
|
314
314
|
var src, sprite;
|
315
315
|
return __generator(this, function (_a) {
|
316
316
|
switch (_a.label) {
|
317
317
|
case 0:
|
318
|
-
src = (typeof
|
318
|
+
src = (typeof source === "string" ? { src: source } : source).src;
|
319
319
|
return [4 /*yield*/, createAssetImage(src)];
|
320
320
|
case 1:
|
321
321
|
sprite = _a.sent();
|
@@ -326,24 +326,24 @@ var Scene = /** @class */ (function () {
|
|
326
326
|
}); }, MAX_ASSET_PARALLEL_LOAD);
|
327
327
|
};
|
328
328
|
Scene.prototype.createSounds = function () {
|
329
|
-
var
|
329
|
+
var sources = [];
|
330
330
|
for (var _i = 0; _i < arguments.length; _i++) {
|
331
|
-
|
331
|
+
sources[_i] = arguments[_i];
|
332
332
|
}
|
333
333
|
return __awaiter(this, void 0, void 0, function () {
|
334
|
-
var sounds, _a,
|
334
|
+
var sounds, _a, sources_1, source, _b, volume, src, _c, type, sound;
|
335
335
|
return __generator(this, function (_d) {
|
336
336
|
switch (_d.label) {
|
337
337
|
case 0:
|
338
338
|
sounds = [];
|
339
|
-
_a = 0,
|
339
|
+
_a = 0, sources_1 = sources;
|
340
340
|
_d.label = 1;
|
341
341
|
case 1:
|
342
|
-
if (!(_a <
|
343
|
-
|
344
|
-
_b = typeof
|
345
|
-
? { src:
|
346
|
-
:
|
342
|
+
if (!(_a < sources_1.length)) return [3 /*break*/, 4];
|
343
|
+
source = sources_1[_a];
|
344
|
+
_b = typeof source === "string"
|
345
|
+
? { src: source, volume: undefined, type: undefined }
|
346
|
+
: source, volume = _b.volume, src = _b.src, _c = _b.type, type = _c === void 0 ? SoundType.ONCE : _c;
|
347
347
|
return [4 /*yield*/, createAssetSound(src, type)];
|
348
348
|
case 2:
|
349
349
|
sound = _d.sent();
|
@@ -362,9 +362,9 @@ var Scene = /** @class */ (function () {
|
|
362
362
|
});
|
363
363
|
};
|
364
364
|
Scene.prototype.mapSprites = function () {
|
365
|
-
var
|
365
|
+
var sources = [];
|
366
366
|
for (var _i = 0; _i < arguments.length; _i++) {
|
367
|
-
|
367
|
+
sources[_i] = arguments[_i];
|
368
368
|
}
|
369
369
|
return __awaiter(this, void 0, void 0, function () {
|
370
370
|
var spritesDecor;
|
@@ -373,7 +373,7 @@ var Scene = /** @class */ (function () {
|
|
373
373
|
switch (_a.label) {
|
374
374
|
case 0:
|
375
375
|
spritesDecor = this.spritesDecor.filter(function (decor) { return !decor.src; });
|
376
|
-
return [4 /*yield*/, parallel(
|
376
|
+
return [4 /*yield*/, parallel(sources, function (src, _a) {
|
377
377
|
var realIndex = _a.realIndex;
|
378
378
|
return __awaiter(_this_1, void 0, void 0, function () {
|
379
379
|
var decor, sprite;
|
@@ -401,9 +401,9 @@ var Scene = /** @class */ (function () {
|
|
401
401
|
});
|
402
402
|
};
|
403
403
|
Scene.prototype.mapSounds = function () {
|
404
|
-
var
|
404
|
+
var sources = [];
|
405
405
|
for (var _i = 0; _i < arguments.length; _i++) {
|
406
|
-
|
406
|
+
sources[_i] = arguments[_i];
|
407
407
|
}
|
408
408
|
return __awaiter(this, void 0, void 0, function () {
|
409
409
|
var soundsDecor, index, _a, soundsDecor_1, decor, src, sound;
|
@@ -417,7 +417,7 @@ var Scene = /** @class */ (function () {
|
|
417
417
|
case 1:
|
418
418
|
if (!(_a < soundsDecor_1.length)) return [3 /*break*/, 4];
|
419
419
|
decor = soundsDecor_1[_a];
|
420
|
-
src =
|
420
|
+
src = sources[index++];
|
421
421
|
return [4 /*yield*/, createAssetSound(src, decor.type)];
|
422
422
|
case 2:
|
423
423
|
sound = _b.sent();
|
@@ -495,7 +495,7 @@ var Scene = /** @class */ (function () {
|
|
495
495
|
this.loadedAssetsError = errors_1;
|
496
496
|
}
|
497
497
|
else {
|
498
|
-
// when
|
498
|
+
// when don't have error or skip error
|
499
499
|
this.loadedAssets = true;
|
500
500
|
}
|
501
501
|
return [2 /*return*/];
|
package/lib/classes/sound.js
CHANGED
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
36
36
|
};
|
37
37
|
var _a;
|
38
38
|
import { SoundType } from "../export-enums";
|
39
|
-
// cant not Sound extends Audio, because TS
|
39
|
+
// cant not Sound extends Audio, because TS compile, make call new Audio like a function
|
40
40
|
var Sound = /** @class */ (function () {
|
41
41
|
function Sound(type) {
|
42
42
|
if (type === void 0) { type = SoundType.ONCE; }
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Avatar } from "../../export-types";
|
2
2
|
import { GetInitialParams, Sprite } from "./sprite";
|
3
|
-
declare type
|
3
|
+
declare type SpriteOffset = {
|
4
4
|
x: number;
|
5
5
|
y: number;
|
6
6
|
width: number;
|
@@ -8,11 +8,11 @@ declare type SpriteOffet = {
|
|
8
8
|
index: number;
|
9
9
|
};
|
10
10
|
declare type AvatarGetInitialParams<S extends AvatarSprite> = GetInitialParams<S> & {
|
11
|
-
offset?: Partial<
|
11
|
+
offset?: Partial<SpriteOffset>;
|
12
12
|
};
|
13
13
|
export declare class AvatarSprite extends Sprite<Avatar | undefined | null> {
|
14
14
|
private _offset;
|
15
|
-
get offset():
|
15
|
+
get offset(): SpriteOffset;
|
16
16
|
onDraw(): void;
|
17
17
|
initial(params?: AvatarGetInitialParams<this>): void;
|
18
18
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"avatar.sprite.d.ts","sourceRoot":"","sources":["../../../src/classes/sprites/avatar.sprite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEpD,aAAK,
|
1
|
+
{"version":3,"file":"avatar.sprite.d.ts","sourceRoot":"","sources":["../../../src/classes/sprites/avatar.sprite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEpD,aAAK,YAAY,GAAG;IAClB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,aAAK,sBAAsB,CAAC,CAAC,SAAS,YAAY,IAAI,gBAAgB,CAAC,CAAC,CAAC,GAAG;IAE1E,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;CAChC,CAAC;AAEF,qBAAa,YAAa,SAAQ,MAAM,CAAC,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IACjE,OAAO,CAAC,OAAO,CAMb;IAEF,IAAI,MAAM,iBAET;IAED,MAAM;IAuBN,OAAO,CAAC,MAAM,CAAC,EAAE,sBAAsB,CAAC,IAAI,CAAC;CAc9C"}
|
package/lib/classes/watcher.js
CHANGED
@@ -27,7 +27,7 @@ export function Watcher(_a) {
|
|
27
27
|
var names = Array.isArray(_names) ? _names : [_names];
|
28
28
|
var _b = useState(initialValues), values = _b[0], setValues = _b[1];
|
29
29
|
useEffect(function () {
|
30
|
-
var
|
30
|
+
var unSubs = names.map(function (name) {
|
31
31
|
return scene.onEntityPropsChange(name, function (value) {
|
32
32
|
setValues(function (prev) {
|
33
33
|
var _a;
|
@@ -36,9 +36,9 @@ export function Watcher(_a) {
|
|
36
36
|
});
|
37
37
|
});
|
38
38
|
return function () {
|
39
|
-
for (var _i = 0,
|
40
|
-
var
|
41
|
-
|
39
|
+
for (var _i = 0, unSubs_1 = unSubs; _i < unSubs_1.length; _i++) {
|
40
|
+
var unSub = unSubs_1[_i];
|
41
|
+
unSub();
|
42
42
|
}
|
43
43
|
};
|
44
44
|
}, __spreadArray(__spreadArray([], names, true), [scene], false));
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Engine, Body } from "matter-js";
|
2
2
|
import { SimpleCamera } from "./simple-camera";
|
3
3
|
import { Scene } from "./scene";
|
4
|
-
import {
|
4
|
+
import { EntitySuit } from "./entities/entity-suit";
|
5
5
|
export declare class WorldManagement {
|
6
6
|
private _camera;
|
7
7
|
private _scene;
|
@@ -14,20 +14,20 @@ export declare class WorldManagement {
|
|
14
14
|
get engine(): Engine;
|
15
15
|
get camera(): SimpleCamera;
|
16
16
|
get scene(): Scene<any>;
|
17
|
-
iterateEntities(action: (entity:
|
17
|
+
iterateEntities(action: (entity: EntitySuit) => boolean | undefined | void): void;
|
18
18
|
private joinPool;
|
19
19
|
private outPool;
|
20
20
|
destructor(): void;
|
21
|
-
changeEntityLayerIndex(entity:
|
22
|
-
changeEntityName(entity:
|
21
|
+
changeEntityLayerIndex(entity: EntitySuit, newIndex: number): void;
|
22
|
+
changeEntityName(entity: EntitySuit, newName: string): void;
|
23
23
|
bootstrapCompleted(): void;
|
24
|
-
getEntity<T extends
|
24
|
+
getEntity<T extends EntitySuit = EntitySuit>(name: string | {
|
25
25
|
new (): T;
|
26
26
|
}): T;
|
27
27
|
addBody(body: Body): void;
|
28
28
|
removeBody(body: Body): void;
|
29
|
-
addEntity(entity:
|
30
|
-
removeEntity(entity:
|
29
|
+
addEntity(entity: EntitySuit): void;
|
30
|
+
removeEntity(entity: EntitySuit): void;
|
31
31
|
update(): void;
|
32
32
|
draw(): void;
|
33
33
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"world-management.d.ts","sourceRoot":"","sources":["../../src/classes/world-management.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAiB,IAAI,EAAE,MAAM,WAAW,CAAC;AAIxD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGhC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;
|
1
|
+
{"version":3,"file":"world-management.d.ts","sourceRoot":"","sources":["../../src/classes/world-management.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAiB,IAAI,EAAE,MAAM,WAAW,CAAC;AAIxD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGhC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,qBAAa,eAAe;IAWd,OAAO,CAAC,OAAO;IAAgB,OAAO,CAAC,MAAM;IAVzD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAkC;IAC/D,OAAO,CAAC,QAAQ,CAAC,YAAY,CAGtB;IACP,OAAO,CAAC,QAAQ,CAAC,YAAY,CACxB;IAEL,OAAO,CAAC,OAAO,CAAS;gBAEJ,OAAO,EAAE,YAAY,EAAU,MAAM,EAAE,KAAK;IAoDhE,OAAO,CAAC,mBAAmB;IAiB3B,IAAI,MAAM,WAET;IAED,IAAI,MAAM,iBAET;IAED,IAAI,KAAK,eAER;IAED,eAAe,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,OAAO,GAAG,SAAS,GAAG,IAAI;IAqB1E,OAAO,CAAC,QAAQ;IAKhB,OAAO,CAAC,OAAO;IAWf,UAAU;IAKV,sBAAsB,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM;IAK3D,gBAAgB,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM;IAKpD,kBAAkB;IAMlB,SAAS,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,EACzC,IAAI,EAAE,MAAM,GAAG;QAAE,QAAQ,CAAC,CAAA;KAAE,GAC3B,CAAC;IAgBJ,OAAO,CAAC,IAAI,EAAE,IAAI;IAIlB,UAAU,CAAC,IAAI,EAAE,IAAI;IAIrB,SAAS,CAAC,MAAM,EAAE,UAAU;IAa5B,YAAY,CAAC,MAAM,EAAE,UAAU;IAoB/B,MAAM;IAiBN,IAAI;CAqBL"}
|
@@ -141,14 +141,14 @@ var WorldManagement = /** @class */ (function () {
|
|
141
141
|
return this.entitiesHash[id];
|
142
142
|
}
|
143
143
|
else {
|
144
|
-
var
|
144
|
+
var found_1;
|
145
145
|
this.iterateEntities(function (entity) {
|
146
146
|
if (entity instanceof name) {
|
147
|
-
|
147
|
+
found_1 = entity;
|
148
148
|
return true;
|
149
149
|
}
|
150
150
|
});
|
151
|
-
return
|
151
|
+
return found_1;
|
152
152
|
}
|
153
153
|
};
|
154
154
|
WorldManagement.prototype.addBody = function (body) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"sound-from.decor.d.ts","sourceRoot":"","sources":["../../src/decorators/sound-from.decor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,wBAAgB,SAAS,CACvB,
|
1
|
+
{"version":3,"file":"sound-from.decor.d.ts","sourceRoot":"","sources":["../../src/decorators/sound-from.decor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,wBAAgB,SAAS,CACvB,MAAM,CAAC,EAAE,MAAM,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,EACnD,IAAI,GAAE,SAA0B,YAEP,GAAG,eAAe,MAAM,UAiBlD"}
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import { SoundType } from "../export-enums";
|
2
|
-
export function SoundFrom(
|
2
|
+
export function SoundFrom(source, type) {
|
3
3
|
if (type === void 0) { type = SoundType.ONCE; }
|
4
4
|
return function (target, propertyKey) {
|
5
|
-
var _a =
|
6
|
-
? typeof
|
7
|
-
? { src:
|
8
|
-
:
|
5
|
+
var _a = source
|
6
|
+
? typeof source === "string"
|
7
|
+
? { src: source, volume: undefined }
|
8
|
+
: source
|
9
9
|
: { volume: undefined, src: undefined }, volume = _a.volume, src = _a.src;
|
10
10
|
if (!target.soundsDecor) {
|
11
11
|
target.soundsDecor = [];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"sprite-from.decor.d.ts","sourceRoot":"","sources":["../../src/decorators/sprite-from.decor.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,
|
1
|
+
{"version":3,"file":"sprite-from.decor.d.ts","sourceRoot":"","sources":["../../src/decorators/sprite-from.decor.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,YAClC,GAAG,eAAe,MAAM,UAelD"}
|
@@ -1,9 +1,9 @@
|
|
1
|
-
export function SpriteFrom(
|
1
|
+
export function SpriteFrom(source) {
|
2
2
|
return function (target, propertyKey) {
|
3
|
-
var src = (
|
4
|
-
? typeof
|
5
|
-
? { src:
|
6
|
-
:
|
3
|
+
var src = (source
|
4
|
+
? typeof source === "string"
|
5
|
+
? { src: source }
|
6
|
+
: source
|
7
7
|
: { src: undefined }).src;
|
8
8
|
if (!target.spritesDecor) {
|
9
9
|
target.spritesDecor = [];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"export-interfaces.d.ts","sourceRoot":"","sources":["../src/export-interfaces.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,
|
1
|
+
{"version":3,"file":"export-interfaces.d.ts","sourceRoot":"","sources":["../src/export-interfaces.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,GAAG;IAClC,OAAO,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC;CAC9B"}
|
package/lib/export-types.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Entity } from "./classes/entities/entity";
|
2
2
|
import { Sprite } from "./classes/sprites/sprite";
|
3
3
|
import type { Body, IChamferableBodyDefinition } from "matter-js";
|
4
|
-
import {
|
4
|
+
import { Initializer } from "./export-interfaces";
|
5
5
|
import { Sound } from "./classes/sound";
|
6
6
|
import { SoundType } from "./export-enums";
|
7
7
|
export type { Collection } from "./classes/p5";
|
@@ -43,12 +43,12 @@ export declare type EntityInitial<E extends Entity> = {
|
|
43
43
|
scaleY?: number;
|
44
44
|
props?: Partial<E["props"]>;
|
45
45
|
};
|
46
|
-
export declare type
|
47
|
-
export declare type
|
46
|
+
export declare type Configuration<C extends Initializer> = Parameters<C["initial"]>[0];
|
47
|
+
export declare type Configurable<C extends Initializer = Initializer> = {
|
48
48
|
new (): C;
|
49
49
|
} | [{
|
50
50
|
new (): C;
|
51
|
-
},
|
51
|
+
}, Configuration<C>];
|
52
52
|
export declare type SoundManagement = Record<SoundType, {
|
53
53
|
canPlay: boolean;
|
54
54
|
}>;
|
@@ -96,6 +96,8 @@ export declare type AnimationInitialParams<E extends Record<string, any> = Recor
|
|
96
96
|
timePerFrame?: number;
|
97
97
|
source?: Avatar;
|
98
98
|
size?: Size;
|
99
|
+
maxCycle?: number;
|
100
|
+
isRunning?: boolean;
|
99
101
|
} & E;
|
100
102
|
export declare type EntityEdge = {
|
101
103
|
left: number;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"export-types.d.ts","sourceRoot":"","sources":["../src/export-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD,OAAO,KAAK,EAAE,IAAI,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"export-types.d.ts","sourceRoot":"","sources":["../src/export-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD,OAAO,KAAK,EAAE,IAAI,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,oBAAY,MAAM,GAAG,UAAU,CAAC,OAAO,cAAc,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;AACxE,oBAAY,KAAK,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AACtD,oBAAY,KAAK,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAC7C,oBAAY,MAAM,GAAG,KAAK,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM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
package/lib/hooks/entity.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
import {
|
1
|
+
import { EntitySuit } from "../classes/entities/entity-suit";
|
2
2
|
declare type TargetFind<T> = string | {
|
3
3
|
new (): T;
|
4
4
|
};
|
5
|
-
export declare function useEntity<T extends
|
5
|
+
export declare function useEntity<T extends EntitySuit = EntitySuit>(...entityClasses: TargetFind<T>[]): T[];
|
6
6
|
export {};
|
7
7
|
//# sourceMappingURL=entity.d.ts.map
|
package/lib/hooks/watcher.js
CHANGED
@@ -25,7 +25,7 @@ export function useWatcher(name, initialValues) {
|
|
25
25
|
var names = Array.isArray(name) ? name : [name];
|
26
26
|
var _a = useState(initialValues), values = _a[0], setValues = _a[1];
|
27
27
|
useEffect(function () {
|
28
|
-
var
|
28
|
+
var unSubs = names.map(function (name) {
|
29
29
|
return scene.onEntityPropsChange(name, function (value) {
|
30
30
|
setValues(function (prev) {
|
31
31
|
var _a;
|
@@ -34,9 +34,9 @@ export function useWatcher(name, initialValues) {
|
|
34
34
|
});
|
35
35
|
});
|
36
36
|
return function () {
|
37
|
-
for (var _i = 0,
|
38
|
-
var
|
39
|
-
|
37
|
+
for (var _i = 0, unSubs_1 = unSubs; _i < unSubs_1.length; _i++) {
|
38
|
+
var unSub = unSubs_1[_i];
|
39
|
+
unSub();
|
40
40
|
}
|
41
41
|
};
|
42
42
|
}, __spreadArray(__spreadArray([], names, true), [scene], false));
|
@@ -12,7 +12,7 @@ var __assign = (this && this.__assign) || function () {
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
13
13
|
import { useMemo } from "react";
|
14
14
|
import { useLongPress } from "../hooks/interact";
|
15
|
-
import {
|
15
|
+
import { getClassName } from "../utils";
|
16
16
|
export function Control(_a) {
|
17
17
|
var _b = _a.xAxisOriginCenter, xAxisOriginCenter = _b === void 0 ? false : _b, _c = _a.yAxisOriginCenter, yAxisOriginCenter = _c === void 0 ? false : _c, top = _a.top, left = _a.left, right = _a.right, bottom = _a.bottom, children = _a.children, _d = _a.orientation, orientation = _d === void 0 ? "vertical" : _d, _e = _a.alignment, alignment = _e === void 0 ? "flex-start" : _e, _f = _a.interact, interact = _f === void 0 ? {} : _f;
|
18
18
|
var longPressProps = useLongPress(interact.onLongPress, interact.delay, interact.exts);
|
@@ -21,7 +21,7 @@ export function Control(_a) {
|
|
21
21
|
var y = yAxisOriginCenter ? "".concat(top != null ? -50 : 50, "%") : 0;
|
22
22
|
return "translate(".concat(x, ",").concat(y, ")");
|
23
23
|
}, [left, top, xAxisOriginCenter, yAxisOriginCenter]);
|
24
|
-
return (_jsx("div", __assign({ className:
|
24
|
+
return (_jsx("div", __assign({ className: getClassName("ui-control"), style: {
|
25
25
|
top: top,
|
26
26
|
left: left,
|
27
27
|
right: right,
|
@@ -10,8 +10,8 @@ var __assign = (this && this.__assign) || function () {
|
|
10
10
|
return __assign.apply(this, arguments);
|
11
11
|
};
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
13
|
-
import {
|
13
|
+
import { getClassName } from "../utils";
|
14
14
|
export function FloatContainer(_a) {
|
15
15
|
var children = _a.children, style = _a.style, id = _a.id;
|
16
|
-
return (_jsx("div", __assign({ className:
|
16
|
+
return (_jsx("div", __assign({ className: getClassName("float-container"), style: style }, { children: _jsx("div", __assign({ id: id }, { children: children })) })));
|
17
17
|
}
|
@@ -23,7 +23,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
23
23
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
24
24
|
import { useEffect, useMemo, useState } from "react";
|
25
25
|
import { SceneManagement } from "../classes/scene-management";
|
26
|
-
import {
|
26
|
+
import { getClassName } from "../utils";
|
27
27
|
import { Logger } from "./logger";
|
28
28
|
import { SceneRunner } from "./scene-runner";
|
29
29
|
export function GameBootstrap(_a) {
|
@@ -53,9 +53,9 @@ export function GameBootstrap(_a) {
|
|
53
53
|
document.createElement("style");
|
54
54
|
style.id = "game-container-style-wrap";
|
55
55
|
document.head.appendChild(style);
|
56
|
-
var gameRootClass =
|
57
|
-
var gameLoggerClass =
|
58
|
-
style.appendChild(document.createTextNode("\n .".concat(
|
56
|
+
var gameRootClass = getClassName("game-root");
|
57
|
+
var gameLoggerClass = getClassName("game-logger");
|
58
|
+
style.appendChild(document.createTextNode("\n .".concat(getClassName("assets-fail-view"), "{\n background-color: #f28181a1;\n min-height: 100px;\n padding: 10px;\n color: #000;\n }\n \n .").concat(getClassName("game-modal"), " {\n position: fixed;\n top: 0;\n left: 0;\n }\n\n .").concat(getClassName("scene-modal-stack"), "{\n position: absolute;\n top: 0;\n left: 0;\n width: 0;\n height: 0;\n z-index: 2;\n }\n \n .").concat(getClassName("modal-content-main"), "{\n position: relative;\n z-index: 1;\n min-width: 200px;\n min-height: 200px;\n }\n\n .").concat(getClassName("modal-content-closer"), "{\n width: 100%;\n height: 100%;\n position: absolute;\n z-index: 0;\n }\n .").concat(getClassName("modal-content-centered"), "{\n width: 100%;\n height: 100%;\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .").concat(getClassName("modal-content-wrap"), "{\n width: 100%;\n height: 100%;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n }\n\n .").concat(gameRootClass, ", .").concat(gameRootClass, " *,\n .").concat(gameLoggerClass, ", .").concat(gameLoggerClass, " *\n {\n box-sizing: border-box;\n -webkit-touch-callout: none;\n -webkit-tap-highlight-color: none;\n -webkit-user-select: none;\n -ms-user-select: none;\n user-select: none;\n text-size-adjust: none;\n }\n\n .").concat(gameRootClass, " {\n overflow: hidden;\n position: relative;\n }\n\n .").concat(gameLoggerClass, " {\n z-index: 4;\n position: fixed;\n top:0;\n right:0;\n }\n\n .").concat(getClassName("message-stack"), " {\n width: cacl(100vw - 40px);\n max-width: 300px;\n max-height: calc(50vh - 50px);\n min-width: 200px;\n min-height: 150px;\n position: absolute;\n top: 5px;\n right: 5px;\n padding: 5px;\n background-color: #0000007b;\n color: #fff;\n font-size: 0.8rem;\n\n display: flex;\n flex-direction: column;\n }\n\n .").concat(getClassName("message-stack-heading"), "{\n width: 100%;\n display: flex;\n justify-content: flex-end;\n }\n\n .").concat(getClassName("message-stack-content"), "{\n flex: 1;\n width: 100%;\n overflow-x: hidden;\n overflow-y: auto;\n }\n\n\n .").concat(getClassName("float-container"), " {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n }\n\n .").concat(getClassName("float-container"), " > div {\n position: relative;\n width: 100%;\n height: 100%;\n }\n\n .").concat(getClassName("ui-control"), " {\n position: absolute;\n display: inline-flex;\n }\n\n .").concat(getClassName("scaler-container"), " {\n width: 100%;\n height: 100%;\n position: relative;\n top: 0;\n left: 0;\n }\n\n .").concat(getClassName("scaler-container"), " > div {\n transform-origin: left top;\n position: relative;\n top: 50%;\n left: 50%;\n }\n ")));
|
59
59
|
}, []);
|
60
60
|
return (_jsxs(_Fragment, { children: [_jsx(SceneRunner, __assign({ current: currentScene }, props), currentScene.sessionId), logPopup && _jsx(Logger, {})] }));
|
61
61
|
}
|
@@ -21,13 +21,13 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
21
21
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
22
22
|
import { useCallback, useMemo, useRef, useState } from "react";
|
23
23
|
import ReactDOM from "react-dom";
|
24
|
-
import {
|
24
|
+
import { getClassName, toText } from "../utils";
|
25
25
|
export function Logger() {
|
26
26
|
var _a = useState([]), messages = _a[0], setMessages = _a[1];
|
27
27
|
var refList = useRef(null);
|
28
28
|
var container = useMemo(function () {
|
29
29
|
var c = document.createElement("div");
|
30
|
-
c.className =
|
30
|
+
c.className = getClassName("game-logger");
|
31
31
|
document.body.appendChild(c);
|
32
32
|
return c;
|
33
33
|
}, []);
|
@@ -87,5 +87,5 @@ export function Logger() {
|
|
87
87
|
pushMessage(args);
|
88
88
|
};
|
89
89
|
}, [pushMessage]);
|
90
|
-
return ReactDOM.createPortal(messages.length ? (_jsxs("div", __assign({ className:
|
90
|
+
return ReactDOM.createPortal(messages.length ? (_jsxs("div", __assign({ className: getClassName("message-stack") }, { children: [_jsx("div", __assign({ className: getClassName("message-stack-heading") }, { children: _jsx("p", __assign({ onClick: function () { return setMessages([]); } }, { children: "X Clear" })) })), _jsx("div", __assign({ className: getClassName("message-stack-content"), ref: refList }, { children: messages.map(function (mss, i) { return (_jsxs("p", { children: ["- ", mss] }, i)); }) }))] }))) : null, container);
|
91
91
|
}
|
@@ -12,14 +12,14 @@ var __assign = (this && this.__assign) || function () {
|
|
12
12
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
13
13
|
import { useMemo, useEffect, useState, useCallback, forwardRef, cloneElement, useImperativeHandle, useRef, memo, } from "react";
|
14
14
|
import * as ReactDOM from "react-dom";
|
15
|
-
import {
|
15
|
+
import { getClassName } from "../utils";
|
16
16
|
export var Modal = forwardRef(function (_a, ref) {
|
17
17
|
var _b;
|
18
18
|
var backgroundStyle = _a.backgroundStyle, trigger = _a.children, content = _a.content, _c = _a.defaultOpen, defaultOpen = _c === void 0 ? false : _c, onClose = _a.onClose, _d = _a.event, event = _d === void 0 ? "onClick" : _d;
|
19
19
|
var _e = useState(defaultOpen), isOpen = _e[0], setOpen = _e[1];
|
20
20
|
var container = useMemo(function () {
|
21
21
|
var c = document.createElement("div");
|
22
|
-
c.className =
|
22
|
+
c.className = getClassName("game-modal");
|
23
23
|
return c;
|
24
24
|
}, []);
|
25
25
|
useEffect(function () {
|
@@ -72,5 +72,5 @@ var ModalWrap = memo(function (_a) {
|
|
72
72
|
close: handleClose,
|
73
73
|
}, content.props.children);
|
74
74
|
}, [content]);
|
75
|
-
return (_jsx("div", __assign({ className:
|
75
|
+
return (_jsx("div", __assign({ className: getClassName("modal-content-wrap") }, { children: _jsxs("div", __assign({ className: getClassName("modal-content-centered"), ref: refModal }, { children: [_jsx("div", { className: getClassName("modal-content-closer"), style: __assign({}, backgroundStyle), onClick: handleClose }), _jsx("main", __assign({ className: getClassName("modal-content-main") }, { children: el }))] })) })));
|
76
76
|
});
|
@@ -10,10 +10,10 @@ var __assign = (this && this.__assign) || function () {
|
|
10
10
|
return __assign.apply(this, arguments);
|
11
11
|
};
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
13
|
-
import {
|
13
|
+
import { getClassName } from "../utils";
|
14
14
|
export function ScalerContainer(_a) {
|
15
15
|
var width = _a.width, height = _a.height, value = _a.value, children = _a.children;
|
16
|
-
return (_jsx("div", __assign({ className:
|
16
|
+
return (_jsx("div", __assign({ className: getClassName("scaler-container") }, { children: _jsx("div", __assign({ style: {
|
17
17
|
width: width,
|
18
18
|
height: height,
|
19
19
|
transform: "scale(".concat(value, ") translate(-50%, -50%)"),
|
@@ -12,7 +12,7 @@ var __assign = (this && this.__assign) || function () {
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
13
13
|
import { useEffect, useMemo, useRef, useState, } from "react";
|
14
14
|
import { Scaler } from "../classes/scaler";
|
15
|
-
import {
|
15
|
+
import { getClassName, useWindowSize } from "../utils";
|
16
16
|
import { LayoutMode } from "../export-enums";
|
17
17
|
import { UISceneContext } from "../react-context";
|
18
18
|
import { ScalerContainer } from "./scaler-container";
|
@@ -70,7 +70,7 @@ export function SceneRunner(_a) {
|
|
70
70
|
}
|
71
71
|
return (AssetsLoader !== null && AssetsLoader !== void 0 ? AssetsLoader : _jsx("div", { children: "Assets loading..." }));
|
72
72
|
}, [AssetsLoader]);
|
73
|
-
return (_jsxs("div", __assign({ className:
|
73
|
+
return (_jsxs("div", __assign({ className: getClassName("game-root"), style: {
|
74
74
|
width: screenSize.width,
|
75
75
|
height: screenSize.height,
|
76
76
|
} }, { children: [_jsx(FloatContainer, __assign({ style: {
|
@@ -84,9 +84,9 @@ export function SceneRunner(_a) {
|
|
84
84
|
? (function () {
|
85
85
|
var rendered = current.renderAssetsFail();
|
86
86
|
if (Array.isArray(rendered)) {
|
87
|
-
return (_jsx("div", __assign({ className:
|
87
|
+
return (_jsx("div", __assign({ className: getClassName("assets-fail-view") }, { children: rendered.map(function (item, i) { return (_jsxs("p", { children: ["- ", item.type, ": ", item.detail] }, i)); }) })));
|
88
88
|
}
|
89
89
|
return rendered;
|
90
90
|
})()
|
91
|
-
: assetsLoader })) : (_jsx(_Fragment, { children: isBootDone ? (_jsxs(UISceneContext.Provider, __assign({ value: current }, { children: [_jsx(current.UI, __assign({ scene: current }, current.getUIProps())), joystick && (_jsx(MovementControl, __assign({}, (joystick === true ? {} : joystick)))), _jsx("div", { className:
|
91
|
+
: assetsLoader })) : (_jsx(_Fragment, { children: isBootDone ? (_jsxs(UISceneContext.Provider, __assign({ value: current }, { children: [_jsx(current.UI, __assign({ scene: current }, current.getUIProps())), joystick && (_jsx(MovementControl, __assign({}, (joystick === true ? {} : joystick)))), _jsx("div", { className: getClassName("scene-modal-stack"), id: "scene-modal-stack" })] }))) : (_jsx("div", {})) })) }))] })));
|
92
92
|
}
|
package/lib/utils.d.ts
CHANGED
@@ -14,6 +14,6 @@ export declare function useWindowSize(): {
|
|
14
14
|
height: number;
|
15
15
|
};
|
16
16
|
export declare function toText(obj: Record<string, any> | Record<string, any>[]): string | Record<string, any>;
|
17
|
-
export declare function
|
17
|
+
export declare function getClassName(cls: string): string;
|
18
18
|
export declare function genId(length?: number): string;
|
19
19
|
//# sourceMappingURL=utils.d.ts.map
|
package/lib/utils.js
CHANGED
@@ -34,10 +34,10 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
34
34
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
35
35
|
}
|
36
36
|
};
|
37
|
-
import
|
37
|
+
import OutOfScopeP5 from "p5";
|
38
38
|
import { useEffect, useState } from "react";
|
39
39
|
import { Sound } from "./classes/sound";
|
40
|
-
var
|
40
|
+
var outOfScopeP5;
|
41
41
|
document.addEventListener("DOMContentLoaded", function () {
|
42
42
|
var noop = document.createElement("div");
|
43
43
|
noop.style.position = "absolute";
|
@@ -46,14 +46,14 @@ document.addEventListener("DOMContentLoaded", function () {
|
|
46
46
|
noop.style.left = "-100%";
|
47
47
|
document.body.appendChild(noop);
|
48
48
|
setTimeout(function () {
|
49
|
-
|
49
|
+
outOfScopeP5 = new OutOfScopeP5(function (skt) { }, noop);
|
50
50
|
}, 0);
|
51
51
|
});
|
52
52
|
export function createAssetImage(src) {
|
53
53
|
return __awaiter(this, void 0, void 0, function () {
|
54
54
|
return __generator(this, function (_a) {
|
55
55
|
return [2 /*return*/, new Promise(function (res, rej) {
|
56
|
-
|
56
|
+
outOfScopeP5.loadImage(src, res, rej);
|
57
57
|
})];
|
58
58
|
});
|
59
59
|
});
|
@@ -191,7 +191,7 @@ export function toText(obj) {
|
|
191
191
|
}
|
192
192
|
}
|
193
193
|
var ENGINE_CLASS_PREFIX = "spt-hc_rsgn_";
|
194
|
-
export function
|
194
|
+
export function getClassName(cls) {
|
195
195
|
return ENGINE_CLASS_PREFIX + cls;
|
196
196
|
}
|
197
197
|
export function genId(length) {
|