Merge branch 'new-race-mode' into test

This commit is contained in:
2026-05-13 14:58:45 +08:00
2 changed files with 7 additions and 8 deletions

View File

@@ -60,8 +60,8 @@ async function onReceiveMessage(message) {
audioManager.play("比赛结束", false);
} else if (type === MESSAGETYPESV2.ShootResult) {
if (melee.value && current.playerId !== user.value.id) return;
// 仅计用户自己的命中箭,并加上限防护,防止超过 totalShot如重入时 currentShot 初始值偏高)
if (current.playerId === user.value.id && currentShot.value < totalShot.value) currentShot.value++;
// 直接使用后端返回的 myIndex当前用户已射箭数不在前端自增
if (current.playerId === user.value.id) currentShot.value = current.myIndex ?? currentShot.value;
if (message.shootData) {
let key = [];
key.push(

View File

@@ -196,9 +196,9 @@ function onBattleEnd() {
function onNewRound(msg, prevRound) {
showRoundTip.value = true;
isFinalShoot.value = msg.current.goldRound;
// 决金箭轮每人只射一箭,重置箭数显示为 (0/1)
// 决金轮箭数不确定(平局后可能再加一箭),清零 totalShot 隐藏箭数显示
if (msg.current.goldRound) {
store.updateShotInfo(0, 1);
store.updateShotInfo(0, 0);
}
// 用传入的 prevRound捕获时刻的旧轮次展示结算 Tip与进度条 currentRound 解耦
roundTipRound.value = prevRound;
@@ -290,10 +290,9 @@ onShow(async () => {
} else {
if (result.status !== 0) {
// 比赛进行中,从后端恢复箭数(测距阶段不展示)
if (result.shootNumber) {
// current.index 为 0 基的已射箭数0=尚未射出),与 ShootResult 累加语义一致
// 注意:不再 +1避免重进时与后续 ShootResult 自增形成双重计数导致超出 totalShot
store.updateShotInfo(result.current?.index ?? 0, result.shootNumber);
// 决金轮不展示箭数;其余轮次使用后端 myIndex 恢复已射箭数
if (result.shootNumber && !result.current?.goldRound) {
store.updateShotInfo(result.current?.myIndex ?? 0, result.shootNumber);
}
} else {
// 测距阶段重置箭数,防止 ImmediateWatcher 读取 Pinia 保留的旧值