fix:比赛射箭数取后端动态值

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

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 保留的旧值