update:优化节奏训练

This commit is contained in:
2026-08-24 16:35:56 +08:00
parent 59fa317c5a
commit 35e0ee3ca0
9 changed files with 679 additions and 41 deletions
+16 -5
View File
@@ -16,6 +16,7 @@ import {
} from "@/util";
import {
getPrecisionShotAudioKeys,
getRhythmShotAudioKeys,
getTrainingStartAudioKey,
} from "@/audioManager";
import {
@@ -405,10 +406,9 @@ function getAckAudioKeys(message, businessMessage) {
) {
return [];
}
if (
(businessMessage?.trainingType || currentContext?.trainingType) ===
"precision"
) {
const trainingType =
businessMessage?.trainingType || currentContext?.trainingType;
if (trainingType === "precision") {
const shootData = businessMessage?.shootData;
const directionText =
shootData?.angle !== null && shootData?.angle !== undefined
@@ -416,6 +416,9 @@ function getAckAudioKeys(message, businessMessage) {
: "";
return getPrecisionShotAudioKeys(shootData, directionText);
}
if (trainingType === "rhythm") {
return getRhythmShotAudioKeys(businessMessage?.shootData);
}
return getShootResultAudioKeys(businessMessage?.shootData);
case ServerMessageType.SERVER_MSG_MATCH_END:
return ["比赛结束"];
@@ -680,7 +683,9 @@ function sendHeartbeatAck() {
}
function sendPracticeInfoSync() {
if (!socket || !currentContext?.matchId || !currentContext?.userId) return;
if (!socket || !currentContext?.matchId || !currentContext?.userId) {
return false;
}
const clientMessage = {
type: ClientMessageType.CLIENT_MSG_SYNC_PRACTICE_INFO,
@@ -695,6 +700,12 @@ function sendPracticeInfoSync() {
"CLIENT_MSG_SYNC_PRACTICE_INFO",
clientMessage
);
return true;
}
// 训练开始后可在不重连 WebSocket 的情况下主动刷新完整练习快照。
export function requestPracticeInfoSync() {
return sendPracticeInfoSync();
}
function sendAck({ matchId, sequence }) {