@gamelearn/arcade-components 2.12.3 → 2.12.5

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.
@@ -296,7 +296,7 @@ var DialogComponent = function DialogComponent(_ref) {
296
296
  if (zoomInActor) setAnimationRunning(true);
297
297
  }, [zoomInActor]);
298
298
 
299
- var restTalkingAnimation = function restTalkingAnimation() {
299
+ var resetTalkingAnimation = function resetTalkingAnimation() {
300
300
  var element = getCurrentVisible(talkingCharacter === null || talkingCharacter === void 0 ? void 0 : talkingCharacter.uid);
301
301
 
302
302
  if (!element) {
@@ -323,16 +323,16 @@ var DialogComponent = function DialogComponent(_ref) {
323
323
  (0, _react.useEffect)(function () {
324
324
  var element = getCurrentVisible(talkingCharacter === null || talkingCharacter === void 0 ? void 0 : talkingCharacter.uid);
325
325
 
326
- if (element) {
326
+ if (element && currentMessage.show) {
327
327
  if (talking) {
328
328
  var _talkingCharacter$cha, _talkingCharacter$cha2, _talkingCharacter$cha3, _talkingCharacter$cha4;
329
329
 
330
330
  (0, _helpers.executeTalkingAnimation)(element, talkingCharacter === null || talkingCharacter === void 0 ? void 0 : (_talkingCharacter$cha = talkingCharacter.character) === null || _talkingCharacter$cha === void 0 ? void 0 : (_talkingCharacter$cha2 = _talkingCharacter$cha.resource) === null || _talkingCharacter$cha2 === void 0 ? void 0 : (_talkingCharacter$cha3 = _talkingCharacter$cha2.animations) === null || _talkingCharacter$cha3 === void 0 ? void 0 : (_talkingCharacter$cha4 = _talkingCharacter$cha3.talking) === null || _talkingCharacter$cha4 === void 0 ? void 0 : _talkingCharacter$cha4.url);
331
331
  } else {
332
- restTalkingAnimation();
332
+ resetTalkingAnimation();
333
333
  }
334
334
  }
335
- }, [talkingCharacter, talking]);
335
+ }, [talkingCharacter, talking, currentMessage.show]);
336
336
  var finishConversation = (0, _react.useCallback)(function () {
337
337
  lastSet.current = true;
338
338
  changeLine(0);
@@ -404,7 +404,7 @@ var DialogComponent = function DialogComponent(_ref) {
404
404
  }
405
405
  }, [currentLineData === null || currentLineData === void 0 ? void 0 : currentLineData.id, edges, finishConversation, lines]);
406
406
  var backLine = (0, _react.useCallback)(function () {
407
- restTalkingAnimation();
407
+ resetTalkingAnimation();
408
408
  setAudioFailed(false);
409
409
 
410
410
  if (isBranched) {
@@ -417,7 +417,7 @@ var DialogComponent = function DialogComponent(_ref) {
417
417
  }
418
418
  }, [handleBranchDirection, isBranched, lastLine, line]);
419
419
  var nextLine = (0, _react.useCallback)(function (choice, reset) {
420
- restTalkingAnimation();
420
+ resetTalkingAnimation();
421
421
  setEdgesHistory([].concat(_toConsumableArray(edgesHistory), [currentLineData.id]));
422
422
  setAudioFailed(false);
423
423
 
@@ -727,6 +727,8 @@ var DialogComponent = function DialogComponent(_ref) {
727
727
  y: animationTarget.current.position.y,
728
728
  z: animationTarget.current.position.z
729
729
  });
730
+ } else {
731
+ zoomStarted.current = false;
730
732
  }
731
733
  }, [animationRunning]); // Animate Camera
732
734
  // 🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥
@@ -9,7 +9,7 @@ var _react = _interopRequireDefault(require("react"));
9
9
 
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
11
 
12
- var LABELS_INDEX = ['A', 'B', 'C'];
12
+ var LABELS_INDEX = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'];
13
13
 
14
14
  var Questions = function Questions(_ref) {
15
15
  var disabled = _ref.disabled,
@@ -23,6 +23,8 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
23
23
 
24
24
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
25
25
 
26
+ function _readOnlyError(name) { throw new TypeError("\"" + name + "\" is read-only"); }
27
+
26
28
  var xAxis = new _three.Vector3(1, 0, 0);
27
29
  exports.xAxis = xAxis;
28
30
  var yAxis = new _three.Vector3(0, 1, 0);
@@ -194,7 +196,7 @@ var executeCrossFade = function executeCrossFade(startAction, endAction) {
194
196
  exports.executeCrossFade = executeCrossFade;
195
197
 
196
198
  var executeTalkingAnimation = function executeTalkingAnimation(target, talkingURL) {
197
- if (target) {
199
+ if (target && talkingURL) {
198
200
  var tracks = [];
199
201
  var _target$userData = target.userData,
200
202
  mixer = _target$userData.mixer,
@@ -202,30 +204,38 @@ var executeTalkingAnimation = function executeTalkingAnimation(target, talkingUR
202
204
  var cloned = defaultAnim.clone();
203
205
 
204
206
  var onLoad = function onLoad(anim) {
205
- var _cloned$tracks;
207
+ var talkingClip = anim === null || anim === void 0 ? void 0 : anim.animations[0];
208
+
209
+ if (talkingClip) {
210
+ var _cloned$tracks;
206
211
 
207
- if (anim) {
208
- tracks.push.apply(tracks, _toConsumableArray(anim.animations[0].tracks.filter(function (track) {
212
+ talkingClip.tracks.filter(function (track) {
209
213
  return bones.find(function (bone) {
210
214
  return track.name.includes(bone);
211
215
  });
212
- })));
213
- }
214
-
215
- cloned.tracks = cloned.tracks.filter(function (track) {
216
- return !bones.find(function (bone) {
217
- return track.name.includes(bone);
216
+ }), _readOnlyError("tracks");
217
+ cloned.tracks = cloned.tracks.filter(function (track) {
218
+ return !bones.find(function (bone) {
219
+ return track.name.includes(bone);
220
+ });
218
221
  });
219
- });
220
222
 
221
- (_cloned$tracks = cloned.tracks).push.apply(_cloned$tracks, tracks);
223
+ (_cloned$tracks = cloned.tracks).push.apply(_cloned$tracks, _toConsumableArray(tracks));
224
+
225
+ target.userData.emotionClip = cloned;
226
+ cloned.resetDuration();
227
+ var talkingSubClip = cloned;
222
228
 
223
- target.userData.emotionClip = cloned;
224
- var defaultAction = mixer.clipAction(defaultAnim, target);
225
- var emotionAction = mixer.clipAction(cloned, target);
226
- emotionAction.loop = _three.LoopPingPong;
227
- mixer.stopAllAction();
228
- executeCrossFade(defaultAction, emotionAction, crossFadeDuration);
229
+ if (cloned.duration > 4) {
230
+ talkingSubClip = _three.AnimationUtils.subclip(cloned, 'shortTalking', 0, 120, 30);
231
+ }
232
+
233
+ var defaultAction = mixer.clipAction(defaultAnim, target);
234
+ var emotionAction = mixer.clipAction(talkingSubClip, target);
235
+ emotionAction.loop = _three.LoopPingPong;
236
+ mixer.stopAllAction();
237
+ executeCrossFade(defaultAction, emotionAction, crossFadeDuration);
238
+ }
229
239
  };
230
240
 
231
241
  loader.load(talkingURL, function (anim) {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@gamelearn/arcade-components",
3
3
  "author": "Gamelearn",
4
4
  "license": "unlicense",
5
- "version": "2.12.3",
5
+ "version": "2.12.5",
6
6
  "main": "dist/index.js",
7
7
  "files": [
8
8
  "dist",