bug修复

This commit is contained in:
kron
2025-06-26 01:27:23 +08:00
parent 0ea2d65e67
commit 159207a99d
6 changed files with 86 additions and 31 deletions

View File

@@ -28,6 +28,7 @@ const currentBluePoint = ref(0);
const totalRounds = ref(0);
const power = ref(0);
const scores = ref([]);
const blueScores = ref([]);
const redTeam = ref([]);
const blueTeam = ref([]);
const currentShooterId = ref(0);
@@ -89,6 +90,7 @@ async function onReceiveMessage(messages = []) {
}
if (msg.constructor === MESSAGETYPES.ToSomeoneShoot) {
scores.value = [];
blueScores.value = [];
seq.value += 1;
currentShooterId.value = msg.userId;
if (redTeam.value[0].id === currentShooterId.value) {
@@ -98,11 +100,16 @@ async function onReceiveMessage(messages = []) {
}
}
if (msg.constructor === MESSAGETYPES.ShootResult) {
scores.value = [msg.target];
const isRed = redTeam.value.find((item) => item.id === msg.userId);
if (isRed) {
scores.value = [msg.target];
} else {
blueScores.value = [msg.target];
}
}
if (msg.constructor === MESSAGETYPES.RoundPoint) {
bluePoints.value += msg.blueScore;
redPoints.value += msg.redScore;
// bluePoints.value += msg.blueScore;
// redPoints.value += msg.redScore;
}
if (msg.constructor === MESSAGETYPES.CurrentRoundEnded) {
const result = msg.preRoundResult;
@@ -110,6 +117,8 @@ async function onReceiveMessage(messages = []) {
currentShooterId.value = 0;
currentBluePoint.value = result.blueScore;
currentRedPoint.value = result.redScore;
bluePoints.value += result.blueScore;
redPoints.value += result.redScore;
showRoundTip.value = true;
// 开始下一轮;
roundResults.value = result.roundResults;
@@ -159,11 +168,13 @@ onUnmounted(() => {
:redTeam="redTeam"
/>
<BowTarget
mode="team"
:showE="start && user.id === currentShooterId"
:power="start ? power : 0"
:currentRound="currentRound"
:totalRound="totalRounds"
:scores="scores"
:blueScores="blueScores"
:tips="
!start && scores.length > 0
? `本次射程${scores[scores.length - 1].dst / 100}米,${