@gamelearn/arcade-components 1.18.1 → 1.18.2
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.
|
@@ -46,29 +46,34 @@ var ComicComponent = function ComicComponent(_ref) {
|
|
|
46
46
|
soundActions = _ref$soundActions === void 0 ? [function () {}, function () {}] : _ref$soundActions,
|
|
47
47
|
autoPlay = _ref.autoPlay;
|
|
48
48
|
|
|
49
|
-
var _useState = (0, _react.useState)(
|
|
49
|
+
var _useState = (0, _react.useState)(true),
|
|
50
50
|
_useState2 = _slicedToArray(_useState, 2),
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
started = _useState2[0],
|
|
52
|
+
setStarted = _useState2[1];
|
|
53
53
|
|
|
54
|
-
var _useState3 = (0, _react.useState)(
|
|
54
|
+
var _useState3 = (0, _react.useState)(!!autoPlay),
|
|
55
55
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
automatic = _useState4[0],
|
|
57
|
+
setAutomatic = _useState4[1];
|
|
58
|
+
|
|
59
|
+
var _useState5 = (0, _react.useState)(false),
|
|
60
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
61
|
+
audioFailed = _useState6[0],
|
|
62
|
+
setAudioFailed = _useState6[1];
|
|
58
63
|
|
|
59
64
|
var _useTimeout = (0, _useTimeout2.default)(),
|
|
60
65
|
start = _useTimeout.start,
|
|
61
66
|
stop = _useTimeout.stop;
|
|
62
67
|
|
|
63
|
-
var
|
|
64
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
65
|
-
slideCount = _useState6[0],
|
|
66
|
-
setCount = _useState6[1];
|
|
67
|
-
|
|
68
|
-
var _useState7 = (0, _react.useState)('slide-animation'),
|
|
68
|
+
var _useState7 = (0, _react.useState)(0),
|
|
69
69
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
slideCount = _useState8[0],
|
|
71
|
+
setCount = _useState8[1];
|
|
72
|
+
|
|
73
|
+
var _useState9 = (0, _react.useState)('slide-animation'),
|
|
74
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
75
|
+
slideTransition = _useState10[0],
|
|
76
|
+
setTransition = _useState10[1];
|
|
72
77
|
|
|
73
78
|
var _soundActions = _slicedToArray(soundActions, 1),
|
|
74
79
|
play = _soundActions[0];
|
|
@@ -80,21 +85,25 @@ var ComicComponent = function ComicComponent(_ref) {
|
|
|
80
85
|
});
|
|
81
86
|
}, [emitEvent]);
|
|
82
87
|
var goToNextSlide = (0, _react.useCallback)(function () {
|
|
88
|
+
setStarted(false);
|
|
83
89
|
setAudioFailed(false);
|
|
84
90
|
|
|
85
91
|
if (slideCount + 1 < slides.length) {
|
|
86
92
|
setTransition('slide-animation');
|
|
87
93
|
setCount(slideCount + 1);
|
|
94
|
+
setStarted(true);
|
|
88
95
|
} else {
|
|
89
96
|
close();
|
|
90
97
|
}
|
|
91
98
|
}, [close, slideCount, slides === null || slides === void 0 ? void 0 : slides.length]);
|
|
92
99
|
var goToPreviousSlide = (0, _react.useCallback)(function () {
|
|
100
|
+
setStarted(false);
|
|
93
101
|
setAudioFailed(false);
|
|
94
102
|
|
|
95
103
|
if (slideCount - 1 >= 0) {
|
|
96
104
|
setTransition('slide-animation');
|
|
97
105
|
setCount(slideCount - 1);
|
|
106
|
+
setStarted(true);
|
|
98
107
|
play('click-ui');
|
|
99
108
|
}
|
|
100
109
|
}, [play, slideCount]);
|
|
@@ -116,6 +125,7 @@ var ComicComponent = function ComicComponent(_ref) {
|
|
|
116
125
|
voice: slides === null || slides === void 0 ? void 0 : (_slides$slideCount2 = slides[slideCount]) === null || _slides$slideCount2 === void 0 ? void 0 : _slides$slideCount2.voice,
|
|
117
126
|
text: slides === null || slides === void 0 ? void 0 : (_slides$slideCount3 = slides[slideCount]) === null || _slides$slideCount3 === void 0 ? void 0 : (_slides$slideCount3$v = _slides$slideCount3.vignettes[0].textData) === null || _slides$slideCount3$v === void 0 ? void 0 : _slides$slideCount3$v.text,
|
|
118
127
|
audio: slides === null || slides === void 0 ? void 0 : (_slides$slideCount4 = slides[slideCount]) === null || _slides$slideCount4 === void 0 ? void 0 : _slides$slideCount4.audio,
|
|
128
|
+
started: started,
|
|
119
129
|
soundActions: soundActions,
|
|
120
130
|
emitEvent: emitEvent,
|
|
121
131
|
onError: function onError() {
|
package/dist/components/conversational-pro-component/components/ConversationalProComponent.js
CHANGED
|
@@ -61,20 +61,25 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
|
|
|
61
61
|
lodSettings = _ref.lodSettings,
|
|
62
62
|
autoPlay = _ref.autoPlay;
|
|
63
63
|
|
|
64
|
-
var _useState = (0, _react.useState)(
|
|
64
|
+
var _useState = (0, _react.useState)(true),
|
|
65
65
|
_useState2 = _slicedToArray(_useState, 2),
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
started = _useState2[0],
|
|
67
|
+
setStarted = _useState2[1];
|
|
68
68
|
|
|
69
|
-
var _useState3 = (0, _react.useState)(
|
|
69
|
+
var _useState3 = (0, _react.useState)(!!autoPlay),
|
|
70
70
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
automatic = _useState4[0],
|
|
72
|
+
setAutomatic = _useState4[1];
|
|
73
73
|
|
|
74
|
-
var _useState5 = (0, _react.useState)(
|
|
74
|
+
var _useState5 = (0, _react.useState)(false),
|
|
75
75
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
audioFailed = _useState6[0],
|
|
77
|
+
setAudioFailed = _useState6[1];
|
|
78
|
+
|
|
79
|
+
var _useState7 = (0, _react.useState)(0),
|
|
80
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
81
|
+
currentLine = _useState8[0],
|
|
82
|
+
setCurrentLine = _useState8[1];
|
|
78
83
|
|
|
79
84
|
var _soundActions = _slicedToArray(soundActions, 1),
|
|
80
85
|
playSound = _soundActions[0];
|
|
@@ -246,6 +251,7 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
|
|
|
246
251
|
}
|
|
247
252
|
}, [currentLineData.id, edges, finishConversation, lines]);
|
|
248
253
|
var handleClickNext = (0, _react.useCallback)(function (choice, reset) {
|
|
254
|
+
setStarted(false);
|
|
249
255
|
setAudioFailed(false);
|
|
250
256
|
|
|
251
257
|
if (isBranched) {
|
|
@@ -264,9 +270,12 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
|
|
|
264
270
|
finishConversation();
|
|
265
271
|
}
|
|
266
272
|
}
|
|
273
|
+
|
|
274
|
+
setStarted(true);
|
|
267
275
|
}, [currentLine, finishConversation, handleBranchDirection, handleDecisionBranch, isBranched, lines.length]);
|
|
268
276
|
|
|
269
277
|
var handleClickBack = function handleClickBack() {
|
|
278
|
+
setStarted(false);
|
|
270
279
|
setAudioFailed(false);
|
|
271
280
|
|
|
272
281
|
if (isBranched) {
|
|
@@ -274,6 +283,8 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
|
|
|
274
283
|
} else if (currentLine > 0) {
|
|
275
284
|
setCurrentLine(currentLine - 1);
|
|
276
285
|
}
|
|
286
|
+
|
|
287
|
+
setStarted(true);
|
|
277
288
|
};
|
|
278
289
|
|
|
279
290
|
var manualClickNext = function manualClickNext() {
|
|
@@ -292,6 +303,7 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
|
|
|
292
303
|
var stopEkho = (0, _useEkho.default)({
|
|
293
304
|
audioType: currentLineData === null || currentLineData === void 0 ? void 0 : currentLineData.audioType,
|
|
294
305
|
voice: currentLineData === null || currentLineData === void 0 ? void 0 : currentLineData.voice,
|
|
306
|
+
started: started,
|
|
295
307
|
text: currentMessage === null || currentMessage === void 0 ? void 0 : currentMessage.text,
|
|
296
308
|
audio: currentLineData === null || currentLineData === void 0 ? void 0 : currentLineData.audio,
|
|
297
309
|
soundActions: soundActions,
|
|
@@ -300,7 +312,7 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
|
|
|
300
312
|
setAudioFailed(true);
|
|
301
313
|
},
|
|
302
314
|
onFinish: function onFinish() {
|
|
303
|
-
if (autoplayCond
|
|
315
|
+
if (autoplayCond) {
|
|
304
316
|
handleClickNext();
|
|
305
317
|
}
|
|
306
318
|
}
|
package/dist/helpers/useEkho.js
CHANGED
|
@@ -7,6 +7,12 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
|
|
10
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
11
|
+
|
|
12
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
13
|
+
|
|
14
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
|
+
|
|
10
16
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
11
17
|
|
|
12
18
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
@@ -157,6 +163,9 @@ var useEkho = function useEkho(_ref) {
|
|
|
157
163
|
}(), [emitEvent, onError, setCurrentPlaying]);
|
|
158
164
|
var stopCurrentAudio = (0, _react.useCallback)(function () {
|
|
159
165
|
if (currentPlaying.current.url) {
|
|
166
|
+
currentPlaying.current = _objectSpread(_objectSpread({}, currentPlaying.current), {}, {
|
|
167
|
+
url: ''
|
|
168
|
+
});
|
|
160
169
|
stop(currentPlaying.current.cc);
|
|
161
170
|
}
|
|
162
171
|
}, [stop]);
|