细节优化

This commit is contained in:
kron
2025-11-06 16:08:02 +08:00
parent cf95e8c046
commit 5cefd8b36d
3 changed files with 25 additions and 5 deletions

View File

@@ -57,6 +57,24 @@ async function onReceiveMessage(messages = []) {
if (msg.constructor === MESSAGETYPES.ShootResult) {
if (melee.value && msg.userId !== user.value.id) return;
if (msg.userId === user.value.id) currentShot.value++;
if (msg.battleInfo && msg.userId === user.value.id) {
const players = [
...(msg.battleInfo.blueTeam || []),
...(msg.battleInfo.redTeam || []),
];
const currentPlayer = players.find((p) => p.id === msg.userId);
currentShot.value = 0;
try {
if (
currentPlayer &&
currentPlayer.shotHistory &&
currentPlayer.shotHistory[msg.battleInfo.currentRound]
) {
currentShot.value =
currentPlayer.shotHistory[msg.battleInfo.currentRound].length;
}
} catch (_) {}
}
if (!halfTime.value && msg.target) {
currentSound.value = msg.target.ring
? `${msg.target.ring}`