@gamelearn/arcade-components 2.4.3 → 2.5.0
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 +2 -2
- package/dist/components/decision-component/components/DecisionBody.js +4 -4
- package/dist/components/decision-component/components/DecisionComponent.js +8 -24
- package/dist/components/dialog-component/components/DialogComponent.js +6 -10
- package/package.json +1 -1
package/dist/components/conversational-pro-component/components/ConversationalProComponent.js
CHANGED
|
@@ -185,7 +185,7 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
|
|
|
185
185
|
slots: !isVoiceOver ? currentLineData.slots : voiceOverSlots,
|
|
186
186
|
flex: isFlex,
|
|
187
187
|
pause: pause
|
|
188
|
-
}; //
|
|
188
|
+
}; // Last line with slots
|
|
189
189
|
|
|
190
190
|
var leftWithSlots = lines.slice(0, currentLine + 1).reverse().find(function (line) {
|
|
191
191
|
return line.slots;
|
|
@@ -481,7 +481,7 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
|
|
|
481
481
|
});
|
|
482
482
|
|
|
483
483
|
if (isDecision) {
|
|
484
|
-
return /*#__PURE__*/_react.default.createElement(_decisionComponent.default, decisionPayload);
|
|
484
|
+
return /*#__PURE__*/_react.default.createElement(_decisionComponent.default, decisionPayload);
|
|
485
485
|
}
|
|
486
486
|
|
|
487
487
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -37,9 +37,9 @@ var DecisionBody = function DecisionBody(_ref) {
|
|
|
37
37
|
var options = _ref.options,
|
|
38
38
|
question = _ref.question,
|
|
39
39
|
inherited = _ref.inherited,
|
|
40
|
+
branched = _ref.branched,
|
|
40
41
|
changeOption = _ref.changeOption,
|
|
41
42
|
onNext = _ref.onNext,
|
|
42
|
-
onBack = _ref.onBack,
|
|
43
43
|
failed = _ref.failed,
|
|
44
44
|
showingResults = _ref.showingResults,
|
|
45
45
|
currentSelectedChoice = _ref.currentSelectedChoice,
|
|
@@ -68,7 +68,7 @@ var DecisionBody = function DecisionBody(_ref) {
|
|
|
68
68
|
var optionsProps = {
|
|
69
69
|
inherited: inherited,
|
|
70
70
|
selectedChoice: selectedChoice,
|
|
71
|
-
selectChoice: failed ?
|
|
71
|
+
selectChoice: (!required || branched) && selectedChoice.id !== undefined || required && !failed ? noop : choose,
|
|
72
72
|
options: options,
|
|
73
73
|
showingResults: showingResults
|
|
74
74
|
};
|
|
@@ -90,11 +90,11 @@ var DecisionBody = function DecisionBody(_ref) {
|
|
|
90
90
|
dir: "auto"
|
|
91
91
|
}, /*#__PURE__*/_react.default.createElement(_Options.default, optionsProps)), /*#__PURE__*/_react.default.createElement("div", {
|
|
92
92
|
className: "popup--buttons"
|
|
93
|
-
}, !failed ? /*#__PURE__*/_react.default.createElement("button", {
|
|
93
|
+
}, (required ? !failed : selectedChoice.id !== undefined) ? /*#__PURE__*/_react.default.createElement("button", {
|
|
94
94
|
type: "button",
|
|
95
95
|
className: "gat--btn gat--btn__primary ".concat(selectedChoice.id !== undefined ? '' : 'disabled'),
|
|
96
96
|
onClick: function onClick() {
|
|
97
|
-
return
|
|
97
|
+
return onNext(selectedChoice);
|
|
98
98
|
}
|
|
99
99
|
}, translate('screens.continue')) : null));
|
|
100
100
|
};
|
|
@@ -119,22 +119,6 @@ var DecisionComponent = function DecisionComponent(_ref) {
|
|
|
119
119
|
setResultChoice(option);
|
|
120
120
|
selectView('options');
|
|
121
121
|
},
|
|
122
|
-
onBack: function onBack(choice) {
|
|
123
|
-
playSound('click-ui');
|
|
124
|
-
|
|
125
|
-
if (failed) {
|
|
126
|
-
emitEvent({
|
|
127
|
-
type: 'addPoints',
|
|
128
|
-
payload: choice.rewards,
|
|
129
|
-
finish: false,
|
|
130
|
-
complex: true,
|
|
131
|
-
onFinish: function onFinish() {
|
|
132
|
-
setResultChoice({});
|
|
133
|
-
selectView('options');
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
122
|
onNext: function onNext(choice) {
|
|
139
123
|
playSound('click-ui');
|
|
140
124
|
|
|
@@ -186,14 +170,14 @@ var DecisionComponent = function DecisionComponent(_ref) {
|
|
|
186
170
|
playSound('fail');
|
|
187
171
|
|
|
188
172
|
if (!branched) {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
if (!required) {
|
|
173
|
+
if (inherited || required) {
|
|
174
|
+
emitEvent({
|
|
175
|
+
type: 'addPoints',
|
|
176
|
+
payload: choice.rewards,
|
|
177
|
+
finish: false,
|
|
178
|
+
complex: true
|
|
179
|
+
});
|
|
180
|
+
} else if (!required) {
|
|
197
181
|
setResultChoice({});
|
|
198
182
|
selectView('options');
|
|
199
183
|
}
|
|
@@ -65,14 +65,10 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
65
65
|
|
|
66
66
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
67
67
|
|
|
68
|
-
// import { DeviceDetection } from '../../../helpers/deviceDetection';
|
|
69
|
-
// Global
|
|
70
|
-
// const isMobile = DeviceDetection();
|
|
71
68
|
var crossFadeDuration = 0.2;
|
|
72
69
|
var characterMs = 75;
|
|
73
70
|
var minMs = 1400;
|
|
74
|
-
var headSize = 2;
|
|
75
|
-
|
|
71
|
+
var headSize = 2;
|
|
76
72
|
var raycast = new _three.Raycaster();
|
|
77
73
|
var maxCharacterToSwitch = 70;
|
|
78
74
|
raycast.firstHitOnly = true;
|
|
@@ -246,8 +242,7 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
246
242
|
return '';
|
|
247
243
|
});
|
|
248
244
|
return (slot === null || slot === void 0 ? void 0 : (_slot$character = slot.character) === null || _slot$character === void 0 ? void 0 : (_slot$character$resou = _slot$character.resource) === null || _slot$character$resou === void 0 ? void 0 : _slot$character$resou.url) || (object === null || object === void 0 ? void 0 : object.completeUrl) || '';
|
|
249
|
-
}, [actors]);
|
|
250
|
-
|
|
245
|
+
}, [actors]);
|
|
251
246
|
var loadEmotion = (0, _react.useCallback)(function (slot, element) {
|
|
252
247
|
var _slot$character2;
|
|
253
248
|
|
|
@@ -318,7 +313,8 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
318
313
|
}
|
|
319
314
|
|
|
320
315
|
startTalking(false);
|
|
321
|
-
};
|
|
316
|
+
}; // Execute talking animation
|
|
317
|
+
|
|
322
318
|
|
|
323
319
|
(0, _react.useEffect)(function () {
|
|
324
320
|
var element = getCurrentVisible(talkingCharacter === null || talkingCharacter === void 0 ? void 0 : talkingCharacter.uid);
|
|
@@ -496,7 +492,7 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
496
492
|
var yDistance = zoomInActor ? 2.5 : 2;
|
|
497
493
|
var xDistance = zoomInActor ? 1.2 : 1.5;
|
|
498
494
|
target.translateY(staticDisplay || showArrowTop ? 0 : yDistance);
|
|
499
|
-
target.translateX(xDistance); //
|
|
495
|
+
target.translateX(xDistance); // Check if character is left or right in the screen
|
|
500
496
|
|
|
501
497
|
var vector = new _three.Vector3();
|
|
502
498
|
vector.setFromMatrixPosition(head.matrixWorld);
|
|
@@ -708,7 +704,7 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
708
704
|
var objects = raycast.intersectObjects(scene.children, true);
|
|
709
705
|
changedMats.current = objects.filter(function (o) {
|
|
710
706
|
return o.distance < 10;
|
|
711
|
-
}); //
|
|
707
|
+
}); // Make objects invisible in front of the camera
|
|
712
708
|
|
|
713
709
|
if (changedMats.current.length) {
|
|
714
710
|
changedMats.current.forEach(function (o) {
|