@gamelearn/arcade-components 1.3.10 → 1.3.12
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/README.md
CHANGED
|
@@ -28,6 +28,18 @@ export default class App extends Component {
|
|
|
28
28
|
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
+
## Generar version hotfix para arcade/master-stg
|
|
32
|
+
|
|
33
|
+
Para generar una version hotfix nos vamos al commit que desplego la version que utiliza actualmente arcade/master-stg y creamos una rama sobre ella.
|
|
34
|
+
|
|
35
|
+
Generamos los cambios o hacemos cherrypick de ellos si ya estan creados y una vez terminemos con los cambios tendremos que cambiar la version del package.json a una tal que asi :
|
|
36
|
+
|
|
37
|
+
`"version": "1.3.5-fix-1",`
|
|
38
|
+
|
|
39
|
+
Habiendo cambiado ya la version pasaremos a publicarla usando el comando
|
|
40
|
+
|
|
41
|
+
`npm publish`
|
|
42
|
+
|
|
31
43
|
## Available Scripts
|
|
32
44
|
|
|
33
45
|
Para ver Storybook en local
|
package/dist/components/conversational-pro-component/components/ConversationalProComponent.js
CHANGED
|
@@ -121,13 +121,13 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
|
|
|
121
121
|
return !decision ? getCurrentMessage() : {};
|
|
122
122
|
}, [getCurrentMessage, decision]);
|
|
123
123
|
var playSpeech = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
124
|
-
var payload;
|
|
124
|
+
var payload, url;
|
|
125
125
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
126
126
|
while (1) {
|
|
127
127
|
switch (_context.prev = _context.next) {
|
|
128
128
|
case 0:
|
|
129
129
|
if (!(currentLineData.voice.id && currentMessage)) {
|
|
130
|
-
_context.next =
|
|
130
|
+
_context.next = 7;
|
|
131
131
|
break;
|
|
132
132
|
}
|
|
133
133
|
|
|
@@ -137,23 +137,27 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
|
|
|
137
137
|
};
|
|
138
138
|
|
|
139
139
|
if (!(payload.voiceId && payload.text)) {
|
|
140
|
-
_context.next =
|
|
140
|
+
_context.next = 7;
|
|
141
141
|
break;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
_context.next = 5;
|
|
145
145
|
return emitEvent({
|
|
146
|
-
type: '
|
|
146
|
+
type: 'getSpeech',
|
|
147
147
|
payload: payload
|
|
148
148
|
});
|
|
149
149
|
|
|
150
150
|
case 5:
|
|
151
|
+
url = _context.sent;
|
|
152
|
+
playSound(url, 'tts');
|
|
153
|
+
|
|
154
|
+
case 7:
|
|
151
155
|
case "end":
|
|
152
156
|
return _context.stop();
|
|
153
157
|
}
|
|
154
158
|
}
|
|
155
159
|
}, _callee);
|
|
156
|
-
})), [currentLineData.voice, currentMessage, emitEvent, getVoice]); // Recupera la antigua linea de la conversacion para conservar los personajes en voice-over
|
|
160
|
+
})), [currentLineData.voice, currentMessage, emitEvent, getVoice, playSound]); // Recupera la antigua linea de la conversacion para conservar los personajes en voice-over
|
|
157
161
|
|
|
158
162
|
var leftWithSlots = lines.slice(0, currentLine + 1).reverse().find(function (line) {
|
|
159
163
|
return line.slots;
|
|
@@ -261,13 +265,18 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
|
|
|
261
265
|
} else if (currentLineData !== null && currentLineData !== void 0 && (_currentLineData$audi = currentLineData.audio) !== null && _currentLineData$audi !== void 0 && _currentLineData$audi.url) {
|
|
262
266
|
var _currentLineData$audi2;
|
|
263
267
|
|
|
264
|
-
playSound(currentLineData === null || currentLineData === void 0 ? void 0 : (_currentLineData$audi2 = currentLineData.audio) === null || _currentLineData$audi2 === void 0 ? void 0 : _currentLineData$audi2.url);
|
|
268
|
+
playSound(currentLineData === null || currentLineData === void 0 ? void 0 : (_currentLineData$audi2 = currentLineData.audio) === null || _currentLineData$audi2 === void 0 ? void 0 : _currentLineData$audi2.url, 'tts');
|
|
265
269
|
}
|
|
266
270
|
|
|
267
271
|
return function () {
|
|
268
|
-
stop();
|
|
272
|
+
stop('tts');
|
|
269
273
|
};
|
|
270
274
|
}, [currentLineData, currentMessage, finished, lines, playSound, playSpeech, stop]);
|
|
275
|
+
(0, _react.useEffect)(function () {
|
|
276
|
+
return function () {
|
|
277
|
+
stop('tts');
|
|
278
|
+
};
|
|
279
|
+
}, [stop]);
|
|
271
280
|
|
|
272
281
|
var decisionPayload = _objectSpread(_objectSpread({}, currentLineData.payload), {}, {
|
|
273
282
|
onFinish: handleClickNext,
|
|
@@ -149,13 +149,13 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
149
149
|
return null;
|
|
150
150
|
}, [translate]);
|
|
151
151
|
var playSpeech = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
152
|
-
var payload;
|
|
152
|
+
var payload, url;
|
|
153
153
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
154
154
|
while (1) {
|
|
155
155
|
switch (_context.prev = _context.next) {
|
|
156
156
|
case 0:
|
|
157
157
|
if (!currentLine.voice.id) {
|
|
158
|
-
_context.next =
|
|
158
|
+
_context.next = 7;
|
|
159
159
|
break;
|
|
160
160
|
}
|
|
161
161
|
|
|
@@ -165,23 +165,32 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
165
165
|
};
|
|
166
166
|
|
|
167
167
|
if (!(payload.voiceId && payload.text)) {
|
|
168
|
-
_context.next =
|
|
168
|
+
_context.next = 7;
|
|
169
169
|
break;
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
_context.next = 5;
|
|
173
173
|
return emitEvent({
|
|
174
|
-
type: '
|
|
174
|
+
type: 'getSpeech',
|
|
175
175
|
payload: payload
|
|
176
176
|
});
|
|
177
177
|
|
|
178
178
|
case 5:
|
|
179
|
+
url = _context.sent;
|
|
180
|
+
playSound(url, 'tts');
|
|
181
|
+
|
|
182
|
+
case 7:
|
|
183
|
+
return _context.abrupt("return", function () {
|
|
184
|
+
stop('tts');
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
case 8:
|
|
179
188
|
case "end":
|
|
180
189
|
return _context.stop();
|
|
181
190
|
}
|
|
182
191
|
}
|
|
183
192
|
}, _callee);
|
|
184
|
-
})), [currentLine === null || currentLine === void 0 ? void 0 : currentLine.voice, getVoice, currentMessage.text, emitEvent]);
|
|
193
|
+
})), [currentLine === null || currentLine === void 0 ? void 0 : currentLine.voice, getVoice, currentMessage.text, playSound, emitEvent, stop]);
|
|
185
194
|
var getCurrentVisible = (0, _react.useCallback)(function (uid) {
|
|
186
195
|
var object;
|
|
187
196
|
scene.traverseVisible(function (node) {
|
|
@@ -227,7 +236,7 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
227
236
|
} else {
|
|
228
237
|
onLoadAnim();
|
|
229
238
|
}
|
|
230
|
-
}, [loader]);
|
|
239
|
+
}, [loader]);
|
|
231
240
|
|
|
232
241
|
var executeAnimation = function executeAnimation(element) {
|
|
233
242
|
var mixer = element.userData.mixer;
|
|
@@ -244,30 +253,16 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
244
253
|
|
|
245
254
|
element.userData.currentEmotion = defaultAction;
|
|
246
255
|
}
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
var resetAnims = (0, _react.useCallback)(function () {
|
|
250
|
-
var end = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
256
|
+
}; // Reset currentEmotion to defaultAnim
|
|
251
257
|
|
|
252
|
-
if (end) {
|
|
253
|
-
scene.traverseVisible(function (node) {
|
|
254
|
-
if (node.userData.mixer && node.userData.currentEmotion) {
|
|
255
|
-
executeAnimation(node);
|
|
256
|
-
}
|
|
257
|
-
});
|
|
258
|
-
} else if (lastLine !== null && lastLine !== void 0 && lastLine.slots) {
|
|
259
|
-
var slottedCharacters = lastLine.slots.filter(function (slot) {
|
|
260
|
-
return slot.uid;
|
|
261
|
-
});
|
|
262
|
-
slottedCharacters.forEach(function (slot) {
|
|
263
|
-
var element = getCurrentVisible(slot.uid);
|
|
264
258
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
259
|
+
var resetAnims = (0, _react.useCallback)(function () {
|
|
260
|
+
scene.traverseVisible(function (node) {
|
|
261
|
+
if (node.userData.mixer && node.userData.currentEmotion) {
|
|
262
|
+
executeAnimation(node);
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
}, [scene]);
|
|
271
266
|
var resetCameraView = (0, _react.useCallback)(function () {
|
|
272
267
|
messagePosition.current.child = null;
|
|
273
268
|
messagePosition.current.parent = null;
|
|
@@ -284,7 +279,7 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
284
279
|
setCurrentMessage({});
|
|
285
280
|
changeLine(line + 1);
|
|
286
281
|
} else {
|
|
287
|
-
resetAnims(
|
|
282
|
+
resetAnims();
|
|
288
283
|
lastSet.current = true;
|
|
289
284
|
setCurrentMessage({});
|
|
290
285
|
resetCameraView();
|
|
@@ -318,8 +313,7 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
318
313
|
});
|
|
319
314
|
var slottedCharacters = currentLine.slots.filter(function (slot) {
|
|
320
315
|
return slot.uid && !slot.talking;
|
|
321
|
-
});
|
|
322
|
-
resetAnims(false); // Check not talking elements emotion
|
|
316
|
+
}); // Check not talking elements emotion
|
|
323
317
|
|
|
324
318
|
slottedCharacters.forEach(function (slot) {
|
|
325
319
|
var element = getCurrentVisible(slot.uid);
|
|
@@ -408,7 +402,7 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
408
402
|
});
|
|
409
403
|
}
|
|
410
404
|
}
|
|
411
|
-
}, [actors, camera, currentLine, zoomInActor, getCurrentVisible, translate, getAvatarURL, loadEmotion,
|
|
405
|
+
}, [actors, camera, currentLine, zoomInActor, getCurrentVisible, translate, getAvatarURL, loadEmotion, resetCameraView]); // Sound logic
|
|
412
406
|
|
|
413
407
|
(0, _react.useEffect)(function () {
|
|
414
408
|
var _currentLine$audio;
|
|
@@ -418,13 +412,18 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
418
412
|
} else if (currentLine !== null && currentLine !== void 0 && (_currentLine$audio = currentLine.audio) !== null && _currentLine$audio !== void 0 && _currentLine$audio.url) {
|
|
419
413
|
var _currentLine$audio2;
|
|
420
414
|
|
|
421
|
-
playSound(currentLine === null || currentLine === void 0 ? void 0 : (_currentLine$audio2 = currentLine.audio) === null || _currentLine$audio2 === void 0 ? void 0 : _currentLine$audio2.url);
|
|
415
|
+
playSound(currentLine === null || currentLine === void 0 ? void 0 : (_currentLine$audio2 = currentLine.audio) === null || _currentLine$audio2 === void 0 ? void 0 : _currentLine$audio2.url, 'tts');
|
|
422
416
|
}
|
|
423
417
|
|
|
424
418
|
return function () {
|
|
425
|
-
stop();
|
|
419
|
+
stop('tts');
|
|
420
|
+
};
|
|
421
|
+
}, [currentLine === null || currentLine === void 0 ? void 0 : (_currentLine$audio3 = currentLine.audio) === null || _currentLine$audio3 === void 0 ? void 0 : _currentLine$audio3.url, currentLine === null || currentLine === void 0 ? void 0 : currentLine.audioType, currentMessage, lines, playSound, playSpeech, stop]);
|
|
422
|
+
(0, _react.useEffect)(function () {
|
|
423
|
+
return function () {
|
|
424
|
+
stop('tts');
|
|
426
425
|
};
|
|
427
|
-
}, [
|
|
426
|
+
}, [stop]); // Autoplay logic
|
|
428
427
|
|
|
429
428
|
(0, _react.useEffect)(function () {
|
|
430
429
|
var timeout;
|