Commit 3bc18849 authored by 李维's avatar 李维

增加独立选项文字选择的划掉热区功能

修复正确判断逻辑错误的问题
parent b0639eac
......@@ -1657,11 +1657,21 @@ export default class SceneComponent extends MyCocosSceneComponent {
const optionList = [];
if(contentData.useSelectOptionList) {
contentData.selectOptionList.forEach((option, index) => {
let strikeOutHotZoneNode = null;
if(option.selectStrikeOutHotZoneIndex != null && !isNaN(Number(option.selectStrikeOutHotZoneIndex)) && Number(option.selectStrikeOutHotZoneIndex) >= 0) {
const strikeOutHotZoneData = this.data.hotZoneItemArr[option.selectStrikeOutHotZoneIndex];
strikeOutHotZoneNode = this.newRectNode(strikeOutHotZoneData, layer_3, debugMode);
const lineNode = this.newStrikeOutNode(strikeOutHotZoneNode.width, strikeOutHotZoneNode.height);
strikeOutHotZoneNode.addChild(lineNode);
strikeOutHotZoneNode.active = false;
strikeOutHotZoneNode.refCount = 0;
}
optionList.push({
index: index,
label: option.optionShowText ? option.optionShowText : option.text,
value: option.text,
strikeOutNode: null
strikeOutNode: strikeOutHotZoneNode
})
});
}
......@@ -1672,16 +1682,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.newDecorativeFrame(hotZoneItemData, layer_1, "#FFFFFF", "#6dbef6", debugMode);
const rect = this.newRectNode(hotZoneItemData, layer_3, debugMode);
let strikeOutHotZoneNode = null;
if(option.selectStrikeOutHotZoneIndex != null && !isNaN(Number(option.selectStrikeOutHotZoneIndex)) && Number(option.selectStrikeOutHotZoneIndex) >= 0) {
const strikeOutHotZoneData = this.data.hotZoneItemArr[option.selectStrikeOutHotZoneIndex];
strikeOutHotZoneNode = this.newRectNode(strikeOutHotZoneData, layer_3, debugMode);
const lineNode = this.newStrikeOutNode(strikeOutHotZoneNode.width, strikeOutHotZoneNode.height);
strikeOutHotZoneNode.addChild(lineNode);
strikeOutHotZoneNode.active = false;
strikeOutHotZoneNode.refCount = 0;
}
resultRects.push({
detail: {
contentType: TEXT_SELECT,
......@@ -1701,6 +1701,16 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 如果不是独立选项数据
if(!contentData.useSelectOptionList) {
let strikeOutHotZoneNode = null;
if(option.selectStrikeOutHotZoneIndex != null && !isNaN(Number(option.selectStrikeOutHotZoneIndex)) && Number(option.selectStrikeOutHotZoneIndex) >= 0) {
const strikeOutHotZoneData = this.data.hotZoneItemArr[option.selectStrikeOutHotZoneIndex];
strikeOutHotZoneNode = this.newRectNode(strikeOutHotZoneData, layer_3, debugMode);
const lineNode = this.newStrikeOutNode(strikeOutHotZoneNode.width, strikeOutHotZoneNode.height);
strikeOutHotZoneNode.addChild(lineNode);
strikeOutHotZoneNode.active = false;
strikeOutHotZoneNode.refCount = 0;
}
optionList.push({
index: index,
label: option.optionShowText ? option.optionShowText : option.text,
......@@ -1772,8 +1782,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
score: 0
}
// 正确答案序号 - 单独列表的和正常顺序来源不同
const correctIndex = contentData.useSelectOptionList ? option.selectOptionListIndex : index;
// 选择数据的索引 和 当前索引是否相等 判断是否选择正确
if(selectData.index == index) {
if(selectData.index == correctIndex) {
// 正确 返回分数
result.score = option.score && !isNaN(Number(option.score)) ? Number(option.score) : 0;
return [result]
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment