react-simple-game-engine 0.2.91 → 0.2.93
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/scene.d.ts +1 -1
- package/lib/classes/scene.js +9 -9
- package/lib/classes/sound.d.ts +2 -2
- package/lib/classes/sound.js +1 -1
- package/lib/decorators/sound-from.decor.d.ts +1 -1
- package/lib/decorators/sound-from.decor.js +3 -3
- package/lib/export-types.d.ts +1 -1
- package/lib/ui-components/control.d.ts.map +1 -1
- package/lib/ui-components/control.js +2 -3
- package/lib/ui-components/float-container.d.ts.map +1 -1
- package/lib/ui-components/float-container.js +2 -1
- package/lib/ui-components/game-bootstrap.d.ts.map +1 -1
- package/lib/ui-components/game-bootstrap.js +4 -1
- package/lib/ui-components/logger.d.ts.map +1 -1
- package/lib/ui-components/logger.js +3 -25
- package/lib/ui-components/modal.d.ts.map +1 -1
- package/lib/ui-components/modal.js +3 -24
- package/lib/ui-components/scene-runner.d.ts.map +1 -1
- package/lib/ui-components/scene-runner.js +4 -18
- package/lib/utils.d.ts +1 -0
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +4 -0
- package/package.json +1 -1
package/lib/classes/scene.d.ts
CHANGED
@@ -82,7 +82,7 @@ export declare abstract class Scene<UIP = any> {
|
|
82
82
|
})[]): Promise<import("p5").Image[]>;
|
83
83
|
createSounds(...srcables: (string | {
|
84
84
|
src: string;
|
85
|
-
|
85
|
+
volume?: number;
|
86
86
|
type?: SoundType;
|
87
87
|
})[]): Promise<Sound[]>;
|
88
88
|
mapSprites(...srcs: string[]): Promise<void>;
|
package/lib/classes/scene.js
CHANGED
@@ -290,8 +290,8 @@ var Scene = /** @class */ (function () {
|
|
290
290
|
return [4 /*yield*/, createAssetSound(decor.src, decor.type)];
|
291
291
|
case 2:
|
292
292
|
sound = _b.sent();
|
293
|
-
if (decor.
|
294
|
-
sound.
|
293
|
+
if (decor.volume) {
|
294
|
+
sound.volume = decor.volume;
|
295
295
|
}
|
296
296
|
this[decor.propertyKey] = sound;
|
297
297
|
this.sounds.push(sound);
|
@@ -331,7 +331,7 @@ var Scene = /** @class */ (function () {
|
|
331
331
|
srcables[_i] = arguments[_i];
|
332
332
|
}
|
333
333
|
return __awaiter(this, void 0, void 0, function () {
|
334
|
-
var sounds, _a, srcables_1, srcable, _b,
|
334
|
+
var sounds, _a, srcables_1, srcable, _b, volume, src, _c, type, sound;
|
335
335
|
return __generator(this, function (_d) {
|
336
336
|
switch (_d.label) {
|
337
337
|
case 0:
|
@@ -342,13 +342,13 @@ var Scene = /** @class */ (function () {
|
|
342
342
|
if (!(_a < srcables_1.length)) return [3 /*break*/, 4];
|
343
343
|
srcable = srcables_1[_a];
|
344
344
|
_b = typeof srcable === "string"
|
345
|
-
? { src: srcable,
|
346
|
-
: srcable,
|
345
|
+
? { src: srcable, volume: undefined, type: undefined }
|
346
|
+
: srcable, 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();
|
350
|
-
if (
|
351
|
-
sound.
|
350
|
+
if (volume) {
|
351
|
+
sound.volume = volume;
|
352
352
|
}
|
353
353
|
sounds.push(sound);
|
354
354
|
this.sounds.push(sound);
|
@@ -421,8 +421,8 @@ var Scene = /** @class */ (function () {
|
|
421
421
|
return [4 /*yield*/, createAssetSound(src, decor.type)];
|
422
422
|
case 2:
|
423
423
|
sound = _b.sent();
|
424
|
-
if (decor.
|
425
|
-
sound.
|
424
|
+
if (decor.volume) {
|
425
|
+
sound.volume = decor.volume;
|
426
426
|
}
|
427
427
|
this[decor.propertyKey] = sound;
|
428
428
|
this.sounds.push(sound);
|
package/lib/classes/sound.d.ts
CHANGED
@@ -5,8 +5,8 @@ export declare class Sound {
|
|
5
5
|
static Management: SoundManagement;
|
6
6
|
readonly native: HTMLAudioElement;
|
7
7
|
constructor(type?: SoundType);
|
8
|
-
get
|
9
|
-
set
|
8
|
+
get volume(): number;
|
9
|
+
set volume(vol: number);
|
10
10
|
get isStopped(): boolean;
|
11
11
|
playNow(): Promise<void>;
|
12
12
|
pause(): Promise<void>;
|
package/lib/classes/sound.js
CHANGED
@@ -43,7 +43,7 @@ var Sound = /** @class */ (function () {
|
|
43
43
|
this.type = type;
|
44
44
|
this.native = new Audio();
|
45
45
|
}
|
46
|
-
Object.defineProperty(Sound.prototype, "
|
46
|
+
Object.defineProperty(Sound.prototype, "volume", {
|
47
47
|
get: function () {
|
48
48
|
return this.native.volume;
|
49
49
|
},
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { SoundType } from "../export-enums";
|
2
2
|
export declare function SoundFrom(srcable?: string | {
|
3
3
|
src?: string;
|
4
|
-
|
4
|
+
volume?: number;
|
5
5
|
}, type?: SoundType): (target: any, propertyKey: string) => void;
|
6
6
|
//# sourceMappingURL=sound-from.decor.d.ts.map
|
@@ -4,14 +4,14 @@ export function SoundFrom(srcable, type) {
|
|
4
4
|
return function (target, propertyKey) {
|
5
5
|
var _a = srcable
|
6
6
|
? typeof srcable === "string"
|
7
|
-
? { src: srcable,
|
7
|
+
? { src: srcable, volume: undefined }
|
8
8
|
: srcable
|
9
|
-
: {
|
9
|
+
: { volume: undefined, src: undefined }, volume = _a.volume, src = _a.src;
|
10
10
|
if (!target.soundsDecor) {
|
11
11
|
target.soundsDecor = [];
|
12
12
|
}
|
13
13
|
target.soundsDecor.push({
|
14
|
-
|
14
|
+
volume: volume,
|
15
15
|
propertyKey: propertyKey,
|
16
16
|
src: src,
|
17
17
|
type: type,
|
package/lib/export-types.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"control.d.ts","sourceRoot":"","sources":["../../src/ui-components/control.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAW,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAgB,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;
|
1
|
+
{"version":3,"file":"control.d.ts","sourceRoot":"","sources":["../../src/ui-components/control.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAW,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAgB,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAGpE,oBAAY,YAAY,GAAG;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,SAAS,CAAC;IACpB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,WAAW,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC;IACxC,SAAS,CAAC,EAAE,YAAY,GAAG,QAAQ,GAAG,UAAU,CAAC;IAEjD,QAAQ,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACvC,CAAC;AAEF,wBAAgB,OAAO,CAAC,EACtB,iBAAyB,EACzB,iBAAyB,EACzB,GAAG,EACH,IAAI,EACJ,KAAK,EACL,MAAM,EACN,QAAQ,EACR,WAAwB,EACxB,SAAwB,EACxB,QAAa,GACd,EAAE,YAAY,eA6Bd"}
|
@@ -12,6 +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 { getClassname } from "../utils";
|
15
16
|
export function Control(_a) {
|
16
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;
|
17
18
|
var longPressProps = useLongPress(interact.onLongPress, interact.delay, interact.exts);
|
@@ -20,13 +21,11 @@ export function Control(_a) {
|
|
20
21
|
var y = yAxisOriginCenter ? "".concat(top != null ? -50 : 50, "%") : 0;
|
21
22
|
return "translate(".concat(x, ",").concat(y, ")");
|
22
23
|
}, [left, top, xAxisOriginCenter, yAxisOriginCenter]);
|
23
|
-
return (_jsx("div", __assign({ style: {
|
24
|
-
position: "absolute",
|
24
|
+
return (_jsx("div", __assign({ className: getClassname("ui-control"), style: {
|
25
25
|
top: top,
|
26
26
|
left: left,
|
27
27
|
right: right,
|
28
28
|
bottom: bottom,
|
29
|
-
display: "inline-flex",
|
30
29
|
flexDirection: orientation === "vertical" ? "column" : "row",
|
31
30
|
alignItems: alignment,
|
32
31
|
transform: transform,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"float-container.d.ts","sourceRoot":"","sources":["../../src/ui-components/float-container.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
1
|
+
{"version":3,"file":"float-container.d.ts","sourceRoot":"","sources":["../../src/ui-components/float-container.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGjD,aAAK,mBAAmB,GAAG;IACzB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,mBAAmB,eAM1E"}
|
@@ -10,7 +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 { getClassname } from "../utils";
|
13
14
|
export function FloatContainer(_a) {
|
14
15
|
var children = _a.children, style = _a.style, id = _a.id;
|
15
|
-
return (_jsx("div", __assign({
|
16
|
+
return (_jsx("div", __assign({ className: getClassname("float-container"), style: style }, { children: _jsx("div", __assign({ id: id }, { children: children })) })));
|
16
17
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"game-bootstrap.d.ts","sourceRoot":"","sources":["../../src/ui-components/game-bootstrap.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAmB,UAAU,EAAE,MAAM,6BAA6B,CAAC;
|
1
|
+
{"version":3,"file":"game-bootstrap.d.ts","sourceRoot":"","sources":["../../src/ui-components/game-bootstrap.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAmB,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAG1E,OAAO,EAAe,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAErE,aAAK,cAAc,GAAG,sBAAsB,GAAG;IAC7C,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,eAsL3E"}
|
@@ -23,6 +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 { getClassname } from "../utils";
|
26
27
|
import { Logger } from "./logger";
|
27
28
|
import { SceneRunner } from "./scene-runner";
|
28
29
|
export function GameBootstrap(_a) {
|
@@ -52,7 +53,9 @@ export function GameBootstrap(_a) {
|
|
52
53
|
document.createElement("style");
|
53
54
|
style.id = "game-container-style-wrap";
|
54
55
|
document.head.appendChild(style);
|
55
|
-
|
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 ")));
|
56
59
|
}, []);
|
57
60
|
return (_jsxs(_Fragment, { children: [_jsx(SceneRunner, __assign({ current: currentScene }, props), currentScene.sessionId), logPopup && _jsx(Logger, {})] }));
|
58
61
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/ui-components/logger.tsx"],"names":[],"mappings":";AAIA,wBAAgB,MAAM,
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/ui-components/logger.tsx"],"names":[],"mappings":";AAIA,wBAAgB,MAAM,gCAqErB"}
|
@@ -21,16 +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 { toText } from "../utils";
|
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.
|
31
|
-
c.style.position = "fixed";
|
32
|
-
c.style.top = "0";
|
33
|
-
c.style.right = "0";
|
30
|
+
c.className = getClassname("game-logger");
|
34
31
|
document.body.appendChild(c);
|
35
32
|
return c;
|
36
33
|
}, []);
|
@@ -90,24 +87,5 @@ export function Logger() {
|
|
90
87
|
pushMessage(args);
|
91
88
|
};
|
92
89
|
}, [pushMessage]);
|
93
|
-
return ReactDOM.createPortal(messages.length ? (_jsxs("div", __assign({
|
94
|
-
width: "calc(50vw - 200px)",
|
95
|
-
height: "calc(50vh - 50px)",
|
96
|
-
minWidth: 200,
|
97
|
-
minHeight: 150,
|
98
|
-
position: "absolute",
|
99
|
-
top: 5,
|
100
|
-
right: 5,
|
101
|
-
padding: 5,
|
102
|
-
backgroundColor: "#0000007b",
|
103
|
-
color: "#fff",
|
104
|
-
fontSize: "0.8rem",
|
105
|
-
display: "flex",
|
106
|
-
flexDirection: "column",
|
107
|
-
} }, { children: [_jsx("div", __assign({ style: { width: "100%", display: "flex", justifyContent: "flex-end" } }, { children: _jsx("p", __assign({ onClick: function () { return setMessages([]); } }, { children: "X Clear" })) })), _jsx("div", __assign({ style: {
|
108
|
-
flex: 1,
|
109
|
-
width: "100%",
|
110
|
-
overflowX: "hidden",
|
111
|
-
overflowY: "auto",
|
112
|
-
}, ref: refList }, { children: messages.map(function (mss, i) { return (_jsxs("p", { children: ["- ", mss] }, i)); }) }))] }))) : null, container);
|
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);
|
113
91
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../src/ui-components/modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,YAAY,EAKZ,aAAa,EAEd,MAAM,OAAO,CAAC;
|
1
|
+
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../src/ui-components/modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,YAAY,EAKZ,aAAa,EAEd,MAAM,OAAO,CAAC;AAIf,aAAK,UAAU,GAAG;IAChB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,OAAO,EAAE,YAAY,CAAC;IACtB,eAAe,CAAC,EAAE,aAAa,CAAC;IAChC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,oBAAY,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,KAAK,0GAqEhB,CAAC"}
|
@@ -12,15 +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 { getClassname } from "../utils";
|
15
16
|
export var Modal = forwardRef(function (_a, ref) {
|
16
17
|
var _b;
|
17
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;
|
18
19
|
var _e = useState(defaultOpen), isOpen = _e[0], setOpen = _e[1];
|
19
20
|
var container = useMemo(function () {
|
20
21
|
var c = document.createElement("div");
|
21
|
-
c.
|
22
|
-
c.style.top = "0";
|
23
|
-
c.style.left = "0";
|
22
|
+
c.className = getClassname("game-modal");
|
24
23
|
return c;
|
25
24
|
}, []);
|
26
25
|
useEffect(function () {
|
@@ -73,25 +72,5 @@ var ModalWrap = memo(function (_a) {
|
|
73
72
|
close: handleClose,
|
74
73
|
}, content.props.children);
|
75
74
|
}, [content]);
|
76
|
-
return (_jsx("div", __assign({ style: {
|
77
|
-
width: "100%",
|
78
|
-
height: "100%",
|
79
|
-
position: "fixed",
|
80
|
-
top: 0,
|
81
|
-
left: 0,
|
82
|
-
right: 0,
|
83
|
-
bottom: 0,
|
84
|
-
} }, { children: _jsxs("div", __assign({ style: {
|
85
|
-
width: "100%",
|
86
|
-
height: "100%",
|
87
|
-
position: "relative",
|
88
|
-
display: "flex",
|
89
|
-
alignItems: "center",
|
90
|
-
justifyContent: "center",
|
91
|
-
}, ref: refModal }, { children: [_jsx("div", { style: __assign({ width: "100%", height: "100%", position: "absolute", zIndex: 0 }, backgroundStyle), onClick: handleClose }), _jsx("main", __assign({ style: {
|
92
|
-
position: "relative",
|
93
|
-
zIndex: 1,
|
94
|
-
minWidth: "200px",
|
95
|
-
minHeight: "200px",
|
96
|
-
} }, { children: el }))] })) })));
|
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 }))] })) })));
|
97
76
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"scene-runner.d.ts","sourceRoot":"","sources":["../../src/ui-components/scene-runner.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAEb,SAAS,EAKV,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAKzC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAIrD,OAAO,EAAmB,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAG3E,oBAAY,sBAAsB,GAAG;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC;IACzC,WAAW,CAAC,EAAE,M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GAAG,sBAAsB,GAAG;IAC/C,OAAO,EAAE,KAAK,CAAC;CAChB,CAAC;AAEF,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,MAAM,EACN,OAAO,EACP,UAAiC,EAEjC,SAAS,EACT,WAAW,EACX,kBAAkB,EAClB,YAAY,EAAE,YAAY,EAC1B,QAAQ,GACT,EAAE,gBAAgB,eA+HlB"}
|
@@ -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 { useWindowSize } from "../utils";
|
15
|
+
import { getClassname, useWindowSize } from "../utils";
|
16
16
|
import { LayoutMode } from "../export-enums";
|
17
17
|
import { ScalerContainer } from "./scaler-container";
|
18
18
|
import { Sketch } from "./sketch";
|
@@ -60,11 +60,9 @@ export function SceneRunner(_a) {
|
|
60
60
|
}
|
61
61
|
return (AssetsLoader !== null && AssetsLoader !== void 0 ? AssetsLoader : _jsx("div", { children: "Assets loading..." }));
|
62
62
|
}, [AssetsLoader]);
|
63
|
-
return (_jsxs("div", __assign({ className: "game-root", style: {
|
63
|
+
return (_jsxs("div", __assign({ className: getClassname("game-root"), style: {
|
64
64
|
width: screenSize.width,
|
65
65
|
height: screenSize.height,
|
66
|
-
overflow: "hidden",
|
67
|
-
position: "relative",
|
68
66
|
} }, { children: [_jsx(FloatContainer, __assign({ style: {
|
69
67
|
zIndex: 0,
|
70
68
|
backgroundColor: "rgb(41,41,41)",
|
@@ -76,21 +74,9 @@ export function SceneRunner(_a) {
|
|
76
74
|
? (function () {
|
77
75
|
var rendered = current.renderAssetsFail();
|
78
76
|
if (Array.isArray(rendered)) {
|
79
|
-
return (_jsx("div", __assign({
|
80
|
-
backgroundColor: "#f28181a1",
|
81
|
-
minHeight: 100,
|
82
|
-
padding: 10,
|
83
|
-
color: "#000",
|
84
|
-
} }, { children: rendered.map(function (item, i) { return (_jsxs("p", { children: ["- ", item.type, ": ", item.detail] }, i)); }) })));
|
77
|
+
return (_jsx("div", __assign({ className: getClassname("assets-fail-view") }, { children: rendered.map(function (item, i) { return (_jsxs("p", { children: ["- ", item.type, ": ", item.detail] }, i)); }) })));
|
85
78
|
}
|
86
79
|
return rendered;
|
87
80
|
})()
|
88
|
-
: assetsLoader })) : (_jsx(_Fragment, { children: isBootDone ? (_jsxs(_Fragment, { children: [_jsx(current.UI, __assign({ scene: current }, current.getUIProps())), joystick && (_jsx(MovementControl, __assign({ scene: current }, (joystick === true ? {} : joystick)))), _jsx("div", {
|
89
|
-
position: "absolute",
|
90
|
-
top: 0,
|
91
|
-
left: 0,
|
92
|
-
width: 0,
|
93
|
-
height: 0,
|
94
|
-
zIndex: 2,
|
95
|
-
} })] })) : (_jsx("div", {})) })) }))] })));
|
81
|
+
: assetsLoader })) : (_jsx(_Fragment, { children: isBootDone ? (_jsxs(_Fragment, { children: [_jsx(current.UI, __assign({ scene: current }, current.getUIProps())), joystick && (_jsx(MovementControl, __assign({ scene: current }, (joystick === true ? {} : joystick)))), _jsx("div", { className: getClassname("scene-modal-stack"), id: "scene-modal-stack" })] })) : (_jsx("div", {})) })) }))] })));
|
96
82
|
}
|
package/lib/utils.d.ts
CHANGED
@@ -14,4 +14,5 @@ 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 getClassname(cls: string): string;
|
17
18
|
//# sourceMappingURL=utils.d.ts.map
|
package/lib/utils.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;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