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

fix

parent c29d0e4d
......@@ -132,13 +132,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
this._totalQuestion = defaultData.questions.length;
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");
}
......@@ -342,7 +335,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
if (isAnswer) {
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 })
node.active = false;
this._cake.insert(this._nowRightLetter, this._nowRightIndex);
......@@ -350,7 +344,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
} else {
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 })
node.active = false;
this.cakePiece.active = true;
......@@ -617,22 +612,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
playLocalAudio(audioName, notWaitDone?: boolean) {
return new Promise((resolve, reject) => {
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);
}
})
})
playLocalAudio(audioName) {
this.node.getChildByName("audioRoot").getChildByName(audioName).getComponent(cc.AudioSource).play();
}
}
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