@gamelearn/arcade-components 1.31.2 → 1.31.5
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.
|
@@ -70,6 +70,7 @@ var CurrentFramePuzzle = function CurrentFramePuzzle(_ref) {
|
|
|
70
70
|
var info = props.info,
|
|
71
71
|
specificFeedbacks = props.specificFeedbacks;
|
|
72
72
|
info.description = description;
|
|
73
|
+
var currentSelected = (0, _react.useRef)(0);
|
|
73
74
|
var correctClicked = (0, _react.useRef)(0);
|
|
74
75
|
var puzzleId = "frame-image-click-puzzle_".concat(index, "_").concat(nodeId);
|
|
75
76
|
(0, _react.useEffect)(function () {
|
|
@@ -82,6 +83,7 @@ var CurrentFramePuzzle = function CurrentFramePuzzle(_ref) {
|
|
|
82
83
|
}, [setInfo, info, puzzleId]);
|
|
83
84
|
(0, _react.useEffect)(function () {
|
|
84
85
|
correctClicked.current = 0;
|
|
86
|
+
currentSelected.current = 0;
|
|
85
87
|
}, [index]);
|
|
86
88
|
var onComplete = (0, _react.useCallback)(function (rw) {
|
|
87
89
|
var correct = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -95,7 +97,14 @@ var CurrentFramePuzzle = function CurrentFramePuzzle(_ref) {
|
|
|
95
97
|
if (specificFeedbacks !== null && specificFeedbacks !== void 0 && (_specificFeedbacks$co = specificFeedbacks.correctFeedbacks) !== null && _specificFeedbacks$co !== void 0 && _specificFeedbacks$co.length && !props.hasClickOnce && !finish) {
|
|
96
98
|
correctClicked.current += 1;
|
|
97
99
|
} else {
|
|
98
|
-
|
|
100
|
+
var total = selected;
|
|
101
|
+
|
|
102
|
+
if (currentSelected.current) {
|
|
103
|
+
total -= currentSelected.current;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
correctClicked.current = props.areas.length;
|
|
107
|
+
setSelected(total + correctClicked.current);
|
|
99
108
|
}
|
|
100
109
|
|
|
101
110
|
if (correctClicked.current === props.areas.length) {
|
|
@@ -146,6 +155,7 @@ var CurrentFramePuzzle = function CurrentFramePuzzle(_ref) {
|
|
|
146
155
|
var handleResetPuzzle = (0, _react.useCallback)(function () {
|
|
147
156
|
setFramesCompleted({});
|
|
148
157
|
correctClicked.current = 0;
|
|
158
|
+
currentSelected.current = 0;
|
|
149
159
|
emitResetPuzzle();
|
|
150
160
|
}, [emitResetPuzzle, setFramesCompleted]);
|
|
151
161
|
(0, _react.useEffect)(function () {
|
|
@@ -156,6 +166,7 @@ var CurrentFramePuzzle = function CurrentFramePuzzle(_ref) {
|
|
|
156
166
|
|
|
157
167
|
var checkSelectedAreas = function checkSelectedAreas() {
|
|
158
168
|
var areasSelected = props.hasClickOnce ? props.areas.length : 1;
|
|
169
|
+
currentSelected.current += areasSelected;
|
|
159
170
|
setSelected(selected + areasSelected);
|
|
160
171
|
};
|
|
161
172
|
|
|
@@ -203,7 +203,10 @@ var TestComponent = function TestComponent(_ref) {
|
|
|
203
203
|
setResult({});
|
|
204
204
|
setTime(countdown.time);
|
|
205
205
|
setTimeOver(false);
|
|
206
|
-
|
|
206
|
+
|
|
207
|
+
if (audio !== null && audio !== void 0 && audio.url) {
|
|
208
|
+
playSound(audio.url, 'test_bg');
|
|
209
|
+
}
|
|
207
210
|
};
|
|
208
211
|
|
|
209
212
|
var resultAnswers = Object.values(result);
|