游戏结束射箭不再播放声音

This commit is contained in:
kron
2025-07-15 18:24:18 +08:00
parent 32baa7279d
commit d775c703cb

View File

@@ -45,6 +45,7 @@ const currentSound = ref("");
const currentRound = ref(props.currentRound);
const currentRoundEnded = ref(!props.battleId);
const halfTimeTip = ref(false);
const ended = ref(false);
watch(
() => props.tips,
@@ -128,7 +129,7 @@ const updateSound = () => {
};
async function onReceiveMessage(messages = []) {
if (!sound.value) return;
if (!sound.value || ended.value) return;
messages.forEach((msg) => {
if (
(props.battleId && msg.constructor === MESSAGETYPES.ShootResult) ||
@@ -154,6 +155,10 @@ async function onReceiveMessage(messages = []) {
audioManager.play("比赛结束");
} else if (msg.constructor === MESSAGETYPES.FinalShoot) {
audioManager.play("决金箭轮");
} else if (msg.constructor === MESSAGETYPES.ShootSyncMePracticeID) {
ended.value = true;
} else if (msg.constructor === MESSAGETYPES.MatchOver) {
ended.value = true;
}
});
}