From f02062c1addefe7ac3c1790381d2d01b922d7f41 Mon Sep 17 00:00:00 2001 From: kron Date: Mon, 14 Jul 2025 22:39:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A3=B0=E9=9F=B3=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ShootProgress.vue | 35 +++++++++++++++++++++----------- src/pages/battle-room.vue | 2 ++ src/pages/team-match.vue | 9 +++++++- 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/src/components/ShootProgress.vue b/src/components/ShootProgress.vue index b8a671c..e17fda9 100644 --- a/src/components/ShootProgress.vue +++ b/src/components/ShootProgress.vue @@ -19,6 +19,14 @@ const props = defineProps({ type: Number, default: 0, }, + currentRound: { + type: Number, + default: 90, + }, + battleId: { + type: String, + default: "", + }, }); const barColor = ref("#fed847"); @@ -26,21 +34,15 @@ const remain = ref(props.total); const timer = ref(null); const sound = ref(true); const currentSound = ref(""); -const currentRound = ref(0); -const currentRoundEnded = ref(true); +const currentRound = ref(props.currentRound); +const currentRoundEnded = ref(!props.battleId); watch( () => props.tips, (newVal) => { let key = ""; - if (newVal.includes("红队")) { - barColor.value = "#FF6060"; - key = "请红方射击"; - } - if (newVal.includes("蓝队")) { - barColor.value = "#5FADFF"; - key = "请蓝方射击"; - } + if (newVal.includes("红队")) key = "请红方射击"; + if (newVal.includes("蓝队")) key = "请蓝方射击"; if (key && sound.value) { if (currentRoundEnded.value) { currentRound.value += 1; @@ -57,6 +59,15 @@ watch( audioManager.play(key); } } + } +); + +watch( + () => props.tips, + (newVal) => { + let key = ""; + if (newVal.includes("红队")) barColor.value = "#FF6060"; + if (newVal.includes("蓝队")) barColor.value = "#5FADFF"; }, { immediate: true, @@ -111,8 +122,8 @@ async function onReceiveMessage(messages = []) { if (!sound.value) return; messages.forEach((msg) => { if ( - msg.constructor === MESSAGETYPES.ShootSyncMeArrowID || - msg.constructor === MESSAGETYPES.ShootResult + (props.battleId && msg.constructor === MESSAGETYPES.ShootResult) || + (!props.battleId && msg.constructor === MESSAGETYPES.ShootSyncMeArrowID) ) { if (msg.target) { currentSound.value = msg.target.ring diff --git a/src/pages/battle-room.vue b/src/pages/battle-room.vue index 51977b8..efacd4e 100644 --- a/src/pages/battle-room.vue +++ b/src/pages/battle-room.vue @@ -510,6 +510,8 @@ onUnmounted(() => { :seq="seq" :start="start && startCount" :total="total" + :currentRound="currentRound" + :battleId="battleId" /> { :blueTeam="blueTeam" /> - +