Commit debc3faf authored by 范雪寒's avatar 范雪寒

fix: 点第一页点任意处标题和题干一起发音了

parent 6b2cf5ca
...@@ -109,17 +109,15 @@ export async function asyncPlayDragonBoneAnimation(node, animationName, time = 1 ...@@ -109,17 +109,15 @@ export async function asyncPlayDragonBoneAnimation(node, animationName, time = 1
} }
export async function asyncPlayEffectByUrl(url, loop = false) { export async function asyncPlayEffectByUrl(url, loop = false) {
if (!url) {
return;
}
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
cc.assetManager.loadRemote(url, (err, clip) => { cc.assetManager.loadRemote(url, (err, clip) => {
cc.audioEngine.playEffect(clip, loop); if (!clip) {
return;
setTimeout(() => { }
const audioID = cc.audioEngine.playEffect(clip, loop);
cc.audioEngine.setFinishCallback(audioID, function () {
resolve(); resolve();
}, clip.duration * 1000); });
}); });
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment