@gamelearn/arcade-components 2.36.0 → 2.37.1
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.
|
@@ -26,7 +26,8 @@ var Board = function Board(_ref) {
|
|
|
26
26
|
soundActions = _ref.soundActions,
|
|
27
27
|
onFinish = _ref.onFinish,
|
|
28
28
|
handleSuccess = _ref.handleSuccess,
|
|
29
|
-
resolveWithAnyCard = _ref.resolveWithAnyCard
|
|
29
|
+
resolveWithAnyCard = _ref.resolveWithAnyCard,
|
|
30
|
+
selectCard = _ref.selectCard;
|
|
30
31
|
var _useState = (0, _react.useState)(Array(cards.length).fill(false)),
|
|
31
32
|
_useState2 = _slicedToArray(_useState, 2),
|
|
32
33
|
flipped = _useState2[0],
|
|
@@ -97,6 +98,7 @@ var Board = function Board(_ref) {
|
|
|
97
98
|
if (finished) return;
|
|
98
99
|
if (!feedbackIsShown) {
|
|
99
100
|
play('click-ui');
|
|
101
|
+
selectCard(cards[index]);
|
|
100
102
|
if (cards[index].correct && !isOrderBased) {
|
|
101
103
|
handleCorrect(index);
|
|
102
104
|
} else if (isOrderBased) {
|
|
@@ -145,6 +147,7 @@ Board.defaultProps = {
|
|
|
145
147
|
handleError: function handleError() {},
|
|
146
148
|
onFinish: function onFinish() {},
|
|
147
149
|
handleSuccess: function handleSuccess() {},
|
|
150
|
+
selectCard: function selectCard() {},
|
|
148
151
|
documentsDict: {},
|
|
149
152
|
cards: [],
|
|
150
153
|
currentOrder: 1,
|
package/dist/components/cards-selector-puzzle-component/components/CardsSelectorPuzzleComponent.js
CHANGED
|
@@ -66,6 +66,10 @@ var CardsSelectorPuzzleComponent = function CardsSelectorPuzzleComponent(_ref) {
|
|
|
66
66
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
67
67
|
feedBackText = _useState16[0],
|
|
68
68
|
setFeedBackText = _useState16[1];
|
|
69
|
+
var _useState17 = (0, _react.useState)(),
|
|
70
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
71
|
+
cardSelected = _useState18[0],
|
|
72
|
+
selectCard = _useState18[1];
|
|
69
73
|
var _soundActions = _slicedToArray(soundActions, 1),
|
|
70
74
|
playSound = _soundActions[0];
|
|
71
75
|
var translate = function translate(id) {
|
|
@@ -104,10 +108,20 @@ var CardsSelectorPuzzleComponent = function CardsSelectorPuzzleComponent(_ref) {
|
|
|
104
108
|
var specificRewards = (specificFeedbacks === null || specificFeedbacks === void 0 ? void 0 : (_specificFeedbacks$co = specificFeedbacks.correctFeedbacks) === null || _specificFeedbacks$co === void 0 ? void 0 : _specificFeedbacks$co.map(function (spReward) {
|
|
105
109
|
return spReward.rewards;
|
|
106
110
|
}).flat()) || [];
|
|
107
|
-
var rewardsData = []
|
|
111
|
+
var rewardsData = [];
|
|
108
112
|
playSound('score');
|
|
113
|
+
if (resolveWithAnyCard) {
|
|
114
|
+
rewardsData = [].concat(_toConsumableArray(accRewards), _toConsumableArray(rewards), _toConsumableArray(specificRewards));
|
|
115
|
+
} else {
|
|
116
|
+
var _specificRewards$corr;
|
|
117
|
+
var cardFeedback = (specificRewards === null || specificRewards === void 0 ? void 0 : (_specificRewards$corr = specificRewards.correctFeedbacks) === null || _specificRewards$corr === void 0 ? void 0 : _specificRewards$corr.find(function (feedback) {
|
|
118
|
+
return cardSelected.id === feedback.id;
|
|
119
|
+
})) || {};
|
|
120
|
+
var cardReward = cardFeedback && cardFeedback.rewards ? cardFeedback.rewards : [];
|
|
121
|
+
rewardsData = [].concat(_toConsumableArray(accRewards), _toConsumableArray(rewards), _toConsumableArray(cardReward));
|
|
122
|
+
}
|
|
109
123
|
closeFeedbackAndShowPoints(rewardsData);
|
|
110
|
-
}, [accRewards, closeFeedbackAndShowPoints, emitEvent, info === null || info === void 0 ? void 0 : (_info$solution2 = info.solution) === null || _info$solution2 === void 0 ? void 0 : _info$solution2.right, playSound, specificFeedbacks === null || specificFeedbacks === void 0 ? void 0 : specificFeedbacks.correctFeedbacks]);
|
|
124
|
+
}, [accRewards, closeFeedbackAndShowPoints, emitEvent, info === null || info === void 0 ? void 0 : (_info$solution2 = info.solution) === null || _info$solution2 === void 0 ? void 0 : _info$solution2.right, playSound, specificFeedbacks === null || specificFeedbacks === void 0 ? void 0 : specificFeedbacks.correctFeedbacks, resolveWithAnyCard, cardSelected]);
|
|
111
125
|
var onFinish = function onFinish() {
|
|
112
126
|
setFinished(true);
|
|
113
127
|
if (info.solution.right.desc && !(specificFeedbacks !== null && specificFeedbacks !== void 0 && specificFeedbacks.specificCorrectFeedbacks)) {
|
|
@@ -251,7 +265,8 @@ var CardsSelectorPuzzleComponent = function CardsSelectorPuzzleComponent(_ref) {
|
|
|
251
265
|
feedbackIsShown: feedbackIsShown,
|
|
252
266
|
resolvePuzzle: resolvePuzzle,
|
|
253
267
|
soundActions: soundActions,
|
|
254
|
-
handleSuccess: handleSuccessPick
|
|
268
|
+
handleSuccess: handleSuccessPick,
|
|
269
|
+
selectCard: selectCard
|
|
255
270
|
})), feedbackIsShown && /*#__PURE__*/_react.default.createElement(_feedbackComponent.default, {
|
|
256
271
|
success: feedbackResult || rightPick,
|
|
257
272
|
text: feedBackText,
|
|
@@ -539,6 +539,12 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
539
539
|
isLeft: isLeft
|
|
540
540
|
};
|
|
541
541
|
};
|
|
542
|
+
var setUIContainerToItsDefaultZIndex = function setUIContainerToItsDefaultZIndex(value) {
|
|
543
|
+
emitEvent({
|
|
544
|
+
type: 'resetZIndexUIContainer',
|
|
545
|
+
payload: value
|
|
546
|
+
});
|
|
547
|
+
};
|
|
542
548
|
|
|
543
549
|
// Position bubble over talking character/and switch emotions
|
|
544
550
|
(0, _react.useEffect)(function () {
|
|
@@ -721,9 +727,11 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
721
727
|
keyboardControl: keyboardControl,
|
|
722
728
|
onMount: function onMount() {
|
|
723
729
|
resetCameraView();
|
|
730
|
+
setUIContainerToItsDefaultZIndex(true);
|
|
724
731
|
},
|
|
725
732
|
onUnMount: function onUnMount() {
|
|
726
733
|
zoomStarted.current = false;
|
|
734
|
+
setUIContainerToItsDefaultZIndex(false);
|
|
727
735
|
}
|
|
728
736
|
});
|
|
729
737
|
return /*#__PURE__*/_react.default.createElement(_DialogDecision.default, decisionPayload);
|
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.
|
|
5
|
+
"version": "2.37.1",
|
|
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.20.
|
|
17
|
+
"@gamelearn/arcade-styles": "2.20.1",
|
|
18
18
|
"@gamelearn/arcade-three-core": "1.24.3",
|
|
19
19
|
"@react-three/a11y": "^3.0.0",
|
|
20
20
|
"@react-three/drei": "9.4.3",
|