promogame-player 2.0.6 → 2.0.7
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.
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { jsxs as E, jsx as
|
|
1
|
+
import { jsxs as E, jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import * as M from "react";
|
|
3
|
-
import { useState as
|
|
4
|
-
import
|
|
3
|
+
import { useState as o, useRef as R, useImperativeHandle as y, useEffect as m, useMemo as $ } from "react";
|
|
4
|
+
import j from "../../hooks/use-broadcast-channel.js";
|
|
5
5
|
import { cn as p } from "../../utils.js";
|
|
6
|
-
import { DefaultLoading as
|
|
6
|
+
import { DefaultLoading as x } from "./default-loading.js";
|
|
7
7
|
const L = M.forwardRef(
|
|
8
|
-
({ className: h, gameLink:
|
|
9
|
-
const [e, w] =
|
|
10
|
-
|
|
8
|
+
({ className: h, gameLink: t, loadingComponent: r, controlLoading: l, campaign: c }, v) => {
|
|
9
|
+
const [e, w] = o(!1), g = R(null);
|
|
10
|
+
y(
|
|
11
11
|
v,
|
|
12
12
|
() => ({
|
|
13
13
|
canvas: g.current,
|
|
@@ -18,48 +18,55 @@ const L = M.forwardRef(
|
|
|
18
18
|
}),
|
|
19
19
|
[]
|
|
20
20
|
);
|
|
21
|
-
const [
|
|
21
|
+
const [n, C] = o(!1), { message: i } = j("defold_channel");
|
|
22
22
|
m(() => {
|
|
23
23
|
i === "loading_completed" && (console.log("Game init completed"), C(!0));
|
|
24
24
|
}, [i]), m(() => {
|
|
25
|
-
const
|
|
26
|
-
return
|
|
25
|
+
const a = document.createElement("script");
|
|
26
|
+
return a.src = `${t}/dmloader.js`, a.async = !0, a.onload = () => {
|
|
27
27
|
window.CUSTOM_PARAMETERS = {
|
|
28
28
|
...window.CUSTOM_PARAMETERS,
|
|
29
29
|
start_success: () => {
|
|
30
30
|
w(!0);
|
|
31
31
|
},
|
|
32
|
-
archive_location_filter: (_) => `${
|
|
32
|
+
archive_location_filter: (_) => `${t}/archive${_}`,
|
|
33
33
|
resize_window_callback: () => {
|
|
34
34
|
}
|
|
35
|
-
}, window.EngineLoader.load("canvas", `${
|
|
36
|
-
}, document.body.appendChild(
|
|
37
|
-
document.body.removeChild(
|
|
35
|
+
}, window.EngineLoader.load("canvas", `${t}/luckywheel`);
|
|
36
|
+
}, document.body.appendChild(a), () => {
|
|
37
|
+
document.body.removeChild(a);
|
|
38
38
|
};
|
|
39
|
-
}, [
|
|
40
|
-
const [d, u] =
|
|
41
|
-
if (!e || !
|
|
39
|
+
}, [t]);
|
|
40
|
+
const [d, u] = o(!1), f = $(() => {
|
|
41
|
+
if (!e || !n || l && !d)
|
|
42
42
|
return !0;
|
|
43
|
-
}, [e,
|
|
43
|
+
}, [e, n, l, d]);
|
|
44
44
|
return /* @__PURE__ */ E("div", { className: "relative h-full w-full", children: [
|
|
45
|
-
/* @__PURE__ */
|
|
45
|
+
/* @__PURE__ */ s("div", { className: p("absolute inset-0 z-10 flex items-center justify-center", !f && "hidden"), children: f && (r ? /* @__PURE__ */ s(
|
|
46
46
|
r,
|
|
47
47
|
{
|
|
48
48
|
campaign: c,
|
|
49
49
|
progress: e ? 0.95 : 0.5,
|
|
50
|
-
loadingCompleted: e &&
|
|
50
|
+
loadingCompleted: e && n,
|
|
51
51
|
closeLoading: () => u(!0)
|
|
52
52
|
}
|
|
53
|
-
) : /* @__PURE__ */
|
|
54
|
-
|
|
53
|
+
) : /* @__PURE__ */ s(
|
|
54
|
+
x,
|
|
55
55
|
{
|
|
56
56
|
campaign: c,
|
|
57
57
|
progress: e ? 0.95 : 0.5,
|
|
58
|
-
loadingCompleted: e &&
|
|
58
|
+
loadingCompleted: e && n,
|
|
59
59
|
closeLoading: () => u(!0)
|
|
60
60
|
}
|
|
61
61
|
)) }),
|
|
62
|
-
/* @__PURE__ */
|
|
62
|
+
/* @__PURE__ */ s("div", { id: "app-container", className: p("canvas-app-container h-full w-full", h, !e && "hidden"), children: /* @__PURE__ */ s(
|
|
63
|
+
"div",
|
|
64
|
+
{
|
|
65
|
+
id: "canvas-container",
|
|
66
|
+
className: "canvas-app-canvas-container flex h-full w-full items-center justify-center",
|
|
67
|
+
children: /* @__PURE__ */ s("canvas", { id: "canvas", width: "540", height: "1169", className: "canvas-app-canvas aspect-[1080/2337] h-full" })
|
|
68
|
+
}
|
|
69
|
+
) })
|
|
63
70
|
] });
|
|
64
71
|
}
|
|
65
72
|
);
|