@gamelearn/arcade-components 3.8.11 → 3.8.12
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.
|
@@ -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
|