Commit 36c04a00 authored by 李维's avatar 李维

部分题型添加历史记录显示

文字选择题
热区选项(单选)
热区选项(多选)
parent 0f061087
......@@ -117,25 +117,25 @@
"__id__": 1124
},
{
"__id__": 1166
"__id__": 1172
},
{
"__id__": 1169
"__id__": 1175
},
{
"__id__": 1172
"__id__": 1178
}
],
"_active": true,
"_components": [
{
"__id__": 1181
"__id__": 1187
},
{
"__id__": 1182
"__id__": 1188
},
{
"__id__": 1183
"__id__": 1189
}
],
"_prefab": null,
......@@ -45204,6 +45204,15 @@
},
{
"__id__": 1164
},
{
"__id__": 1166
},
{
"__id__": 1168
},
{
"__id__": 1170
}
],
"_active": true,
......@@ -45418,6 +45427,249 @@
"preload": false,
"_id": "e5i4eqxI1NYK3E5PwO9i4/"
},
{
"__type__": "cc.Node",
"_name": "HY_AllRight",
"_objFlags": 0,
"_parent": {
"__id__": 1161
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 1167
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "9eGv4cjAtFFr5OnPwGObpw"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1166
},
"_enabled": true,
"_clip": {
"__uuid__": "0a9eb7a2-998f-4b04-afa7-fe2c414431b1"
},
"_volume": 1,
"_mute": false,
"_loop": false,
"_firstlyEnabled": true,
"playOnLoad": false,
"preload": false,
"_id": "f9RX1D/xNLuKDsq5EYfbtb"
},
{
"__type__": "cc.Node",
"_name": "HY_Normal",
"_objFlags": 0,
"_parent": {
"__id__": 1161
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 1169
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "19k2P6iUtGfq01JAxoXB+C"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1168
},
"_enabled": true,
"_clip": {
"__uuid__": "28194632-71a1-4070-b0e2-ff50583091e3"
},
"_volume": 1,
"_mute": false,
"_loop": false,
"_firstlyEnabled": true,
"playOnLoad": false,
"preload": false,
"_id": "f4tPtNKBVHhqYhFePIy9xq"
},
{
"__type__": "cc.Node",
"_name": "HY_AllWrong",
"_objFlags": 0,
"_parent": {
"__id__": 1161
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 1171
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "fdXxMqf+VJnobqEfD9CLpV"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1170
},
"_enabled": true,
"_clip": {
"__uuid__": "59479332-7f75-4c60-b483-0c243c6b2dc6"
},
"_volume": 1,
"_mute": false,
"_loop": false,
"_firstlyEnabled": true,
"playOnLoad": false,
"preload": false,
"_id": "28fmKFEsxAxo0NH8zbu0nQ"
},
{
"__type__": "cc.Node",
"_name": "Speaker",
......@@ -45429,10 +45681,10 @@
"_active": false,
"_components": [
{
"__id__": 1167
"__id__": 1173
},
{
"__id__": 1168
"__id__": 1174
}
],
"_prefab": null,
......@@ -45488,7 +45740,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1166
"__id__": 1172
},
"_enabled": true,
"_defaultClip": {
......@@ -45507,7 +45759,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1166
"__id__": 1172
},
"_enabled": true,
"_materials": [
......@@ -45545,10 +45797,10 @@
"_active": false,
"_components": [
{
"__id__": 1170
"__id__": 1176
},
{
"__id__": 1171
"__id__": 1177
}
],
"_prefab": null,
......@@ -45604,7 +45856,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1169
"__id__": 1175
},
"_enabled": true,
"_defaultClip": {
......@@ -45623,7 +45875,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1169
"__id__": 1175
},
"_enabled": true,
"_materials": [
......@@ -45659,16 +45911,16 @@
},
"_children": [
{
"__id__": 1173
"__id__": 1179
},
{
"__id__": 1176
"__id__": 1182
}
],
"_active": false,
"_components": [
{
"__id__": 1180
"__id__": 1186
}
],
"_prefab": null,
......@@ -45724,16 +45976,16 @@
"_name": "videoPlayer",
"_objFlags": 0,
"_parent": {
"__id__": 1172
"__id__": 1178
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 1174
"__id__": 1180
},
{
"__id__": 1175
"__id__": 1181
}
],
"_prefab": null,
......@@ -45789,7 +46041,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1173
"__id__": 1179
},
"_enabled": true,
"_resourceType": 0,
......@@ -45809,7 +46061,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1173
"__id__": 1179
},
"_enabled": true,
"alignMode": 1,
......@@ -45836,19 +46088,19 @@
"_name": "close",
"_objFlags": 0,
"_parent": {
"__id__": 1172
"__id__": 1178
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 1177
"__id__": 1183
},
{
"__id__": 1178
"__id__": 1184
},
{
"__id__": 1179
"__id__": 1185
}
],
"_prefab": null,
......@@ -45904,12 +46156,12 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1176
"__id__": 1182
},
"_enabled": true,
"alignMode": 1,
"_target": {
"__id__": 1172
"__id__": 1178
},
"_alignFlags": 33,
"_left": 0,
......@@ -45933,7 +46185,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1176
"__id__": 1182
},
"_enabled": true,
"_normalMaterial": null,
......@@ -46001,7 +46253,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1176
"__id__": 1182
},
"_enabled": true,
"_materials": [],
......@@ -46029,7 +46281,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1172
"__id__": 1178
},
"_enabled": true,
"alignMode": 1,
......@@ -46116,10 +46368,10 @@
"__id__": 224
},
"aniSpeaker": {
"__id__": 1166
"__id__": 1172
},
"aniVideoTips": {
"__id__": 1169
"__id__": 1175
},
"pronunciationAssessmentModal": {
"__id__": 892
......
......@@ -13,6 +13,609 @@ import { getUUID } from "../script/util_DG_FAF";
const { ccclass, property } = cc._decorator;
const history = {
"details": [
{
"contentType": "3",
"configIndex": 0,
"contentIndex": -1,
"currentSelectIndex": -1,
"currentSelectText": "",
"correctSelectIndex": 1,
"correctSelectText": "",
"right": false
},
{
"contentType": "3",
"configIndex": 1,
"contentIndex": -1,
"currentSelectIndex": -1,
"currentSelectText": "",
"correctSelectIndex": 1,
"correctSelectText": "",
"right": false
},
{
"contentType": "3",
"configIndex": 2,
"contentIndex": -1,
"currentSelectIndex": -1,
"currentSelectText": "",
"correctSelectIndex": 0,
"correctSelectText": "",
"right": false
},
{
"contentType": "3",
"configIndex": 3,
"contentIndex": -1,
"currentSelectIndex": -1,
"currentSelectText": "",
"correctSelectIndex": 1,
"correctSelectText": "",
"right": false
},
{
"contentType": "3",
"configIndex": 4,
"contentIndex": -1,
"currentSelectIndex": -1,
"currentSelectText": "",
"correctSelectIndex": 0,
"correctSelectText": "",
"right": false
},
{
"contentType": "3",
"configIndex": 5,
"contentIndex": -1,
"currentSelectIndex": -1,
"currentSelectText": "",
"correctSelectIndex": 0,
"correctSelectText": "",
"right": false
},
{
"contentType": "3",
"configIndex": 6,
"contentIndex": -1,
"currentSelectIndex": -1,
"currentSelectText": "",
"correctSelectIndex": 0,
"correctSelectText": "",
"right": false
},
{
"contentType": "3",
"configIndex": 7,
"contentIndex": -1,
"currentSelectIndex": -1,
"currentSelectText": "",
"correctSelectIndex": 1,
"correctSelectText": "",
"right": false
},
{
"contentType": "4",
"configIndex": 9,
"contentIndex": -1,
"currentSelectText": [
"",
""
],
"currentSelectIndex": [
2,
5
],
"correctSelectText": [
"",
""
],
"correctSelectIndex": [
2,
5
],
"right": true
},
{
"contentType": "4",
"configIndex": 10,
"contentIndex": -1,
"currentSelectText": [
""
],
"currentSelectIndex": [
4
],
"correctSelectText": [
"",
""
],
"correctSelectIndex": [
0,
5
],
"right": false
},
{
"contentType": "4",
"configIndex": 11,
"contentIndex": -1,
"currentSelectText": [
"",
""
],
"currentSelectIndex": [
2,
3
],
"correctSelectText": [
"",
""
],
"correctSelectIndex": [
1,
2
],
"right": false
},
{
"contentType": "4",
"configIndex": 12,
"contentIndex": -1,
"currentSelectText": [
""
],
"currentSelectIndex": [
0
],
"correctSelectText": [
"",
""
],
"correctSelectIndex": [
0,
5
],
"right": false
},
{
"contentType": "0",
"configIndex": 14,
"contentIndex": 0,
"currentSelectIndex": null,
"currentSelectText": "",
"correctSelectIndex": 0,
"correctSelectText": "",
"right": false
},
{
"contentType": "0",
"configIndex": 14,
"contentIndex": 1,
"currentSelectIndex": null,
"currentSelectText": "",
"correctSelectIndex": 1,
"correctSelectText": "",
"right": false
},
{
"contentType": "0",
"configIndex": 14,
"contentIndex": 2,
"currentSelectIndex": null,
"currentSelectText": "",
"correctSelectIndex": 2,
"correctSelectText": "",
"right": false
},
{
"contentType": "0",
"configIndex": 14,
"contentIndex": 3,
"currentSelectIndex": null,
"currentSelectText": "",
"correctSelectIndex": 3,
"correctSelectText": "",
"right": false
},
{
"contentType": "0",
"configIndex": 14,
"contentIndex": 4,
"currentSelectIndex": null,
"currentSelectText": "",
"correctSelectIndex": 4,
"correctSelectText": "",
"right": false
},
{
"contentType": "3",
"configIndex": 16,
"contentIndex": -1,
"currentSelectIndex": 0,
"currentSelectText": "",
"correctSelectIndex": 2,
"correctSelectText": "",
"right": false
},
{
"contentType": "3",
"configIndex": 17,
"contentIndex": -1,
"currentSelectIndex": 1,
"currentSelectText": "",
"correctSelectIndex": 0,
"correctSelectText": "",
"right": false
},
{
"contentType": "3",
"configIndex": 18,
"contentIndex": -1,
"currentSelectIndex": 2,
"currentSelectText": "",
"correctSelectIndex": 1,
"correctSelectText": "",
"right": false
},
{
"contentType": "3",
"configIndex": 19,
"contentIndex": -1,
"currentSelectIndex": 1,
"currentSelectText": "",
"correctSelectIndex": 2,
"correctSelectText": "",
"right": false
},
{
"contentType": "3",
"configIndex": 20,
"contentIndex": -1,
"currentSelectIndex": -1,
"currentSelectText": "",
"correctSelectIndex": 0,
"correctSelectText": "",
"right": false
},
{
"contentType": "0",
"configIndex": 22,
"contentIndex": 0,
"currentSelectIndex": 0,
"currentSelectText": "A",
"correctSelectIndex": 0,
"correctSelectText": "",
"right": false
},
{
"contentType": "0",
"configIndex": 23,
"contentIndex": 0,
"currentSelectIndex": 2,
"currentSelectText": "C",
"correctSelectIndex": 0,
"correctSelectText": "",
"right": false
},
{
"contentType": "0",
"configIndex": 24,
"contentIndex": 0,
"currentSelectIndex": 1,
"currentSelectText": "B",
"correctSelectIndex": 0,
"correctSelectText": "",
"right": false
},
{
"contentType": "0",
"configIndex": 25,
"contentIndex": 0,
"currentSelectIndex": 0,
"currentSelectText": "A",
"correctSelectIndex": 0,
"correctSelectText": "",
"right": true
},
{
"contentType": "0",
"configIndex": 26,
"contentIndex": 0,
"currentSelectIndex": 1,
"currentSelectText": "B",
"correctSelectIndex": 0,
"correctSelectText": "",
"right": false
},
{
"contentType": "0",
"configIndex": 27,
"contentIndex": 0,
"currentSelectIndex": 2,
"currentSelectText": "C",
"correctSelectIndex": 0,
"correctSelectText": "",
"right": false
},
{
"contentType": "0",
"configIndex": 28,
"contentIndex": 0,
"currentSelectIndex": 0,
"currentSelectText": "A",
"correctSelectIndex": 0,
"correctSelectText": "",
"right": false
},
{
"contentType": "0",
"configIndex": 29,
"contentIndex": 0,
"currentSelectIndex": 2,
"currentSelectText": "C",
"correctSelectIndex": 0,
"correctSelectText": "",
"right": false
},
{
"contentType": "0",
"configIndex": 31,
"contentIndex": 0,
"currentSelectIndex": 0,
"currentSelectText": "F",
"correctSelectIndex": 0,
"correctSelectText": "",
"right": true
},
{
"contentType": "0",
"configIndex": 32,
"contentIndex": 0,
"currentSelectIndex": 1,
"currentSelectText": "T",
"correctSelectIndex": 0,
"correctSelectText": "",
"right": true
},
{
"contentType": "0",
"configIndex": 33,
"contentIndex": 0,
"currentSelectIndex": 1,
"currentSelectText": "T",
"correctSelectIndex": 0,
"correctSelectText": "",
"right": false
},
{
"contentType": "0",
"configIndex": 34,
"contentIndex": 0,
"currentSelectIndex": 1,
"currentSelectText": "T",
"correctSelectIndex": 0,
"correctSelectText": "",
"right": true
},
{
"contentType": "0",
"configIndex": 35,
"contentIndex": 0,
"currentSelectIndex": 1,
"currentSelectText": "T",
"correctSelectIndex": 0,
"correctSelectText": "",
"right": true
},
{
"contentType": "0",
"configIndex": 36,
"contentIndex": 0,
"currentSelectIndex": 0,
"currentSelectText": "F",
"correctSelectIndex": 0,
"correctSelectText": "",
"right": true
},
{
"contentType": "0",
"configIndex": 37,
"contentIndex": 0,
"currentSelectIndex": 0,
"currentSelectText": "F",
"correctSelectIndex": 0,
"correctSelectText": "",
"right": false
},
{
"contentType": "0",
"configIndex": 38,
"contentIndex": 0,
"currentSelectIndex": 0,
"currentSelectText": "F",
"correctSelectIndex": 0,
"correctSelectText": "",
"right": false
},
{
"contentType": "6",
"configIndex": 39,
"contentIndex": -1,
"results": [
{
"startIndex": 0,
"startText": "",
"correctEndIndex": 0,
"correctEndText": "",
"currentEndIndex": -1,
"currentEndText": "",
"right": false
},
{
"startIndex": 1,
"startText": "",
"correctEndIndex": 1,
"correctEndText": "",
"currentEndIndex": -1,
"currentEndText": "",
"right": false
},
{
"startIndex": 2,
"startText": "",
"correctEndIndex": 2,
"correctEndText": "",
"currentEndIndex": -1,
"currentEndText": "",
"right": false
},
{
"startIndex": 3,
"startText": "",
"correctEndIndex": 3,
"correctEndText": "",
"currentEndIndex": -1,
"currentEndText": "",
"right": false
},
{
"startIndex": 4,
"startText": "",
"correctEndIndex": 4,
"correctEndText": "",
"currentEndIndex": -1,
"currentEndText": "",
"right": false
},
{
"startIndex": 5,
"startText": "",
"correctEndIndex": 5,
"correctEndText": "",
"currentEndIndex": -1,
"currentEndText": "",
"right": false
},
{
"startIndex": 6,
"startText": "",
"correctEndIndex": 6,
"correctEndText": "",
"currentEndIndex": -1,
"currentEndText": "",
"right": false
}
]
},
{
"contentType": "15",
"configIndex": 40,
"contentIndex": -1,
"currentInputText": [],
"correctText": [],
"right": true
},
{
"contentType": "15",
"configIndex": 41,
"contentIndex": -1,
"currentInputText": [],
"correctText": [],
"right": true
},
{
"contentType": "15",
"configIndex": 42,
"contentIndex": -1,
"currentInputText": [],
"correctText": [],
"right": true
},
{
"contentType": "15",
"configIndex": 43,
"contentIndex": -1,
"currentInputText": [],
"correctText": [],
"right": true
},
{
"contentType": "15",
"configIndex": 44,
"contentIndex": -1,
"currentInputText": [],
"correctText": [],
"right": true
},
{
"contentType": "15",
"configIndex": 45,
"contentIndex": -1,
"currentInputText": [],
"correctText": [],
"right": true
}
],
"scoreCconfigArr": [
{
"linkHotZoneIndex": -1,
"linkHotZoneIndexArr": [
0,
1,
2,
3,
4,
5,
6,
7,
9,
10,
11,
12,
14,
16,
17,
18,
19,
20,
22,
23,
24,
25,
26,
27,
28,
29,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45
],
"score": 16
}
],
"basicScore": 0,
"totalScore": 16,
"isAllRight": false,
"isAllWrong": false,
"startTimestamp": 1687345308611,
"submitTimestamp": 1687345376194,
"answeringTime": 67583
}
// 题型
const TEXT_SELECT = "0";
const IMAGE_SELECT = "1";
......@@ -124,6 +727,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
await this.initHotZoneBg(); // 初始化背景
this.initSlicedHotZoneBg(); // 切片背景图 - 修复某些设备上背景图过长导致的黑屏
this.initHotZoneItem(); // 初始化热区数据
// this.showHistory(); // 展示模式
this.initScorePanel();
this.initActionButton();
this.initScoreShow();
......@@ -661,7 +1265,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
configItem.index = index;
let validater = null;
switch (configItem.hotZoneType) {
// 文字选择题
// 文字选择题 [做题 - 显示]
case TEXT_SELECT:
validater = this.setTextOptionList(configItem, isDebug);
this.scoreValidater.push(validater);
......@@ -684,12 +1288,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
case VIDEO_PLAY:
this.setOneVideoBtn(configItem, this.data.hotZoneItemArr[configItem.linkHotZoneIndex]);
break;
// 热区选项(单选)
// 热区选项(单选) [做题 - 显示]
case HOT_ZONE_RADIO:
validater = this.setHotZoneRadioGroup(configItem, isDebug);
this.scoreValidater.push(validater);
break;
// 热区选项(多选)
// 热区选项(多选) [做题 - 显示]
case HOT_ZONE_CHECKBOX:
validater = this.setHotZoneCheckboxGroup(configItem, isDebug);
this.scoreValidater.push(validater);
......@@ -757,6 +1361,214 @@ export default class SceneComponent extends MyCocosSceneComponent {
// this.checkCanSubmit();
};
// 显示历史做题记录
showHistory() {
this.data.hotZoneConfigArr.forEach((configItem, index) => {
const historyData = history.details.filter(item=>item.configIndex == index);
if(historyData.length == 0) {
return
}
switch (historyData[0].contentType + "") {
// 文字选择题
case TEXT_SELECT:
this.showHistoryOptionList(configItem, historyData);
break;
// 热区单选
case HOT_ZONE_RADIO:
this.showHistoryRadio(configItem, historyData);
break;
// 多选
case HOT_ZONE_CHECKBOX:
this.showCheckboxGroup(configItem, historyData);
break;
}
})
};
// 文字选项 - 历史记录
showHistoryOptionList(configItem, _historyData) {
const debugMode = false;
configItem.contentList.forEach((option, index) => {
const hotZoneItemData = this.data.hotZoneItemArr[option.selectHotZoneIndex];
const resultRect = this.newRectNode(hotZoneItemData, layer_2, debugMode);
this.newDecorativeFrame(hotZoneItemData, layer_1, "#FFFFFF", "#6dbef6", debugMode);
const rect = this.newRectNode(hotZoneItemData, layer_4, debugMode);
const historyData = _historyData.find(item=>item.contentIndex == index)
const inputLabel = this.newInputTextNode(historyData.currentSelectText + "", 0);
inputLabel.x = rect.width / 2;
inputLabel.y = rect.height / 2;
rect.addChild(inputLabel);
const errIcon = getSprNode("icon_answer_wrong");
const rightIcon = getSprNode("icon_answer_right");
// 图标太大 缩小一半
errIcon.scale = rightIcon.scale = 0.5;
// 显示在热区的中间
errIcon.x = rightIcon.x = resultRect.width / 2;
errIcon.y = rightIcon.y = resultRect.height / 2;
if(historyData.right) {
resultRect.addChild(rightIcon);
} else {
resultRect.addChild(errIcon);
}
})
}
// 热区单选 - 历史记录
showHistoryRadio(configItem, _historyData) {
const debugMode = false;
const historyData = _historyData[0];
const resultIconShowData = this.data.hotZoneItemArr[configItem.linkResultShowHotZoneIndex];
const resultIconRect = this.newRectNode(resultIconShowData, layer_2, false);
const selStyle = configItem.selectedStyle ? configItem.selectedStyle : "border";
const unselStyle = configItem.unselectedStyle ? configItem.unselectedStyle : "mask";
configItem.contentList.forEach((option, index) => {
const hotZoneData = this.data.hotZoneItemArr[option.selectHotZoneIndex];
const rect = this.newRectNode(hotZoneData, layer_4, debugMode);
// 创建 结果节点 颜色区域 和 边框
const maskNode = this.newMaskRectNode(hotZoneData, layer_2, "#00000033");
const selLineNode = this.newOutlineNode(hotZoneData, layer_2, "#6dbef6");
const unselLineNode = this.newOutlineNode(hotZoneData, layer_2, "#6dbef6");
const {sprNode, picNode} = this.newSprNodeByResName(hotZoneData, "icon_right", true);
maskNode.active = unselStyle == "mask";
unselLineNode.active = unselStyle == "border";
selLineNode.active = false;
sprNode.active = false;
// 隐藏当前点击的颜色块
if(unselStyle == "mask") {
if(historyData.currentSelectIndex != index) {
maskNode.active = true;
} else {
maskNode.active = false;
}
}
// 隐藏当前点击的边框
if(unselStyle == "border") {
if(historyData.currentSelectIndex != index) {
unselLineNode.active = true;
} else {
unselLineNode.active = false;
}
}
// 显示边框
if(selStyle == "border") {
if(historyData.currentSelectIndex == index) {
selLineNode.active = true;
} else {
selLineNode.active = false;
}
}
// 显示对号
if(selStyle == "right") {
if(historyData.currentSelectIndex == index) {
sprNode.active = true;
} else {
sprNode.active = false;
}
}
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(historyData.right) {
resultIconRect.addChild(rightIcon);
} else {
resultIconRect.addChild(errIcon);
}
})
}
// 多选 - 历史记录
showCheckboxGroup(configItem, _historyData) {
const debugMode = false;
const historyData = _historyData[0];
console.log(historyData)
const resultIconShowData = this.data.hotZoneItemArr[configItem.linkResultShowHotZoneIndex];
const resultIconRect = this.newRectNode(resultIconShowData, layer_2, false);
const selStyle = configItem.selectedStyle ? configItem.selectedStyle : "border";
const unselStyle = configItem.unselectedStyle ? configItem.unselectedStyle : "mask";
configItem.contentList.forEach((option, index) => {
const hotZoneData = this.data.hotZoneItemArr[option.selectHotZoneIndex];
const rect = this.newRectNode(hotZoneData, layer_4, debugMode);
// 创建 结果节点 颜色区域 和 边框
const maskNode = this.newMaskRectNode(hotZoneData, layer_2, "#00000033");
const selLineNode = this.newOutlineNode(hotZoneData, layer_2, "#6dbef6");
const unselLineNode = this.newOutlineNode(hotZoneData, layer_2, "#6dbef6");
const {sprNode, picNode} = this.newSprNodeByResName(hotZoneData, "icon_right", true);
maskNode.active = unselStyle == "mask";
unselLineNode.active = unselStyle == "border";
selLineNode.active = false;
sprNode.active = false;
// 隐藏当前点击的颜色块
if(unselStyle == "mask") {
if(historyData.currentSelectIndex.indexOf(index) == -1 ) {
maskNode.active = true;
} else {
maskNode.active = false;
}
}
// 隐藏当前点击的边框
if(unselStyle == "border") {
if(historyData.currentSelectIndex.indexOf(index) == -1) {
unselLineNode.active = true;
} else {
unselLineNode.active = false;
}
}
// 显示边框
if(selStyle == "border") {
if(historyData.currentSelectIndex.indexOf(index) != -1) {
selLineNode.active = true;
} else {
selLineNode.active = false;
}
}
// 显示对号
if(selStyle == "right") {
if(historyData.currentSelectIndex.indexOf(index) != -1) {
sprNode.active = true;
} else {
sprNode.active = false;
}
}
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(historyData.right) {
resultIconRect.addChild(rightIcon);
} else {
resultIconRect.addChild(errIcon);
}
})
}
// 初始化分数牌
subScorePanels = [];
totalScorePanel = null;
......@@ -1205,7 +2017,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
currentSelectIndex: [],
correctSelectText: [],
correctSelectIndex: [],
right: true
right: true,
},
configIndex: contentData.index,
rect: resultIconRect,
......@@ -1227,6 +2039,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
reuslt.score += (option.score!=null && !isNaN(Number(option.score))) ? Number(option.score) : 0;
} else {
// 有错误 判错
reuslt.detail.right = false;
reuslt.allRight = false;
}
});
......
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