Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
T_FT_01
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
T_FT_01
Commits
b4bfe8a7
Commit
b4bfe8a7
authored
Dec 20, 2020
by
Chen Jiping
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:修复音频动画的问题
parent
ef75555e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
Scene.js
play/assets/tmpGame/script/Scene.js
+13
-6
No files found.
play/assets/tmpGame/script/Scene.js
View file @
b4bfe8a7
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
// Learn life-cycle callbacks:
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import
{
playAudioByUrl
,
setSprNodeMaxLen
,
btnClickAnima
}
from
"
./util
"
;
import
{
setSprNodeMaxLen
,
btnClickAnima
}
from
"
./util
"
;
cc
.
Class
({
cc
.
Class
({
...
@@ -244,7 +244,7 @@ cc.Class({
...
@@ -244,7 +244,7 @@ cc.Class({
},
},
showStartAudio
()
{
showStartAudio
()
{
playAudioByUrl
(
this
.
data
.
title
.
audioUrl
,
()
=>
{
this
.
playAudioByUrl
(
this
.
data
.
title
.
audioUrl
,
()
=>
{
this
.
showQuestionAudio
();
this
.
showQuestionAudio
();
})
})
},
},
...
@@ -252,7 +252,7 @@ cc.Class({
...
@@ -252,7 +252,7 @@ cc.Class({
showQuestionAudio
()
{
showQuestionAudio
()
{
if
(
this
.
_curExercise
.
hotZoneItemArr
&&
this
.
_curExercise
.
hotZoneItemArr
.
length
>
0
)
{
if
(
this
.
_curExercise
.
hotZoneItemArr
&&
this
.
_curExercise
.
hotZoneItemArr
.
length
>
0
)
{
playAudioByUrl
(
this
.
_curExercise
.
hotZoneItemArr
[
0
].
audio_url
);
this
.
playAudioByUrl
(
this
.
_curExercise
.
hotZoneItemArr
[
0
].
audio_url
);
}
}
},
},
...
@@ -339,7 +339,7 @@ cc.Class({
...
@@ -339,7 +339,7 @@ cc.Class({
titleBgNode
.
addComponent
(
cc
.
Button
);
titleBgNode
.
addComponent
(
cc
.
Button
);
titleBgNode
.
on
(
'
click
'
,
()
=>
{
titleBgNode
.
on
(
'
click
'
,
()
=>
{
playAudioByUrl
(
this
.
data
.
title
.
audioUrl
);
this
.
playAudioByUrl
(
this
.
data
.
title
.
audioUrl
);
});
});
...
@@ -543,7 +543,7 @@ cc.Class({
...
@@ -543,7 +543,7 @@ cc.Class({
bubbleSpr
.
node
.
addComponent
(
cc
.
Button
)
bubbleSpr
.
node
.
addComponent
(
cc
.
Button
)
bubbleSpr
.
node
.
on
(
'
click
'
,
()
=>
{
bubbleSpr
.
node
.
on
(
'
click
'
,
()
=>
{
playAudioByUrl
(
hotZoneItem
.
audio_url
,
()
=>
{
this
.
playAudioByUrl
(
hotZoneItem
.
audio_url
,
()
=>
{
});
});
});
});
...
@@ -739,7 +739,7 @@ cc.Class({
...
@@ -739,7 +739,7 @@ cc.Class({
this
.
showSoundAnima
(
sprNode
,
item
);
this
.
showSoundAnima
(
sprNode
,
item
);
playAudioByUrl
(
item
.
data
.
audioUrl
,
()
=>
{
this
.
playAudioByUrl
(
item
.
data
.
audioUrl
,
()
=>
{
this
.
stopSoundAnima
(
sprNode
);
this
.
stopSoundAnima
(
sprNode
);
});
});
});
});
...
@@ -962,10 +962,17 @@ cc.Class({
...
@@ -962,10 +962,17 @@ cc.Class({
})
})
},
},
_audioId
:
null
,
playAudioByUrl
(
audio_url
,
cb
=
null
)
{
playAudioByUrl
(
audio_url
,
cb
=
null
)
{
if
(
this
.
_audioId
){
cc
.
audioEngine
.
pause
(
this
.
_audioId
);
}
if
(
audio_url
)
{
if
(
audio_url
)
{
cc
.
assetManager
.
loadRemote
(
audio_url
,
(
err
,
audioClip
)
=>
{
cc
.
assetManager
.
loadRemote
(
audio_url
,
(
err
,
audioClip
)
=>
{
const
audioId
=
cc
.
audioEngine
.
play
(
audioClip
,
false
,
0.8
);
const
audioId
=
cc
.
audioEngine
.
play
(
audioClip
,
false
,
0.8
);
this
.
_audioId
=
audioId
;
if
(
cb
)
{
if
(
cb
)
{
cc
.
audioEngine
.
setFinishCallback
(
audioId
,
()
=>
{
cc
.
audioEngine
.
setFinishCallback
(
audioId
,
()
=>
{
cb
();
cb
();
...
...
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