@gamelearn/arcade-components 1.4.13 → 1.4.15

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.
@@ -251,14 +251,19 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
251
251
  var currentEdge = optionsEdges.find(function (edge) {
252
252
  return parseInt(edge.fromPointIndex) === currentId;
253
253
  });
254
- var destinationEdge = lines.findIndex(function (l) {
255
- return l.id === currentEdge.toId;
256
- });
257
254
 
258
- if (currentEdge.fromId === currentEdge.toId) {
259
- reset();
260
- } else if (destinationEdge >= 0) {
261
- setCurrentLine(destinationEdge);
255
+ if (currentEdge) {
256
+ var destinationEdge = lines.findIndex(function (l) {
257
+ return l.id === currentEdge.toId;
258
+ });
259
+
260
+ if (currentEdge.fromId === currentEdge.toId) {
261
+ reset();
262
+ } else if (destinationEdge >= 0) {
263
+ setCurrentLine(destinationEdge);
264
+ } else {
265
+ finishConversation();
266
+ }
262
267
  } else {
263
268
  finishConversation();
264
269
  }
@@ -59,6 +59,7 @@ var isMobile = (0, _deviceDetection.DeviceDetection)();
59
59
  var crossFadeDuration = 0.5; // Mobile always zoom in?
60
60
 
61
61
  var raycast = new _three.Raycaster();
62
+ var maxCharacterToSwitch = 70;
62
63
  raycast.firstHitOnly = true;
63
64
 
64
65
  var DialogComponent = function DialogComponent(_ref) {
@@ -86,6 +87,7 @@ var DialogComponent = function DialogComponent(_ref) {
86
87
  text: '',
87
88
  name: '',
88
89
  left: false,
90
+ top: false,
89
91
  inScene: false,
90
92
  thinkful: false,
91
93
  voiceOver: false,
@@ -328,11 +330,15 @@ var DialogComponent = function DialogComponent(_ref) {
328
330
  return l.id === currentEdge.toId;
329
331
  });
330
332
 
331
- if (currentEdge.fromId === currentEdge.toId) {
332
- reset();
333
- } else if (destinationEdge >= 0) {
334
- setCurrentMessage({});
335
- changeLine(destinationEdge);
333
+ if (destinationEdge) {
334
+ if (currentEdge.fromId === currentEdge.toId) {
335
+ reset();
336
+ } else if (destinationEdge >= 0) {
337
+ setCurrentMessage({});
338
+ changeLine(destinationEdge);
339
+ } else {
340
+ finishConversation();
341
+ }
336
342
  } else {
337
343
  finishConversation();
338
344
  }
@@ -364,6 +370,7 @@ var DialogComponent = function DialogComponent(_ref) {
364
370
  inScene: false,
365
371
  voiceOver: true,
366
372
  thinkful: false,
373
+ top: false,
367
374
  avatar: '',
368
375
  show: true
369
376
  });
@@ -408,12 +415,13 @@ var DialogComponent = function DialogComponent(_ref) {
408
415
 
409
416
  setTimeout(function () {
410
417
  if (talkingCharacter.uid === element.uid) {
418
+ var showArrowTop = talkingCharacter.text.length > maxCharacterToSwitch;
411
419
  var head = element.getObjectByName('Head_M');
412
420
  var target = new _three.Object3D();
413
421
  head.getWorldPosition(target.position);
414
422
  target.applyQuaternion(camera.quaternion);
415
423
  target.translateX(1.25);
416
- target.translateY(2);
424
+ target.translateY(showArrowTop ? 1.25 : 2);
417
425
  messagePosition.current = {
418
426
  pos: target.position.toArray(),
419
427
  child: head,
@@ -432,6 +440,7 @@ var DialogComponent = function DialogComponent(_ref) {
432
440
  text: talkingCharacter.text,
433
441
  name: talkingCharacter.alias || ((_talkingCharacter$cha = talkingCharacter.character) === null || _talkingCharacter$cha === void 0 ? void 0 : _talkingCharacter$cha.name),
434
442
  left: true,
443
+ top: showArrowTop,
435
444
  inScene: true,
436
445
  thinkful: talkingCharacter.emotion === 'thinkful',
437
446
  avatar: '',
@@ -449,6 +458,7 @@ var DialogComponent = function DialogComponent(_ref) {
449
458
  text: talkingCharacter.text,
450
459
  name: talkingCharacter.alias || ((_talkingCharacter$cha2 = talkingCharacter.character) === null || _talkingCharacter$cha2 === void 0 ? void 0 : _talkingCharacter$cha2.name) || object.name,
451
460
  left: false,
461
+ top: talkingCharacter.text.length > maxCharacterToSwitch,
452
462
  inScene: false,
453
463
  thinkful: talkingCharacter.emotion === 'thinkful',
454
464
  avatar: getAvatarURL(talkingCharacter),
@@ -542,6 +552,7 @@ var DialogComponent = function DialogComponent(_ref) {
542
552
  setCurrentMessage(function (old) {
543
553
  return _objectSpread(_objectSpread({}, old), {}, {
544
554
  left: false,
555
+ top: false,
545
556
  inScene: !completeOutside,
546
557
  avatar: getAvatarURL(talkingCharacter),
547
558
  show: true
@@ -29,7 +29,7 @@ var SpeechBubbleComponent = /*#__PURE__*/_react.default.forwardRef(function (_re
29
29
 
30
30
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
31
31
  ref: ref,
32
- className: "\n speech-bubble\n ".concat(message.left && message.inScene ? 'speech-bubble--arrow-left' : '', "\n ").concat(!message.left && message.inScene ? 'speech-bubble--arrow-right' : '', "\n ").concat(message.thinkful || message.voiceOver ? 'speech-bubble--italic' : '', "\n ")
32
+ className: "\n speech-bubble\n ".concat(message.left && message.inScene ? 'speech-bubble--arrow-left' : '', "\n ").concat(!message.left && message.inScene ? 'speech-bubble--arrow-right' : '', "\n ").concat(message.top && message.inScene ? 'arrow-top' : '', "\n ").concat(message.thinkful || message.voiceOver ? 'speech-bubble--italic' : '', "\n ")
33
33
  }, /*#__PURE__*/_react.default.createElement("div", {
34
34
  className: "speech-bubble__content"
35
35
  }, /*#__PURE__*/_react.default.createElement("div", {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@gamelearn/arcade-components",
3
3
  "author": "Gamelearn",
4
4
  "license": "unlicense",
5
- "version": "1.4.13",
5
+ "version": "1.4.15",
6
6
  "main": "dist/index.js",
7
7
  "files": [
8
8
  "dist",
@@ -64,7 +64,7 @@
64
64
  "@babel/eslint-parser": "^7.15.8",
65
65
  "@babel/preset-env": "7.12.11",
66
66
  "@babel/preset-react": "7.12.10",
67
- "@gamelearn/arcade-styles": "0.5.9",
67
+ "@gamelearn/arcade-styles": "0.5.10",
68
68
  "@gamelearn/version": "^1.3.1",
69
69
  "@react-three/test-renderer": "6.0.6",
70
70
  "@storybook/addon-actions": "6.1.11",