Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
DG_FAF
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
template admin
DG_FAF
Commits
3ec21225
Commit
3ec21225
authored
Jul 11, 2023
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
暂时提交代码
未完成连线组
parent
8f2961c4
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
675 additions
and
2566 deletions
+675
-2566
DG_FAF.ts
assets/DG_FAF/scene/DG_FAF.ts
+85
-7
defaultData_DG_FAF.ts
assets/DG_FAF/script/defaultData_DG_FAF.ts
+1
-1
historyData_DG_FAF.ts
assets/DG_FAF/script/historyData_DG_FAF.ts
+589
-2558
No files found.
assets/DG_FAF/scene/DG_FAF.ts
View file @
3ec21225
...
@@ -117,9 +117,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -117,9 +117,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
isDestroy
=
false
;
isDestroy
=
false
;
startTimestamp
=
null
;
startTimestamp
=
null
;
isHistoryMode
=
false
;
// 历史记录模式
async
onLoadEnd
()
{
async
onLoadEnd
()
{
// TODO 加载完成后的逻辑写在这里
// TODO 加载完成后的逻辑写在这里
console
.
log
(
this
.
data
);
console
.
log
(
this
.
data
);
if
(
this
.
isHistoryMode
)
{
this
.
data
=
historyData
.
dataSaved
;
}
this
.
disableScroll
();
// 禁用页面滚动
this
.
disableScroll
();
// 禁用页面滚动
this
.
initSize
();
// 页面尺寸
this
.
initSize
();
// 页面尺寸
this
.
initMiddleLayer
();
// 中间层相关
this
.
initMiddleLayer
();
// 中间层相关
...
@@ -128,8 +132,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -128,8 +132,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
initVideoPlayerLayer
();
// 视频播放层
this
.
initVideoPlayerLayer
();
// 视频播放层
await
this
.
initHotZoneBg
();
// 初始化背景
await
this
.
initHotZoneBg
();
// 初始化背景
this
.
initSlicedHotZoneBg
();
// 切片背景图 - 修复某些设备上背景图过长导致的黑屏
this
.
initSlicedHotZoneBg
();
// 切片背景图 - 修复某些设备上背景图过长导致的黑屏
if
(
!
this
.
isHistoryMode
)
{
this
.
initHotZoneItem
();
// 初始化热区数据
this
.
initHotZoneItem
();
// 初始化热区数据
// this.showHistory(); // 展示模式
}
else
{
this
.
showHistory
();
// 展示模式
}
this
.
initScorePanel
();
this
.
initScorePanel
();
this
.
initActionButton
();
this
.
initActionButton
();
this
.
initScoreShow
();
this
.
initScoreShow
();
...
@@ -810,7 +817,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -810,7 +817,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 显示历史做题记录
// 显示历史做题记录
showHistory
()
{
showHistory
()
{
historyData
.
dataSaved
.
hotZoneConfigArr
.
forEach
((
configItem
,
index
)
=>
{
this
.
data
.
hotZoneConfigArr
.
forEach
((
configItem
,
index
)
=>
{
const
resultData
=
historyData
.
details
.
filter
(
item
=>
item
.
configIndex
==
index
);
const
resultData
=
historyData
.
details
.
filter
(
item
=>
item
.
configIndex
==
index
);
if
(
resultData
.
length
==
0
)
{
if
(
resultData
.
length
==
0
)
{
return
return
...
@@ -844,6 +851,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -844,6 +851,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
case
HOT_ZONE_CHECKBOX
:
case
HOT_ZONE_CHECKBOX
:
this
.
showCheckboxGroup
(
configItem
,
resultData
);
this
.
showCheckboxGroup
(
configItem
,
resultData
);
break
;
break
;
// 连线组
case
CONNECTION
:
this
.
showConnectionGroup
(
configItem
,
resultData
);
break
;
}
}
})
})
...
@@ -862,7 +873,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -862,7 +873,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
newDecorativeFrame
(
hotZoneItemData
,
layer_1
,
"
#FFFFFF
"
,
"
#6dbef6
"
,
debugMode
);
this
.
newDecorativeFrame
(
hotZoneItemData
,
layer_1
,
"
#FFFFFF
"
,
"
#6dbef6
"
,
debugMode
);
const
rect
=
this
.
newRectNode
(
hotZoneItemData
,
layer_4
,
debugMode
);
const
rect
=
this
.
newRectNode
(
hotZoneItemData
,
layer_4
,
debugMode
);
const
historyItem
=
resultData
.
find
(
item
=>
item
.
contentIndex
==
index
)
const
historyItem
=
resultData
.
find
(
item
=>
item
.
contentIndex
==
index
)
console
.
log
(
historyItem
)
const
textShow
=
historyItem
.
currentSelectIndex
?
configItem
.
selectOptionList
[
historyItem
.
currentSelectIndex
].
text
:
""
const
textShow
=
historyItem
.
currentSelectIndex
?
configItem
.
selectOptionList
[
historyItem
.
currentSelectIndex
].
text
:
""
const
inputLabel
=
this
.
newInputTextNode
(
textShow
+
""
,
0
);
const
inputLabel
=
this
.
newInputTextNode
(
textShow
+
""
,
0
);
inputLabel
.
x
=
rect
.
width
/
2
;
inputLabel
.
x
=
rect
.
width
/
2
;
...
@@ -911,11 +921,81 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -911,11 +921,81 @@ export default class SceneComponent extends MyCocosSceneComponent {
resultRect
.
addChild
(
errIcon
);
resultRect
.
addChild
(
errIcon
);
}
}
})
})
}
// 连线组 - 历史记录
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
);
let
allRight
=
true
;
resultData
[
0
].
results
.
forEach
(
item
=>
{
if
(
item
.
right
==
false
)
{
allRight
=
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
(
allRight
)
{
resultIconRect
.
addChild
(
rightIcon
);
}
else
{
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
endHotZoneData
=
this
.
data
.
hotZoneItemArr
[
configItem
.
contentList
[
resData
.
currentEndIndex
].
selectEndHotZoneIndex
];
const
endRect
=
this
.
newRectNode
(
endHotZoneData
,
layer_5
,
debugMode
);
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
;
endRect
.
addChild
(
iconEnd
);
startRect
.
addChild
(
iconStart
);
const
lineNode
=
new
cc
.
Node
();
lineNode
.
name
=
'
connect1_
'
+
index
;
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
();
});
}
}
// 判断对错 - 历史记录
// 判断对错 - 历史记录
showRightOrWrongGroup
(
configItem
,
resultData
)
{
showRightOrWrongGroup
(
configItem
,
resultData
)
{
console
.
log
(
configItem
,
resultData
)
const
debugMode
=
false
;
const
debugMode
=
false
;
const
resultIconShowData
=
this
.
data
.
hotZoneItemArr
[
configItem
.
linkResultShowHotZoneIndex
];
const
resultIconShowData
=
this
.
data
.
hotZoneItemArr
[
configItem
.
linkResultShowHotZoneIndex
];
const
resultIconRect
=
this
.
newRectNode
(
resultIconShowData
,
layer_2
,
debugMode
);
const
resultIconRect
=
this
.
newRectNode
(
resultIconShowData
,
layer_2
,
debugMode
);
...
@@ -986,7 +1066,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -986,7 +1066,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
showHistoryRadio
(
configItem
,
resultData
)
{
showHistoryRadio
(
configItem
,
resultData
)
{
const
debugMode
=
false
;
const
debugMode
=
false
;
const
historyItem
=
resultData
[
0
];
const
historyItem
=
resultData
[
0
];
const
resultIconShowData
=
this
.
data
.
hotZoneItemArr
[
configItem
.
linkResultShowHotZoneIndex
];
const
resultIconShowData
=
this
.
data
.
hotZoneItemArr
[
configItem
.
linkResultShowHotZoneIndex
];
const
resultIconRect
=
this
.
newRectNode
(
resultIconShowData
,
layer_2
,
false
);
const
resultIconRect
=
this
.
newRectNode
(
resultIconShowData
,
layer_2
,
false
);
...
@@ -996,7 +1075,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -996,7 +1075,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
configItem
.
contentList
.
forEach
((
option
,
index
)
=>
{
configItem
.
contentList
.
forEach
((
option
,
index
)
=>
{
const
hotZoneData
=
this
.
data
.
hotZoneItemArr
[
option
.
selectHotZoneIndex
];
const
hotZoneData
=
this
.
data
.
hotZoneItemArr
[
option
.
selectHotZoneIndex
];
const
rect
=
this
.
newRectNode
(
hotZoneData
,
layer_4
,
debugMode
);
const
rect
=
this
.
newRectNode
(
hotZoneData
,
layer_4
,
debugMode
);
// 创建 结果节点 颜色区域 和 边框
// 创建 结果节点 颜色区域 和 边框
const
maskNode
=
this
.
newMaskRectNode
(
hotZoneData
,
layer_2
,
"
#00000033
"
);
const
maskNode
=
this
.
newMaskRectNode
(
hotZoneData
,
layer_2
,
"
#00000033
"
);
const
selLineNode
=
this
.
newOutlineNode
(
hotZoneData
,
layer_2
,
"
#6dbef6
"
);
const
selLineNode
=
this
.
newOutlineNode
(
hotZoneData
,
layer_2
,
"
#6dbef6
"
);
...
...
assets/DG_FAF/script/defaultData_DG_FAF.ts
View file @
3ec21225
This diff is collapsed.
Click to expand it.
assets/DG_FAF/script/historyData_DG_FAF.ts
View file @
3ec21225
This source diff could not be displayed because it is too large. You can
view the blob
instead.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment