Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
douyin_xiaoxiaole
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
douyin_xiaoxiaole
Commits
f256c122
Commit
f256c122
authored
Jul 13, 2023
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 全选
parent
2f4c3ded
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
16 deletions
+49
-16
wordgame_syllabus.fire
assets/wordgame_syllabus/scene/wordgame_syllabus.fire
+2
-2
wordgame_syllabus.ts
assets/wordgame_syllabus/scene/wordgame_syllabus.ts
+47
-14
No files found.
assets/wordgame_syllabus/scene/wordgame_syllabus.fire
View file @
f256c122
...
...
@@ -2155,7 +2155,7 @@
"__id__": 48
}
],
"_active":
tru
e,
"_active":
fals
e,
"_components": [
{
"__id__": 51
...
...
@@ -2486,7 +2486,7 @@
"__id__": 56
}
],
"_active":
tru
e,
"_active":
fals
e,
"_components": [
{
"__id__": 59
...
...
assets/wordgame_syllabus/scene/wordgame_syllabus.ts
View file @
f256c122
...
...
@@ -134,6 +134,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
itemsContent
.
removeAllChildren
();
templateItem
.
active
=
true
;
let
checkAllActive
=
false
;
for
(
let
i
=
0
;
i
<
rows
.
length
;
i
++
)
{
const
row
=
rows
[
i
];
const
itemClone
=
cc
.
instantiate
(
templateItem
);
...
...
@@ -143,14 +144,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
cc
.
find
(
`syllabus_item/label_disable`
,
itemClone
).
active
=
false
;
cc
.
find
(
`syllabus_item/label`
,
itemClone
).
getComponent
(
cc
.
Label
).
string
=
row
.
text_en
;
cc
.
find
(
`syllabus_item/label_disable`
,
itemClone
).
getComponent
(
cc
.
Label
).
string
=
row
.
text_en
;
if
(
row
.
has_child
)
{
cc
.
find
(
`Canvas/mainpage/toolbar/check_all`
).
active
=
false
;
}
else
{
cc
.
find
(
`Canvas/mainpage/toolbar/check_all`
).
active
=
true
;
if
(
!
row
.
has_child
)
{
checkAllActive
=
true
;
}
itemClone
.
attr
({
treeNodeId
:
row
.
id
,
treeNodePid
:
row
.
pid
,
hasChild
:
row
.
has_child
});
}
cc
.
find
(
`Canvas/mainpage/toolbar/check_all`
).
active
=
checkAllActive
;
templateItem
.
active
=
false
;
setTimeout
(()
=>
{
...
...
@@ -159,9 +159,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
checkAll
()
{
checkAll
(
evt
:
cc
.
Event
)
{
// 全选按钮
const
txt
=
cc
.
find
(
`text`
,
evt
.
currentTarget
).
getComponent
(
cc
.
Label
).
string
;
const
node
=
cc
.
find
(
`Canvas/mainpage/view/content`
);
if
(
txt
===
'
全选
'
)
{
for
(
let
i
=
0
;
i
<
node
.
children
.
length
;
i
++
)
{
const
nd
=
node
.
children
[
i
];
const
sure
=
cc
.
find
(
`syllabus_item/sure`
,
nd
);
...
...
@@ -169,17 +171,46 @@ export default class SceneComponent extends MyCocosSceneComponent {
sure
.
active
=
true
;
cc
.
find
(
`syllabus_item/label_disable`
,
nd
).
active
=
true
;
}
cc
.
find
(
`Canvas/mainpage/toolbar/choice_full`
).
active
=
true
;
cc
.
find
(
`Canvas/mainpage/toolbar/check_all/text`
).
getComponent
(
cc
.
Label
).
string
=
`全不选`
;
}
else
{
for
(
let
i
=
0
;
i
<
node
.
children
.
length
;
i
++
)
{
const
nd
=
node
.
children
[
i
];
const
sure
=
cc
.
find
(
`syllabus_item/sure`
,
nd
);
nd
.
attr
({
itemChecked
:
false
});
sure
.
active
=
false
;
cc
.
find
(
`syllabus_item/label_disable`
,
nd
).
active
=
false
;
}
cc
.
find
(
`Canvas/mainpage/toolbar/choice_full`
).
active
=
false
;
cc
.
find
(
`Canvas/mainpage/toolbar/check_all/text`
).
getComponent
(
cc
.
Label
).
string
=
`全选`
;
}
}
canTouch
=
true
;
async
loadTreeNode
(
evt
:
cc
.
Event
)
{
const
node
=
evt
.
currentTarget
;
if
(
!
node
.
hasChild
)
{
cc
.
find
(
`Canvas/mainpage/toolbar/check_all`
).
active
=
true
;
// 单个单词
const
sure
=
cc
.
find
(
`syllabus_item/sure`
,
node
);
sure
.
active
=
!
sure
.
active
;
cc
.
find
(
`syllabus_item/label_disable`
,
node
).
active
=
sure
.
active
;
node
.
attr
({
itemChecked
:
sure
.
active
});
const
arr
=
cc
.
find
(
`Canvas/mainpage/view/content`
).
children
;
let
sureBtnActive
=
false
;
let
checkAllText
=
`全不选`
;
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
const
nd
=
arr
[
i
];
if
(
nd
[
"
itemChecked
"
])
{
sureBtnActive
=
true
;
}
else
{
checkAllText
=
`全选`
;
}
}
cc
.
find
(
`Canvas/mainpage/toolbar/choice_full`
).
active
=
sureBtnActive
;
cc
.
find
(
`Canvas/mainpage/toolbar/check_all/text`
).
getComponent
(
cc
.
Label
).
string
=
checkAllText
;
return
;
}
if
(
!
this
.
canTouch
)
{
...
...
@@ -200,7 +231,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
return
;
}
this
.
canTouch
=
false
;
cc
.
find
(
`Canvas/mainpage/toolbar/choice_full`
).
active
=
false
;
cc
.
find
(
`Canvas/mainpage/toolbar/check_all`
).
active
=
false
;
const
node
=
this
.
nodePath
.
pop
();
if
(
node
&&
node
.
treeNodePid
)
{
this
.
pid
=
node
.
treeNodePid
;
...
...
@@ -219,7 +251,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
return
;
}
this
.
canTouch
=
false
;
cc
.
find
(
`Canvas/mainpage/toolbar/choice_full`
).
active
=
false
;
cc
.
find
(
`Canvas/mainpage/toolbar/check_all`
).
active
=
false
;
this
.
pid
=
null
;
this
.
nodePath
=
[];
await
this
.
loadData
();
...
...
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