添加声音连续播放

This commit is contained in:
kron
2025-11-12 11:39:17 +08:00
parent 59a2b173a6
commit 6b96087b68
3 changed files with 89 additions and 19 deletions

View File

@@ -22,26 +22,23 @@ const totalShot = ref(0);
watch(
() => tips.value,
(newVal) => {
let key = "";
if (newVal.includes("重回")) return;
if (newVal.includes("红队")) key = "请红方射箭";
if (newVal.includes("蓝队")) key = "请蓝方射箭";
if (!sound.value) return;
let key = [];
if (newVal.includes("重回")) return;
if (currentRoundEnded.value) {
currentRound.value += 1;
// 播放当前轮次语音
audioManager.play(
`${["一", "二", "三", "四", "五"][currentRound.value - 1]}`
);
key.push(`${["一", "二", "三", "四", "五"][currentRound.value - 1]}`);
}
// 延迟播放队伍提示音
setTimeout(
() => {
if (key) audioManager.play(newVal.includes("") ? "轮到你了" : key);
currentRoundEnded.value = false;
},
currentRoundEnded.value ? 1000 : 0
key.push(
newVal.includes("你")
? "轮到你了"
: newVal.includes("红队")
? "请红方射箭"
: "请蓝方射箭"
);
audioManager.play(key);
currentRoundEnded.value = false;
}
);