@gamelearn/arcade-components 1.22.0 → 1.22.8
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.
package/dist/components/conversational-pro-component/components/ConversationalProComponent.js
CHANGED
|
@@ -94,6 +94,12 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
|
|
|
94
94
|
var voiceOver = currentLineData.voiceOver,
|
|
95
95
|
decision = currentLineData.decision;
|
|
96
96
|
var isBranched = !!edges;
|
|
97
|
+
|
|
98
|
+
var _useState9 = (0, _react.useState)(false),
|
|
99
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
100
|
+
previousLineWasDecision = _useState10[0],
|
|
101
|
+
setPreviousLineWasDecision = _useState10[1];
|
|
102
|
+
|
|
97
103
|
var isVoiceOver = voiceOver || currentLineData.type === 'conversationalNarration';
|
|
98
104
|
var isDecision = decision || currentLineData.type === 'conversationalDecision';
|
|
99
105
|
var isFlex = currentLineData.flex;
|
|
@@ -251,6 +257,7 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
|
|
|
251
257
|
}
|
|
252
258
|
}, [currentLineData.id, edges, finishConversation, lines]);
|
|
253
259
|
var handleClickNext = (0, _react.useCallback)(function (choice, reset) {
|
|
260
|
+
setPreviousLineWasDecision(currentLineData.decision);
|
|
254
261
|
setStarted(false);
|
|
255
262
|
setAudioFailed(false);
|
|
256
263
|
|
|
@@ -272,7 +279,7 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
|
|
|
272
279
|
}
|
|
273
280
|
|
|
274
281
|
setStarted(true);
|
|
275
|
-
}, [currentLine, finishConversation, handleBranchDirection, handleDecisionBranch, isBranched, lines.length]);
|
|
282
|
+
}, [currentLine, currentLineData, finishConversation, handleBranchDirection, handleDecisionBranch, isBranched, lines.length]);
|
|
276
283
|
|
|
277
284
|
var handleClickBack = function handleClickBack() {
|
|
278
285
|
setStarted(false);
|
|
@@ -300,7 +307,7 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
|
|
|
300
307
|
};
|
|
301
308
|
|
|
302
309
|
var autoplayCond = automatic && !isDecision;
|
|
303
|
-
var disableBackButton = currentLine === 0 || currentLine > 0 && (lastLine === null || lastLine === void 0 ? void 0 : lastLine.decision);
|
|
310
|
+
var disableBackButton = currentLine === 0 || previousLineWasDecision || currentLine > 0 && (lastLine === null || lastLine === void 0 ? void 0 : lastLine.decision);
|
|
304
311
|
var stopEkho = (0, _useEkho.default)({
|
|
305
312
|
audioType: currentLineData === null || currentLineData === void 0 ? void 0 : currentLineData.audioType,
|
|
306
313
|
voice: currentLineData === null || currentLineData === void 0 ? void 0 : currentLineData.voice,
|
|
@@ -131,6 +131,7 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
131
131
|
var groupRef = (0, _react.useRef)();
|
|
132
132
|
var animationTarget = (0, _react.useRef)(new _three.Object3D());
|
|
133
133
|
var currentLine = lines[line];
|
|
134
|
+
var currentLineData = lines[line];
|
|
134
135
|
var lastLine = lines[line - 1];
|
|
135
136
|
var lastSet = (0, _react.useRef)(false);
|
|
136
137
|
var isBranched = !!edges;
|
|
@@ -145,6 +146,12 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
145
146
|
payload: id
|
|
146
147
|
});
|
|
147
148
|
}, [emitEvent]);
|
|
149
|
+
|
|
150
|
+
var _useState9 = (0, _react.useState)(false),
|
|
151
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
152
|
+
previousLineWasDecision = _useState10[0],
|
|
153
|
+
setPreviousLineWasDecision = _useState10[1];
|
|
154
|
+
|
|
148
155
|
var isVoiceOver = voiceOver || (currentLine === null || currentLine === void 0 ? void 0 : currentLine.type) === 'conversationalNarration';
|
|
149
156
|
var isDecision = decision || (currentLine === null || currentLine === void 0 ? void 0 : currentLine.type) === 'conversationalDecision';
|
|
150
157
|
var getCurrentVisible = (0, _react.useCallback)(function (uid) {
|
|
@@ -303,6 +310,7 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
303
310
|
}
|
|
304
311
|
}, [currentLine === null || currentLine === void 0 ? void 0 : currentLine.id, edges, finishConversation, lines]);
|
|
305
312
|
var nextLine = (0, _react.useCallback)(function (choice, reset) {
|
|
313
|
+
setPreviousLineWasDecision(currentLineData.decision);
|
|
306
314
|
setAudioFailed(false);
|
|
307
315
|
|
|
308
316
|
if (isBranched) {
|
|
@@ -319,7 +327,7 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
319
327
|
} else {
|
|
320
328
|
finishConversation();
|
|
321
329
|
}
|
|
322
|
-
}, [isBranched, line, lines.length, handleDecisionBranch, handleBranchDirection, finishConversation]);
|
|
330
|
+
}, [currentLineData.decision, isBranched, line, lines.length, handleDecisionBranch, handleBranchDirection, finishConversation]);
|
|
323
331
|
|
|
324
332
|
var manualBackLine = function manualBackLine() {
|
|
325
333
|
setAutomatic(false);
|
|
@@ -590,7 +598,7 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
590
598
|
height: '100vh',
|
|
591
599
|
position: 'static'
|
|
592
600
|
};
|
|
593
|
-
var disableBackButton = line === 0 || line > 0 && (lastLine === null || lastLine === void 0 ? void 0 : lastLine.decision);
|
|
601
|
+
var disableBackButton = line === 0 || previousLineWasDecision || line > 0 && (lastLine === null || lastLine === void 0 ? void 0 : lastLine.decision);
|
|
594
602
|
|
|
595
603
|
if (isDecision) {
|
|
596
604
|
var decisionPayload = _objectSpread(_objectSpread({}, currentLine.payload), {}, {
|