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