@gamelearn/arcade-components 2.2.1 → 2.2.3
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/auto-evaluation-component/components/AutoEvaluation.js +2 -4
- package/dist/components/cards-selector-puzzle-component/components/CardsSelectorPuzzleComponent.js +3 -6
- package/dist/components/chained-image-click-puzzle-component/components/CurrentImagePuzzle.js +8 -20
- package/dist/components/comic-component/components/ComicComponent.js +4 -2
- package/dist/components/conversational-pro-component/components/ConversationalProComponent.js +48 -144
- package/dist/components/conversational-pro-component/components/SlotList.js +2 -6
- package/dist/components/conversational-pro-component/components/scene/Panel.js +10 -72
- package/dist/components/conversational-pro-component/components/scene/Panels.js +1 -3
- package/dist/components/conversational-pro-component/components/scene/index.js +1 -8
- package/dist/components/dialog-component/components/DialogComponent.js +81 -202
- package/dist/components/feedback-component/components/FeedbackComponent.js +3 -2
- package/dist/components/frame-click-puzzle-component/components/CurrentFramePuzzle.js +3 -16
- package/dist/components/frame-click-puzzle-component/components/FrameClickPuzzleComponent.js +2 -4
- package/dist/components/image-click-wrapper-component/components/ImageClickWrapperComponent.js +1 -9
- package/dist/components/lectures-component/components/LecturesComponent.js +1 -1
- package/dist/components/survey-component/components/SurveyComponent.js +2 -4
- package/dist/components/terminal-puzzle-component/components/Visor/index.js +1 -1
- package/dist/components/test-component/components/Container.js +3 -4
- package/dist/components/test-component/components/TestComponent.js +4 -11
- package/dist/helpers/index.js +4 -70
- package/dist/helpers/useEkho.js +8 -14
- package/package.json +2 -2
package/dist/components/frame-click-puzzle-component/components/FrameClickPuzzleComponent.js
CHANGED
|
@@ -48,8 +48,7 @@ var FrameImageClickComponent = function FrameImageClickComponent(_ref) {
|
|
|
48
48
|
soundActions = _ref.soundActions,
|
|
49
49
|
disableExit = _ref.disableExit,
|
|
50
50
|
setResolveAction = _ref.setResolveAction,
|
|
51
|
-
setInfo = _ref.setInfo
|
|
52
|
-
pause = _ref.pause;
|
|
51
|
+
setInfo = _ref.setInfo;
|
|
53
52
|
|
|
54
53
|
var _useState = (0, _react.useState)({}),
|
|
55
54
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -162,8 +161,7 @@ var FrameImageClickComponent = function FrameImageClickComponent(_ref) {
|
|
|
162
161
|
emitResetPuzzle: resetPuzzle,
|
|
163
162
|
setPuzzlesAutoCompleted: setPuzzlesAutoCompleted,
|
|
164
163
|
puzzlesAutoCompleted: puzzlesAutoCompleted,
|
|
165
|
-
emitOpenPopupCounterInfo: onInitPuzzle
|
|
166
|
-
pause: pause
|
|
164
|
+
emitOpenPopupCounterInfo: onInitPuzzle
|
|
167
165
|
};
|
|
168
166
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
169
167
|
className: "puzzle-frame"
|
package/dist/components/image-click-wrapper-component/components/ImageClickWrapperComponent.js
CHANGED
|
@@ -88,8 +88,7 @@ var ImageClickWrapperComponent = function ImageClickWrapperComponent(props) {
|
|
|
88
88
|
emitResetPuzzle = props.emitResetPuzzle,
|
|
89
89
|
firstTryForFrame = props.firstTryForFrame,
|
|
90
90
|
puzzlesAutoCompleted = props.puzzlesAutoCompleted,
|
|
91
|
-
emitOpenPopupCounterInfo = props.emitOpenPopupCounterInfo
|
|
92
|
-
pause = props.pause;
|
|
91
|
+
emitOpenPopupCounterInfo = props.emitOpenPopupCounterInfo;
|
|
93
92
|
|
|
94
93
|
var _useState = (0, _react.useState)([]),
|
|
95
94
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -168,13 +167,6 @@ var ImageClickWrapperComponent = function ImageClickWrapperComponent(props) {
|
|
|
168
167
|
shape: 'poly'
|
|
169
168
|
}, area);
|
|
170
169
|
});
|
|
171
|
-
(0, _react.useEffect)(function () {
|
|
172
|
-
if (pause) {
|
|
173
|
-
clearInterval(intervalForCountDown.current);
|
|
174
|
-
} else {
|
|
175
|
-
startCountDown();
|
|
176
|
-
}
|
|
177
|
-
}, [pause, startCountDown]);
|
|
178
170
|
var startCountDown = (0, _react.useCallback)(function () {
|
|
179
171
|
var timeout = setInterval(function () {
|
|
180
172
|
setCountDownTime(function (t) {
|
|
@@ -121,7 +121,7 @@ var LecturesComponent = function LecturesComponent(_ref) {
|
|
|
121
121
|
return visible ? /*#__PURE__*/_react.default.createElement("div", {
|
|
122
122
|
className: "".concat(viewed ? 'notes--results' : 'readings--container', " ").concat(!viewed && backgroundImage !== null && backgroundImage !== void 0 && backgroundImage.url ? 'readings--container--with-custom-bg' : ''),
|
|
123
123
|
style: !viewed && backgroundImage !== null && backgroundImage !== void 0 && backgroundImage.url ? {
|
|
124
|
-
backgroundImage: "url(
|
|
124
|
+
backgroundImage: "url(".concat(backgroundImage.url, ")")
|
|
125
125
|
} : {}
|
|
126
126
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
127
127
|
className: viewed ? 'notes--results__text' : 'readings'
|
|
@@ -107,9 +107,7 @@ var SurveyComponent = function SurveyComponent(_ref) {
|
|
|
107
107
|
};
|
|
108
108
|
|
|
109
109
|
var View = PAGES[page].component;
|
|
110
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
111
|
-
className: "survey--container__overlay"
|
|
112
|
-
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
110
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
113
111
|
className: "survey--container",
|
|
114
112
|
dir: "auto"
|
|
115
113
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -155,7 +153,7 @@ var SurveyComponent = function SurveyComponent(_ref) {
|
|
|
155
153
|
});
|
|
156
154
|
},
|
|
157
155
|
className: "gat--btn gat--btn__primary ".concat(disabled ? 'disabled' : '', " not-transition")
|
|
158
|
-
}, translate('survey.finish')))))
|
|
156
|
+
}, translate('survey.finish')))));
|
|
159
157
|
};
|
|
160
158
|
|
|
161
159
|
var _default = SurveyComponent;
|
|
@@ -120,8 +120,8 @@ var Visor = function Visor(_ref) {
|
|
|
120
120
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
121
121
|
className: "puzzle--terminal__visor"
|
|
122
122
|
}, /*#__PURE__*/_react.default.createElement(_FeedbackComponent.default, {
|
|
123
|
-
playSound: playSound,
|
|
124
123
|
shortText: true,
|
|
124
|
+
playSound: playSound,
|
|
125
125
|
success: fileId === solutionId,
|
|
126
126
|
text: fileId === solutionId ? info.solution.right.desc : info.solution.wrong.desc,
|
|
127
127
|
functionOnClose: fileId === solutionId ? resolvePuzzle : backFile,
|
|
@@ -47,8 +47,7 @@ var Container = function Container(_ref) {
|
|
|
47
47
|
updateForm = _ref.updateForm,
|
|
48
48
|
disabled = _ref.disabled,
|
|
49
49
|
translate = _ref.translate,
|
|
50
|
-
soundActions = _ref.soundActions
|
|
51
|
-
paused = _ref.paused;
|
|
50
|
+
soundActions = _ref.soundActions;
|
|
52
51
|
|
|
53
52
|
var _useState = (0, _react.useState)(0),
|
|
54
53
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -66,7 +65,7 @@ var Container = function Container(_ref) {
|
|
|
66
65
|
play = _soundActions[0];
|
|
67
66
|
|
|
68
67
|
(0, _react.useEffect)(function () {
|
|
69
|
-
if (time >= 0 && !disabled
|
|
68
|
+
if (time >= 0 && !disabled) {
|
|
70
69
|
var timeout = setInterval(function () {
|
|
71
70
|
if (!feedback) {
|
|
72
71
|
setTime(function (t) {
|
|
@@ -81,7 +80,7 @@ var Container = function Container(_ref) {
|
|
|
81
80
|
}
|
|
82
81
|
|
|
83
82
|
return undefined;
|
|
84
|
-
}, [disabled, feedback,
|
|
83
|
+
}, [disabled, feedback, saveInterval, setTime, time]);
|
|
85
84
|
|
|
86
85
|
var nextPage = function nextPage() {
|
|
87
86
|
play('click-ui');
|
|
@@ -52,8 +52,7 @@ var TestComponent = function TestComponent(_ref) {
|
|
|
52
52
|
emitEvent = _ref.emitEvent,
|
|
53
53
|
soundActions = _ref.soundActions,
|
|
54
54
|
audio = _ref.audio,
|
|
55
|
-
required = _ref.required
|
|
56
|
-
pause = _ref.pause;
|
|
55
|
+
required = _ref.required;
|
|
57
56
|
var questions = test.questions;
|
|
58
57
|
var indicators = emitEvent({
|
|
59
58
|
type: 'loadIndicators'
|
|
@@ -204,10 +203,7 @@ var TestComponent = function TestComponent(_ref) {
|
|
|
204
203
|
setResult({});
|
|
205
204
|
setTime(countdown.time);
|
|
206
205
|
setTimeOver(false);
|
|
207
|
-
|
|
208
|
-
if (audio !== null && audio !== void 0 && audio.url) {
|
|
209
|
-
playSound(audio.url, 'test_bg');
|
|
210
|
-
}
|
|
206
|
+
playSound(audio.url, 'test_bg');
|
|
211
207
|
};
|
|
212
208
|
|
|
213
209
|
var resultAnswers = Object.values(result);
|
|
@@ -243,9 +239,7 @@ var TestComponent = function TestComponent(_ref) {
|
|
|
243
239
|
});
|
|
244
240
|
};
|
|
245
241
|
|
|
246
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
247
|
-
className: "test--container__overlay"
|
|
248
|
-
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
242
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
249
243
|
className: "test--container",
|
|
250
244
|
dir: "auto"
|
|
251
245
|
}, view !== 'results' ? /*#__PURE__*/_react.default.createElement(_Container.default, {
|
|
@@ -256,7 +250,6 @@ var TestComponent = function TestComponent(_ref) {
|
|
|
256
250
|
tries: tries,
|
|
257
251
|
answerPage: answerPage,
|
|
258
252
|
setTime: setTime,
|
|
259
|
-
paused: pause,
|
|
260
253
|
saveInterval: saveInterval,
|
|
261
254
|
disabled: view !== 'test',
|
|
262
255
|
answered: answeredPage || view !== 'test',
|
|
@@ -284,7 +277,7 @@ var TestComponent = function TestComponent(_ref) {
|
|
|
284
277
|
timeOverText: countdown.text,
|
|
285
278
|
emitEvent: emitEvent,
|
|
286
279
|
soundActions: soundActions
|
|
287
|
-
}))
|
|
280
|
+
}));
|
|
288
281
|
};
|
|
289
282
|
|
|
290
283
|
var _default = TestComponent;
|
package/dist/helpers/index.js
CHANGED
|
@@ -3,35 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.zAxis = exports.yAxis = exports.xAxis = exports.vectorTranslateZ = exports.vectorTranslateY = exports.vectorTranslateX = exports.vectorTranslateOnAxis = exports.vectorToScreen = exports.usePrevious = exports.screenToVector = exports.roundFloat = exports.
|
|
6
|
+
exports.zAxis = exports.yAxis = exports.xAxis = exports.vectorTranslateZ = exports.vectorTranslateY = exports.vectorTranslateX = exports.vectorTranslateOnAxis = exports.vectorToScreen = exports.usePrevious = exports.screenToVector = exports.roundFloat = exports.getObjectPosition = exports.formatMessage = exports.executeCrossFade = exports.cameraFitAnyObject = void 0;
|
|
7
7
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
|
|
10
10
|
var _three = require("three");
|
|
11
11
|
|
|
12
|
-
var _GLTFLoader = require("three/examples/jsm/loaders/GLTFLoader");
|
|
13
|
-
|
|
14
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
15
|
-
|
|
16
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
17
|
-
|
|
18
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
19
|
-
|
|
20
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
21
|
-
|
|
22
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
23
|
-
|
|
24
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
25
|
-
|
|
26
12
|
var xAxis = new _three.Vector3(1, 0, 0);
|
|
27
13
|
exports.xAxis = xAxis;
|
|
28
14
|
var yAxis = new _three.Vector3(0, 1, 0);
|
|
29
15
|
exports.yAxis = yAxis;
|
|
30
16
|
var zAxis = new _three.Vector3(0, 0, 1);
|
|
31
17
|
exports.zAxis = zAxis;
|
|
32
|
-
var crossFadeDuration = 0.2;
|
|
33
|
-
var bones = ['Jaw_M', 'Head_M', 'L_lip_jnt', 'HeadEnd_M', 'Neck_M', 'R_lip_jnt', 'joint4', 'transform1', 'lowerTeeths', 'upperTeeths'];
|
|
34
|
-
var loader = new _GLTFLoader.GLTFLoader();
|
|
35
18
|
|
|
36
19
|
var formatMessage = function formatMessage(text) {
|
|
37
20
|
var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -44,12 +27,6 @@ var formatMessage = function formatMessage(text) {
|
|
|
44
27
|
|
|
45
28
|
exports.formatMessage = formatMessage;
|
|
46
29
|
|
|
47
|
-
var getRandomIndex = function getRandomIndex(length) {
|
|
48
|
-
return Math.floor(Math.random() * length);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
exports.getRandomIndex = getRandomIndex;
|
|
52
|
-
|
|
53
30
|
var usePrevious = function usePrevious(value) {
|
|
54
31
|
var ref = (0, _react.useRef)();
|
|
55
32
|
(0, _react.useEffect)(function () {
|
|
@@ -179,7 +156,7 @@ var setWeight = function setWeight(action, weight) {
|
|
|
179
156
|
action.setEffectiveWeight(weight);
|
|
180
157
|
};
|
|
181
158
|
|
|
182
|
-
var executeCrossFade = function executeCrossFade(startAction, endAction) {
|
|
159
|
+
var executeCrossFade = function executeCrossFade(startAction, endAction, duration) {
|
|
183
160
|
if (startAction === endAction) return;
|
|
184
161
|
if (!startAction || !endAction) return;
|
|
185
162
|
startAction.play();
|
|
@@ -187,51 +164,8 @@ var executeCrossFade = function executeCrossFade(startAction, endAction) {
|
|
|
187
164
|
endAction.reset();
|
|
188
165
|
endAction.time = 0;
|
|
189
166
|
setWeight(endAction, 1);
|
|
190
|
-
endAction.crossFadeFrom(startAction,
|
|
167
|
+
endAction.crossFadeFrom(startAction, duration, true);
|
|
191
168
|
endAction.play();
|
|
192
169
|
};
|
|
193
170
|
|
|
194
|
-
exports.executeCrossFade = executeCrossFade;
|
|
195
|
-
|
|
196
|
-
var executeTalkingAnimation = function executeTalkingAnimation(target, talkingURL) {
|
|
197
|
-
if (target) {
|
|
198
|
-
var tracks = [];
|
|
199
|
-
var _target$userData = target.userData,
|
|
200
|
-
mixer = _target$userData.mixer,
|
|
201
|
-
defaultAnim = _target$userData.defaultAnim;
|
|
202
|
-
var cloned = defaultAnim.clone();
|
|
203
|
-
|
|
204
|
-
var onLoad = function onLoad(anim) {
|
|
205
|
-
var _cloned$tracks;
|
|
206
|
-
|
|
207
|
-
if (anim) {
|
|
208
|
-
tracks.push.apply(tracks, _toConsumableArray(anim.animations[0].tracks.filter(function (track) {
|
|
209
|
-
return bones.find(function (bone) {
|
|
210
|
-
return track.name.includes(bone);
|
|
211
|
-
});
|
|
212
|
-
})));
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
cloned.tracks = cloned.tracks.filter(function (track) {
|
|
216
|
-
return !bones.find(function (bone) {
|
|
217
|
-
return track.name.includes(bone);
|
|
218
|
-
});
|
|
219
|
-
});
|
|
220
|
-
|
|
221
|
-
(_cloned$tracks = cloned.tracks).push.apply(_cloned$tracks, tracks);
|
|
222
|
-
|
|
223
|
-
target.userData.emotionClip = cloned;
|
|
224
|
-
var defaultAction = mixer.clipAction(defaultAnim, target);
|
|
225
|
-
var emotionAction = mixer.clipAction(cloned, target);
|
|
226
|
-
emotionAction.loop = _three.LoopPingPong;
|
|
227
|
-
mixer.stopAllAction();
|
|
228
|
-
executeCrossFade(defaultAction, emotionAction, crossFadeDuration);
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
loader.load(talkingURL, function (anim) {
|
|
232
|
-
onLoad(anim);
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
exports.executeTalkingAnimation = executeTalkingAnimation;
|
|
171
|
+
exports.executeCrossFade = executeCrossFade;
|
package/dist/helpers/useEkho.js
CHANGED
|
@@ -45,14 +45,11 @@ var useEkho = function useEkho(_ref) {
|
|
|
45
45
|
_ref$onError = _ref.onError,
|
|
46
46
|
onError = _ref$onError === void 0 ? noop : _ref$onError,
|
|
47
47
|
_ref$onStart = _ref.onStart,
|
|
48
|
-
onStart = _ref$onStart === void 0 ? noop : _ref$onStart
|
|
49
|
-
pauseTTS = _ref.pauseTTS;
|
|
48
|
+
onStart = _ref$onStart === void 0 ? noop : _ref$onStart;
|
|
50
49
|
|
|
51
|
-
var _soundActions = _slicedToArray(soundActions,
|
|
50
|
+
var _soundActions = _slicedToArray(soundActions, 2),
|
|
52
51
|
playSound = _soundActions[0],
|
|
53
|
-
stop = _soundActions[1]
|
|
54
|
-
pause = _soundActions[2],
|
|
55
|
-
resume = _soundActions[3];
|
|
52
|
+
stop = _soundActions[1];
|
|
56
53
|
|
|
57
54
|
var noAudio = !audio && !voice;
|
|
58
55
|
|
|
@@ -102,7 +99,11 @@ var useEkho = function useEkho(_ref) {
|
|
|
102
99
|
url: url,
|
|
103
100
|
cc: cc
|
|
104
101
|
};
|
|
105
|
-
|
|
102
|
+
onStart({
|
|
103
|
+
url: url,
|
|
104
|
+
cc: cc
|
|
105
|
+
});
|
|
106
|
+
playSound(url, cc, loop, volume, onFinish);
|
|
106
107
|
}, [onStart, playSound, loop, onFinish, volume]);
|
|
107
108
|
var playSpeech = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
108
109
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(payload) {
|
|
@@ -162,13 +163,6 @@ var useEkho = function useEkho(_ref) {
|
|
|
162
163
|
stopCurrentAudio();
|
|
163
164
|
};
|
|
164
165
|
}, [stopCurrentAudio]);
|
|
165
|
-
(0, _react.useEffect)(function () {
|
|
166
|
-
if (pauseTTS) {
|
|
167
|
-
pause();
|
|
168
|
-
} else {
|
|
169
|
-
resume();
|
|
170
|
-
}
|
|
171
|
-
}, [pause, pauseTTS, resume]);
|
|
172
166
|
(0, _react.useEffect)(function () {
|
|
173
167
|
if (noAudio) {
|
|
174
168
|
stopCurrentAudio();
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@gamelearn/arcade-components",
|
|
3
3
|
"author": "Gamelearn",
|
|
4
4
|
"license": "unlicense",
|
|
5
|
-
"version": "2.2.
|
|
5
|
+
"version": "2.2.3",
|
|
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": "2.
|
|
17
|
+
"@gamelearn/arcade-styles": "2.2.0",
|
|
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",
|