@doodle-engine/react 0.0.8 → 0.0.10
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/CHANGELOG.md +16 -0
- package/dist/GameProvider.d.ts +14 -3
- package/dist/GameProvider.d.ts.map +1 -1
- package/dist/GameRenderer.d.ts.map +1 -1
- package/dist/GameShell.d.ts +11 -1
- package/dist/GameShell.d.ts.map +1 -1
- package/dist/components/Interlude.d.ts +13 -0
- package/dist/components/Interlude.d.ts.map +1 -0
- package/dist/components/LoadingScreen.d.ts +14 -0
- package/dist/components/LoadingScreen.d.ts.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/react.cjs +5 -4
- package/dist/react.js +463 -387
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
package/dist/react.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { VERSION as
|
|
3
|
-
import
|
|
1
|
+
import { enableDevTools as ie, Engine as ue } from "@doodle-engine/core";
|
|
2
|
+
import { VERSION as Ye } from "@doodle-engine/core";
|
|
3
|
+
import de, { createContext as me, useState as C, useEffect as $, useCallback as N, useContext as he, useRef as L } from "react";
|
|
4
4
|
var Z = { exports: {} }, z = {};
|
|
5
5
|
/**
|
|
6
6
|
* @license React
|
|
@@ -11,22 +11,22 @@ var Z = { exports: {} }, z = {};
|
|
|
11
11
|
* This source code is licensed under the MIT license found in the
|
|
12
12
|
* LICENSE file in the root directory of this source tree.
|
|
13
13
|
*/
|
|
14
|
-
var
|
|
15
|
-
function
|
|
16
|
-
if (
|
|
17
|
-
|
|
14
|
+
var ne;
|
|
15
|
+
function fe() {
|
|
16
|
+
if (ne) return z;
|
|
17
|
+
ne = 1;
|
|
18
18
|
var n = Symbol.for("react.transitional.element"), s = Symbol.for("react.fragment");
|
|
19
19
|
function r(a, l, o) {
|
|
20
|
-
var
|
|
21
|
-
if (o !== void 0 && (
|
|
20
|
+
var d = null;
|
|
21
|
+
if (o !== void 0 && (d = "" + o), l.key !== void 0 && (d = "" + l.key), "key" in l) {
|
|
22
22
|
o = {};
|
|
23
|
-
for (var
|
|
24
|
-
|
|
23
|
+
for (var m in l)
|
|
24
|
+
m !== "key" && (o[m] = l[m]);
|
|
25
25
|
} else o = l;
|
|
26
26
|
return l = o.ref, {
|
|
27
27
|
$$typeof: n,
|
|
28
28
|
type: a,
|
|
29
|
-
key:
|
|
29
|
+
key: d,
|
|
30
30
|
ref: l !== void 0 ? l : null,
|
|
31
31
|
props: o
|
|
32
32
|
};
|
|
@@ -43,47 +43,47 @@ var B = {};
|
|
|
43
43
|
* This source code is licensed under the MIT license found in the
|
|
44
44
|
* LICENSE file in the root directory of this source tree.
|
|
45
45
|
*/
|
|
46
|
-
var
|
|
47
|
-
function
|
|
48
|
-
return
|
|
46
|
+
var te;
|
|
47
|
+
function pe() {
|
|
48
|
+
return te || (te = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
49
49
|
function n(t) {
|
|
50
50
|
if (t == null) return null;
|
|
51
51
|
if (typeof t == "function")
|
|
52
52
|
return t.$$typeof === y ? null : t.displayName || t.name || null;
|
|
53
53
|
if (typeof t == "string") return t;
|
|
54
54
|
switch (t) {
|
|
55
|
-
case
|
|
55
|
+
case p:
|
|
56
56
|
return "Fragment";
|
|
57
|
-
case
|
|
57
|
+
case x:
|
|
58
58
|
return "Profiler";
|
|
59
|
-
case
|
|
59
|
+
case u:
|
|
60
60
|
return "StrictMode";
|
|
61
|
-
case
|
|
61
|
+
case W:
|
|
62
62
|
return "Suspense";
|
|
63
|
-
case
|
|
63
|
+
case P:
|
|
64
64
|
return "SuspenseList";
|
|
65
|
-
case
|
|
65
|
+
case b:
|
|
66
66
|
return "Activity";
|
|
67
67
|
}
|
|
68
68
|
if (typeof t == "object")
|
|
69
69
|
switch (typeof t.tag == "number" && console.error(
|
|
70
70
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
71
71
|
), t.$$typeof) {
|
|
72
|
-
case
|
|
72
|
+
case f:
|
|
73
73
|
return "Portal";
|
|
74
|
-
case
|
|
74
|
+
case F:
|
|
75
75
|
return t.displayName || "Context";
|
|
76
|
-
case
|
|
76
|
+
case A:
|
|
77
77
|
return (t._context.displayName || "Context") + ".Consumer";
|
|
78
|
-
case
|
|
79
|
-
var
|
|
80
|
-
return t = t.displayName, t || (t =
|
|
81
|
-
case
|
|
82
|
-
return
|
|
83
|
-
case
|
|
84
|
-
|
|
78
|
+
case U:
|
|
79
|
+
var i = t.render;
|
|
80
|
+
return t = t.displayName, t || (t = i.displayName || i.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
|
|
81
|
+
case D:
|
|
82
|
+
return i = t.displayName || null, i !== null ? i : n(t.type) || "Memo";
|
|
83
|
+
case c:
|
|
84
|
+
i = t._payload, t = t._init;
|
|
85
85
|
try {
|
|
86
|
-
return n(t(
|
|
86
|
+
return n(t(i));
|
|
87
87
|
} catch {
|
|
88
88
|
}
|
|
89
89
|
}
|
|
@@ -95,27 +95,27 @@ function ve() {
|
|
|
95
95
|
function r(t) {
|
|
96
96
|
try {
|
|
97
97
|
s(t);
|
|
98
|
-
var
|
|
98
|
+
var i = !1;
|
|
99
99
|
} catch {
|
|
100
|
-
|
|
100
|
+
i = !0;
|
|
101
101
|
}
|
|
102
|
-
if (
|
|
103
|
-
|
|
104
|
-
var
|
|
105
|
-
return
|
|
106
|
-
|
|
102
|
+
if (i) {
|
|
103
|
+
i = console;
|
|
104
|
+
var k = i.error, w = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
|
|
105
|
+
return k.call(
|
|
106
|
+
i,
|
|
107
107
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
108
|
-
|
|
108
|
+
w
|
|
109
109
|
), s(t);
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
function a(t) {
|
|
113
|
-
if (t ===
|
|
114
|
-
if (typeof t == "object" && t !== null && t.$$typeof ===
|
|
113
|
+
if (t === p) return "<>";
|
|
114
|
+
if (typeof t == "object" && t !== null && t.$$typeof === c)
|
|
115
115
|
return "<...>";
|
|
116
116
|
try {
|
|
117
|
-
var
|
|
118
|
-
return
|
|
117
|
+
var i = n(t);
|
|
118
|
+
return i ? "<" + i + ">" : "<...>";
|
|
119
119
|
} catch {
|
|
120
120
|
return "<...>";
|
|
121
121
|
}
|
|
@@ -127,42 +127,42 @@ function ve() {
|
|
|
127
127
|
function o() {
|
|
128
128
|
return Error("react-stack-top-frame");
|
|
129
129
|
}
|
|
130
|
-
function
|
|
130
|
+
function d(t) {
|
|
131
131
|
if (M.call(t, "key")) {
|
|
132
|
-
var
|
|
133
|
-
if (
|
|
132
|
+
var i = Object.getOwnPropertyDescriptor(t, "key").get;
|
|
133
|
+
if (i && i.isReactWarning) return !1;
|
|
134
134
|
}
|
|
135
135
|
return t.key !== void 0;
|
|
136
136
|
}
|
|
137
|
-
function
|
|
138
|
-
function
|
|
139
|
-
|
|
137
|
+
function m(t, i) {
|
|
138
|
+
function k() {
|
|
139
|
+
I || (I = !0, console.error(
|
|
140
140
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
141
|
-
|
|
141
|
+
i
|
|
142
142
|
));
|
|
143
143
|
}
|
|
144
|
-
|
|
145
|
-
get:
|
|
144
|
+
k.isReactWarning = !0, Object.defineProperty(t, "key", {
|
|
145
|
+
get: k,
|
|
146
146
|
configurable: !0
|
|
147
147
|
});
|
|
148
148
|
}
|
|
149
|
-
function
|
|
149
|
+
function v() {
|
|
150
150
|
var t = n(this.type);
|
|
151
|
-
return
|
|
151
|
+
return G[t] || (G[t] = !0, console.error(
|
|
152
152
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
153
153
|
)), t = this.props.ref, t !== void 0 ? t : null;
|
|
154
154
|
}
|
|
155
|
-
function g(t,
|
|
156
|
-
var
|
|
155
|
+
function g(t, i, k, w, X, K) {
|
|
156
|
+
var T = k.ref;
|
|
157
157
|
return t = {
|
|
158
|
-
$$typeof:
|
|
158
|
+
$$typeof: h,
|
|
159
159
|
type: t,
|
|
160
|
-
key:
|
|
161
|
-
props:
|
|
162
|
-
_owner:
|
|
163
|
-
}, (
|
|
160
|
+
key: i,
|
|
161
|
+
props: k,
|
|
162
|
+
_owner: w
|
|
163
|
+
}, (T !== void 0 ? T : null) !== null ? Object.defineProperty(t, "ref", {
|
|
164
164
|
enumerable: !1,
|
|
165
|
-
get:
|
|
165
|
+
get: v
|
|
166
166
|
}) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
|
|
167
167
|
configurable: !1,
|
|
168
168
|
enumerable: !1,
|
|
@@ -177,7 +177,7 @@ function ve() {
|
|
|
177
177
|
configurable: !1,
|
|
178
178
|
enumerable: !1,
|
|
179
179
|
writable: !0,
|
|
180
|
-
value:
|
|
180
|
+
value: X
|
|
181
181
|
}), Object.defineProperty(t, "_debugTask", {
|
|
182
182
|
configurable: !1,
|
|
183
183
|
enumerable: !1,
|
|
@@ -185,291 +185,298 @@ function ve() {
|
|
|
185
185
|
value: K
|
|
186
186
|
}), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
|
|
187
187
|
}
|
|
188
|
-
function
|
|
189
|
-
var
|
|
190
|
-
if (
|
|
191
|
-
if (
|
|
192
|
-
if (Y(
|
|
193
|
-
for (
|
|
194
|
-
R(
|
|
195
|
-
Object.freeze && Object.freeze(
|
|
188
|
+
function j(t, i, k, w, X, K) {
|
|
189
|
+
var T = i.children;
|
|
190
|
+
if (T !== void 0)
|
|
191
|
+
if (w)
|
|
192
|
+
if (Y(T)) {
|
|
193
|
+
for (w = 0; w < T.length; w++)
|
|
194
|
+
R(T[w]);
|
|
195
|
+
Object.freeze && Object.freeze(T);
|
|
196
196
|
} else
|
|
197
197
|
console.error(
|
|
198
198
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
199
199
|
);
|
|
200
|
-
else R(
|
|
201
|
-
if (M.call(
|
|
202
|
-
|
|
203
|
-
var
|
|
200
|
+
else R(T);
|
|
201
|
+
if (M.call(i, "key")) {
|
|
202
|
+
T = n(t);
|
|
203
|
+
var q = Object.keys(i).filter(function(ce) {
|
|
204
204
|
return ce !== "key";
|
|
205
205
|
});
|
|
206
|
-
|
|
206
|
+
w = 0 < q.length ? "{key: someKey, " + q.join(": ..., ") + ": ...}" : "{key: someKey}", E[T + w] || (q = 0 < q.length ? "{" + q.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
207
207
|
`A props object containing a "key" prop is being spread into JSX:
|
|
208
208
|
let props = %s;
|
|
209
209
|
<%s {...props} />
|
|
210
210
|
React keys must be passed directly to JSX without using spread:
|
|
211
211
|
let props = %s;
|
|
212
212
|
<%s key={someKey} {...props} />`,
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
),
|
|
213
|
+
w,
|
|
214
|
+
T,
|
|
215
|
+
q,
|
|
216
|
+
T
|
|
217
|
+
), E[T + w] = !0);
|
|
218
218
|
}
|
|
219
|
-
if (
|
|
220
|
-
|
|
221
|
-
for (var ee in
|
|
222
|
-
ee !== "key" && (
|
|
223
|
-
} else
|
|
224
|
-
return
|
|
225
|
-
|
|
219
|
+
if (T = null, k !== void 0 && (r(k), T = "" + k), d(i) && (r(i.key), T = "" + i.key), "key" in i) {
|
|
220
|
+
k = {};
|
|
221
|
+
for (var ee in i)
|
|
222
|
+
ee !== "key" && (k[ee] = i[ee]);
|
|
223
|
+
} else k = i;
|
|
224
|
+
return T && m(
|
|
225
|
+
k,
|
|
226
226
|
typeof t == "function" ? t.displayName || t.name || "Unknown" : t
|
|
227
227
|
), g(
|
|
228
228
|
t,
|
|
229
|
+
T,
|
|
229
230
|
k,
|
|
230
|
-
j,
|
|
231
231
|
l(),
|
|
232
|
-
|
|
232
|
+
X,
|
|
233
233
|
K
|
|
234
234
|
);
|
|
235
235
|
}
|
|
236
236
|
function R(t) {
|
|
237
|
-
|
|
237
|
+
_(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === c && (t._payload.status === "fulfilled" ? _(t._payload.value) && t._payload.value._store && (t._payload.value._store.validated = 1) : t._store && (t._store.validated = 1));
|
|
238
238
|
}
|
|
239
|
-
function
|
|
240
|
-
return typeof t == "object" && t !== null && t.$$typeof ===
|
|
239
|
+
function _(t) {
|
|
240
|
+
return typeof t == "object" && t !== null && t.$$typeof === h;
|
|
241
241
|
}
|
|
242
|
-
var
|
|
242
|
+
var S = de, h = Symbol.for("react.transitional.element"), f = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), u = Symbol.for("react.strict_mode"), x = Symbol.for("react.profiler"), A = Symbol.for("react.consumer"), F = Symbol.for("react.context"), U = Symbol.for("react.forward_ref"), W = Symbol.for("react.suspense"), P = Symbol.for("react.suspense_list"), D = Symbol.for("react.memo"), c = Symbol.for("react.lazy"), b = Symbol.for("react.activity"), y = Symbol.for("react.client.reference"), O = S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, M = Object.prototype.hasOwnProperty, Y = Array.isArray, V = console.createTask ? console.createTask : function() {
|
|
243
243
|
return null;
|
|
244
244
|
};
|
|
245
|
-
|
|
245
|
+
S = {
|
|
246
246
|
react_stack_bottom_frame: function(t) {
|
|
247
247
|
return t();
|
|
248
248
|
}
|
|
249
249
|
};
|
|
250
|
-
var
|
|
251
|
-
|
|
250
|
+
var I, G = {}, J = S.react_stack_bottom_frame.bind(
|
|
251
|
+
S,
|
|
252
252
|
o
|
|
253
|
-
)(),
|
|
254
|
-
B.Fragment =
|
|
255
|
-
var
|
|
256
|
-
return
|
|
253
|
+
)(), Q = V(a(o)), E = {};
|
|
254
|
+
B.Fragment = p, B.jsx = function(t, i, k) {
|
|
255
|
+
var w = 1e4 > O.recentlyCreatedOwnerStacks++;
|
|
256
|
+
return j(
|
|
257
257
|
t,
|
|
258
|
-
|
|
259
|
-
|
|
258
|
+
i,
|
|
259
|
+
k,
|
|
260
260
|
!1,
|
|
261
|
-
|
|
262
|
-
|
|
261
|
+
w ? Error("react-stack-top-frame") : J,
|
|
262
|
+
w ? V(a(t)) : Q
|
|
263
263
|
);
|
|
264
|
-
}, B.jsxs = function(t,
|
|
265
|
-
var
|
|
266
|
-
return
|
|
264
|
+
}, B.jsxs = function(t, i, k) {
|
|
265
|
+
var w = 1e4 > O.recentlyCreatedOwnerStacks++;
|
|
266
|
+
return j(
|
|
267
267
|
t,
|
|
268
|
-
|
|
269
|
-
|
|
268
|
+
i,
|
|
269
|
+
k,
|
|
270
270
|
!0,
|
|
271
|
-
|
|
272
|
-
|
|
271
|
+
w ? Error("react-stack-top-frame") : J,
|
|
272
|
+
w ? V(a(t)) : Q
|
|
273
273
|
);
|
|
274
274
|
};
|
|
275
275
|
})()), B;
|
|
276
276
|
}
|
|
277
277
|
var se;
|
|
278
|
-
function
|
|
279
|
-
return se || (se = 1, process.env.NODE_ENV === "production" ? Z.exports =
|
|
278
|
+
function ve() {
|
|
279
|
+
return se || (se = 1, process.env.NODE_ENV === "production" ? Z.exports = fe() : Z.exports = pe()), Z.exports;
|
|
280
280
|
}
|
|
281
|
-
var e =
|
|
282
|
-
const ae =
|
|
283
|
-
function
|
|
284
|
-
const [
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
281
|
+
var e = ve();
|
|
282
|
+
const ae = me(null);
|
|
283
|
+
function xe({ engine: n, initialSnapshot: s, children: r, devTools: a = !1 }) {
|
|
284
|
+
const [l, o] = C(s);
|
|
285
|
+
$(() => {
|
|
286
|
+
if (a)
|
|
287
|
+
return ie(n, () => o(n.getSnapshot())), () => {
|
|
288
|
+
delete window.doodle;
|
|
289
|
+
};
|
|
290
|
+
}, [n, a]);
|
|
291
|
+
const d = N(
|
|
292
|
+
(u) => {
|
|
293
|
+
const x = n.selectChoice(u);
|
|
294
|
+
o(x);
|
|
291
295
|
},
|
|
292
296
|
[n]
|
|
293
297
|
), m = N(
|
|
294
|
-
(
|
|
295
|
-
const
|
|
296
|
-
|
|
297
|
-
},
|
|
298
|
-
[n]
|
|
299
|
-
), h = N(
|
|
300
|
-
(i) => {
|
|
301
|
-
const u = n.takeItem(i);
|
|
302
|
-
l(u);
|
|
298
|
+
(u) => {
|
|
299
|
+
const x = n.talkTo(u);
|
|
300
|
+
o(x);
|
|
303
301
|
},
|
|
304
302
|
[n]
|
|
305
|
-
),
|
|
306
|
-
(
|
|
307
|
-
const
|
|
308
|
-
|
|
303
|
+
), v = N(
|
|
304
|
+
(u) => {
|
|
305
|
+
const x = n.takeItem(u);
|
|
306
|
+
o(x);
|
|
309
307
|
},
|
|
310
308
|
[n]
|
|
311
309
|
), g = N(
|
|
312
|
-
(
|
|
313
|
-
const
|
|
314
|
-
|
|
310
|
+
(u) => {
|
|
311
|
+
const x = n.travelTo(u);
|
|
312
|
+
o(x);
|
|
315
313
|
},
|
|
316
314
|
[n]
|
|
317
|
-
),
|
|
318
|
-
(
|
|
319
|
-
const
|
|
320
|
-
|
|
315
|
+
), j = N(
|
|
316
|
+
(u, x) => {
|
|
317
|
+
const A = n.writeNote(u, x);
|
|
318
|
+
o(A);
|
|
321
319
|
},
|
|
322
320
|
[n]
|
|
323
321
|
), R = N(
|
|
324
|
-
(
|
|
325
|
-
const
|
|
326
|
-
|
|
322
|
+
(u) => {
|
|
323
|
+
const x = n.deleteNote(u);
|
|
324
|
+
o(x);
|
|
327
325
|
},
|
|
328
326
|
[n]
|
|
329
|
-
),
|
|
330
|
-
(
|
|
331
|
-
const
|
|
332
|
-
|
|
327
|
+
), _ = N(
|
|
328
|
+
(u) => {
|
|
329
|
+
const x = n.setLocale(u);
|
|
330
|
+
o(x);
|
|
333
331
|
},
|
|
334
332
|
[n]
|
|
335
|
-
),
|
|
336
|
-
|
|
333
|
+
), S = N(() => n.saveGame(), [n]), h = N(
|
|
334
|
+
(u) => {
|
|
335
|
+
const x = n.loadGame(u);
|
|
336
|
+
o(x);
|
|
337
|
+
},
|
|
338
|
+
[n]
|
|
339
|
+
), f = N(() => {
|
|
340
|
+
o(n.getSnapshot());
|
|
341
|
+
}, [n]), p = {
|
|
342
|
+
snapshot: l,
|
|
337
343
|
actions: {
|
|
338
|
-
selectChoice:
|
|
344
|
+
selectChoice: d,
|
|
339
345
|
talkTo: m,
|
|
340
|
-
takeItem:
|
|
341
|
-
travelTo:
|
|
342
|
-
writeNote:
|
|
343
|
-
deleteNote:
|
|
344
|
-
setLocale:
|
|
345
|
-
saveGame:
|
|
346
|
-
loadGame:
|
|
346
|
+
takeItem: v,
|
|
347
|
+
travelTo: g,
|
|
348
|
+
writeNote: j,
|
|
349
|
+
deleteNote: R,
|
|
350
|
+
setLocale: _,
|
|
351
|
+
saveGame: S,
|
|
352
|
+
loadGame: h,
|
|
353
|
+
dismissInterlude: f
|
|
347
354
|
}
|
|
348
355
|
};
|
|
349
|
-
return /* @__PURE__ */ e.jsx(ae.Provider, { value:
|
|
356
|
+
return /* @__PURE__ */ e.jsx(ae.Provider, { value: p, children: r });
|
|
350
357
|
}
|
|
351
358
|
function re() {
|
|
352
|
-
const n =
|
|
359
|
+
const n = he(ae);
|
|
353
360
|
if (!n)
|
|
354
361
|
throw new Error("useGame must be used within a GameProvider");
|
|
355
362
|
return n;
|
|
356
363
|
}
|
|
357
364
|
function le(n, s = {}) {
|
|
358
|
-
var
|
|
365
|
+
var D;
|
|
359
366
|
const {
|
|
360
367
|
audioBasePath: r = "/audio",
|
|
361
368
|
masterVolume: a = 1,
|
|
362
369
|
musicVolume: l = 0.7,
|
|
363
370
|
soundVolume: o = 0.8,
|
|
364
|
-
voiceVolume:
|
|
365
|
-
crossfadeDuration:
|
|
366
|
-
} = s, [
|
|
367
|
-
|
|
368
|
-
const
|
|
369
|
-
|
|
370
|
-
const
|
|
371
|
-
return
|
|
372
|
-
|
|
371
|
+
voiceVolume: d = 1,
|
|
372
|
+
crossfadeDuration: m = 1e3
|
|
373
|
+
} = s, [v, g] = C(a), [j, R] = C(l), [_, S] = C(o), [h, f] = C(d), p = L(null), u = L(null), x = L(null), A = L(null);
|
|
374
|
+
$(() => {
|
|
375
|
+
const c = new Audio();
|
|
376
|
+
c.loop = !0, p.current = c;
|
|
377
|
+
const b = new Audio();
|
|
378
|
+
return u.current = b, () => {
|
|
379
|
+
A.current && clearInterval(A.current), c.pause(), b.pause(), c.src = "", b.src = "";
|
|
373
380
|
};
|
|
374
|
-
}, []),
|
|
375
|
-
const
|
|
376
|
-
if (!
|
|
377
|
-
const
|
|
378
|
-
if (
|
|
379
|
-
if (
|
|
380
|
-
|
|
381
|
+
}, []), $(() => {
|
|
382
|
+
const c = p.current;
|
|
383
|
+
if (!c) return;
|
|
384
|
+
const b = n.music;
|
|
385
|
+
if (b !== x.current)
|
|
386
|
+
if (x.current = b, !b)
|
|
387
|
+
U(c, m);
|
|
381
388
|
else {
|
|
382
|
-
const y = `${r}/music/${
|
|
383
|
-
|
|
389
|
+
const y = `${r}/music/${b}`;
|
|
390
|
+
F(c, y, m);
|
|
384
391
|
}
|
|
385
|
-
|
|
386
|
-
}, [n.music,
|
|
392
|
+
c.volume = v * j;
|
|
393
|
+
}, [n.music, v, j, r, m]), $(() => {
|
|
387
394
|
var y;
|
|
388
|
-
const
|
|
389
|
-
if (!
|
|
390
|
-
const
|
|
391
|
-
|
|
395
|
+
const c = u.current;
|
|
396
|
+
if (!c) return;
|
|
397
|
+
const b = (y = n.dialogue) == null ? void 0 : y.voice;
|
|
398
|
+
b && (c.pause(), c.currentTime = 0, c.src = `${r}/voice/${b}`, c.volume = v * h, c.play().catch((O) => {
|
|
392
399
|
console.warn("Voice playback failed:", O);
|
|
393
400
|
}));
|
|
394
|
-
}, [(
|
|
395
|
-
n.pendingSounds.length !== 0 && n.pendingSounds.forEach((
|
|
396
|
-
const
|
|
397
|
-
|
|
401
|
+
}, [(D = n.dialogue) == null ? void 0 : D.voice, v, h, r]), $(() => {
|
|
402
|
+
n.pendingSounds.length !== 0 && n.pendingSounds.forEach((c) => {
|
|
403
|
+
const b = new Audio(`${r}/sfx/${c}`);
|
|
404
|
+
b.volume = v * _, b.play().catch((y) => {
|
|
398
405
|
console.warn("Sound playback failed:", y);
|
|
399
406
|
});
|
|
400
407
|
});
|
|
401
|
-
}, [n.pendingSounds,
|
|
402
|
-
const
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
408
|
+
}, [n.pendingSounds, v, _, r]);
|
|
409
|
+
const F = (c, b, y) => {
|
|
410
|
+
U(c, y / 2).then(() => {
|
|
411
|
+
c.src = b, c.load(), c.volume = 0, c.play().then(() => {
|
|
412
|
+
W(c, y / 2, v * j);
|
|
406
413
|
}).catch((O) => {
|
|
407
414
|
console.warn("Music playback failed:", O);
|
|
408
415
|
});
|
|
409
416
|
});
|
|
410
|
-
},
|
|
411
|
-
const O =
|
|
412
|
-
let
|
|
413
|
-
const
|
|
414
|
-
|
|
417
|
+
}, U = (c, b) => new Promise((y) => {
|
|
418
|
+
const O = c.volume, M = 20, Y = b / M, V = O / M;
|
|
419
|
+
let I = 0;
|
|
420
|
+
const G = setInterval(() => {
|
|
421
|
+
I++, c.volume = Math.max(0, O - V * I), I >= M && (clearInterval(G), c.pause(), c.currentTime = 0, y());
|
|
415
422
|
}, Y);
|
|
416
|
-
|
|
417
|
-
}),
|
|
418
|
-
const M =
|
|
419
|
-
let
|
|
420
|
-
const
|
|
421
|
-
|
|
423
|
+
A.current = G;
|
|
424
|
+
}), W = (c, b, y) => {
|
|
425
|
+
const M = b / 20, Y = y / 20;
|
|
426
|
+
let V = 0;
|
|
427
|
+
const I = setInterval(() => {
|
|
428
|
+
V++, c.volume = Math.min(y, Y * V), V >= 20 && clearInterval(I);
|
|
422
429
|
}, M);
|
|
423
|
-
|
|
430
|
+
A.current = I;
|
|
424
431
|
};
|
|
425
432
|
return {
|
|
426
433
|
setMasterVolume: g,
|
|
427
434
|
setMusicVolume: R,
|
|
428
|
-
setSoundVolume:
|
|
429
|
-
setVoiceVolume:
|
|
435
|
+
setSoundVolume: S,
|
|
436
|
+
setVoiceVolume: f,
|
|
430
437
|
stopAll: () => {
|
|
431
|
-
|
|
438
|
+
p.current && (p.current.pause(), p.current.currentTime = 0), u.current && (u.current.pause(), u.current.currentTime = 0);
|
|
432
439
|
}
|
|
433
440
|
};
|
|
434
441
|
}
|
|
435
|
-
const
|
|
442
|
+
const je = {
|
|
436
443
|
click: "click.ogg",
|
|
437
444
|
menuOpen: "menu_open.ogg",
|
|
438
445
|
menuClose: "menu_close.ogg"
|
|
439
446
|
};
|
|
440
|
-
function
|
|
447
|
+
function Ne(n = {}) {
|
|
441
448
|
const {
|
|
442
449
|
enabled: s = !0,
|
|
443
450
|
basePath: r = "/audio/ui",
|
|
444
451
|
volume: a = 0.5,
|
|
445
452
|
sounds: l = {}
|
|
446
|
-
} = n, [o,
|
|
447
|
-
(
|
|
448
|
-
if (!o || !
|
|
449
|
-
const
|
|
450
|
-
|
|
453
|
+
} = n, [o, d] = C(s), [m, v] = C(a), g = L({ ...je, ...l }), j = N(
|
|
454
|
+
(f) => {
|
|
455
|
+
if (!o || !f) return;
|
|
456
|
+
const p = new Audio(`${r}/${f}`);
|
|
457
|
+
p.volume = m, p.play().catch(() => {
|
|
451
458
|
});
|
|
452
459
|
},
|
|
453
|
-
[o,
|
|
460
|
+
[o, m, r]
|
|
454
461
|
), R = N(
|
|
455
|
-
(
|
|
456
|
-
const
|
|
457
|
-
|
|
462
|
+
(f) => {
|
|
463
|
+
const p = g.current[f];
|
|
464
|
+
p && j(p);
|
|
458
465
|
},
|
|
459
|
-
[
|
|
460
|
-
),
|
|
466
|
+
[j]
|
|
467
|
+
), _ = N(() => j(g.current.click), [j]), S = N(() => j(g.current.menuOpen), [j]), h = N(() => j(g.current.menuClose), [j]);
|
|
461
468
|
return {
|
|
462
|
-
playClick:
|
|
463
|
-
playMenuOpen:
|
|
464
|
-
playMenuClose:
|
|
469
|
+
playClick: _,
|
|
470
|
+
playMenuOpen: S,
|
|
471
|
+
playMenuClose: h,
|
|
465
472
|
playSound: R,
|
|
466
|
-
setEnabled:
|
|
467
|
-
setVolume:
|
|
473
|
+
setEnabled: d,
|
|
474
|
+
setVolume: v,
|
|
468
475
|
enabled: o,
|
|
469
|
-
volume:
|
|
476
|
+
volume: m
|
|
470
477
|
};
|
|
471
478
|
}
|
|
472
|
-
function
|
|
479
|
+
function ge({ dialogue: n, className: s = "" }) {
|
|
473
480
|
return /* @__PURE__ */ e.jsxs("div", { className: `dialogue-box ${s}`, children: [
|
|
474
481
|
n.portrait && /* @__PURE__ */ e.jsx("div", { className: "dialogue-portrait", children: /* @__PURE__ */ e.jsx("img", { src: n.portrait, alt: n.speakerName }) }),
|
|
475
482
|
/* @__PURE__ */ e.jsxs("div", { className: "dialogue-content", children: [
|
|
@@ -489,7 +496,7 @@ function be({ choices: n, onSelectChoice: s, className: r = "" }) {
|
|
|
489
496
|
a.id
|
|
490
497
|
)) });
|
|
491
498
|
}
|
|
492
|
-
function
|
|
499
|
+
function ke({ location: n, className: s = "" }) {
|
|
493
500
|
return /* @__PURE__ */ e.jsxs("div", { className: `location-view ${s}`, children: [
|
|
494
501
|
n.banner && /* @__PURE__ */ e.jsx("div", { className: "location-banner", children: /* @__PURE__ */ e.jsx("img", { src: n.banner, alt: n.name }) }),
|
|
495
502
|
/* @__PURE__ */ e.jsxs("div", { className: "location-content", children: [
|
|
@@ -526,7 +533,7 @@ function Se({
|
|
|
526
533
|
)) })
|
|
527
534
|
] });
|
|
528
535
|
}
|
|
529
|
-
function
|
|
536
|
+
function ye({ items: n, className: s = "" }) {
|
|
530
537
|
const [r, a] = C(null);
|
|
531
538
|
return /* @__PURE__ */ e.jsxs("div", { className: `inventory ${s}`, children: [
|
|
532
539
|
/* @__PURE__ */ e.jsx("h2", { children: "Inventory" }),
|
|
@@ -550,7 +557,7 @@ function ke({ items: n, className: s = "" }) {
|
|
|
550
557
|
] }) })
|
|
551
558
|
] });
|
|
552
559
|
}
|
|
553
|
-
function
|
|
560
|
+
function Ee({ quests: n, entries: s, className: r = "" }) {
|
|
554
561
|
return /* @__PURE__ */ e.jsxs("div", { className: `journal ${r}`, children: [
|
|
555
562
|
/* @__PURE__ */ e.jsx("h2", { children: "Journal" }),
|
|
556
563
|
n.length > 0 && /* @__PURE__ */ e.jsxs("div", { className: "journal-quests", children: [
|
|
@@ -571,7 +578,7 @@ function ye({ quests: n, entries: s, className: r = "" }) {
|
|
|
571
578
|
n.length === 0 && s.length === 0 && /* @__PURE__ */ e.jsx("p", { className: "journal-empty", children: "No entries yet" })
|
|
572
579
|
] });
|
|
573
580
|
}
|
|
574
|
-
function
|
|
581
|
+
function we({ map: n, onTravelTo: s, className: r = "" }) {
|
|
575
582
|
return n ? /* @__PURE__ */ e.jsxs("div", { className: `map-view ${r}`, children: [
|
|
576
583
|
/* @__PURE__ */ e.jsx("h2", { children: n.name }),
|
|
577
584
|
/* @__PURE__ */ e.jsxs("div", { className: "map-container", style: { position: "relative" }, children: [
|
|
@@ -601,40 +608,99 @@ function Te({
|
|
|
601
608
|
}) {
|
|
602
609
|
return n.length === 0 ? null : /* @__PURE__ */ e.jsx("div", { className: `notification-area ${s}`, children: n.map((r, a) => /* @__PURE__ */ e.jsx("div", { className: "notification", children: r }, a)) });
|
|
603
610
|
}
|
|
604
|
-
function
|
|
611
|
+
function Re({
|
|
605
612
|
onSave: n,
|
|
606
613
|
onLoad: s,
|
|
607
614
|
storageKey: r = "doodle-engine-save",
|
|
608
615
|
className: a = ""
|
|
609
616
|
}) {
|
|
610
|
-
const [l, o] = C(""),
|
|
617
|
+
const [l, o] = C(""), d = () => {
|
|
611
618
|
const g = n();
|
|
612
619
|
localStorage.setItem(r, JSON.stringify(g)), o("Saved!"), setTimeout(() => o(""), 2e3);
|
|
613
|
-
},
|
|
620
|
+
}, m = () => {
|
|
614
621
|
const g = localStorage.getItem(r);
|
|
615
622
|
if (!g) {
|
|
616
623
|
o("No save found"), setTimeout(() => o(""), 2e3);
|
|
617
624
|
return;
|
|
618
625
|
}
|
|
619
|
-
const
|
|
620
|
-
s(
|
|
621
|
-
},
|
|
626
|
+
const j = JSON.parse(g);
|
|
627
|
+
s(j), o("Loaded!"), setTimeout(() => o(""), 2e3);
|
|
628
|
+
}, v = localStorage.getItem(r) !== null;
|
|
622
629
|
return /* @__PURE__ */ e.jsxs("div", { className: `save-load-panel ${a}`, children: [
|
|
623
|
-
/* @__PURE__ */ e.jsx("button", { className: "save-button", onClick:
|
|
624
|
-
/* @__PURE__ */ e.jsx("button", { className: "load-button", onClick:
|
|
630
|
+
/* @__PURE__ */ e.jsx("button", { className: "save-button", onClick: d, children: "Save" }),
|
|
631
|
+
/* @__PURE__ */ e.jsx("button", { className: "load-button", onClick: m, disabled: !v, children: "Load" }),
|
|
625
632
|
l && /* @__PURE__ */ e.jsx("span", { className: "save-load-message", children: l })
|
|
626
633
|
] });
|
|
627
634
|
}
|
|
635
|
+
function Ce({ interlude: n, onDismiss: s }) {
|
|
636
|
+
const r = L(null), a = L(null), l = L(null), o = L(null), [d, m] = C(!1), [v, g] = C(0), j = n.scrollSpeed, R = n.scroll;
|
|
637
|
+
$(() => {
|
|
638
|
+
if (!R || d) {
|
|
639
|
+
l.current !== null && (cancelAnimationFrame(l.current), l.current = null), o.current = null;
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
const h = (f) => {
|
|
643
|
+
o.current === null && (o.current = f);
|
|
644
|
+
const p = (f - o.current) / 1e3;
|
|
645
|
+
o.current = f, g((u) => {
|
|
646
|
+
const x = r.current, A = a.current;
|
|
647
|
+
if (!x || !A) return u;
|
|
648
|
+
const F = x.scrollHeight - A.clientHeight;
|
|
649
|
+
return u >= F ? u : u + j * p;
|
|
650
|
+
}), l.current = requestAnimationFrame(h);
|
|
651
|
+
};
|
|
652
|
+
return l.current = requestAnimationFrame(h), () => {
|
|
653
|
+
l.current !== null && (cancelAnimationFrame(l.current), l.current = null);
|
|
654
|
+
};
|
|
655
|
+
}, [R, d, j]), $(() => {
|
|
656
|
+
a.current && (a.current.scrollTop = v);
|
|
657
|
+
}, [v]);
|
|
658
|
+
const _ = N((h) => {
|
|
659
|
+
m(!0), g((f) => Math.max(0, f + h.deltaY));
|
|
660
|
+
}, []), S = N((h) => {
|
|
661
|
+
(h.key === "ArrowDown" || h.key === "ArrowUp") && (m(!0), g((f) => Math.max(0, f + (h.key === "ArrowDown" ? 40 : -40)))), (h.key === " " || h.key === "Enter" || h.key === "Escape") && (h.preventDefault(), s());
|
|
662
|
+
}, [s]);
|
|
663
|
+
return $(() => (window.addEventListener("keydown", S), () => window.removeEventListener("keydown", S)), [S]), /* @__PURE__ */ e.jsxs(
|
|
664
|
+
"div",
|
|
665
|
+
{
|
|
666
|
+
className: "interlude-overlay",
|
|
667
|
+
style: { backgroundImage: `url(${n.background})` },
|
|
668
|
+
onClick: s,
|
|
669
|
+
children: [
|
|
670
|
+
n.banner && /* @__PURE__ */ e.jsx("img", { className: "interlude-banner", src: n.banner, alt: "", "aria-hidden": "true" }),
|
|
671
|
+
/* @__PURE__ */ e.jsx(
|
|
672
|
+
"div",
|
|
673
|
+
{
|
|
674
|
+
ref: a,
|
|
675
|
+
className: "interlude-scroll-container",
|
|
676
|
+
onWheel: _,
|
|
677
|
+
onClick: (h) => h.stopPropagation(),
|
|
678
|
+
children: /* @__PURE__ */ e.jsx("div", { ref: r, className: "interlude-text", children: n.text.split(`
|
|
679
|
+
`).map((h, f) => /* @__PURE__ */ e.jsx("p", { children: h || " " }, f)) })
|
|
680
|
+
}
|
|
681
|
+
),
|
|
682
|
+
/* @__PURE__ */ e.jsx("button", { className: "interlude-skip-button", onClick: s, children: "Skip »" })
|
|
683
|
+
]
|
|
684
|
+
}
|
|
685
|
+
);
|
|
686
|
+
}
|
|
628
687
|
function _e({ className: n = "" }) {
|
|
629
688
|
const { snapshot: s, actions: r } = re();
|
|
630
689
|
le(s);
|
|
631
690
|
const a = Object.entries(s.variables).filter(([l]) => !l.startsWith("_"));
|
|
632
691
|
return /* @__PURE__ */ e.jsxs("div", { className: `game-renderer ${n}`, children: [
|
|
692
|
+
s.pendingInterlude && /* @__PURE__ */ e.jsx(
|
|
693
|
+
Ce,
|
|
694
|
+
{
|
|
695
|
+
interlude: s.pendingInterlude,
|
|
696
|
+
onDismiss: r.dismissInterlude
|
|
697
|
+
}
|
|
698
|
+
),
|
|
633
699
|
/* @__PURE__ */ e.jsx(Te, { notifications: s.notifications }),
|
|
634
700
|
/* @__PURE__ */ e.jsxs("div", { className: "game-main", children: [
|
|
635
|
-
/* @__PURE__ */ e.jsx(
|
|
701
|
+
/* @__PURE__ */ e.jsx(ke, { location: s.location }),
|
|
636
702
|
s.dialogue && /* @__PURE__ */ e.jsxs("div", { className: "dialogue-container", children: [
|
|
637
|
-
/* @__PURE__ */ e.jsx(
|
|
703
|
+
/* @__PURE__ */ e.jsx(ge, { dialogue: s.dialogue }),
|
|
638
704
|
/* @__PURE__ */ e.jsx(be, { choices: s.choices, onSelectChoice: r.selectChoice })
|
|
639
705
|
] }),
|
|
640
706
|
!s.dialogue && /* @__PURE__ */ e.jsx(
|
|
@@ -646,7 +712,7 @@ function _e({ className: n = "" }) {
|
|
|
646
712
|
)
|
|
647
713
|
] }),
|
|
648
714
|
/* @__PURE__ */ e.jsxs("div", { className: "game-sidebar", children: [
|
|
649
|
-
/* @__PURE__ */ e.jsx(
|
|
715
|
+
/* @__PURE__ */ e.jsx(Re, { onSave: r.saveGame, onLoad: r.loadGame }),
|
|
650
716
|
a.length > 0 && /* @__PURE__ */ e.jsxs("div", { className: "resources", children: [
|
|
651
717
|
/* @__PURE__ */ e.jsx("h2", { children: "Resources" }),
|
|
652
718
|
/* @__PURE__ */ e.jsx("ul", { className: "resources-list", children: a.map(([l, o]) => /* @__PURE__ */ e.jsxs("li", { className: "resource-entry", children: [
|
|
@@ -658,20 +724,20 @@ function _e({ className: n = "" }) {
|
|
|
658
724
|
/* @__PURE__ */ e.jsx("h2", { children: "Party" }),
|
|
659
725
|
/* @__PURE__ */ e.jsx("ul", { className: "party-list", children: s.party.map((l) => /* @__PURE__ */ e.jsx("li", { className: "party-member", children: /* @__PURE__ */ e.jsx("span", { className: "party-member-name", children: l.name }) }, l.id)) })
|
|
660
726
|
] }),
|
|
661
|
-
/* @__PURE__ */ e.jsx(
|
|
662
|
-
/* @__PURE__ */ e.jsx(
|
|
663
|
-
s.map && /* @__PURE__ */ e.jsx(
|
|
727
|
+
/* @__PURE__ */ e.jsx(ye, { items: s.inventory }),
|
|
728
|
+
/* @__PURE__ */ e.jsx(Ee, { quests: s.quests, entries: s.journal }),
|
|
729
|
+
s.map && /* @__PURE__ */ e.jsx(we, { map: s.map, onTravelTo: r.travelTo })
|
|
664
730
|
] })
|
|
665
731
|
] });
|
|
666
732
|
}
|
|
667
|
-
function
|
|
733
|
+
function Ae({
|
|
668
734
|
logoSrc: n,
|
|
669
735
|
title: s,
|
|
670
736
|
onComplete: r,
|
|
671
737
|
duration: a = 2e3,
|
|
672
738
|
className: l = ""
|
|
673
739
|
}) {
|
|
674
|
-
return
|
|
740
|
+
return $(() => {
|
|
675
741
|
const o = setTimeout(r, a);
|
|
676
742
|
return () => clearTimeout(o);
|
|
677
743
|
}, [r, a]), /* @__PURE__ */ e.jsxs("div", { className: `splash-screen ${l}`, onClick: r, children: [
|
|
@@ -680,28 +746,28 @@ function Ce({
|
|
|
680
746
|
/* @__PURE__ */ e.jsx("div", { className: "splash-loading", children: "Loading..." })
|
|
681
747
|
] });
|
|
682
748
|
}
|
|
683
|
-
function
|
|
749
|
+
function Pe({
|
|
684
750
|
title: n = "Doodle Engine",
|
|
685
751
|
subtitle: s,
|
|
686
752
|
logoSrc: r,
|
|
687
753
|
hasSaveData: a,
|
|
688
754
|
onNewGame: l,
|
|
689
755
|
onContinue: o,
|
|
690
|
-
onSettings:
|
|
691
|
-
className:
|
|
756
|
+
onSettings: d,
|
|
757
|
+
className: m = ""
|
|
692
758
|
}) {
|
|
693
|
-
return /* @__PURE__ */ e.jsxs("div", { className: `title-screen ${
|
|
759
|
+
return /* @__PURE__ */ e.jsxs("div", { className: `title-screen ${m}`, children: [
|
|
694
760
|
r && /* @__PURE__ */ e.jsx("img", { src: r, alt: n, className: "title-logo" }),
|
|
695
761
|
/* @__PURE__ */ e.jsx("h1", { className: "title-heading", children: n }),
|
|
696
762
|
s && /* @__PURE__ */ e.jsx("p", { className: "title-subtitle", children: s }),
|
|
697
763
|
/* @__PURE__ */ e.jsxs("div", { className: "title-menu", children: [
|
|
698
764
|
/* @__PURE__ */ e.jsx("button", { className: "title-button", onClick: l, children: "New Game" }),
|
|
699
765
|
a && /* @__PURE__ */ e.jsx("button", { className: "title-button", onClick: o, children: "Continue" }),
|
|
700
|
-
/* @__PURE__ */ e.jsx("button", { className: "title-button", onClick:
|
|
766
|
+
/* @__PURE__ */ e.jsx("button", { className: "title-button", onClick: d, children: "Settings" })
|
|
701
767
|
] })
|
|
702
768
|
] });
|
|
703
769
|
}
|
|
704
|
-
function
|
|
770
|
+
function Oe({
|
|
705
771
|
onResume: n,
|
|
706
772
|
onSave: s,
|
|
707
773
|
onLoad: r,
|
|
@@ -727,14 +793,14 @@ function oe({
|
|
|
727
793
|
currentLocale: a,
|
|
728
794
|
onLocaleChange: l,
|
|
729
795
|
onBack: o,
|
|
730
|
-
className:
|
|
796
|
+
className: d = ""
|
|
731
797
|
}) {
|
|
732
|
-
return /* @__PURE__ */ e.jsxs("div", { className: `settings-panel ${
|
|
798
|
+
return /* @__PURE__ */ e.jsxs("div", { className: `settings-panel ${d}`, children: [
|
|
733
799
|
/* @__PURE__ */ e.jsx("h2", { className: "settings-title", children: "Settings" }),
|
|
734
800
|
/* @__PURE__ */ e.jsxs("div", { className: "settings-section", children: [
|
|
735
801
|
/* @__PURE__ */ e.jsx("h3", { children: "Audio" }),
|
|
736
802
|
/* @__PURE__ */ e.jsx(
|
|
737
|
-
|
|
803
|
+
H,
|
|
738
804
|
{
|
|
739
805
|
label: "Master",
|
|
740
806
|
value: 1,
|
|
@@ -742,7 +808,7 @@ function oe({
|
|
|
742
808
|
}
|
|
743
809
|
),
|
|
744
810
|
/* @__PURE__ */ e.jsx(
|
|
745
|
-
|
|
811
|
+
H,
|
|
746
812
|
{
|
|
747
813
|
label: "Music",
|
|
748
814
|
value: 0.7,
|
|
@@ -750,7 +816,7 @@ function oe({
|
|
|
750
816
|
}
|
|
751
817
|
),
|
|
752
818
|
/* @__PURE__ */ e.jsx(
|
|
753
|
-
|
|
819
|
+
H,
|
|
754
820
|
{
|
|
755
821
|
label: "Sound Effects",
|
|
756
822
|
value: 0.8,
|
|
@@ -758,7 +824,7 @@ function oe({
|
|
|
758
824
|
}
|
|
759
825
|
),
|
|
760
826
|
/* @__PURE__ */ e.jsx(
|
|
761
|
-
|
|
827
|
+
H,
|
|
762
828
|
{
|
|
763
829
|
label: "Voice",
|
|
764
830
|
value: 1,
|
|
@@ -766,7 +832,7 @@ function oe({
|
|
|
766
832
|
}
|
|
767
833
|
),
|
|
768
834
|
s && /* @__PURE__ */ e.jsx(
|
|
769
|
-
|
|
835
|
+
H,
|
|
770
836
|
{
|
|
771
837
|
label: "UI Sounds",
|
|
772
838
|
value: s.volume,
|
|
@@ -781,15 +847,15 @@ function oe({
|
|
|
781
847
|
{
|
|
782
848
|
className: "settings-locale-select",
|
|
783
849
|
value: a,
|
|
784
|
-
onChange: (
|
|
785
|
-
children: r.map((
|
|
850
|
+
onChange: (m) => l(m.target.value),
|
|
851
|
+
children: r.map((m) => /* @__PURE__ */ e.jsx("option", { value: m.code, children: m.label }, m.code))
|
|
786
852
|
}
|
|
787
853
|
)
|
|
788
854
|
] }),
|
|
789
855
|
/* @__PURE__ */ e.jsx("button", { className: "settings-back-button", onClick: o, children: "Back" })
|
|
790
856
|
] });
|
|
791
857
|
}
|
|
792
|
-
function
|
|
858
|
+
function H({
|
|
793
859
|
label: n,
|
|
794
860
|
value: s,
|
|
795
861
|
onChange: r
|
|
@@ -810,16 +876,16 @@ function Q({
|
|
|
810
876
|
)
|
|
811
877
|
] });
|
|
812
878
|
}
|
|
813
|
-
function
|
|
879
|
+
function $e({
|
|
814
880
|
src: n,
|
|
815
881
|
basePath: s = "/video",
|
|
816
882
|
onComplete: r,
|
|
817
883
|
className: a = ""
|
|
818
884
|
}) {
|
|
819
|
-
const l =
|
|
820
|
-
return
|
|
821
|
-
const o = (
|
|
822
|
-
(
|
|
885
|
+
const l = L(null);
|
|
886
|
+
return $(() => {
|
|
887
|
+
const o = (d) => {
|
|
888
|
+
(d.key === "Escape" || d.key === " " || d.key === "Enter") && (d.preventDefault(), r());
|
|
823
889
|
};
|
|
824
890
|
return window.addEventListener("keydown", o), () => window.removeEventListener("keydown", o);
|
|
825
891
|
}, [r]), /* @__PURE__ */ e.jsxs("div", { className: `video-player-overlay ${a}`, children: [
|
|
@@ -843,24 +909,25 @@ function Oe({
|
|
|
843
909
|
)
|
|
844
910
|
] });
|
|
845
911
|
}
|
|
846
|
-
function
|
|
912
|
+
function Le({
|
|
847
913
|
registry: n,
|
|
848
914
|
config: s,
|
|
849
915
|
title: r = "Doodle Engine",
|
|
850
916
|
subtitle: a,
|
|
851
917
|
logoSrc: l,
|
|
852
918
|
splashDuration: o = 2e3,
|
|
853
|
-
uiSounds:
|
|
854
|
-
audioOptions:
|
|
855
|
-
storageKey:
|
|
919
|
+
uiSounds: d,
|
|
920
|
+
audioOptions: m,
|
|
921
|
+
storageKey: v = "doodle-engine-save",
|
|
856
922
|
availableLocales: g,
|
|
857
|
-
videoBasePath:
|
|
858
|
-
className: R = ""
|
|
923
|
+
videoBasePath: j = "/video",
|
|
924
|
+
className: R = "",
|
|
925
|
+
devTools: _ = !1
|
|
859
926
|
}) {
|
|
860
|
-
const [
|
|
861
|
-
|
|
862
|
-
),
|
|
863
|
-
const
|
|
927
|
+
const [S, h] = C(o > 0 ? "splash" : "title"), [f, p] = C(!1), [u, x] = C(!1), [A, F] = C("title"), [U, W] = C(null), [P, D] = C(null), c = Ne(
|
|
928
|
+
d === !1 ? { enabled: !1 } : d
|
|
929
|
+
), b = localStorage.getItem(v) !== null, y = N(() => {
|
|
930
|
+
const E = {
|
|
864
931
|
currentLocation: s.startLocation,
|
|
865
932
|
currentTime: { ...s.startTime },
|
|
866
933
|
flags: { ...s.startFlags },
|
|
@@ -876,45 +943,46 @@ function Me({
|
|
|
876
943
|
notifications: [],
|
|
877
944
|
pendingSounds: [],
|
|
878
945
|
pendingVideo: null,
|
|
946
|
+
pendingInterlude: null,
|
|
879
947
|
currentLocale: "en"
|
|
880
948
|
};
|
|
881
|
-
return new
|
|
882
|
-
}, [n, s]),
|
|
883
|
-
|
|
884
|
-
const
|
|
885
|
-
|
|
886
|
-
}, [
|
|
887
|
-
|
|
888
|
-
const
|
|
889
|
-
if (!
|
|
890
|
-
const
|
|
891
|
-
|
|
892
|
-
}, [
|
|
893
|
-
if (!
|
|
894
|
-
|
|
895
|
-
const
|
|
896
|
-
localStorage.setItem(
|
|
897
|
-
}, [
|
|
898
|
-
const
|
|
899
|
-
if (!
|
|
900
|
-
|
|
901
|
-
const
|
|
902
|
-
|
|
903
|
-
}, [
|
|
904
|
-
|
|
905
|
-
}, [
|
|
906
|
-
|
|
907
|
-
}, [
|
|
908
|
-
|
|
909
|
-
}, [
|
|
910
|
-
|
|
911
|
-
if (
|
|
912
|
-
const
|
|
913
|
-
|
|
949
|
+
return new ue(n, E);
|
|
950
|
+
}, [n, s]), O = N(() => {
|
|
951
|
+
c.playClick();
|
|
952
|
+
const E = y(), t = E.newGame(s);
|
|
953
|
+
D({ engine: E, snapshot: t }), h("playing");
|
|
954
|
+
}, [y, s, c]), M = N(() => {
|
|
955
|
+
c.playClick();
|
|
956
|
+
const E = localStorage.getItem(v);
|
|
957
|
+
if (!E) return;
|
|
958
|
+
const t = JSON.parse(E), i = y(), k = i.loadGame(t);
|
|
959
|
+
D({ engine: i, snapshot: k }), h("playing");
|
|
960
|
+
}, [y, v, c]), Y = N(() => {
|
|
961
|
+
if (!P) return;
|
|
962
|
+
c.playClick();
|
|
963
|
+
const E = P.engine.saveGame();
|
|
964
|
+
localStorage.setItem(v, JSON.stringify(E)), p(!1);
|
|
965
|
+
}, [P, v, c]), V = N(() => {
|
|
966
|
+
const E = localStorage.getItem(v);
|
|
967
|
+
if (!E || !P) return;
|
|
968
|
+
c.playClick();
|
|
969
|
+
const t = JSON.parse(E), i = P.engine.loadGame(t);
|
|
970
|
+
D({ engine: P.engine, snapshot: i }), p(!1);
|
|
971
|
+
}, [P, v, c]), I = N(() => {
|
|
972
|
+
c.playClick(), p(!1), x(!1), D(null), h("title");
|
|
973
|
+
}, [c]), G = N((E) => {
|
|
974
|
+
c.playMenuOpen(), F(E), x(!0), E === "pause" && p(!1);
|
|
975
|
+
}, [c]), J = N(() => {
|
|
976
|
+
c.playMenuClose(), x(!1), A === "pause" && p(!0);
|
|
977
|
+
}, [A, c]);
|
|
978
|
+
$(() => {
|
|
979
|
+
if (S !== "playing") return;
|
|
980
|
+
const E = (t) => {
|
|
981
|
+
t.key === "Escape" && (t.preventDefault(), u ? J() : (f ? c.playMenuClose() : c.playMenuOpen(), p((i) => !i)));
|
|
914
982
|
};
|
|
915
|
-
return window.addEventListener("keydown",
|
|
916
|
-
}, [
|
|
917
|
-
const
|
|
983
|
+
return window.addEventListener("keydown", E), () => window.removeEventListener("keydown", E);
|
|
984
|
+
}, [S, f, u, J, c]);
|
|
985
|
+
const Q = {
|
|
918
986
|
setMasterVolume: () => {
|
|
919
987
|
},
|
|
920
988
|
setMusicVolume: () => {
|
|
@@ -926,141 +994,149 @@ function Me({
|
|
|
926
994
|
stopAll: () => {
|
|
927
995
|
}
|
|
928
996
|
};
|
|
929
|
-
return
|
|
930
|
-
|
|
997
|
+
return S === "splash" ? /* @__PURE__ */ e.jsx("div", { className: `game-shell ${R}`, children: /* @__PURE__ */ e.jsx(
|
|
998
|
+
Ae,
|
|
931
999
|
{
|
|
932
1000
|
logoSrc: l,
|
|
933
1001
|
title: r,
|
|
934
|
-
onComplete: () =>
|
|
1002
|
+
onComplete: () => h("title"),
|
|
935
1003
|
duration: o
|
|
936
1004
|
}
|
|
937
|
-
) }) :
|
|
1005
|
+
) }) : S === "title" ? /* @__PURE__ */ e.jsx("div", { className: `game-shell ${R}`, children: u ? /* @__PURE__ */ e.jsx(
|
|
938
1006
|
oe,
|
|
939
1007
|
{
|
|
940
|
-
audioControls:
|
|
941
|
-
uiSoundControls:
|
|
1008
|
+
audioControls: Q,
|
|
1009
|
+
uiSoundControls: d !== !1 ? c : void 0,
|
|
942
1010
|
availableLocales: g,
|
|
943
|
-
onBack:
|
|
1011
|
+
onBack: J
|
|
944
1012
|
}
|
|
945
1013
|
) : /* @__PURE__ */ e.jsx(
|
|
946
|
-
|
|
1014
|
+
Pe,
|
|
947
1015
|
{
|
|
948
1016
|
title: r,
|
|
949
1017
|
subtitle: a,
|
|
950
1018
|
logoSrc: l,
|
|
951
|
-
hasSaveData:
|
|
952
|
-
onNewGame:
|
|
953
|
-
onContinue:
|
|
954
|
-
onSettings: () =>
|
|
1019
|
+
hasSaveData: b,
|
|
1020
|
+
onNewGame: O,
|
|
1021
|
+
onContinue: M,
|
|
1022
|
+
onSettings: () => G("title")
|
|
955
1023
|
}
|
|
956
|
-
) }) :
|
|
957
|
-
|
|
1024
|
+
) }) : P ? /* @__PURE__ */ e.jsx("div", { className: `game-shell ${R}`, children: /* @__PURE__ */ e.jsx(xe, { engine: P.engine, initialSnapshot: P.snapshot, devTools: _, children: /* @__PURE__ */ e.jsx(
|
|
1025
|
+
Ve,
|
|
958
1026
|
{
|
|
959
|
-
audioOptions:
|
|
960
|
-
uiSoundControls:
|
|
961
|
-
showPauseMenu:
|
|
1027
|
+
audioOptions: m,
|
|
1028
|
+
uiSoundControls: d !== !1 ? c : void 0,
|
|
1029
|
+
showPauseMenu: f,
|
|
962
1030
|
showSettings: u,
|
|
963
1031
|
availableLocales: g,
|
|
964
|
-
videoBasePath:
|
|
965
|
-
pendingVideo:
|
|
966
|
-
setPendingVideo:
|
|
1032
|
+
videoBasePath: j,
|
|
1033
|
+
pendingVideo: U,
|
|
1034
|
+
setPendingVideo: W,
|
|
967
1035
|
onPause: () => {
|
|
968
|
-
|
|
1036
|
+
c.playMenuOpen(), p(!0);
|
|
969
1037
|
},
|
|
970
1038
|
onResume: () => {
|
|
971
|
-
|
|
1039
|
+
c.playMenuClose(), p(!1);
|
|
972
1040
|
},
|
|
973
|
-
onSave:
|
|
974
|
-
onLoad:
|
|
975
|
-
onSettings: () =>
|
|
976
|
-
onQuitToTitle:
|
|
977
|
-
onCloseSettings:
|
|
1041
|
+
onSave: Y,
|
|
1042
|
+
onLoad: V,
|
|
1043
|
+
onSettings: () => G("pause"),
|
|
1044
|
+
onQuitToTitle: I,
|
|
1045
|
+
onCloseSettings: J
|
|
978
1046
|
}
|
|
979
1047
|
) }) }) : null;
|
|
980
1048
|
}
|
|
981
|
-
function
|
|
1049
|
+
function Ve({
|
|
982
1050
|
audioOptions: n,
|
|
983
1051
|
uiSoundControls: s,
|
|
984
1052
|
showPauseMenu: r,
|
|
985
1053
|
showSettings: a,
|
|
986
1054
|
availableLocales: l,
|
|
987
1055
|
videoBasePath: o,
|
|
988
|
-
pendingVideo:
|
|
989
|
-
setPendingVideo:
|
|
990
|
-
onPause:
|
|
1056
|
+
pendingVideo: d,
|
|
1057
|
+
setPendingVideo: m,
|
|
1058
|
+
onPause: v,
|
|
991
1059
|
onResume: g,
|
|
992
|
-
onSave:
|
|
1060
|
+
onSave: j,
|
|
993
1061
|
onLoad: R,
|
|
994
|
-
onSettings:
|
|
995
|
-
onQuitToTitle:
|
|
996
|
-
onCloseSettings:
|
|
1062
|
+
onSettings: _,
|
|
1063
|
+
onQuitToTitle: S,
|
|
1064
|
+
onCloseSettings: h
|
|
997
1065
|
}) {
|
|
998
|
-
const { snapshot:
|
|
999
|
-
return
|
|
1000
|
-
|
|
1001
|
-
}, [
|
|
1002
|
-
|
|
1003
|
-
|
|
1066
|
+
const { snapshot: f, actions: p } = re(), u = le(f, n);
|
|
1067
|
+
return $(() => {
|
|
1068
|
+
f.pendingVideo && m(f.pendingVideo);
|
|
1069
|
+
}, [f.pendingVideo, m]), /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
1070
|
+
d && /* @__PURE__ */ e.jsx(
|
|
1071
|
+
$e,
|
|
1004
1072
|
{
|
|
1005
|
-
src:
|
|
1073
|
+
src: d,
|
|
1006
1074
|
basePath: o,
|
|
1007
|
-
onComplete: () =>
|
|
1075
|
+
onComplete: () => m(null)
|
|
1008
1076
|
}
|
|
1009
1077
|
),
|
|
1010
1078
|
/* @__PURE__ */ e.jsx(_e, {}),
|
|
1011
|
-
!r && !a && !
|
|
1079
|
+
!r && !a && !d && /* @__PURE__ */ e.jsx(
|
|
1012
1080
|
"button",
|
|
1013
1081
|
{
|
|
1014
1082
|
className: "game-shell-menu-button",
|
|
1015
|
-
onClick:
|
|
1083
|
+
onClick: v,
|
|
1016
1084
|
"aria-label": "Menu",
|
|
1017
1085
|
children: "Menu"
|
|
1018
1086
|
}
|
|
1019
1087
|
),
|
|
1020
1088
|
r && /* @__PURE__ */ e.jsx(
|
|
1021
|
-
|
|
1089
|
+
Oe,
|
|
1022
1090
|
{
|
|
1023
1091
|
onResume: g,
|
|
1024
|
-
onSave:
|
|
1092
|
+
onSave: j,
|
|
1025
1093
|
onLoad: R,
|
|
1026
|
-
onSettings:
|
|
1027
|
-
onQuitToTitle:
|
|
1094
|
+
onSettings: _,
|
|
1095
|
+
onQuitToTitle: S
|
|
1028
1096
|
}
|
|
1029
1097
|
),
|
|
1030
1098
|
a && /* @__PURE__ */ e.jsx(
|
|
1031
1099
|
oe,
|
|
1032
1100
|
{
|
|
1033
|
-
audioControls:
|
|
1101
|
+
audioControls: u,
|
|
1034
1102
|
uiSoundControls: s,
|
|
1035
1103
|
availableLocales: l,
|
|
1036
|
-
currentLocale: (
|
|
1037
|
-
onLocaleChange:
|
|
1038
|
-
onBack:
|
|
1104
|
+
currentLocale: (f.time, void 0),
|
|
1105
|
+
onLocaleChange: p.setLocale,
|
|
1106
|
+
onBack: h
|
|
1039
1107
|
}
|
|
1040
1108
|
)
|
|
1041
1109
|
] });
|
|
1042
1110
|
}
|
|
1111
|
+
function De({ message: n = "Loading...", className: s = "" }) {
|
|
1112
|
+
return /* @__PURE__ */ e.jsx("div", { className: `loading-screen ${s}`, children: /* @__PURE__ */ e.jsxs("div", { className: "loading-screen-content", children: [
|
|
1113
|
+
/* @__PURE__ */ e.jsx("div", { className: "loading-screen-spinner" }),
|
|
1114
|
+
/* @__PURE__ */ e.jsx("p", { className: "loading-screen-message", children: n })
|
|
1115
|
+
] }) });
|
|
1116
|
+
}
|
|
1043
1117
|
export {
|
|
1044
1118
|
Se as CharacterList,
|
|
1045
1119
|
be as ChoiceList,
|
|
1046
|
-
|
|
1120
|
+
ge as DialogueBox,
|
|
1047
1121
|
ae as GameContext,
|
|
1048
|
-
|
|
1122
|
+
xe as GameProvider,
|
|
1049
1123
|
_e as GameRenderer,
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
ye as
|
|
1053
|
-
|
|
1054
|
-
|
|
1124
|
+
Le as GameShell,
|
|
1125
|
+
Ce as Interlude,
|
|
1126
|
+
ye as Inventory,
|
|
1127
|
+
Ee as Journal,
|
|
1128
|
+
De as LoadingScreen,
|
|
1129
|
+
ke as LocationView,
|
|
1130
|
+
we as MapView,
|
|
1055
1131
|
Te as NotificationArea,
|
|
1056
|
-
|
|
1057
|
-
|
|
1132
|
+
Oe as PauseMenu,
|
|
1133
|
+
Re as SaveLoadPanel,
|
|
1058
1134
|
oe as SettingsPanel,
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1135
|
+
Ae as SplashScreen,
|
|
1136
|
+
Pe as TitleScreen,
|
|
1137
|
+
Ye as VERSION,
|
|
1138
|
+
$e as VideoPlayer,
|
|
1063
1139
|
le as useAudioManager,
|
|
1064
1140
|
re as useGame,
|
|
1065
|
-
|
|
1141
|
+
Ne as useUISounds
|
|
1066
1142
|
};
|