@gamelearn/arcade-components 0.23.0 → 0.23.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.
- package/dist/components/conversational-pro-component/components/ConversationalProComponent.js +9 -2
- package/dist/components/conversational-pro-component/components/Message.js +18 -15
- package/dist/components/conversational-pro-component/components/scene/Panel.js +18 -2
- package/dist/components/image-click-wrapper-component/components/ImageClickWrapperComponent.js +1 -1
- package/dist/components/image-click-wrapper-component/mocks/mockForStory.js +23 -1
- package/dist/components/konva-components/Area/index.js +19 -9
- package/dist/components/text-click-puzzle-component/mocks/mockForStory.js +5 -3
- package/package.json +2 -2
package/dist/components/conversational-pro-component/components/ConversationalProComponent.js
CHANGED
|
@@ -66,6 +66,13 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
|
|
|
66
66
|
decision = currentLineData.decision;
|
|
67
67
|
var isFlex = currentLineData.flex;
|
|
68
68
|
|
|
69
|
+
var translate = function translate(id) {
|
|
70
|
+
return emitEvent({
|
|
71
|
+
type: 'translate',
|
|
72
|
+
payload: id
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
|
|
69
76
|
var getCurrentMessage = function getCurrentMessage() {
|
|
70
77
|
if (voiceOver) {
|
|
71
78
|
return currentLineData;
|
|
@@ -220,8 +227,8 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
|
|
|
220
227
|
className: "conversation--body"
|
|
221
228
|
}, currentMessage ? /*#__PURE__*/_react.default.createElement(_Message.default, {
|
|
222
229
|
current: currentMessage,
|
|
223
|
-
|
|
224
|
-
}) :
|
|
230
|
+
translate: translate
|
|
231
|
+
}) : null, /*#__PURE__*/_react.default.createElement("div", {
|
|
225
232
|
className: "conversation--controls arcade-conversation--controls"
|
|
226
233
|
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
227
234
|
className: "gat--btn__round ".concat(currentLine > 0 && !lastLine.decision ? '' : 'visibility--hidden'),
|
|
@@ -7,31 +7,34 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
10
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
11
|
|
|
14
12
|
var Message = function Message(_ref) {
|
|
15
13
|
var current = _ref.current,
|
|
16
|
-
|
|
14
|
+
translate = _ref.translate;
|
|
17
15
|
var currentText = current.text;
|
|
16
|
+
|
|
17
|
+
var VoiceOver = function VoiceOver() {
|
|
18
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
19
|
+
className: "conversation--voice__over"
|
|
20
|
+
}, /*#__PURE__*/_react.default.createElement("span", null, current.name ? current.name : 'Voice-Over'));
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
var ThinkFul = function ThinkFul() {
|
|
24
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
25
|
+
className: "conversation--voice__over"
|
|
26
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
27
|
+
className: "icon-bubble-thinkful-black"
|
|
28
|
+
}), /*#__PURE__*/_react.default.createElement("span", null, "[", translate('emotion.thinking'), "]"));
|
|
29
|
+
};
|
|
30
|
+
|
|
18
31
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
19
|
-
className: "conversation--message ".concat(voiceOver ? 'voice--over' : '')
|
|
20
|
-
}, voiceOver ? /*#__PURE__*/_react.default.createElement("
|
|
21
|
-
className: "conversation--voice__over"
|
|
22
|
-
}, /*#__PURE__*/_react.default.createElement("span", null, current.name ? current.name : 'Voice-Over')) : /*#__PURE__*/_react.default.createElement("div", null), /*#__PURE__*/_react.default.createElement("span", {
|
|
32
|
+
className: "conversation--message ".concat(current.voiceOver ? 'voice--over' : '')
|
|
33
|
+
}, current.voiceOver ? /*#__PURE__*/_react.default.createElement(VoiceOver, null) : null, current.emotion === 'thinkful' ? /*#__PURE__*/_react.default.createElement(ThinkFul, null) : null, /*#__PURE__*/_react.default.createElement("span", {
|
|
23
34
|
className: "conversation--main__text"
|
|
24
35
|
}, currentText));
|
|
25
36
|
};
|
|
26
37
|
|
|
27
|
-
Message.propTypes = {
|
|
28
|
-
current: _propTypes.default.shape({
|
|
29
|
-
text: _propTypes.default.string,
|
|
30
|
-
text_labelId: _propTypes.default.string,
|
|
31
|
-
name: _propTypes.default.string
|
|
32
|
-
}),
|
|
33
|
-
voiceOver: _propTypes.default.bool
|
|
34
|
-
};
|
|
35
38
|
Message.defaultProps = {
|
|
36
39
|
current: {},
|
|
37
40
|
voiceOver: false
|
|
@@ -32,7 +32,7 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
32
32
|
var defaultCamPos = [0, 14.63, 16];
|
|
33
33
|
|
|
34
34
|
function Panel(_ref) {
|
|
35
|
-
var _character$
|
|
35
|
+
var _character$resource4;
|
|
36
36
|
|
|
37
37
|
var character = _ref.character,
|
|
38
38
|
active = _ref.active,
|
|
@@ -40,7 +40,23 @@ function Panel(_ref) {
|
|
|
40
40
|
var cameraRef = (0, _react.useRef)(null);
|
|
41
41
|
var sceneRef = (0, _react.useRef)(null);
|
|
42
42
|
var isCharacter = character.type === 'character';
|
|
43
|
-
var emotion =
|
|
43
|
+
var emotion = (0, _react.useMemo)(function () {
|
|
44
|
+
if (isCharacter) {
|
|
45
|
+
var _character$resource, _character$resource$a;
|
|
46
|
+
|
|
47
|
+
if (character !== null && character !== void 0 && (_character$resource = character.resource) !== null && _character$resource !== void 0 && (_character$resource$a = _character$resource.animations) !== null && _character$resource$a !== void 0 && _character$resource$a[character.emotion]) {
|
|
48
|
+
var _character$resource2, _character$resource2$;
|
|
49
|
+
|
|
50
|
+
return character === null || character === void 0 ? void 0 : (_character$resource2 = character.resource) === null || _character$resource2 === void 0 ? void 0 : (_character$resource2$ = _character$resource2.animations) === null || _character$resource2$ === void 0 ? void 0 : _character$resource2$[character.emotion];
|
|
51
|
+
} else {
|
|
52
|
+
var _character$resource3, _character$resource3$;
|
|
53
|
+
|
|
54
|
+
return character === null || character === void 0 ? void 0 : (_character$resource3 = character.resource) === null || _character$resource3 === void 0 ? void 0 : (_character$resource3$ = _character$resource3.animations) === null || _character$resource3$ === void 0 ? void 0 : _character$resource3$['neutral'];
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return {};
|
|
59
|
+
}, [character.emotion, character === null || character === void 0 ? void 0 : (_character$resource4 = character.resource) === null || _character$resource4 === void 0 ? void 0 : _character$resource4.animations, isCharacter]);
|
|
44
60
|
var onLoadElement = (0, _react.useCallback)(function (model) {
|
|
45
61
|
if (cameraRef.current) {
|
|
46
62
|
var boundingBox = new _three.Box3();
|
package/dist/components/image-click-wrapper-component/components/ImageClickWrapperComponent.js
CHANGED
|
@@ -301,7 +301,7 @@ var ImageClickWrapperComponent = function ImageClickWrapperComponent(props) {
|
|
|
301
301
|
}) : null, /*#__PURE__*/_react.default.createElement(_KonvaMapper.default, {
|
|
302
302
|
completed: completed,
|
|
303
303
|
imageUrl: imageUrl,
|
|
304
|
-
areas: areasList,
|
|
304
|
+
areas: hasClickOnce && clickedZones.length ? [clickedZones[0]] : areasList,
|
|
305
305
|
badAreas: badAreasList,
|
|
306
306
|
clickedZones: clickedZones,
|
|
307
307
|
onClick: handleCorrectAreaClick,
|
|
@@ -8,7 +8,7 @@ exports.mockPropsOnce = exports.mockProps4 = exports.mockProps3 = exports.mockPr
|
|
|
8
8
|
var emitEvent = function emitEvent(_ref) {
|
|
9
9
|
var type = _ref.type,
|
|
10
10
|
payload = _ref.payload;
|
|
11
|
-
console.log('Emit event called', type);
|
|
11
|
+
console.log('Emit event called', type, payload);
|
|
12
12
|
|
|
13
13
|
if (type === 'translate') {
|
|
14
14
|
return payload;
|
|
@@ -417,6 +417,28 @@ var mockPropsOnce = {
|
|
|
417
417
|
closed: true
|
|
418
418
|
}],
|
|
419
419
|
badAreas: [],
|
|
420
|
+
specificFeedbacks: {
|
|
421
|
+
correctFeedbacks: [{
|
|
422
|
+
id: '1601910616179',
|
|
423
|
+
desc: 'specificFeedbacks 1 correcto',
|
|
424
|
+
rewards: [{
|
|
425
|
+
id: 'k2koxnkq',
|
|
426
|
+
name: 'Power',
|
|
427
|
+
points: 10,
|
|
428
|
+
type: 'score'
|
|
429
|
+
}]
|
|
430
|
+
}, {
|
|
431
|
+
id: '1601910626254',
|
|
432
|
+
desc: 'specificFeedbacks 2 correcto',
|
|
433
|
+
rewards: [{
|
|
434
|
+
id: 'k2koxnkq',
|
|
435
|
+
name: 'Ranger',
|
|
436
|
+
points: 10,
|
|
437
|
+
type: 'score'
|
|
438
|
+
}]
|
|
439
|
+
}],
|
|
440
|
+
wrongFeedbacks: []
|
|
441
|
+
},
|
|
420
442
|
hasClickOrder: false,
|
|
421
443
|
hasClickOnce: true,
|
|
422
444
|
hasHighlights: true
|
|
@@ -30,9 +30,11 @@ var Area = function Area(_ref) {
|
|
|
30
30
|
|
|
31
31
|
var mouseEnterArea = function mouseEnterArea() {
|
|
32
32
|
if (hasHighlights && !completed && !isClicked) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
areaRef.current.
|
|
33
|
+
var _areaRef$current, _areaRef$current2, _areaRef$current3;
|
|
34
|
+
|
|
35
|
+
(_areaRef$current = areaRef.current) === null || _areaRef$current === void 0 ? void 0 : _areaRef$current.setAttr('fill', 'rgba(130, 134, 142, 0.4)');
|
|
36
|
+
(_areaRef$current2 = areaRef.current) === null || _areaRef$current2 === void 0 ? void 0 : _areaRef$current2.setAttr('stroke', 'rgba(255, 255, 255, 0.3)');
|
|
37
|
+
(_areaRef$current3 = areaRef.current) === null || _areaRef$current3 === void 0 ? void 0 : _areaRef$current3.to({
|
|
36
38
|
duration: 0.25,
|
|
37
39
|
opacity: 1
|
|
38
40
|
});
|
|
@@ -41,7 +43,9 @@ var Area = function Area(_ref) {
|
|
|
41
43
|
|
|
42
44
|
var mouseLeaveArea = function mouseLeaveArea() {
|
|
43
45
|
if (hasHighlights && !completed && !isClicked) {
|
|
44
|
-
|
|
46
|
+
var _areaRef$current4;
|
|
47
|
+
|
|
48
|
+
(_areaRef$current4 = areaRef.current) === null || _areaRef$current4 === void 0 ? void 0 : _areaRef$current4.to({
|
|
45
49
|
duration: 0.25,
|
|
46
50
|
opacity: 0
|
|
47
51
|
});
|
|
@@ -51,13 +55,17 @@ var Area = function Area(_ref) {
|
|
|
51
55
|
(0, _react.useEffect)(function () {
|
|
52
56
|
if (completed && !finished) {
|
|
53
57
|
if (!isBad) {
|
|
54
|
-
|
|
58
|
+
var _areaRef$current5, _areaRef$current6;
|
|
59
|
+
|
|
60
|
+
(_areaRef$current5 = areaRef.current) === null || _areaRef$current5 === void 0 ? void 0 : _areaRef$current5.to({
|
|
55
61
|
duration: 0.25,
|
|
56
62
|
opacity: 1
|
|
57
63
|
});
|
|
58
|
-
areaRef.current.globalCompositeOperation('destination-out');
|
|
64
|
+
(_areaRef$current6 = areaRef.current) === null || _areaRef$current6 === void 0 ? void 0 : _areaRef$current6.globalCompositeOperation('destination-out');
|
|
59
65
|
} else {
|
|
60
|
-
|
|
66
|
+
var _areaRef$current7;
|
|
67
|
+
|
|
68
|
+
(_areaRef$current7 = areaRef.current) === null || _areaRef$current7 === void 0 ? void 0 : _areaRef$current7.to({
|
|
61
69
|
duration: 0.25,
|
|
62
70
|
opacity: 0
|
|
63
71
|
});
|
|
@@ -67,14 +75,16 @@ var Area = function Area(_ref) {
|
|
|
67
75
|
|
|
68
76
|
var clickArea = function clickArea() {
|
|
69
77
|
if (!completed) {
|
|
78
|
+
var _areaRef$current8, _areaRef$current9;
|
|
79
|
+
|
|
70
80
|
if (isBad) {
|
|
71
81
|
onClickOutside(area);
|
|
72
82
|
} else {
|
|
73
83
|
onClick(area);
|
|
74
84
|
}
|
|
75
85
|
|
|
76
|
-
areaRef.current.setAttr('fill', fillColor);
|
|
77
|
-
areaRef.current.setAttr('stroke', strokeColor);
|
|
86
|
+
(_areaRef$current8 = areaRef.current) === null || _areaRef$current8 === void 0 ? void 0 : _areaRef$current8.setAttr('fill', fillColor);
|
|
87
|
+
(_areaRef$current9 = areaRef.current) === null || _areaRef$current9 === void 0 ? void 0 : _areaRef$current9.setAttr('stroke', strokeColor);
|
|
78
88
|
}
|
|
79
89
|
};
|
|
80
90
|
|
|
@@ -13,7 +13,7 @@ var emitEvent = function emitEvent(_ref) {
|
|
|
13
13
|
return payload;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
console.log('Emit event called');
|
|
16
|
+
console.log('Emit event called:', type, 'payload:', payload);
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
var messages = {
|
|
@@ -260,7 +260,9 @@ exports.mockProps = mockProps;
|
|
|
260
260
|
var mockPropsOnce = {
|
|
261
261
|
emitEvent: emitEvent,
|
|
262
262
|
setResolveAction: function setResolveAction() {},
|
|
263
|
-
setShowPoints: function setShowPoints() {
|
|
263
|
+
setShowPoints: function setShowPoints(points) {
|
|
264
|
+
console.log('points', points);
|
|
265
|
+
},
|
|
264
266
|
showFrames: true,
|
|
265
267
|
soundActions: [function () {}, function () {}],
|
|
266
268
|
styles: 'chalkboard',
|
|
@@ -323,7 +325,7 @@ var mockPropsOnce = {
|
|
|
323
325
|
rewards: [{
|
|
324
326
|
id: 'k2koxnkq',
|
|
325
327
|
name: 'Power',
|
|
326
|
-
points:
|
|
328
|
+
points: 5,
|
|
327
329
|
type: 'score'
|
|
328
330
|
}]
|
|
329
331
|
}],
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gamelearn/arcade-components",
|
|
3
3
|
"license": "Gamelearn",
|
|
4
|
-
"version": "0.23.
|
|
4
|
+
"version": "0.23.2",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@babel/cli": "7.12.10",
|
|
56
56
|
"@babel/preset-env": "7.12.11",
|
|
57
57
|
"@babel/preset-react": "7.12.10",
|
|
58
|
-
"@gamelearn/ui-components-core": "5.
|
|
58
|
+
"@gamelearn/ui-components-core": "5.49.0",
|
|
59
59
|
"@react-three/test-renderer": "6.0.6",
|
|
60
60
|
"@storybook/addon-actions": "6.1.11",
|
|
61
61
|
"@storybook/addon-essentials": "6.1.11",
|