BUG修复
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user