Commit 3f9d8885 authored by Tt's avatar Tt

1

parent 4b67fd36
......@@ -241,7 +241,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 获取当前页码
const currentPage = Game.getIns().getCurrentPageNum();
// 根据当前页码计算初始位置和目标位置
const initialX = -1500 + 1920 * currentPage;
const targetX = -400 + 1920 * currentPage;
......@@ -364,7 +364,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 获取当前页码
const currentPage = Game.getIns().getCurrentPageNum();
// 根据火苗编号调整消防车位置
// fire_0~fire_2 消防车位置 x=-400,fire_3~fire_5 消防车位置 x=-185
// 并根据当前页码进行偏移
......@@ -417,15 +417,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 切换到持续喷水动画
pg.view.addDBAnimationCallback(this.node_firetruck_flush, null)
pg.view.playDBAnimation(this.node_firetruck_flush, '持续喷水', 1);
this.scheduleOnce(() => {
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.onFireSuccess();
this.touching = false;
}, 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();
})
pg.view.playDBAnimation(this.node_firetruck_flush, '喷水', 1);
}
......@@ -458,7 +456,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
// 检查当前页面是否所有火苗都已处理完毕
if (this.activeFireNodes.length === 5) {
if (this.activeFireNodes.length === 0) {
// 延迟一段时间后检查是否需要切换到下一页
this.scheduleOnce(() => {
// 检查是否需要进入下一页
......@@ -479,12 +477,49 @@ export default class SceneComponent extends MyCocosSceneComponent {
fireNode.active = true;
}
}
nextPage() {
nextPage() {
// 切换到下一页
Game.getIns().addPage();
this.showPage();
}
showCard() {
// 显示卡片
const currentData = this.currentFireNode.data;
console.log('showCard', currentData)
}
/**
* 更新录音界面的显示状态
* @param hide 是否隐藏录音界面
*/
private updateLayoutSpeak(hide?: boolean) {
if (!hide) {
// 显示录音界面
this.layout_speak.active = true;
// 获取UI元素
let ske = pg.view.find(this.layout_speak, 'speak_ske');
let btn_start = pg.view.find(this.layout_speak, 'btn_start');
let btn_stop = pg.view.find(this.layout_speak, 'btn_stop');
// 绑定按钮事件
pg.view.touchOn(btn_start, this.onTouchRecord, this);
pg.view.touchOn(btn_stop, this.onTouchRecordEnd, this);
// 设置动画初始状态(几乎静止)
pg.view.playDBAnimation(ske, 'newAnimation', 0);
ske.getComponent(dragonBones.ArmatureDisplay).timeScale = 0.00001;
// 显示开始按钮,隐藏停止按钮
btn_start.active = true;
btn_stop.active = false;
} else {
// 隐藏录音界面
this.layout_speak.active = false;
}
}
/**
* 游戏帧更新函数
......@@ -770,37 +805,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
/**
* 更新录音界面的显示状态
* @param hide 是否隐藏录音界面
*/
private updateLayoutSpeak(hide?: boolean) {
if (!hide) {
// 显示录音界面
this.layout_speak.active = true;
// 获取UI元素
let ske = pg.view.find(this.layout_speak, 'speak_ske');
let btn_start = pg.view.find(this.layout_speak, 'btn_start');
let btn_stop = pg.view.find(this.layout_speak, 'btn_stop');
// 绑定按钮事件
pg.view.touchOn(btn_start, this.onTouchRecord, this);
pg.view.touchOn(btn_stop, this.onTouchRecordEnd, this);
// 设置动画初始状态(几乎静止)
pg.view.playDBAnimation(ske, 'newAnimation', 0);
ske.getComponent(dragonBones.ArmatureDisplay).timeScale = 0.00001;
// 显示开始按钮,隐藏停止按钮
btn_start.active = true;
btn_stop.active = false;
} else {
// 隐藏录音界面
this.layout_speak.active = false;
}
}
/**
* 更新提示状态
* 根据不同状态显示不同的提示图标和播放相应音效
......
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