Commit 50ef8098 authored by 李维's avatar 李维

修复不封情况酷猫不播放动画的问题

parent e140c71c
import { onHomeworkFinish } from "../script/util"; import { onHomeworkFinish, playDragonBoneAnimation } from "../script/util";
import { defaultData } from "../script/defaultData"; import { defaultData } from "../script/defaultData";
import { itemData } from "./data"; import { itemData } from "./data";
import { hyLoader } from "./hyLoader"; import { hyLoader } from "./hyLoader";
...@@ -408,7 +408,10 @@ cc.Class({ ...@@ -408,7 +408,10 @@ cc.Class({
this._timeoutIds.push(setTimeout(() => {//4秒钟之后出现goodjob提示 this._timeoutIds.push(setTimeout(() => {//4秒钟之后出现goodjob提示
pg.view.visible(end, true); pg.view.visible(end, true);
pg.view.visible(end_success, true); pg.view.visible(end_success, true);
this.playSFX("audio_goodjob"); this.coolCatShutOut("right");
this.playSFX("audio_goodjob").thne(()=>{
this.coolCatShutOut();
});
}, 1000 * 0.5)); }, 1000 * 0.5));
this._timeoutIds.push(setTimeout(() => { this._timeoutIds.push(setTimeout(() => {
this.nextStage(); this.nextStage();
...@@ -433,7 +436,9 @@ cc.Class({ ...@@ -433,7 +436,9 @@ cc.Class({
let btn_picture = pg.view.find(this, "btn_picture"); let btn_picture = pg.view.find(this, "btn_picture");
this.showRestartBtn(); this.showRestartBtn();
// 一局失败弹出tryagain,同时下方录音按钮明亮并出现提示 // 一局失败弹出tryagain,同时下方录音按钮明亮并出现提示
this.coolCatSpeak()
this.playSFX("audio_tryagain").then(() => { this.playSFX("audio_tryagain").then(() => {
this.coolCatShutOut();
pg.view.visible(bg_tryagain, false); pg.view.visible(bg_tryagain, false);
pg.view.visible(end, false); pg.view.visible(end, false);
}) })
...@@ -443,11 +448,13 @@ cc.Class({ ...@@ -443,11 +448,13 @@ cc.Class({
pg.view.visible(btn_record, true); pg.view.visible(btn_record, true);
pg.view.visible(progress, false); pg.view.visible(progress, false);
this.coolCatSpeak()
this._playing = true; this._playing = true;
this._tryagainCount++; this._tryagainCount++;
this._timeoutIds.push(setTimeout(() => { this._timeoutIds.push(setTimeout(() => {
if (this._tryagainCount == 1) { if (this._tryagainCount == 1) {
pg.audio.playAudioByUrl(this._tryagain.one).then(() => { pg.audio.playAudioByUrl(this._tryagain.one).then(() => {
this.coolCatShutOut();
this._playing = false; this._playing = false;
}) })
// this.playSFX("audio_record"); // this.playSFX("audio_record");
...@@ -460,6 +467,7 @@ cc.Class({ ...@@ -460,6 +467,7 @@ cc.Class({
action.start(); action.start();
} else if (this._tryagainCount == 2) { } else if (this._tryagainCount == 2) {
pg.audio.playAudioByUrl(this._tryagain.two).then(() => { pg.audio.playAudioByUrl(this._tryagain.two).then(() => {
this.coolCatShutOut();
this._playing = false; this._playing = false;
}) })
// this.playSFX("audio_record"); // this.playSFX("audio_record");
...@@ -472,11 +480,12 @@ cc.Class({ ...@@ -472,11 +480,12 @@ cc.Class({
action.start(); action.start();
} else { } else {
pg.audio.playAudioByUrl(this._tryagain.three).then(() => { pg.audio.playAudioByUrl(this._tryagain.three).then(() => {
this.coolCatShutOut();
this._playing = false; this._playing = false;
this.nextStage(); this.nextStage();
}) })
} }
}, 1000 * 1)); }, 1000 * 2));
}, },
state5Finish() { state5Finish() {
let btn_replay = pg.view.find(this, "btn_replay") let btn_replay = pg.view.find(this, "btn_replay")
...@@ -1091,15 +1100,19 @@ cc.Class({ ...@@ -1091,15 +1100,19 @@ cc.Class({
} }
}, },
// 酷猫讲话动画
coolCatSpeak(aniName="begin") {
console.log("Play animation: " + aniName)
const cat = cc.find('Canvas/mao_ske');
playDragonBoneAnimation(cat, aniName, -1);
},
// 酷猫闭嘴
coolCatShutOut() {
console.log("Stop animaiton")
const cat = cc.find('Canvas/mao_ske');
playDragonBoneAnimation(cat, 'normal', -1);
},
......
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