更新音频

This commit is contained in:
kron
2025-09-15 11:23:22 +08:00
parent 0a151de3c9
commit aa6bbf6fd6
4 changed files with 83 additions and 61 deletions

View File

@@ -33,6 +33,7 @@ const updateTimer = (value) => {
count.value = Math.round(value);
};
onMounted(() => {
audioManager.play("请射箭测试距离");
timer.value = setInterval(() => {
if (count.value > 0) count.value -= 1;
else clearInterval(timer.value);
@@ -51,10 +52,10 @@ async function onReceiveMessage(messages = []) {
power.value = msg.target.battery;
distance.value = Number((msg.target.dst / 100).toFixed(2));
debugInfo.value = msg.target;
audioManager.play(msg.target.ring ? `${msg.target.ring}` : "未上靶");
audioManager.play("距离合格");
} else if (msg.constructor === MESSAGETYPES.InvalidShot) {
distance.value = Number((msg.target.dst / 100).toFixed(2));
audioManager.play("距离不足5米");
audioManager.play("距离不足");
}
});
}