react-simple-game-engine 0.2.31 → 0.2.32
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.
|
@@ -8,7 +8,7 @@ export declare type ControlProps = {
|
|
|
8
8
|
right?: number;
|
|
9
9
|
bottom?: number;
|
|
10
10
|
render?: (el: ReactElement) => ReactNode;
|
|
11
|
-
props
|
|
11
|
+
props?: IJoystickProps;
|
|
12
12
|
};
|
|
13
13
|
export declare function Control({ scene, render, top, left, right, bottom, props, }: ControlProps): JSX.Element;
|
|
14
14
|
//# sourceMappingURL=control.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.d.ts","sourceRoot":"","sources":["../../src/ui-components/control.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAW,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"control.d.ts","sourceRoot":"","sources":["../../src/ui-components/control.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAW,MAAM,OAAO,CAAC;AAEzD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGzC,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAErE,oBAAY,YAAY,GAAG;IACzB,KAAK,EAAE,KAAK,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,YAAY,KAAK,SAAS,CAAC;IACzC,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB,CAAC;AAEF,wBAAgB,OAAO,CAAC,EACtB,KAAK,EACL,MAAM,EACN,GAAG,EACH,IAAS,EACT,KAAK,EACL,MAAW,EACX,KAAK,GACN,EAAE,YAAY,eA8Dd"}
|
|
@@ -12,17 +12,39 @@ 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 { Watcher } from "../utilities";
|
|
15
|
-
import { FloatContainer } from "./float-container";
|
|
16
15
|
import { Joystick } from "./react-joystick-component";
|
|
17
16
|
export function Control(_a) {
|
|
18
17
|
var scene = _a.scene, render = _a.render, top = _a.top, _b = _a.left, left = _b === void 0 ? 50 : _b, right = _a.right, _c = _a.bottom, bottom = _c === void 0 ? 50 : _c, props = _a.props;
|
|
19
18
|
var el = useMemo(function () {
|
|
20
|
-
|
|
19
|
+
var _a = Renderer.scaler, screenSize = _a.screenSize, canvasSize = _a.canvasSize;
|
|
20
|
+
var verDeltaScale = (screenSize.height - canvasSize.height) / 2;
|
|
21
|
+
var horDeltaScale = (screenSize.width - canvasSize.width) / 2;
|
|
22
|
+
var positionLeft = left != null
|
|
23
|
+
? {
|
|
24
|
+
left: left + horDeltaScale,
|
|
25
|
+
}
|
|
26
|
+
: undefined;
|
|
27
|
+
var positionRight = right != null
|
|
28
|
+
? {
|
|
29
|
+
right: right + horDeltaScale,
|
|
30
|
+
}
|
|
31
|
+
: undefined;
|
|
32
|
+
var positionTop = top != null
|
|
33
|
+
? {
|
|
34
|
+
top: verDeltaScale,
|
|
35
|
+
}
|
|
36
|
+
: undefined;
|
|
37
|
+
var positionBottom = bottom != null
|
|
38
|
+
? {
|
|
39
|
+
bottom: bottom + verDeltaScale,
|
|
40
|
+
}
|
|
41
|
+
: undefined;
|
|
42
|
+
return (_jsx("div", __assign({ style: __assign(__assign(__assign(__assign({ position: "absolute" }, positionLeft), positionRight), positionTop), positionBottom) }, { children: _jsx(Joystick, __assign({ size: 100, baseColor: "#2D2D2D", stickColor: "##303134", throttle: 500 }, props)) })));
|
|
21
43
|
}, [props]);
|
|
22
|
-
return (_jsx(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
44
|
+
return (_jsx(Watcher, __assign({ initialValues: {
|
|
45
|
+
isShow: true,
|
|
46
|
+
}, scene: scene, names: "control-visible" }, { children: function (_a) {
|
|
47
|
+
var isShow = _a.isShow;
|
|
48
|
+
return (isShow ? (render ? render(el) : el) : null);
|
|
49
|
+
} })));
|
|
28
50
|
}
|
|
@@ -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,kBAAkB,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAQ7D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAW,YAAY,EAAE,MAAM,WAAW,CAAC;AAGlD,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,MAAM,CAAC;IACrB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,QAAQ,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;CACxC,CAAC;AAEF,aAAK,gBAAgB,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,
|
|
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,kBAAkB,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAQ7D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAW,YAAY,EAAE,MAAM,WAAW,CAAC;AAGlD,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,MAAM,CAAC;IACrB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,QAAQ,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;CACxC,CAAC;AAEF,aAAK,gBAAgB,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,eA4IlB"}
|
|
@@ -93,5 +93,5 @@ export function SceneRunner(_a) {
|
|
|
93
93
|
}
|
|
94
94
|
return rendered;
|
|
95
95
|
})()
|
|
96
|
-
: assetsLoader })) : (_jsx(_Fragment, { children: isBootDone ? (
|
|
96
|
+
: assetsLoader })) : (_jsx(_Fragment, { children: isBootDone ? (_jsx(ScalerContainer, __assign({ value: refScaler.current.value, height: height, width: width }, { children: _jsxs(FloatContainer, { children: [_jsx(current.UI, __assign({ scene: current }, current.UIProps)), joystick && _jsx(Control, __assign({ scene: current }, joystick))] }) }))) : (_jsx("div", {})) })) }))] })));
|
|
97
97
|
}
|