靶子组件优化

This commit is contained in:
kron
2025-07-16 09:33:33 +08:00
parent 9db88fb945
commit d5bc1a6a89
13 changed files with 38 additions and 108 deletions

View File

@@ -140,8 +140,6 @@ async function onReceiveMessage(messages = []) {
}
if (msg.constructor === MESSAGETYPES.ToSomeoneShoot) {
if (currentShooterId.value !== msg.userId) {
scores.value = [];
blueScores.value = [];
seq.value += 1;
currentShooterId.value = msg.userId;
if (redTeam.value[0].id === currentShooterId.value) {
@@ -158,8 +156,8 @@ async function onReceiveMessage(messages = []) {
}
if (msg.constructor === MESSAGETYPES.ShootResult) {
const isRed = redTeam.value.find((item) => item.id === msg.userId);
if (isRed) scores.value = [msg.target];
else blueScores.value = [msg.target];
if (isRed) scores.value.push(msg.target);
else blueScores.value.push(msg.target);
if (roundResults.value[currentRound.value - 1]) {
if (isRed && roundResults.value[currentRound.value - 1].redArrows) {
roundResults.value[currentRound.value - 1].redArrows.push(msg.target);
@@ -266,7 +264,6 @@ onUnmounted(() => {
<BowTarget
v-if="start"
mode="team"
:showE="start && user.id === currentShooterId"
:power="start ? power : 0"
:currentRound="currentRound"
:totalRound="totalRounds"