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