Commit ea3e19ab authored by 杨一航's avatar 杨一航

fix

parent c29d0e4d
...@@ -132,13 +132,6 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -132,13 +132,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
this._totalQuestion = defaultData.questions.length; this._totalQuestion = defaultData.questions.length;
this._wrongQuestion = 0; this._wrongQuestion = 0;
// await new Promise((resolve) => {
// cc.assetManager.loadBundle("cake_template_test", (ero) => {
// console.log("budle loaded");
// !ero && resolve(null);
// });
// })
console.log("init data"); console.log("init data");
} }
...@@ -342,7 +335,8 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -342,7 +335,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
if (isAnswer) { if (isAnswer) {
this._candle.fireStop(); this._candle.fireStop();
await this.playLocalAudio("effect_chose_right", true); await this.playLocalAudio("effect_chose_right");
await asyncDelay(0.5);
await asyncTweenTo(node.parent, 0.3, { x: 0, y: -100 }) await asyncTweenTo(node.parent, 0.3, { x: 0, y: -100 })
node.active = false; node.active = false;
this._cake.insert(this._nowRightLetter, this._nowRightIndex); this._cake.insert(this._nowRightLetter, this._nowRightIndex);
...@@ -350,7 +344,8 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -350,7 +344,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
} else { } else {
this._candle.fireStop(); this._candle.fireStop();
await this.playLocalAudio("effect_cake_drop", true); this.playLocalAudio("effect_cake_drop");
await asyncDelay(0.5);
// await asyncTweenTo(node.parent, 0.18, { x: 200, y: -300 }) // await asyncTweenTo(node.parent, 0.18, { x: 200, y: -300 })
node.active = false; node.active = false;
this.cakePiece.active = true; this.cakePiece.active = true;
...@@ -617,22 +612,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -617,22 +612,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
playLocalAudio(audioName, notWaitDone?: boolean) { playLocalAudio(audioName) {
return new Promise((resolve, reject) => { this.node.getChildByName("audioRoot").getChildByName(audioName).getComponent(cc.AudioSource).play();
cc.assetManager.getBundle("cake_template_test").load("/audios/" + audioName, (ero: Error, asset: cc.AudioClip) => {
if (!ero) {
let id = cc.audioEngine.playEffect(asset, false);
if (notWaitDone) {
resolve(null)
} else {
cc.audioEngine.setFinishCallback(id, () => {
resolve(null);
});
}
} else {
cc.error(ero);
}
})
})
} }
} }
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