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
0cd07a05
Commit
0cd07a05
authored
May 16, 2023
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改连线组题型,可增加干扰项
parent
dcaf5063
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
21 deletions
+42
-21
DG_FAF.ts
assets/DG_FAF/scene/DG_FAF.ts
+41
-20
defaultData_DG_FAF.ts
assets/DG_FAF/script/defaultData_DG_FAF.ts
+1
-1
No files found.
assets/DG_FAF/scene/DG_FAF.ts
View file @
0cd07a05
...
@@ -89,6 +89,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -89,6 +89,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
if
(
this
.
data
.
header_image_url
)
{
if
(
this
.
data
.
header_image_url
)
{
this
.
_imageResList
.
push
({
url
:
this
.
data
.
header_image_url
});
this
.
_imageResList
.
push
({
url
:
this
.
data
.
header_image_url
});
}
}
if
(
this
.
data
.
hotZoneBgSliceList
)
{
this
.
data
.
hotZoneBgSliceList
.
forEach
(
sliceItem
=>
{
if
(
sliceItem
.
image_url
)
{
this
.
_imageResList
.
push
({
url
:
sliceItem
.
image_url
});
}
});
}
}
}
addPreloadAudio
()
{
addPreloadAudio
()
{
...
@@ -588,11 +595,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -588,11 +595,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
const
svContentSlicedBg
=
cc
.
find
(
"
Canvas/MainContent/ScorllView/view/content/slicedBg
"
);
const
svContentSlicedBg
=
cc
.
find
(
"
Canvas/MainContent/ScorllView/view/content/slicedBg
"
);
const
pAll
=
[];
const
pAll
=
[];
this
.
data
.
hotZoneBgSliceList
.
forEach
((
imgObj
,
index
)
=>
{
this
.
data
.
hotZoneBgSliceList
.
forEach
((
imgObj
,
index
)
=>
{
pAll
.
push
(
new
Promise
((
resovle
,
reject
)
=>
{
if
(
imgObj
.
image_url
)
{
cc
.
assetManager
.
loadRemote
(
imgObj
.
image_url
,
(
err
,
img
)
=>
{
pAll
.
push
(
new
Promise
((
resovle
,
reject
)
=>
{
resovle
(
img
);
cc
.
assetManager
.
loadRemote
(
imgObj
.
image_url
,
(
err
,
img
)
=>
{
});
resovle
(
img
);
}))
});
}))
}
});
});
Promise
.
all
(
pAll
).
then
(
res
=>
{
Promise
.
all
(
pAll
).
then
(
res
=>
{
...
@@ -1319,6 +1328,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -1319,6 +1328,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
if
(
currentConnectionList
[
index
].
linkedIndex
==
index
)
{
if
(
currentConnectionList
[
index
].
linkedIndex
==
index
)
{
// 正确 返回分数
// 正确 返回分数
result
.
score
+=
(
option
.
score
!=
null
&&
!
isNaN
(
Number
(
option
.
score
)))
?
Number
(
option
.
score
)
:
0
;
result
.
score
+=
(
option
.
score
!=
null
&&
!
isNaN
(
Number
(
option
.
score
)))
?
Number
(
option
.
score
)
:
0
;
}
else
if
(
currentConnectionList
[
index
].
rect
==
null
&&
currentConnectionList
[
index
].
linkedIndex
==
-
1
)
{
// 干扰项 没有被连接 正确 返回分数
result
.
score
+=
(
option
.
score
!=
null
&&
!
isNaN
(
Number
(
option
.
score
)))
?
Number
(
option
.
score
)
:
0
;
}
else
{
}
else
{
// 错误
// 错误
detailItem
.
right
=
false
;
detailItem
.
right
=
false
;
...
@@ -1332,7 +1344,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -1332,7 +1344,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
contentData
.
contentList
.
forEach
((
option
,
index
)
=>
{
contentData
.
contentList
.
forEach
((
option
,
index
)
=>
{
// 开始和结束点
// 开始和结束点
const
startHotZoneData
=
this
.
data
.
hotZoneItemArr
[
option
.
selectStartHotZoneIndex
];
const
startHotZoneData
=
this
.
data
.
hotZoneItemArr
[
option
.
selectStartHotZoneIndex
];
const
startRect
=
this
.
newRectNode
(
startHotZoneData
,
layer_4
,
debugMode
);
const
noStartNode
=
startHotZoneData
==
undefined
?
true
:
false
;
const
startRect
=
!
noStartNode
?
this
.
newRectNode
(
startHotZoneData
,
layer_4
,
debugMode
)
:
null
;
const
endHotZoneData
=
this
.
data
.
hotZoneItemArr
[
option
.
selectEndHotZoneIndex
];
const
endHotZoneData
=
this
.
data
.
hotZoneItemArr
[
option
.
selectEndHotZoneIndex
];
const
endRect
=
this
.
newRectNode
(
endHotZoneData
,
layer_5
,
debugMode
);
const
endRect
=
this
.
newRectNode
(
endHotZoneData
,
layer_5
,
debugMode
);
...
@@ -1342,8 +1355,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -1342,8 +1355,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
iconStart
.
zIndex
=
layer_2
;
iconStart
.
zIndex
=
layer_2
;
iconEnd
.
zIndex
=
layer_2
;
iconEnd
.
zIndex
=
layer_2
;
iconEndActive
.
zIndex
=
layer_2
;
iconEndActive
.
zIndex
=
layer_2
;
iconStart
.
x
=
startRect
.
width
/
2
;
if
(
!
noStartNode
)
{
iconStart
.
y
=
startRect
.
height
/
2
;
iconStart
.
x
=
startRect
.
width
/
2
;
iconStart
.
y
=
startRect
.
height
/
2
;
}
iconEnd
.
x
=
endRect
.
width
/
2
;
iconEnd
.
x
=
endRect
.
width
/
2
;
iconEnd
.
y
=
endRect
.
height
/
2
;
iconEnd
.
y
=
endRect
.
height
/
2
;
iconEndActive
.
x
=
endRect
.
width
/
2
;
iconEndActive
.
x
=
endRect
.
width
/
2
;
...
@@ -1352,7 +1367,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -1352,7 +1367,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
endRect
.
addChild
(
iconEnd
);
endRect
.
addChild
(
iconEnd
);
endRect
.
addChild
(
iconEndActive
);
endRect
.
addChild
(
iconEndActive
);
startRect
.
addChild
(
iconStart
);
if
(
!
noStartNode
)
{
startRect
.
addChild
(
iconStart
);
}
// 有些题需要在连接后 显示一个字符到指定区域 以下代码为实现
// 有些题需要在连接后 显示一个字符到指定区域 以下代码为实现
// 显示字符的节点
// 显示字符的节点
...
@@ -1383,19 +1400,23 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -1383,19 +1400,23 @@ export default class SceneComponent extends MyCocosSceneComponent {
getEndShowText
:
()
=>
endShowText
getEndShowText
:
()
=>
endShowText
})
})
// 新建节点 放置线条
let
lineNode
=
null
;
const
lineNode
=
new
cc
.
Node
();
let
ctx
=
null
;
lineNode
.
name
=
'
connect_
'
+
index
;
if
(
!
noStartNode
)
{
startRect
.
addChild
(
lineNode
)
// 新建节点 放置线条
const
ctx
=
lineNode
.
addComponent
(
cc
.
Graphics
);
lineNode
=
new
cc
.
Node
();
ctx
.
lineWidth
=
4
;
lineNode
.
name
=
'
connect_
'
+
index
;
startRect
.
lineCtx
=
ctx
;
startRect
.
addChild
(
lineNode
)
ctx
=
lineNode
.
addComponent
(
cc
.
Graphics
);
ctx
.
lineWidth
=
4
;
startRect
.
lineCtx
=
ctx
;
}
// 临时存储连接所用 手指在移动时保存上一次命中的索引
// 临时存储连接所用 手指在移动时保存上一次命中的索引
let
tempConnectResultIndex
=
-
1
;
let
tempConnectResultIndex
=
-
1
;
// 手点击连线起点 发起连线
// 手点击连线起点 发起连线
startRect
.
on
(
cc
.
Node
.
EventType
.
TOUCH_START
,
()
=>
{
!
noStartNode
&&
startRect
.
on
(
cc
.
Node
.
EventType
.
TOUCH_START
,
()
=>
{
if
(
this
.
submitted
)
{
if
(
this
.
submitted
)
{
return
return
}
}
...
@@ -1410,7 +1431,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -1410,7 +1431,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
})
})
// 松手 离开屏幕
// 松手 离开屏幕
startRect
.
on
(
cc
.
Node
.
EventType
.
TOUCH_CANCEL
,
()
=>
{
!
noStartNode
&&
startRect
.
on
(
cc
.
Node
.
EventType
.
TOUCH_CANCEL
,
()
=>
{
if
(
this
.
submitted
)
{
if
(
this
.
submitted
)
{
return
return
}
}
...
@@ -1443,7 +1464,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -1443,7 +1464,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
// console.log("触摸取消")
// console.log("触摸取消")
})
})
startRect
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
()
=>
{
!
noStartNode
&&
startRect
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
()
=>
{
if
(
this
.
submitted
)
{
if
(
this
.
submitted
)
{
return
return
}
}
...
@@ -1476,7 +1497,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -1476,7 +1497,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
// console.log("触摸结束")
// console.log("触摸结束")
})
})
startRect
.
on
(
cc
.
Node
.
EventType
.
TOUCH_MOVE
,
(
e
)
=>
{
!
noStartNode
&&
startRect
.
on
(
cc
.
Node
.
EventType
.
TOUCH_MOVE
,
(
e
)
=>
{
if
(
this
.
submitted
)
{
if
(
this
.
submitted
)
{
return
return
}
}
...
...
assets/DG_FAF/script/defaultData_DG_FAF.ts
View file @
0cd07a05
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