@gamelearn/arcade-components 2.4.4 → 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.
|
@@ -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
|
}
|