@gamelearn/arcade-components 3.8.11 → 3.9.1
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.
|
@@ -27133,7 +27133,7 @@ function ConversationalProComponent({
|
|
|
27133
27133
|
progress: E
|
|
27134
27134
|
}) {
|
|
27135
27135
|
var Ke, mt, ct;
|
|
27136
|
-
const g = (E == null ? void 0 : E.line) || 0, [_, p] = useState(!1), [x, C] = useState(!0), [T, S] = useState(!!h), [A, R] = useState(!1), [P, w] = useState(g), [O, k] = useState(!1), [L] = f, { start: F, stop: G } = useTimeout(), H = ((Ke = u == null ? void 0 : u.img) == null ? void 0 : Ke.url) || null, W = t[P], { voiceOver: ee, decision: q } = W;
|
|
27136
|
+
const g = t.length - 1 <= (E == null ? void 0 : E.line) ? t.length - 1 : (E == null ? void 0 : E.line) || 0, [_, p] = useState(!1), [x, C] = useState(!0), [T, S] = useState(!!h), [A, R] = useState(!1), [P, w] = useState(g), [O, k] = useState(!1), [L] = f, { start: F, stop: G } = useTimeout(), H = ((Ke = u == null ? void 0 : u.img) == null ? void 0 : Ke.url) || null, W = t[P], { voiceOver: ee, decision: q } = W;
|
|
27137
27137
|
let { flex: z } = W, B = [];
|
|
27138
27138
|
const I = !!n, U = ee || W.type === "conversationalNarration", V = q || W.type === "conversationalDecision", X = W.type === "conversationalCamera", [Q, J] = useState([]), ie = useMemo(() => Q[Q.length - 1], [Q]), ne = useCallback(() => {
|
|
27139
27139
|
const he = n.find((ve) => ve.fromId === ie) || n.find((ve) => ve.toId === ie), pe = t.find((ve) => ve.id === (he == null ? void 0 : he.fromId));
|
|
@@ -57408,7 +57408,7 @@ function DialogComponent({
|
|
|
57408
57408
|
progress: h
|
|
57409
57409
|
}) {
|
|
57410
57410
|
var Wr;
|
|
57411
|
-
const y = (h == null ? void 0 : h.line) || 0, [E, g] = useState(y), [_, p] = useState(!!u), [x, C] = useState(!1), [T, S] = useState(!1), A = useThree((ze) => ze.scene), R = useThree((ze) => ze.camera), { start: P, stop: w } = useTimeout(), O = useRef([]), k = useMemo(() => R.clone(), []), L = useRef({ pos: [0, 0, 0], child: null }), F = r[E], G = r[E - 1], H = useRef(!1), W = !!n, { voiceOver: ee, decision: q } = F || {}, z = useRef({}), B = (Wr = F == null ? void 0 : F.slots) == null ? void 0 : Wr.find((ze) => ze.talking), I = useRef(!1), { startAnimation: U, startAnimationUrl: V, resetActives: X, preloadTalking: Q, unmountActives: J } = useStateMachine(r), ie = useRef(), ne = Object.keys((F == null ? void 0 : F.audio) || {}).length, Z = Object.keys((F == null ? void 0 : F.voice) || {}).length, se = ee || (F == null ? void 0 : F.type) === "conversationalNarration", oe = q || (F == null ? void 0 : F.type) === "conversationalDecision", de = (F == null ? void 0 : F.type) === "conversationalCamera", fe = _ && !oe && !de, [ce, xe] = useState({
|
|
57411
|
+
const y = r.length - 1 <= (h == null ? void 0 : h.line) ? r.length - 1 : (h == null ? void 0 : h.line) || 0, [E, g] = useState(y), [_, p] = useState(!!u), [x, C] = useState(!1), [T, S] = useState(!1), A = useThree((ze) => ze.scene), R = useThree((ze) => ze.camera), { start: P, stop: w } = useTimeout(), O = useRef([]), k = useMemo(() => R.clone(), []), L = useRef({ pos: [0, 0, 0], child: null }), F = r[E], G = r[E - 1], H = useRef(!1), W = !!n, { voiceOver: ee, decision: q } = F || {}, z = useRef({}), B = (Wr = F == null ? void 0 : F.slots) == null ? void 0 : Wr.find((ze) => ze.talking), I = useRef(!1), { startAnimation: U, startAnimationUrl: V, resetActives: X, preloadTalking: Q, unmountActives: J } = useStateMachine(r), ie = useRef(), ne = Object.keys((F == null ? void 0 : F.audio) || {}).length, Z = Object.keys((F == null ? void 0 : F.voice) || {}).length, se = ee || (F == null ? void 0 : F.type) === "conversationalNarration", oe = q || (F == null ? void 0 : F.type) === "conversationalDecision", de = (F == null ? void 0 : F.type) === "conversationalCamera", fe = _ && !oe && !de, [ce, xe] = useState({
|
|
57412
57412
|
text: "",
|
|
57413
57413
|
name: "",
|
|
57414
57414
|
inScene: !1,
|
|
@@ -57566,7 +57566,7 @@ function DialogComponent({
|
|
|
57566
57566
|
} else
|
|
57567
57567
|
e({ type: "saveNode" });
|
|
57568
57568
|
},
|
|
57569
|
-
[n, E, r, e, F.id, W]
|
|
57569
|
+
[n, E, r, e, F == null ? void 0 : F.id, W]
|
|
57570
57570
|
), Ce = useCallback(
|
|
57571
57571
|
(ze, Ie) => {
|
|
57572
57572
|
if (z.current = { ...B }, Be([...Ve, F.id]), S(!1), Ft(), W)
|
|
@@ -57839,29 +57839,27 @@ function DialogComponent({
|
|
|
57839
57839
|
] });
|
|
57840
57840
|
}
|
|
57841
57841
|
function AnimationComponent({ animation: o, loopTimes: e, resource: r, enableInteraction: t, makeDefault: n, emitEvent: a }) {
|
|
57842
|
-
const [l, u] = useState(!1), f = useThree((
|
|
57842
|
+
const [l, u] = useState(!1), f = useThree((y) => y.scene), c = useMemo(() => new GLTFLoader(), []), h = useRef(0);
|
|
57843
57843
|
return useEffect(() => {
|
|
57844
57844
|
u(!1);
|
|
57845
57845
|
}, [r.uid, o == null ? void 0 : o.url]), useEffect(() => {
|
|
57846
57846
|
if (!l) {
|
|
57847
|
-
|
|
57848
|
-
if (
|
|
57849
|
-
r.uid && y.uid === r.uid && !h && (h = y);
|
|
57850
|
-
}), h && o && h.skeletonId === o.skeletonId)
|
|
57847
|
+
const y = f.getObjectByProperty("uid", r.uid);
|
|
57848
|
+
if (y && o && y.skeletonId === o.skeletonId)
|
|
57851
57849
|
if (n)
|
|
57852
57850
|
a({
|
|
57853
57851
|
type: "saveAnimation",
|
|
57854
|
-
payload: { uid: r.uid, animation: o.id, index:
|
|
57852
|
+
payload: { uid: r.uid, animation: o.id, index: y.index }
|
|
57855
57853
|
}), a({ type: "success" });
|
|
57856
57854
|
else {
|
|
57857
|
-
const
|
|
57858
|
-
|
|
57859
|
-
const { mixer:
|
|
57860
|
-
|
|
57861
|
-
|
|
57862
|
-
|
|
57863
|
-
}
|
|
57864
|
-
|
|
57855
|
+
const E = t;
|
|
57856
|
+
E || a({ type: "success" }), c.load(o.url, (g) => {
|
|
57857
|
+
const { mixer: _, clipAction: p, defaultAnim: x } = y.userData.animation;
|
|
57858
|
+
p(g.animations[0], y).setLoop(LoopRepeat, 1 / 0), h.current = 0;
|
|
57859
|
+
function T() {
|
|
57860
|
+
h.current += 1, h.current >= e && (p(x, y), E && a({ type: "success" }), _.removeEventListener("loop", T));
|
|
57861
|
+
}
|
|
57862
|
+
_._listeners && (_._listeners.loop = []), _.addEventListener("loop", T), u(!0);
|
|
57865
57863
|
});
|
|
57866
57864
|
}
|
|
57867
57865
|
else
|