Commit d9ba4c8b authored by 章红平's avatar 章红平

提交

parent 8c10068e
No preview for this file type
......@@ -305,9 +305,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
} else {
this.canTouch = false
if (this.clickNodeData1.pairIdx == data.pairIdx) {
this.asyncPlayAudioByUrl(data.audio)
// this.asyncPlayAudioByUrl(data.audio)
Promise
.all([node.getComponent("card").asyncDoFlip()])
.all([node.getComponent("card").asyncDoFlip(), this.asyncPlayAudioByUrl(data.audio)])
.then(() => {
this.playLocalAudio("true")
Promise.all([node.getComponent("card").playDragon(), this.clickNode1.getComponent("card").playDragon()])
......@@ -339,9 +339,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
)
} else {
this.asyncPlayAudioByUrl(data.audio)
Promise
.all([node.getComponent("card").asyncDoFlip()])
.all([node.getComponent("card").asyncDoFlip(), this.asyncPlayAudioByUrl(data.audio)])
.then(() => {
this.playLocalAudio("false")
// Promise.all([this.playLocalAudio("false")])
......
......@@ -173,6 +173,7 @@ export class MyCocosSceneComponent extends cc.Component {
}
asyncPlayAudioByUrl(audio_url, cb = null) {
// audio_url="ooooo"
if (audio_url) {
console.log("audio_url===",audio_url)
return new Promise((resole, reject) => {
......@@ -187,14 +188,15 @@ export class MyCocosSceneComponent extends cc.Component {
}else{
if(cb)cb();
console.log("asyncPlayAudioByUrlerr=====",err)
resole(null);
}
})
})
} else {
cb && cb();
return Promise.resolve();
}
}
}
\ No newline at end of file
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