Commit 79617c0a authored by Tt's avatar Tt

1

parent 3f9d8885
This diff is collapsed.
...@@ -222,6 +222,9 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -222,6 +222,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 播放背景音乐 // 播放背景音乐
pg.audio.playBgAudioByUrl(Game.getIns().bgAudio); pg.audio.playBgAudioByUrl(Game.getIns().bgAudio);
this.layout_speak.active = false;
// 显示问题 // 显示问题
this.showPage(); this.showPage();
...@@ -417,12 +420,6 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -417,12 +420,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 切换到持续喷水动画 // 切换到持续喷水动画
pg.view.addDBAnimationCallback(this.node_firetruck_flush, null) pg.view.addDBAnimationCallback(this.node_firetruck_flush, null)
pg.view.playDBAnimation(this.node_firetruck_flush, '持续喷水', 1); pg.view.playDBAnimation(this.node_firetruck_flush, '持续喷水', 1);
pg.view.addDBAnimationCallback(this.node_firetruck_flush, () => {
pg.view.addDBAnimationCallback(this.node_firetruck_flush, null)
this.node_firetruck_flush.active = false;
})
pg.view.playDBAnimation(this.node_firetruck_flush, '收水', 1);
this.touching = false;
this.showCard(); this.showCard();
}) })
pg.view.playDBAnimation(this.node_firetruck_flush, '喷水', 1); pg.view.playDBAnimation(this.node_firetruck_flush, '喷水', 1);
...@@ -455,6 +452,13 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -455,6 +452,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.log(`找不到节点: water_${fireIndex}`); this.log(`找不到节点: water_${fireIndex}`);
} }
pg.view.addDBAnimationCallback(this.node_firetruck_flush, () => {
pg.view.addDBAnimationCallback(this.node_firetruck_flush, null)
this.node_firetruck_flush.active = false;
})
pg.view.playDBAnimation(this.node_firetruck_flush, '收水', 1);
this.touching = false;
// 检查当前页面是否所有火苗都已处理完毕 // 检查当前页面是否所有火苗都已处理完毕
if (this.activeFireNodes.length === 0) { if (this.activeFireNodes.length === 0) {
// 延迟一段时间后检查是否需要切换到下一页 // 延迟一段时间后检查是否需要切换到下一页
...@@ -477,39 +481,33 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -477,39 +481,33 @@ export default class SceneComponent extends MyCocosSceneComponent {
fireNode.active = true; fireNode.active = true;
} }
} }
nextPage() { nextPage() {
// 切换到下一页 // 切换到下一页
Game.getIns().addPage(); Game.getIns().addPage();
this.showPage(); this.showPage();
} }
showCard() { showCard(hide: boolean = false) {
// 显示卡片
const currentData = this.currentFireNode.data;
console.log('showCard', currentData)
}
/**
* 更新录音界面的显示状态
* @param hide 是否隐藏录音界面
*/
private updateLayoutSpeak(hide?: boolean) {
if (!hide) { if (!hide) {
// 显示录音界面 // 显示卡片
const currentData = this.currentFireNode.data;
console.log('showCard', currentData)
this.layout_speak.active = true; this.layout_speak.active = true;
// 获取UI元素 // 获取UI元素
let ske = pg.view.find(this.layout_speak, 'speak_ske');
let btn_start = pg.view.find(this.layout_speak, 'btn_start'); let btn_start = pg.view.find(this.layout_speak, 'btn_start');
let btn_start_reset = pg.view.find(this.layout_speak, 'btn_start_reset');
let btn_stop = pg.view.find(this.layout_speak, 'btn_stop'); let btn_stop = pg.view.find(this.layout_speak, 'btn_stop');
let btn_record_replay = pg.view.find(this.layout_speak, 'btn_record_replay');
let btn_record_0 = pg.view.find(this.layout_speak, 'btn_record_0');
let btn_record_1 = pg.view.find(this.layout_speak, 'btn_record_1');
let btn_record_2 = pg.view.find(this.layout_speak, 'btn_record_2');
// 绑定按钮事件 // 绑定按钮事件
pg.view.touchOn(btn_start, this.onTouchRecord, this); pg.view.touchOn(btn_start, this.onTouchRecord, this);
pg.view.touchOn(btn_start_reset, this.onTouchRecord, this);
pg.view.touchOn(btn_stop, this.onTouchRecordEnd, this); pg.view.touchOn(btn_stop, this.onTouchRecordEnd, this);
pg.view.touchOn(btn_record_replay, this.onTouchPlayRecord, this);
// 设置动画初始状态(几乎静止)
pg.view.playDBAnimation(ske, 'newAnimation', 0);
ske.getComponent(dragonBones.ArmatureDisplay).timeScale = 0.00001;
// 显示开始按钮,隐藏停止按钮 // 显示开始按钮,隐藏停止按钮
btn_start.active = true; btn_start.active = true;
...@@ -714,6 +712,15 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -714,6 +712,15 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.recrodEnd(data); this.recrodEnd(data);
}); //结束录音 }); //结束录音
} }
onTouchPlayRecord() {
const voice = Game.getIns().player.getLastVoice();
// voice.audioUrl;
if (voice) {
pg.audio.playAudioByUrl(voice.audioUrl);
}
}
/** 是否需要再次尝试 */ /** 是否需要再次尝试 */
private tryAgain: boolean = false; private tryAgain: boolean = false;
/** 是否正在触摸/操作中 */ /** 是否正在触摸/操作中 */
...@@ -751,7 +758,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -751,7 +758,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 延迟后隐藏卡片和提示,进入下一题 // 延迟后隐藏卡片和提示,进入下一题
await pg.time.delay(3); await pg.time.delay(3);
this.updateLayoutSpeak(true); this.showCard(true);
this.updateTips(null); this.updateTips(null);
this.nextEgg(); this.nextEgg();
return; return;
...@@ -771,7 +778,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -771,7 +778,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
await pg.time.delay(3); await pg.time.delay(3);
this.updateLayoutSpeak(true); this.showCard(true);
this.updateTips(null); this.updateTips(null);
this.recordTouching = false; this.recordTouching = false;
this.nextEgg(); this.nextEgg();
...@@ -797,10 +804,10 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -797,10 +804,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 根据是否需要再次尝试决定显示卡片或进入下一题 // 根据是否需要再次尝试决定显示卡片或进入下一题
if (this.tryAgain) { if (this.tryAgain) {
// 需要再次尝试,显示卡片和录音界面 // 需要再次尝试,显示卡片和录音界面
this.updateLayoutSpeak() this.showCard()
} else { } else {
// 不需要再次尝试,隐藏卡片和录音界面 // 不需要再次尝试,隐藏卡片和录音界面
this.updateLayoutSpeak(true) this.showCard(true)
this.recordTouching = false; this.recordTouching = false;
} }
} }
......
...@@ -88,6 +88,9 @@ class Role { ...@@ -88,6 +88,9 @@ class Role {
addVoice(obj: any) { addVoice(obj: any) {
this.voices.push(obj); this.voices.push(obj);
} }
getLastVoice(){
return this.voices[this.voices.length - 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