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

提交

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