Commit 5728826d authored by 李维's avatar 李维

可以显示连线组历史记录

parent 3ec21225
......@@ -925,8 +925,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 连线组 - 历史记录
showConnectionGroup(configItem, resultData) {
console.log(configItem, resultData)
const debugMode = false;
const resultIconShowData = this.data.hotZoneItemArr[configItem.linkResultShowHotZoneIndex];
const resultIconRect = this.newRectNode(resultIconShowData, layer_2, debugMode);
......@@ -951,24 +949,48 @@ export default class SceneComponent extends MyCocosSceneComponent {
resultIconRect.addChild(errIcon);
}
resultData[0].results.forEach((resData, index) => {
const startHotZoneData = this.data.hotZoneItemArr[configItem.contentList[index].selectStartHotZoneIndex];
const startRect = this.newRectNode(startHotZoneData, layer_4, debugMode);
// 连线点都显示出来
const startRects = [];
const endRects = [];
configItem.contentList.forEach(item => {
if(item.selectStartHotZoneIndex >= 0 && this.data.hotZoneItemArr[item.selectStartHotZoneIndex]) {
const iconStart = this.getSprNode("icon_connect_start");
const startHotZoneData = this.data.hotZoneItemArr[item.selectStartHotZoneIndex];
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);
startRects.push(startRect)
} else {
startRects.push(null)
}
const endHotZoneData = this.data.hotZoneItemArr[configItem.contentList[resData.currentEndIndex].selectEndHotZoneIndex];
const endRect = this.newRectNode(endHotZoneData, layer_5, debugMode);
if(item.selectEndHotZoneIndex >= 0 && this.data.hotZoneItemArr[item.selectEndHotZoneIndex]) {
const endHotZoneData = this.data.hotZoneItemArr[item.selectEndHotZoneIndex];
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 iconStart = this.getSprNode("icon_connect_start");
const iconEnd = this.getSprNode("icon_connect_end");
iconStart.zIndex = layer_2;
iconEnd.zIndex = layer_2;
iconStart.x = startRect.width / 2;
iconStart.y = startRect.height / 2;
iconEnd.x = endRect.width / 2;
iconEnd.y = endRect.height / 2;
// 根据用户结果还原显示
resultData[0].results.forEach((resData, index) => {
if(resData.startIndex < 0 || resData.currentEndIndex < 0) {
return
}
const startRect = startRects[resData.startIndex];
const endRect = endRects[resData.currentEndIndex];
endRect.addChild(iconEnd);
startRect.addChild(iconStart);
if(!startRect || !endRect) {
return
}
const lineNode = new cc.Node();
lineNode.name = 'connect1_' + index;
......@@ -987,11 +1009,16 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 画线
ctx.stroke();
// 结果显示节点
if(configItem.contentList[index].selectEndHotZoneShowIndex && configItem.contentList[index].selectEndHotZoneShowIndex >= 0 && this.data.hotZoneItemArr[configItem.contentList[index].selectEndHotZoneShowIndex] && resData.currentEndText) {
const linkedTextData = this.data.hotZoneItemArr[configItem.contentList[index].selectEndHotZoneShowIndex];
const textNodePartent = this.newRectNode(linkedTextData, layer_4, debugMode);
const textNode = this.newTextNode(resData.currentEndText ? resData.currentEndText : "");
textNode.x = textNodePartent.width / 2;
textNode.y = textNodePartent.height / 2;
textNodePartent.addChild(textNode)
}
});
}
// 判断对错 - 历史记录
......@@ -1806,13 +1833,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
};
contentData.contentList.forEach((option, index) => {
const resultConnectIndex = currentConnectionList.findIndex(item=>item.linkedIndex == index)
const detailItem = {
startIndex: index,
startText: option.startTextShow ? option.startTextShow : "",
correctEndIndex: index,
correctEndText: option.endTextShow ? option.endTextShow : "",
currentEndIndex: currentConnectionList[index].linkedIndex,
currentEndText: currentConnectionList[index].textShow,
currentEndIndex: resultConnectIndex,
currentEndText: resultConnectIndex >= 0 ? currentConnectionList[resultConnectIndex].textShow : "",
right: true
}
if(currentConnectionList[index].linkedIndex == index) {
......@@ -2037,7 +2065,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
currentConnectionList.push({
rect: startRect,
linkedIndex: -1,
textShow: option.textShow ? option.textShow : "",
textShow: option.linkedShowText ? option.linkedShowText : "",
})
});
......
......@@ -1123,8 +1123,8 @@ export const historyData = {
"startText": "",
"correctEndIndex": 0,
"correctEndText": "",
"currentEndIndex": 1,
"currentEndText": "",
"currentEndIndex": 2,
"currentEndText": "a",
"right": false
},
{
......@@ -1132,8 +1132,8 @@ export const historyData = {
"startText": "",
"correctEndIndex": 1,
"correctEndText": "",
"currentEndIndex": 2,
"currentEndText": "",
"currentEndIndex": 0,
"currentEndText": "b",
"right": false
},
{
......@@ -1141,7 +1141,7 @@ export const historyData = {
"startText": "",
"correctEndIndex": 2,
"correctEndText": "",
"currentEndIndex": 0,
"currentEndIndex": -1,
"currentEndText": "",
"right": false
}
......@@ -1177,7 +1177,7 @@ export const historyData = {
"totalScore": 0,
"isAllRight": false,
"isAllWrong": true,
"startTimestamp": 1689000426243,
"submitTimestamp": 1689000433908,
"answeringTime": 7665
"startTimestamp": 1689057128454,
"submitTimestamp": 1689057136559,
"answeringTime": 8105
}
\ No newline at end of file
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