From 4cfa097cc83c185f7142886f79d93e82b69e81f8 Mon Sep 17 00:00:00 2001 From: kron Date: Thu, 5 Feb 2026 18:06:55 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E8=AF=95=E5=A4=9Av=E5=A4=9A=E6=88=BF?= =?UTF-8?q?=E9=97=B4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/HeaderProgress.vue | 78 +------------------------------ src/components/PlayerSeats.vue | 2 +- src/components/TestDistance.vue | 13 ++++-- src/constants.js | 8 ++-- src/pages/battle-room.vue | 31 ++++++------ src/pages/practise-one.vue | 6 ++- src/pages/team-battle.vue | 15 ------ 7 files changed, 32 insertions(+), 121 deletions(-) diff --git a/src/components/HeaderProgress.vue b/src/components/HeaderProgress.vue index 305d2f7..77cf3ac 100644 --- a/src/components/HeaderProgress.vue +++ b/src/components/HeaderProgress.vue @@ -48,83 +48,7 @@ const updateSound = () => { async function onReceiveMessage(message) { if (ended.value) return; - if (Array.isArray(message)) { - message.forEach((msg) => { - // 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) { - // let key = []; - // key.push(msg.target.ring ? `${msg.target.ring}环` : "未上靶"); - // if (!msg.target.ring) - // key.push(`向${getDirectionText(msg.target.angle)}调整`); - // audioManager.play(key); - // } - // } else - // if (msg.constructor === MESSAGETYPES.InvalidShot) { - // if (msg.userId === user.value.id) { - // uni.showToast({ - // title: "距离不足,无效", - // icon: "none", - // }); - // audioManager.play("射击无效"); - // } - // } - // else if (msg.constructor === MESSAGETYPES.AllReady) { - // const { config } = msg.groupUserStatus; - // if (config && config.mode === 1) { - // totalShot.value = config.teamSize === 2 ? 3 : 2; - // } - // currentRoundEnded.value = true; - // audioManager.play("比赛开始"); - // } else if (msg.constructor === MESSAGETYPES.MeleeAllReady) { - // melee.value = true; - // halfTime.value = false; - // audioManager.play("比赛开始"); - // } else if (msg.constructor === MESSAGETYPES.CurrentRoundEnded) { - // currentShot.value = 0; - // if (msg.preRoundResult && msg.preRoundResult.currentRound) { - // currentRound.value = msg.preRoundResult.currentRound; - // currentRoundEnded.value = true; - // } - // } else if (msg.constructor === MESSAGETYPES.HalfTimeOver) { - // halfTime.value = true; - // audioManager.play("中场休息"); - // } else if (msg.constructor === MESSAGETYPES.MatchOver) { - // audioManager.play("比赛结束"); - // } else if (msg.constructor === MESSAGETYPES.FinalShoot) { - // totalShot.value = 0; - // audioManager.play("决金箭轮"); - // tips.value = "即将开始..."; - // currentRoundEnded.value = false; - // } else if (msg.constructor === MESSAGETYPES.MatchOver) { - // ended.value = true; - // } else if (msg.constructor === MESSAGETYPES.BackToGame) { - // if (msg.battleInfo) { - // melee.value = msg.battleInfo.config.mode === 2; - // } - // } - }); - return; - } + if (Array.isArray(message)) return; if (message.type === MESSAGETYPESV2.BattleStart) { melee.value = Boolean(message.mode); totalShot.value = message.mode === 1 ? 3 : 2; diff --git a/src/components/PlayerSeats.vue b/src/components/PlayerSeats.vue index 0cb4020..717c7c8 100644 --- a/src/components/PlayerSeats.vue +++ b/src/components/PlayerSeats.vue @@ -79,7 +79,7 @@ const seats = new Array(props.total).fill(1); } .avatar > text { background-color: #2c261fb3; - border-color: #a3793f66; + border: 1rpx solid #a3793f66; color: #fed847; font-size: 16rpx; border-radius: 20rpx; diff --git a/src/components/TestDistance.vue b/src/components/TestDistance.vue index 9de5fd3..8d7fce3 100644 --- a/src/components/TestDistance.vue +++ b/src/components/TestDistance.vue @@ -36,10 +36,12 @@ const updateTimer = (value) => { }; onMounted(() => { audioManager.play("请射箭测试距离"); - timer.value = setInterval(() => { - if (count.value > 0) count.value -= 1; - else clearInterval(timer.value); - }, 1000); + if (props.isBattle) { + timer.value = setInterval(() => { + count.value -= 1; + if (count.value < 0) clearInterval(timer.value); + }, 1000); + } uni.$on("update-timer", updateTimer); }); onBeforeUnmount(() => { @@ -117,11 +119,12 @@ onBeforeUnmount(() => { - + 具体正式比赛还有 {{ count }} + 进入中... diff --git a/src/constants.js b/src/constants.js index a5cda6b..ff65e93 100644 --- a/src/constants.js +++ b/src/constants.js @@ -114,7 +114,7 @@ export const getBattleResultTips = ( ) => { const getRandomIndex = (len) => Math.floor(Math.random() * len); if (gameMode === 1) { - if (mode === 1) { + if (mode <= 3) { if (win) { const tests = [ "https://static.shelingxingqiu.com/attachment/2025-08-01/dbqq1fglywucyoh9zn.png", @@ -136,7 +136,7 @@ export const getBattleResultTips = ( ]; return tests[getRandomIndex(3)]; } - } else if (mode === 2) { + } else { if (rank <= 3) { const tests = [ "好成绩!全国排位赛等着你!", @@ -148,7 +148,7 @@ export const getBattleResultTips = ( } } } else if (gameMode === 2) { - if (mode === 1) { + if (mode <= 3) { if (win) { const tests = [ "https://static.shelingxingqiu.com/attachment/2025-08-01/dbqq1fgtb29jbdus4g.png", @@ -170,7 +170,7 @@ export const getBattleResultTips = ( ]; return tests[getRandomIndex(3)]; } - } else if (mode === 2) { + } else { if (score > 0) { const tests = [ "王者一定属于你!", diff --git a/src/pages/battle-room.vue b/src/pages/battle-room.vue index 92ad8fd..817421f 100644 --- a/src/pages/battle-room.vue +++ b/src/pages/battle-room.vue @@ -114,8 +114,8 @@ const refreshMembers = (members = []) => { players.value[index] = { ...m.userInfo, groupType: m.groupType }; if (m.groupType === 1) { blueTeam.value.push({ ...m.userInfo, groupType: 1 }); - } else if (m.groupType === 0) { - redTeam.value.push({ ...m.userInfo, groupType: 0 }); + } else if (m.groupType === 2) { + redTeam.value.push({ ...m.userInfo, groupType: 2 }); } }); for (let i = 0; i < room.value.count / 2; i++) { @@ -165,12 +165,6 @@ async function onReceiveMessage(message) { } const chooseTeam = async (team) => { - if (team !== 2) { - const notInTeam = room.value.members.some( - (m) => m.userInfo.id === user.value.id && m.groupType === 2 - ); - if (!notInTeam) return; - } const result = await chooseTeamAPI(roomNumber.value, team); refreshMembers(result.members); }; @@ -302,45 +296,45 @@ onBeforeUnmount(() => { {{ item.name || "我要加入" }} - 已准备 + 已准备 - - 已准备 + 已准备 - {{ item.name || "我要加入" }} @@ -479,7 +473,7 @@ onBeforeUnmount(() => { } .player .ready { background-color: #2c261fb3 !important; - border-color: #a3793f66 !important; + border: 1rpx solid #a3793f66 !important; color: #fed847 !important; } .team-mode > view > image:nth-child(2) { @@ -657,6 +651,7 @@ onBeforeUnmount(() => { display: flex; justify-content: center; align-items: center; + margin-bottom: 14rpx; } .choose-side-left-item > button:last-child > image, .choose-side-right-item > button:first-child > image { @@ -677,7 +672,7 @@ onBeforeUnmount(() => { margin-top: -16rpx; position: relative; background-color: #2c261fb3; - border-color: #a3793f66; + border: 1rpx solid #a3793f66; color: #fed847; } diff --git a/src/pages/practise-one.vue b/src/pages/practise-one.vue index d850099..7b181f2 100644 --- a/src/pages/practise-one.vue +++ b/src/pages/practise-one.vue @@ -109,7 +109,11 @@ onBeforeUnmount(() => {