@gamelearn/arcade-components 3.18.1 → 3.18.3

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.
@@ -61254,35 +61254,43 @@ function DialogComponent({
61254
61254
  ] });
61255
61255
  }
61256
61256
  const activeCache = ProgressManager.request("AssetLoader").cache, assetLoader = new AssetLoader(void 0, activeCache);
61257
- function Animation({ animation: l, loopTimes: e, onAnimationFinish: n, onAnimationSave: t, resource: s, makeDefault: o, emitEvent: d }) {
61258
- const f = useThree((p) => p.scene), h = useRef(1), u = useRef();
61257
+ function Animation({ animation: l, loopTimes: e, onAnimationFinish: n, onAnimationSave: t, resource: s, makeDefault: o }) {
61258
+ const [d, f] = useState(!1), h = useThree((p) => p.scene), u = useRef(1);
61259
61259
  return useEffect(() => {
61260
- if (!u.current) {
61261
- const p = f.getObjectByProperty("uid", s.uid);
61262
- if (p && l && p.skeletonId === l.skeletonId)
61260
+ f(!1);
61261
+ }, [s.uid, l == null ? void 0 : l.url]), useEffect(() => {
61262
+ if (!d) {
61263
+ const p = h.getObjectByProperty("uid", s.uid);
61264
+ if (p && l && l.url && p.skeletonId === (l == null ? void 0 : l.skeletonId))
61263
61265
  if (o)
61264
- t({ uid: s.uid, animation: l.id, index: p.index }), n(l);
61266
+ t({ uid: s.uid, animation: l == null ? void 0 : l.id, index: p.index }), n();
61265
61267
  else {
61266
61268
  const x = p.userData.animator, T = () => {
61267
- x.getAction(l.url).setLoop(LoopRepeat, 1 / 0), h.current = 1;
61269
+ x.getAction(l.url).setLoop(LoopRepeat, 1 / 0), u.current = 1;
61268
61270
  function E() {
61269
- h.current >= e && (x.mix("idle"), n(l), x.removeEventListener("loop", E)), h.current += 1;
61271
+ u.current >= e && (x.mix("idle"), n(), x.removeEventListener("loop", E)), u.current += 1;
61270
61272
  }
61271
- x.mix(l.url).then((g) => {
61273
+ x.mix(l == null ? void 0 : l.url).then((g) => {
61272
61274
  g && x.addEventListener("loop", E);
61273
- });
61275
+ }), f(!0);
61274
61276
  };
61275
- x.getAction(l.url) ? T() : assetLoader.load(l.url, (S) => {
61276
- x.register(l.url, S.animations[0]), T();
61277
- });
61277
+ x.getAction(l == null ? void 0 : l.url) ? T() : assetLoader.load(
61278
+ l == null ? void 0 : l.url,
61279
+ (S) => {
61280
+ x.register(l == null ? void 0 : l.url, S.animations[0]), T();
61281
+ },
61282
+ void 0,
61283
+ (S) => {
61284
+ console.error(`Asset loader failed with: ${l.url}`, S), n();
61285
+ }
61286
+ );
61278
61287
  }
61279
61288
  else
61280
- n(l);
61281
- u.current = l.id;
61289
+ n();
61282
61290
  }
61283
61291
  }, [
61284
- f,
61285
- l.url,
61292
+ h,
61293
+ l == null ? void 0 : l.url,
61286
61294
  e,
61287
61295
  d,
61288
61296
  s.uid,
@@ -61294,29 +61302,31 @@ function Animation({ animation: l, loopTimes: e, onAnimationFinish: n, onAnimati
61294
61302
  ]), null;
61295
61303
  }
61296
61304
  function MultipleAnimation({ animations: l = [], enableInteraction: e, emitEvent: n }) {
61297
- const [t, s] = useState(!1), o = l.length, d = useRef(0), f = () => {
61298
- d.current += 1, d.current >= o && s(!0);
61299
- }, h = (u) => {
61305
+ const t = l.length, s = useRef(0), o = () => {
61306
+ s.current += 1, s.current >= t && e && n({ type: "success" });
61307
+ }, d = (f) => {
61300
61308
  n({
61301
61309
  type: "saveAnimation",
61302
- payload: u
61310
+ payload: f
61303
61311
  });
61304
61312
  };
61305
61313
  return useEffect(() => {
61306
- t && n({ type: "success" });
61307
- }, [n, t]), useEffect(() => {
61308
- e && s(!0);
61309
- }, [e]), l.map(({ animation: u, resource: p, ...x }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
61310
- Animation,
61311
- {
61312
- animation: u,
61313
- resource: p,
61314
- ...x,
61315
- onAnimationSave: h,
61316
- onAnimationFinish: f
61317
- },
61318
- `${u.id}_${p.uid}`
61319
- ));
61314
+ s.current = 0;
61315
+ }, [l]), useEffect(() => {
61316
+ e || n({ type: "success" });
61317
+ }, [n, e]), l.map(({ animation: f, ...h }, u) => {
61318
+ var p;
61319
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
61320
+ Animation,
61321
+ {
61322
+ animation: f,
61323
+ ...h,
61324
+ onAnimationFinish: o,
61325
+ onAnimationSave: d
61326
+ },
61327
+ (f == null ? void 0 : f.id) || ((p = h.resource) == null ? void 0 : p.uid) || u
61328
+ );
61329
+ });
61320
61330
  }
61321
61331
  function EmailPill({ text: l, error: e, handleClick: n }) {
61322
61332
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(