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
94b84879
Commit
94b84879
authored
May 11, 2023
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
禁止连线题有两道题连到同一个选项的操作
parent
31ab18fe
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
4 deletions
+28
-4
DG_FAF.ts
assets/DG_FAF/scene/DG_FAF.ts
+27
-3
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 @
94b84879
...
@@ -1389,6 +1389,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -1389,6 +1389,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
startRect
.
addChild
(
lineNode
)
startRect
.
addChild
(
lineNode
)
const
ctx
=
lineNode
.
addComponent
(
cc
.
Graphics
);
const
ctx
=
lineNode
.
addComponent
(
cc
.
Graphics
);
ctx
.
lineWidth
=
4
;
ctx
.
lineWidth
=
4
;
startRect
.
lineCtx
=
ctx
;
// 临时存储连接所用 手指在移动时保存上一次命中的索引
// 临时存储连接所用 手指在移动时保存上一次命中的索引
let
tempConnectResultIndex
=
-
1
;
let
tempConnectResultIndex
=
-
1
;
...
@@ -1420,16 +1421,28 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -1420,16 +1421,28 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 隐藏所有终点高亮
// 隐藏所有终点高亮
this
.
setActiveEndPointsByUID
(
false
,
uid
);
this
.
setActiveEndPointsByUID
(
false
,
uid
);
// 如果当前连线已经有连接过 则找到上次的连接索引 清掉
const
oldLinkedIndex
=
currentConnectionList
.
findIndex
(
ccl
=>
ccl
.
linkedIndex
==
index
);
if
(
oldLinkedIndex
>=
0
)
{
currentConnectionList
[
oldLinkedIndex
].
linkedIndex
=
-
1
;
}
// 把命中的节点的连接索引更新
// 把命中的节点的连接索引更新
if
(
tempConnectResultIndex
>=
0
)
{
if
(
tempConnectResultIndex
>=
0
)
{
// 当前被连接的点如果已经有起点连接过 则清掉之前的连线
if
(
currentConnectionList
[
tempConnectResultIndex
].
linkedIndex
>=
0
)
{
// 命中节点已经连过线了
currentConnectionList
[
tempConnectResultIndex
].
linkedRect
.
lineCtx
.
clear
();
}
currentConnectionList
[
tempConnectResultIndex
].
linkedIndex
=
index
;
currentConnectionList
[
tempConnectResultIndex
].
linkedIndex
=
index
;
currentConnectionList
[
tempConnectResultIndex
].
linkedRect
=
startRect
;
tempConnectResultIndex
=
-
1
;
tempConnectResultIndex
=
-
1
;
}
else
{
}
else
{
ctx
.
clear
()
ctx
.
clear
()
;
}
}
// console.log("触摸取消")
// console.log("触摸取消")
})
})
startRect
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
()
=>
{
startRect
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
()
=>
{
if
(
this
.
submitted
)
{
if
(
this
.
submitted
)
{
return
return
...
@@ -1441,14 +1454,25 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -1441,14 +1454,25 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 隐藏所有终点高亮
// 隐藏所有终点高亮
this
.
setActiveEndPointsByUID
(
false
,
uid
);
this
.
setActiveEndPointsByUID
(
false
,
uid
);
// 如果当前连线已经有连接过 则找到上次的连接索引 清掉
const
oldLinkedIndex
=
currentConnectionList
.
findIndex
(
ccl
=>
ccl
.
linkedIndex
==
index
);
if
(
oldLinkedIndex
>=
0
)
{
currentConnectionList
[
oldLinkedIndex
].
linkedIndex
=
-
1
;
}
// 把命中的节点的连接索引更新
// 把命中的节点的连接索引更新
if
(
tempConnectResultIndex
>=
0
)
{
if
(
tempConnectResultIndex
>=
0
)
{
// 当前被连接的点如果已经有起点连接过 则清掉之前的连线
if
(
currentConnectionList
[
tempConnectResultIndex
].
linkedIndex
>=
0
)
{
// 命中节点已经连过线了
currentConnectionList
[
tempConnectResultIndex
].
linkedRect
.
lineCtx
.
clear
();
}
currentConnectionList
[
tempConnectResultIndex
].
linkedIndex
=
index
;
currentConnectionList
[
tempConnectResultIndex
].
linkedIndex
=
index
;
currentConnectionList
[
tempConnectResultIndex
].
linkedRect
=
startRect
;
tempConnectResultIndex
=
-
1
;
tempConnectResultIndex
=
-
1
;
}
else
{
}
else
{
ctx
.
clear
()
ctx
.
clear
()
}
}
// console.log("触摸结束")
// console.log("触摸结束")
})
})
...
...
assets/DG_FAF/script/defaultData_DG_FAF.ts
View file @
94b84879
This diff is collapsed.
Click to expand it.
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