update:语音优化

This commit is contained in:
2026-08-19 14:04:12 +08:00
parent 75cfcd66ee
commit bb224c9f29
13 changed files with 153 additions and 86 deletions
+11 -9
View File
@@ -22,7 +22,12 @@ import {
} from "@/apis";
import { connectMatchWebSocket, closeMatchWebSocket } from "@/matchWebsocket";
import { sharePractiseData } from "@/canvas";
import { wxShare, debounce } from "@/util";
import {
wxShare,
debounce,
getDistanceCheckAudioKey,
getShootValidation,
} from "@/util";
import { MESSAGETYPESV2 } from "@/constants";
import useStore from "@/store";
import { storeToRefs } from "pinia";
@@ -154,14 +159,11 @@ async function onReceiveMessage(msg) {
} else if (msg.type === MESSAGETYPESV2.BattleEnd) {
setTimeout(() => onOver(msg), 1500);
} else if (msg.type === MESSAGETYPESV2.TestDistance && step.value === 3) {
const rawDistance = Number(msg.shootData?.distance);
if (rawDistance === 0) {
audioManager.play("未发现靶纸,请瞄准靶纸射箭");
} else if (rawDistance / 100 >= 5) {
audioManager.play("距离合格");
btnDisabled.value = false;
showGuide.value = true;
} else audioManager.play("距离不足");
const result = getShootValidation(msg.shootData);
const isQualified = result.distanceOk && result.targetOk;
audioManager.play(getDistanceCheckAudioKey(msg.shootData));
btnDisabled.value = !isQualified;
showGuide.value = isQualified;
}
// messages.forEach((msg) => {
// if (msg.constructor === MESSAGETYPES.ShootSyncMeArrowID) {