Merge branch 'new-race-mode' into test
This commit is contained in:
@@ -65,8 +65,12 @@ async function onReceiveMessage(message) {
|
|||||||
audioManager.play("比赛结束", false);
|
audioManager.play("比赛结束", false);
|
||||||
} else if (type === MESSAGETYPESV2.ShootResult) {
|
} else if (type === MESSAGETYPESV2.ShootResult) {
|
||||||
if (melee.value && current.playerId !== user.value.id) return;
|
if (melee.value && current.playerId !== user.value.id) return;
|
||||||
// 从 indexMap 按当前用户 id 取已射箭数,由后端维护准确值,不在前端自增
|
// 从 indexMap 按当前用户 id 取已射箭数,由后端维护准确值,不在前端自增。
|
||||||
if (current.playerId === user.value.id) currentShot.value = current.indexMap?.[user.value.id] ?? currentShot.value;
|
// 注意:后端在 ShootResult 中会将 playerId 重置为 0(无当前射手),
|
||||||
|
// 因此不能依赖 playerId === user.id 判断,改为直接读取 indexMap[user.id]。
|
||||||
|
// indexMap[user.id] 只在本人射箭后才增加,队友射箭时该值不变,逻辑等价且更准确。
|
||||||
|
const myShot = current.indexMap?.[user.value.id];
|
||||||
|
if (myShot !== undefined) currentShot.value = myShot;
|
||||||
if (message.shootData) {
|
if (message.shootData) {
|
||||||
let key = [];
|
let key = [];
|
||||||
key.push(
|
key.push(
|
||||||
|
|||||||
@@ -211,6 +211,9 @@ function onBattleEnd() {
|
|||||||
function onNewRound(msg, prevRound) {
|
function onNewRound(msg, prevRound) {
|
||||||
showRoundTip.value = true;
|
showRoundTip.value = true;
|
||||||
isFinalShoot.value = msg.current.goldRound;
|
isFinalShoot.value = msg.current.goldRound;
|
||||||
|
// 新轮次开始时立即清空靶纸箭迹,避免残留上一轮落点至新轮次第一箭到来
|
||||||
|
scores.value = [];
|
||||||
|
blueScores.value = [];
|
||||||
// 决金轮箭数不确定(平局后可能再加一箭),清零 totalShot 隐藏箭数显示
|
// 决金轮箭数不确定(平局后可能再加一箭),清零 totalShot 隐藏箭数显示
|
||||||
if (msg.current.goldRound) {
|
if (msg.current.goldRound) {
|
||||||
store.updateShotInfo(0, 0);
|
store.updateShotInfo(0, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user