@gamelearn/arcade-components 0.22.10 → 0.22.12
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/chained-image-click-puzzle-component/components/CurrentImagePuzzle.js +11 -25
- package/dist/components/frame-click-puzzle-component/components/CurrentFramePuzzle.js +3 -4
- package/dist/components/image-click-wrapper-component/components/ImageClickWrapperComponent.js +3 -3
- package/package.json +1 -1
package/dist/components/chained-image-click-puzzle-component/components/CurrentImagePuzzle.js
CHANGED
|
@@ -93,26 +93,17 @@ var CurrentImageClickPuzzle = function CurrentImageClickPuzzle(_ref) {
|
|
|
93
93
|
var info = currentImageProps.info,
|
|
94
94
|
specificFeedbacks = currentImageProps.specificFeedbacks;
|
|
95
95
|
info.description = description;
|
|
96
|
-
var handleResolve = (0, _react.useCallback)(function () {
|
|
97
|
-
emitEvent({
|
|
98
|
-
type: 'puzzleAction',
|
|
99
|
-
action: 'resolve',
|
|
100
|
-
payload: {
|
|
101
|
-
element: puzzleId,
|
|
102
|
-
rewards: info.resolve.rewards
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
}, [emitEvent, puzzleId, info.resolve.rewards]);
|
|
106
96
|
(0, _react.useEffect)(function () {
|
|
107
97
|
correctClicked.current = 0;
|
|
108
98
|
}, [index]);
|
|
109
99
|
var onComplete = (0, _react.useCallback)(function (rw) {
|
|
110
100
|
var correct = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
101
|
+
var finish = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
111
102
|
|
|
112
103
|
if (correct) {
|
|
113
104
|
var _specificFeedbacks$co;
|
|
114
105
|
|
|
115
|
-
if ((_specificFeedbacks$co = specificFeedbacks.correctFeedbacks) !== null && _specificFeedbacks$co !== void 0 && _specificFeedbacks$co.length && !currentImageProps.hasClickOnce) {
|
|
106
|
+
if (specificFeedbacks !== null && specificFeedbacks !== void 0 && (_specificFeedbacks$co = specificFeedbacks.correctFeedbacks) !== null && _specificFeedbacks$co !== void 0 && _specificFeedbacks$co.length && !currentImageProps.hasClickOnce && !finish) {
|
|
116
107
|
correctClicked.current += 1;
|
|
117
108
|
setSelected(selected + 1);
|
|
118
109
|
} else {
|
|
@@ -145,9 +136,14 @@ var CurrentImageClickPuzzle = function CurrentImageClickPuzzle(_ref) {
|
|
|
145
136
|
|
|
146
137
|
var onResolve = function onResolve() {
|
|
147
138
|
playSound('score');
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
139
|
+
emitEvent({
|
|
140
|
+
type: 'puzzleAction',
|
|
141
|
+
action: 'resolve',
|
|
142
|
+
payload: {
|
|
143
|
+
element: puzzleId,
|
|
144
|
+
rewards: info.resolve.rewards
|
|
145
|
+
}
|
|
146
|
+
});
|
|
151
147
|
};
|
|
152
148
|
|
|
153
149
|
(0, _react.useEffect)(function () {
|
|
@@ -156,19 +152,9 @@ var CurrentImageClickPuzzle = function CurrentImageClickPuzzle(_ref) {
|
|
|
156
152
|
}));
|
|
157
153
|
}, [info, setInfo, puzzleId]);
|
|
158
154
|
(0, _react.useEffect)(function () {
|
|
159
|
-
var timeout;
|
|
160
|
-
|
|
161
155
|
if (currentPuzzleStatus) {
|
|
162
|
-
|
|
163
|
-
onComplete([], false);
|
|
164
|
-
}, 2000);
|
|
156
|
+
onComplete([], true, true);
|
|
165
157
|
}
|
|
166
|
-
|
|
167
|
-
return function () {
|
|
168
|
-
if (timeout) {
|
|
169
|
-
clearTimeout(timeout);
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
158
|
}, [onComplete, puzzleId, currentPuzzleStatus]);
|
|
173
159
|
return /*#__PURE__*/_react.default.createElement(_imageClickWrapperComponent.default, _extends({
|
|
174
160
|
key: index
|
|
@@ -80,13 +80,14 @@ var CurrentFramePuzzle = function CurrentFramePuzzle(_ref) {
|
|
|
80
80
|
}, [index]);
|
|
81
81
|
var onComplete = (0, _react.useCallback)(function (rw) {
|
|
82
82
|
var correct = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
83
|
+
var finish = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
83
84
|
|
|
84
85
|
var updatedCompleted = _objectSpread({}, framesCompleted);
|
|
85
86
|
|
|
86
87
|
if (correct) {
|
|
87
88
|
var _specificFeedbacks$co;
|
|
88
89
|
|
|
89
|
-
if ((_specificFeedbacks$co = specificFeedbacks.correctFeedbacks) !== null && _specificFeedbacks$co !== void 0 && _specificFeedbacks$co.length && !props.hasClickOnce) {
|
|
90
|
+
if (specificFeedbacks !== null && specificFeedbacks !== void 0 && (_specificFeedbacks$co = specificFeedbacks.correctFeedbacks) !== null && _specificFeedbacks$co !== void 0 && _specificFeedbacks$co.length && !props.hasClickOnce && !finish) {
|
|
90
91
|
correctClicked.current += 1;
|
|
91
92
|
setSelected(selected + 1);
|
|
92
93
|
} else {
|
|
@@ -135,9 +136,7 @@ var CurrentFramePuzzle = function CurrentFramePuzzle(_ref) {
|
|
|
135
136
|
}, [emitEvent, puzzleId, playSound, info.resolve.rewards]);
|
|
136
137
|
(0, _react.useEffect)(function () {
|
|
137
138
|
if (loadPuzzleStatus) {
|
|
138
|
-
|
|
139
|
-
onComplete([]);
|
|
140
|
-
}, 2000);
|
|
139
|
+
onComplete([], true, true);
|
|
141
140
|
}
|
|
142
141
|
}, [loadPuzzleStatus, onComplete]);
|
|
143
142
|
return /*#__PURE__*/_react.default.createElement(_imageClickWrapperComponent.default, _extends({
|
package/dist/components/image-click-wrapper-component/components/ImageClickWrapperComponent.js
CHANGED
|
@@ -156,7 +156,7 @@ var ImageClickWrapperComponent = function ImageClickWrapperComponent(props) {
|
|
|
156
156
|
return feed.id === lastClicked.id;
|
|
157
157
|
});
|
|
158
158
|
|
|
159
|
-
if (!((_specificFeedbacks$co = specificFeedbacks.correctFeedbacks) !== null && _specificFeedbacks$co !== void 0 && _specificFeedbacks$co.length) || specificFeedbacks.correctFeedbacks.some(function (feed) {
|
|
159
|
+
if (!(specificFeedbacks !== null && specificFeedbacks !== void 0 && (_specificFeedbacks$co = specificFeedbacks.correctFeedbacks) !== null && _specificFeedbacks$co !== void 0 && _specificFeedbacks$co.length) || specificFeedbacks !== null && specificFeedbacks !== void 0 && specificFeedbacks.correctFeedbacks.some(function (feed) {
|
|
160
160
|
return !feed.desc;
|
|
161
161
|
}) || hasClickOnce) {
|
|
162
162
|
setFeedbackData(function (oldState) {
|
|
@@ -194,7 +194,7 @@ var ImageClickWrapperComponent = function ImageClickWrapperComponent(props) {
|
|
|
194
194
|
desc = _solution$wrong.desc;
|
|
195
195
|
var feedback = desc;
|
|
196
196
|
var rewards = wrongRewards;
|
|
197
|
-
var specific = (_specificFeedbacks$wr = specificFeedbacks.wrongFeedbacks) === null || _specificFeedbacks$wr === void 0 ? void 0 : _specificFeedbacks$wr.find(function (feed) {
|
|
197
|
+
var specific = specificFeedbacks === null || specificFeedbacks === void 0 ? void 0 : (_specificFeedbacks$wr = specificFeedbacks.wrongFeedbacks) === null || _specificFeedbacks$wr === void 0 ? void 0 : _specificFeedbacks$wr.find(function (feed) {
|
|
198
198
|
return feed.id === area.id;
|
|
199
199
|
});
|
|
200
200
|
|
|
@@ -255,7 +255,7 @@ var ImageClickWrapperComponent = function ImageClickWrapperComponent(props) {
|
|
|
255
255
|
if (hasClickOrder && area.index === clickedZones.length || !hasClickOrder) {
|
|
256
256
|
var _specificFeedbacks$co2;
|
|
257
257
|
|
|
258
|
-
if ((_specificFeedbacks$co2 = specificFeedbacks.correctFeedbacks) !== null && _specificFeedbacks$co2 !== void 0 && _specificFeedbacks$co2.length) {
|
|
258
|
+
if (specificFeedbacks !== null && specificFeedbacks !== void 0 && (_specificFeedbacks$co2 = specificFeedbacks.correctFeedbacks) !== null && _specificFeedbacks$co2 !== void 0 && _specificFeedbacks$co2.length) {
|
|
259
259
|
var _specificFeedbacks$co3;
|
|
260
260
|
|
|
261
261
|
var specific = (_specificFeedbacks$co3 = specificFeedbacks.correctFeedbacks) === null || _specificFeedbacks$co3 === void 0 ? void 0 : _specificFeedbacks$co3.find(function (feed) {
|