BUG修复

This commit is contained in:
kron
2025-08-18 16:09:11 +08:00
parent b31689b19f
commit 1ce2ea9eb7
13 changed files with 302 additions and 166 deletions

View File

@@ -9,7 +9,6 @@ const { user } = storeToRefs(store);
const tips = ref("");
const melee = ref(false);
const battleId = ref("");
const timer = ref(null);
const sound = ref(true);
const currentSound = ref("");
@@ -51,16 +50,15 @@ const updateSound = () => {
async function onReceiveMessage(messages = []) {
if (!sound.value || ended.value) return;
messages.forEach((msg) => {
if (battleId.value && msg.constructor === MESSAGETYPES.ShootResult) {
if (msg.constructor === MESSAGETYPES.ShootResult) {
if (melee.value && msg.userId !== user.value.id) return;
if (!halfTime.value && msg.target) {
currentSound.value = msg.target.ring
? `${msg.target.ring}`
: "未上靶";
console.log(currentSound.value);
audioManager.play(currentSound.value);
}
} else if (msg.constructor === MESSAGETYPES.WaitForAllReady) {
battleId.value = msg.id;
} else if (msg.constructor === MESSAGETYPES.AllReady) {
currentRoundEnded.value = true;
audioManager.play("比赛开始");
@@ -84,6 +82,10 @@ async function onReceiveMessage(messages = []) {
ended.value = true;
} else if (msg.constructor === MESSAGETYPES.MatchOver) {
ended.value = true;
} else if (msg.constructor === MESSAGETYPES.BackToGame) {
if (msg.battleInfo) {
melee.value = msg.battleInfo.config.battleMode === 2;
}
}
});
}