Commit e6aebe0f authored by 李维's avatar 李维

添加连线选择题的历史记录显示

parent 81ce15f6
......@@ -766,7 +766,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
validater = this.setCrosswordPuzzleInput(configItem, isDebug);
this.scoreValidater.push(validater);
break;
// 文字排序
// 文字排序 [做题 - 显示]
case SORT_WORDS:
validater = this.setSortWords(configItem, this.data.hotZoneItemArr[configItem.linkHotZoneIndex], isDebug);
this.scoreValidater.push(validater);
......@@ -776,7 +776,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
validater = this.setPronunciationAssessment(configItem, this.data.hotZoneItemArr[configItem.linkHotZoneIndex]);
this.scoreValidater.push(validater);
break;
// 连线选择
// 连线选择 [做题 - 显示]
case CONNECTION_CHOICE:
validater = this.setConnectionChoice(configItem, isDebug);
this.scoreValidater.push(validater);
......@@ -867,6 +867,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
case SORT_WORDS:
this.showSortWords(configItem, resultData);
break;
// 语音评测
case PRONUNCIATION_ASSESSMENT:
this.showPronunciationAssessment(configItem, resultData);
break;
// 连线选择
case CONNECTION_CHOICE:
this.showConnectionChoice(configItem, resultData);
break;
}
})
......@@ -1417,6 +1425,93 @@ export default class SceneComponent extends MyCocosSceneComponent {
resultIconRect.addChild(errIcon);
}
}
// 语音评测题型 - 历史记录
showPronunciationAssessment(configItem, resultData) {
console.log(configItem, resultData)
}
// 连线选择 - 历史记录
showConnectionChoice(configItem, resultData) {
console.log(configItem, resultData)
const debugMode = false;
const resultIconShowData = this.data.hotZoneItemArr[configItem.linkResultShowHotZoneIndex];
const resultIconRect = this.newRectNode(resultIconShowData, layer_2, debugMode);
const errIcon = getSprNode("icon_answer_wrong");
const rightIcon = getSprNode("icon_answer_right");
// 图标太大 缩小一半
errIcon.scale = rightIcon.scale = 0.5;
// 显示在热区的中间
errIcon.x = rightIcon.x = resultIconRect.width / 2;
errIcon.y = rightIcon.y = resultIconRect.height / 2;
if(resultData[0].result.right) {
resultIconRect.addChild(rightIcon);
} else {
resultIconRect.addChild(errIcon);
}
const iconStart = this.getSprNode("icon_connect_start");
const startHotZoneData = this.data.hotZoneItemArr[configItem.linkHotZoneIndex];
const startRect = this.newRectNode(startHotZoneData, layer_4, debugMode);
iconStart.zIndex = layer_2;
iconStart.x = startRect.width / 2;
iconStart.y = startRect.height / 2;
startRect.addChild(iconStart);
// 连线点都显示出来
const endRects = [];
configItem.contentList.forEach(item => {
if(item.selectHotZoneIndex >= 0 && this.data.hotZoneItemArr[item.selectHotZoneIndex]) {
const endHotZoneData = this.data.hotZoneItemArr[item.selectHotZoneIndex];
const endRect = this.newRectNode(endHotZoneData, layer_5, debugMode);
const iconEnd = this.getSprNode("icon_connect_end");
iconEnd.zIndex = layer_2;
iconEnd.x = endRect.width / 2;
iconEnd.y = endRect.height / 2;
endRect.addChild(iconEnd);
endRects.push(endRect)
} else {
endRects.push(null)
}
});
const endRect = endRects[resultData[0].result.currentEndIndex];
if(!startRect || !endRect) {
return
}
const lineNode = new cc.Node();
lineNode.name = 'connect1_0';
startRect.addChild(lineNode)
const ctx = lineNode.addComponent(cc.Graphics);
ctx.lineWidth = 4;
const localPos = lineNode.parent.convertToNodeSpaceAR(endRect.parent.convertToWorldSpaceAR(cc.v2(endRect.x + endRect.width / 2, endRect.y + endRect.height / 2)));
// 清除上一次的痕迹
ctx.clear()
// 移动到当前开始节点的中心开始画线
ctx.moveTo(startRect.width / 2, startRect.height / 2);
// 终点坐标在上面已经计算好了 这里使用
ctx.lineTo(localPos.x, localPos.y);
// 画线
ctx.stroke();
// 结果显示节点
if(configItem.linkHotZoneShowIndex && configItem.linkHotZoneShowIndex >= 0 && this.data.hotZoneItemArr[configItem.linkHotZoneShowIndex] && resultData[0].result.currentEndText) {
const linkedTextData = this.data.hotZoneItemArr[configItem.linkHotZoneShowIndex];
const textNodePartent = this.newRectNode(linkedTextData, layer_4, debugMode);
const textNode = this.newTextNode(resultData[0].result.currentEndText ? resultData[0].result.currentEndText : "");
textNode.x = textNodePartent.width / 2;
textNode.y = textNodePartent.height / 2;
textNodePartent.addChild(textNode)
}
}
// 初始化分数牌
subScorePanels = [];
......@@ -2988,14 +3083,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
let validater = () => {
const result = {
detail: {
contentType: CONNECTION,
contentType: CONNECTION_CHOICE,
configIndex: contentData.index,
contentIndex: -1,
result: {
correctEndIndex: correctConnectIndex,
correctEndText: correctConnectTextShow,
currentEndIndex: currentConnectIndex,
currentEndText: currentConnectTextShow,
currentEndText: currentConnectIndex >= 0 && contentData.contentList[currentConnectIndex] ? contentData.contentList[currentConnectIndex].linkedShowText : "",
right: true
}
},
......
This diff is collapsed.
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