细节调整
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script setup>
|
||||
import { ref, watch, onMounted } from "vue";
|
||||
import { ref, watch, onMounted, onBeforeUnmount } from "vue";
|
||||
import StartCountdown from "@/components/StartCountdown.vue";
|
||||
import { simulShootAPI } from "@/apis";
|
||||
import useStore from "@/store";
|
||||
@@ -103,6 +103,13 @@ onMounted(() => {
|
||||
const envVersion = accountInfo.miniProgram.envVersion;
|
||||
if (envVersion !== "release") showsimul.value = true;
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
if (timer.value) {
|
||||
clearTimeout(timer.value);
|
||||
timer.value = null;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -194,20 +194,20 @@ async function onReceiveMessage(messages = []) {
|
||||
}
|
||||
if (msg.constructor === MESSAGETYPES.ShootResult) {
|
||||
if (currentShooterId.value !== msg.userId) return;
|
||||
const isRed = redTeam.value.find((item) => item.id === msg.userId);
|
||||
if (isRed) scores.value.push({ ...msg.target });
|
||||
else blueScores.value.push({ ...msg.target });
|
||||
// 下标从0开始的,要减1
|
||||
if (!roundResults.value[currentRound.value - 1]) {
|
||||
roundResults.value.push({
|
||||
redArrows: [],
|
||||
blueArrows: [],
|
||||
gold: goldenRound.value > 0,
|
||||
});
|
||||
}
|
||||
roundResults.value[currentRound.value - 1][
|
||||
isRed ? "redArrows" : "blueArrows"
|
||||
].push({ ...msg.target });
|
||||
// const isRed = redTeam.value.find((item) => item.id === msg.userId);
|
||||
// if (isRed) scores.value.push({ ...msg.target });
|
||||
// else blueScores.value.push({ ...msg.target });
|
||||
// // 下标从0开始的,要减1
|
||||
// if (!roundResults.value[currentRound.value - 1]) {
|
||||
// roundResults.value.push({
|
||||
// redArrows: [],
|
||||
// blueArrows: [],
|
||||
// gold: goldenRound.value > 0,
|
||||
// });
|
||||
// }
|
||||
// roundResults.value[currentRound.value - 1][
|
||||
// isRed ? "redArrows" : "blueArrows"
|
||||
// ].push({ ...msg.target });
|
||||
if (msg.battleInfo) recoverData(msg.battleInfo);
|
||||
}
|
||||
if (msg.constructor === MESSAGETYPES.CurrentRoundEnded) {
|
||||
|
||||
Reference in New Issue
Block a user