@gamelearn/arcade-components 1.34.0 → 1.35.0

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.
@@ -93,10 +93,8 @@ var ComicComponent = function ComicComponent(_ref) {
93
93
  setTransition('slide-animation');
94
94
  setCount(slideCount + 1);
95
95
  setStarted(true);
96
- } else {
97
- close();
98
96
  }
99
- }, [close, slideCount, slides === null || slides === void 0 ? void 0 : slides.length]);
97
+ }, [slideCount, slides === null || slides === void 0 ? void 0 : slides.length]);
100
98
  var goToPreviousSlide = (0, _react.useCallback)(function () {
101
99
  setStarted(false);
102
100
  setAudioFailed(false);
@@ -255,17 +255,17 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
255
255
  });
256
256
 
257
257
  if (!(foundEdge !== null && foundEdge !== void 0 && foundEdge[keys[0]])) {
258
- finishConversation();
259
- } else {
260
- var destination = lines.findIndex(function (line) {
261
- return line.id === foundEdge[keys[1]];
262
- });
258
+ return;
259
+ }
263
260
 
264
- if (destination >= 0) {
265
- setCurrentLine(destination);
266
- } else {
267
- finishConversation();
268
- }
261
+ var destination = lines.findIndex(function (line) {
262
+ return line.id === foundEdge[keys[1]];
263
+ });
264
+
265
+ if (destination >= 0) {
266
+ setCurrentLine(destination);
267
+ } else {
268
+ finishConversation();
269
269
  }
270
270
  }, [currentLineData.id, edges, finishConversation, lines]);
271
271
  var handleClickNext = (0, _react.useCallback)(function (choice, reset) {
@@ -287,16 +287,17 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
287
287
 
288
288
  if (line + 1 <= maxLine) {
289
289
  setCurrentLine(line + 1);
290
+ } else if (currentLineData.decision) {
291
+ finishConversation();
290
292
  } else {
291
293
  isLast = true;
292
- finishConversation();
293
294
  }
294
295
  }
295
296
 
296
297
  if (!isLast) {
297
298
  setStarted(true);
298
299
  }
299
- }, [currentLine, currentLineData === null || currentLineData === void 0 ? void 0 : currentLineData.decision, finishConversation, handleBranchDirection, handleDecisionBranch, isBranched, lines.length]);
300
+ }, [currentLine, currentLineData.decision, finishConversation, handleBranchDirection, handleDecisionBranch, isBranched, lines.length]);
300
301
 
301
302
  var handleClickBack = function handleClickBack() {
302
303
  setStarted(false);
@@ -314,8 +315,13 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
314
315
 
315
316
  var manualClickNext = function manualClickNext() {
316
317
  playSound('click-ui');
317
- setAutomatic(false);
318
- handleClickNext();
318
+
319
+ if (currentLine === lines.length - 1) {
320
+ finishConversation();
321
+ } else {
322
+ setAutomatic(false);
323
+ handleClickNext();
324
+ }
319
325
  };
320
326
 
321
327
  var manualClickBack = function manualClickBack() {
@@ -427,7 +433,7 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
427
433
  }, /*#__PURE__*/_react.default.createElement("span", {
428
434
  className: (0, _LangIsRtl.default)() ? 'icon-next' : 'icon-back'
429
435
  })), /*#__PURE__*/_react.default.createElement("button", {
430
- className: "gat--btn__round",
436
+ className: "gat--btn__round ".concat(automatic && currentLine === lines.length - 1 ? 'glowing-animation' : ''),
431
437
  type: "button",
432
438
  onClick: manualClickNext
433
439
  }, /*#__PURE__*/_react.default.createElement("span", {
@@ -290,20 +290,20 @@ var DialogComponent = function DialogComponent(_ref) {
290
290
  });
291
291
 
292
292
  if (!(foundEdge !== null && foundEdge !== void 0 && foundEdge[keys[0]])) {
293
- finishConversation();
294
- } else {
295
- var destination = lines.findIndex(function (l) {
296
- return l.id === foundEdge[keys[1]];
297
- });
293
+ return;
294
+ }
298
295
 
299
- if (destination >= 0) {
300
- setCurrentMessage({
301
- show: false
302
- });
303
- changeLine(destination);
304
- } else {
305
- finishConversation();
306
- }
296
+ var destination = lines.findIndex(function (l) {
297
+ return l.id === foundEdge[keys[1]];
298
+ });
299
+
300
+ if (destination >= 0) {
301
+ setCurrentMessage({
302
+ show: false
303
+ });
304
+ changeLine(destination);
305
+ } else {
306
+ finishConversation();
307
307
  }
308
308
  }, [currentLine === null || currentLine === void 0 ? void 0 : currentLine.id, edges, finishConversation, lines]);
309
309
  var handleDecisionBranch = (0, _react.useCallback)(function (choice, reset) {
@@ -360,7 +360,7 @@ var DialogComponent = function DialogComponent(_ref) {
360
360
  show: false
361
361
  });
362
362
  changeLine(line + 1);
363
- } else {
363
+ } else if (currentLine.decision) {
364
364
  finishConversation();
365
365
  }
366
366
  }, [currentLine === null || currentLine === void 0 ? void 0 : currentLine.decision, isBranched, line, lines.length, handleDecisionBranch, handleBranchDirection, finishConversation]);
@@ -371,8 +371,12 @@ var DialogComponent = function DialogComponent(_ref) {
371
371
  };
372
372
 
373
373
  var manualNextLine = function manualNextLine() {
374
- setAutomatic(false);
375
- nextLine();
374
+ if (line === lines.length - 1) {
375
+ finishConversation();
376
+ } else {
377
+ setAutomatic(false);
378
+ nextLine();
379
+ }
376
380
  }; // Calculate start node
377
381
 
378
382
 
@@ -762,7 +766,7 @@ var DialogComponent = function DialogComponent(_ref) {
762
766
  type: "button",
763
767
  onClick: manualNextLine,
764
768
  disabled: animationRunning,
765
- className: "gat--btn__round ".concat(animationRunning ? 'disabled' : '')
769
+ className: "gat--btn__round \n ".concat(animationRunning ? 'disabled' : '', "\n ").concat(automatic && line === lines.length - 1 ? 'glowing-animation' : '')
766
770
  }, /*#__PURE__*/_react.default.createElement("span", {
767
771
  className: (0, _LangIsRtl.default)() ? 'icon-back' : 'icon-next'
768
772
  })))));
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.34.0",
5
+ "version": "1.35.0",
6
6
  "main": "dist/index.js",
7
7
  "files": [
8
8
  "dist",
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "@babel/runtime": "^7.18.6",
17
- "@gamelearn/arcade-styles": "0.15.7",
17
+ "@gamelearn/arcade-styles": "0.15.8",
18
18
  "@gamelearn/arcade-three-core": "1.17.1",
19
19
  "@react-three/drei": "9.4.3",
20
20
  "@react-three/fiber": "8.0.17",