update:优化节奏训练
This commit is contained in:
+16
-5
@@ -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 }) {
|
||||
|
||||
Reference in New Issue
Block a user