react-simple-game-engine 0.3.29 → 0.3.30
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,11 +1,11 @@
|
|
1
|
-
import {
|
1
|
+
import { ReactElement, ReactNode } from "react";
|
2
2
|
import { IJoystickProps } from "./react-joystick-component/Joystick";
|
3
3
|
declare type TouchEvent = {
|
4
4
|
onPressed?: (container: HTMLDivElement, stick: HTMLButtonElement) => void;
|
5
5
|
onReleased?: (container: HTMLDivElement, stick: HTMLButtonElement) => void;
|
6
6
|
};
|
7
7
|
export declare type MovementControlProps = {
|
8
|
-
|
8
|
+
onLoaded?: (container: HTMLDivElement, stick: HTMLButtonElement) => void;
|
9
9
|
top?: number;
|
10
10
|
left?: number;
|
11
11
|
right?: number;
|
@@ -15,6 +15,6 @@ export declare type MovementControlProps = {
|
|
15
15
|
containerTouchEvent?: TouchEvent;
|
16
16
|
props?: Omit<IJoystickProps, "start" | "move" | "stop">;
|
17
17
|
};
|
18
|
-
export declare function MovementControl({ render, top, left, right, bottom, props, containerTouchEvent, joystickTouchEvent,
|
18
|
+
export declare function MovementControl({ render, top, left, right, bottom, props, containerTouchEvent, joystickTouchEvent, onLoaded, }: MovementControlProps): JSX.Element;
|
19
19
|
export {};
|
20
20
|
//# sourceMappingURL=movement-control.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"movement-control.d.ts","sourceRoot":"","sources":["../../src/ui-components/movement-control.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"movement-control.d.ts","sourceRoot":"","sources":["../../src/ui-components/movement-control.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EACZ,SAAS,EAKV,MAAM,OAAO,CAAC;AAMf,OAAO,EACL,cAAc,EAEf,MAAM,qCAAqC,CAAC;AAE7C,aAAK,UAAU,GAAG;IAChB,SAAS,CAAC,EAAE,CAAC,SAAS,EAAE,cAAc,EAAE,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC1E,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,cAAc,EAAE,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;CAC5E,CAAC;AACF,oBAAY,oBAAoB,GAAG;IACjC,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,cAAc,EAAE,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACzE,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,kBAAkB,CAAC,EAAE,UAAU,CAAC;IAChC,mBAAmB,CAAC,EAAE,UAAU,CAAC;IACjC,KAAK,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC,CAAC;CACzD,CAAC;AAEF,wBAAgB,eAAe,CAAC,EAC9B,MAAM,EACN,GAAG,EACH,IAAS,EACT,KAAK,EACL,MAAW,EACX,KAAK,EACL,mBAAmB,EACnB,kBAAkB,EAClB,QAAQ,GACT,EAAE,oBAAoB,eAyGtB"}
|
@@ -16,20 +16,18 @@ import { UISceneContext } from "../react-context";
|
|
16
16
|
import { Watcher } from "../utilities";
|
17
17
|
import { Joystick } from "./react-joystick-component";
|
18
18
|
export function MovementControl(_a) {
|
19
|
-
var 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, containerTouchEvent = _a.containerTouchEvent, joystickTouchEvent = _a.joystickTouchEvent,
|
19
|
+
var 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, containerTouchEvent = _a.containerTouchEvent, joystickTouchEvent = _a.joystickTouchEvent, onLoaded = _a.onLoaded;
|
20
20
|
var refJoyWrap = useRef(null);
|
21
21
|
var refStick = useRef(null);
|
22
22
|
var scene = useContext(UISceneContext);
|
23
23
|
var defaultShow = useMemo(function () {
|
24
24
|
return scene.getInitialData();
|
25
25
|
}, [scene]).joystick;
|
26
|
-
useEffect(function () {
|
27
|
-
if (containerRef) {
|
28
|
-
containerRef.current = refJoyWrap.current;
|
29
|
-
}
|
30
|
-
}, [containerRef]);
|
31
26
|
useEffect(function () {
|
32
27
|
refStick.current = refJoyWrap.current.querySelectorAll("button")[0];
|
28
|
+
onLoaded === null || onLoaded === void 0 ? void 0 : onLoaded(refJoyWrap.current, refStick.current);
|
29
|
+
}, [onLoaded]);
|
30
|
+
useEffect(function () {
|
33
31
|
if (!joystickTouchEvent) {
|
34
32
|
return;
|
35
33
|
}
|