Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
JJ21
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
JJ21
Commits
2f1b0248
Commit
2f1b0248
authored
May 29, 2025
by
limingzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 增加自动播放
parent
c2eb6249
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
15 deletions
+61
-15
JJ21.js
assets/JJ21/scene/JJ21.js
+61
-15
No files found.
assets/JJ21/scene/JJ21.js
View file @
2f1b0248
...
...
@@ -630,6 +630,7 @@ cc.Class({
// this.initBg();
// this.initPanel();
// this.initScore();
...
...
@@ -653,6 +654,7 @@ cc.Class({
},
showBackBtn
()
{
const
backBtn
=
cc
.
find
(
'
Canvas/back_btn
'
);
backBtn
.
active
=
true
;
...
...
@@ -697,6 +699,7 @@ cc.Class({
this
.
curQuesIndex
--
;
this
.
initCurQues
();
this
.
refreshPage
();
this
.
clickTopAudio
(
this
.
topAudioRectNode
);
})
arrowR
.
on
(
'
click
'
,
()
=>
{
...
...
@@ -713,6 +716,7 @@ cc.Class({
this
.
curQuesIndex
++
;
this
.
initCurQues
();
this
.
refreshPage
();
this
.
clickTopAudio
(
this
.
topAudioRectNode
);
})
...
...
@@ -8787,6 +8791,7 @@ cc.Class({
rectNode
.
isClicked
=
false
;
});
})
},
...
...
@@ -9062,32 +9067,40 @@ cc.Class({
// })
},
topAudioRectNode
:
null
,
setAudioAnim
(
data
,
bg
)
{
console
.
log
(
'
in setAudioAnim
'
)
const
animNode
=
this
.
setOneAnim
(
data
,
bg
,
cc
.
Color
.
YELLOW
)
const
rectNode
=
animNode
.
rectNode
;
const
key
=
data
.
labelArr
[
1
]?.
value
;
rectNode
.
top_audio_key
=
key
;
rectNode
.
anim_node
=
animNode
;
this
.
topAudioRectNode
=
rectNode
;
rectNode
.
on
(
"
click
"
,
()
=>
{
if
(
rectNode
.
isClicked
)
{
return
;
}
rectNode
.
isClicked
=
true
;
this
.
clickTopAudio
(
rectNode
);
const
inputData
=
this
.
curQues
.
find
(
it
=>
{
return
it
[
key
]
;
})
console
.
log
(
'
`inputData:
'
,
inputData
)
;
// if (rectNode.isClicked)
{
// return
;
// }
// rectNode.isClicked = true
;
if
(
inputData
)
{
this
.
playAudioAnim
(
inputData
[
key
],
animNode
,
()
=>
{
rectNode
.
isClicked
=
false
;
});
}
else
{
rectNode
.
isClicked
=
false
;
}
// const inputData = this.curQues.find(it => {
// return it[key];
// })
// console.log('`inputData: ', inputData);
// if (inputData) {
// this.playAudioAnim(inputData[key], animNode, () => {
// rectNode.isClicked = false;
// });
// } else {
// rectNode.isClicked = false;
// }
})
...
...
@@ -9100,8 +9113,38 @@ cc.Class({
this
.
audioAnimArr
.
push
(
rectNode
);
this
.
labaNode
=
rectNode
;
delayCall
(
0.5
,
()
=>
{
this
.
clickTopAudio
(
this
.
topAudioRectNode
);
});
},
clickTopAudio
(
rectNode
)
{
if
(
rectNode
.
isClicked
)
{
return
;
}
rectNode
.
isClicked
=
true
;
const
key
=
rectNode
.
top_audio_key
const
animNode
=
rectNode
.
anim_node
;
const
inputData
=
this
.
curQues
.
find
(
it
=>
{
return
it
[
key
];
})
console
.
log
(
'
`inputData:
'
,
inputData
);
if
(
inputData
)
{
this
.
playAudioAnim
(
inputData
[
key
],
animNode
,
()
=>
{
rectNode
.
isClicked
=
false
;
});
}
else
{
rectNode
.
isClicked
=
false
;
}
},
setTextOption
(
data
,
bg
)
{
const
rectNode
=
this
.
setOneRect
(
data
,
bg
,
cc
.
Color
.
BLUE
);
...
...
@@ -9825,6 +9868,8 @@ cc.Class({
},
refreshPage
()
{
this
.
refreshInputText
();
this
.
refreshInputPic
();
this
.
refreshArrowBtn
();
...
...
@@ -9859,6 +9904,7 @@ cc.Class({
node
.
active
=
false
;
}
else
{
node
.
active
=
true
;
this
.
topAudioRectNode
=
node
;
}
}
else
{
node
.
active
=
false
;
...
...
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