Commit eb5fe7d3 authored by yu's avatar yu

5.21调整

parent bf10a216
This diff is collapsed.
......@@ -97,6 +97,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
private layout_start: cc.Node;
private audioId: any;
async initView() {
cc.audioEngine.stopAllEffects();
this.layout_start = pg.view.find(this, "layout_start");
this.layout_start.active = true;
......@@ -325,14 +326,16 @@ export default class SceneComponent extends MyCocosSceneComponent {
layout = layout_img;
pg.view.setNetImg(pg.view.find(layout_img, 'img'), data.picUrl, { w: 440, h: 286 })
}
touch.off(cc.Node.EventType.TOUCH_END);
//动画效果
this.playLocalAudio("card").then(() => {
pg.audio.playAudioByUrl(data.audioUrl);
})
touch.off(cc.Node.EventType.TOUCH_END);
pg.audio.playAudioByUrl(data.audioUrl, () => {
touch.on(cc.Node.EventType.TOUCH_END, () => {
pg.audio.playAudioByUrl(data.audioUrl);
})
});
})
layout.active = true;
layout.opacity = 255;
layout.scale = 0.1;
......@@ -554,7 +557,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
async recrodEnd(data) {
Game.getIns().player.addVoice(data);
let score = data.result.overall;
if (score >= 80) {
if (score >= 70) {
//提示成功
this.updateTips(TIPS_STATE.GOOD);
Game.getIns().player.addRight();
......@@ -565,7 +568,15 @@ export default class SceneComponent extends MyCocosSceneComponent {
if (this.tryData.some(td => td.id == this.touchData.id)) {
this.updateTips(TIPS_STATE.COM);
this.touchFishs.push(this.touchData);
if (this.tryAgain) {
this.tryAgain = false;
this.playCard(null);
this.updateLayoutSpeak(true);
this.updateTips(null);
this.touching = false;
Game.getIns().state = GAME_STATE.OVER
return pg.event.emit("game_time_over");
}
} else {
this.updateTips(TIPS_STATE.TRY);
this.tryData.push(this.touchData);
......
......@@ -518,12 +518,13 @@ let pg = {
}
},
audio: {
playAudioByUrl(audio_url) {
playAudioByUrl(audio_url, cb = null) {
return new Promise((resolve, reject) => {
if (!audio_url) return resolve(null);
cc.assetManager.loadRemote(audio_url, (err, audioClip: any) => {
cc.assetManager.loadRemote(audio_url, (err, audioClip: any) => {5
const audioId = cc.audioEngine.play(audioClip, false, 0.8);
cc.audioEngine.setFinishCallback(audioId, () => {
cb && cb();
});
resolve(audioId);
});
......@@ -538,7 +539,7 @@ let pg = {
const audioId = cc.audioEngine.playEffect(audioClip, false);
if (cb) {
cc.audioEngine.setFinishCallback(audioId, () => {
cb();
cb && cb();
});
}
......
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