update: 语音优化
This commit is contained in:
@@ -10,7 +10,10 @@ import Avatar from "@/components/Avatar.vue";
|
||||
import BowPower from "@/components/BowPower.vue";
|
||||
import TestDistance from "./components/TestDistance.vue";
|
||||
import BubbleTip from "./components/BubbleTip.vue";
|
||||
import audioManager from "@/audioManager";
|
||||
import audioManager, {
|
||||
getPrecisionShotAudioKeys,
|
||||
getTrainingStartAudioKey,
|
||||
} from "@/audioManager";
|
||||
|
||||
import {
|
||||
createPractiseV2API,
|
||||
@@ -466,16 +469,11 @@ const buildShootResultAudioKeys = (message = {}) => {
|
||||
return [];
|
||||
}
|
||||
|
||||
const keys = [
|
||||
arrow.ring ? `${arrow.ringX ? "X" : arrow.ring}环` : "未上靶",
|
||||
];
|
||||
if (arrow.angle !== null && arrow.angle !== undefined) {
|
||||
keys.push(`向${getDirectionText(arrow.angle)}调整`);
|
||||
}
|
||||
if (arrow.threeConsecutive10Rings === true) {
|
||||
keys.push("tententen");
|
||||
}
|
||||
return keys;
|
||||
const directionText =
|
||||
arrow.angle !== null && arrow.angle !== undefined
|
||||
? getDirectionText(arrow.angle)
|
||||
: "";
|
||||
return getPrecisionShotAudioKeys(arrow, directionText);
|
||||
};
|
||||
|
||||
const playAudioKeysAndWait = (keys) => {
|
||||
@@ -790,6 +788,7 @@ const connectPracticeServer = ({
|
||||
requestPracticeInfoOnOpen: true,
|
||||
appHideResumable: appHideResumable.value,
|
||||
practiceEndAudioKey: "练习结束",
|
||||
trainingType: trainingType.value,
|
||||
});
|
||||
connectionClosed.value = false;
|
||||
return true;
|
||||
@@ -1022,6 +1021,13 @@ onLoad((options = {}) => {
|
||||
};
|
||||
practiseId.value = trainingContext.practiceId || "";
|
||||
serverAddr.value = trainingContext.serverAddr || "";
|
||||
|
||||
const startAudioKey = getTrainingStartAudioKey(trainingParams.value.type);
|
||||
const warmupKeys = [startAudioKey];
|
||||
if (trainingParams.value.type === "precision") {
|
||||
warmupKeys.push("Bingo命中目标", "未命中");
|
||||
}
|
||||
void audioManager.warmKeys(warmupKeys.filter(Boolean));
|
||||
});
|
||||
|
||||
const onReady = async () => {
|
||||
@@ -1051,7 +1057,10 @@ const onReady = async () => {
|
||||
start.value = true;
|
||||
pageStage.value = pageStages.SHOOTING;
|
||||
setPracticeAppHideResumable(true);
|
||||
audioManager.play("练习开始");
|
||||
// 开始接口成功即进入正式训练,直接播放对应提示,避免依赖 BattleStart 消息。
|
||||
audioManager.play(
|
||||
getTrainingStartAudioKey(trainingType.value, "练习开始")
|
||||
);
|
||||
} catch (error) {
|
||||
start.value = false;
|
||||
pageStage.value = pageStages.DISTANCE;
|
||||
|
||||
Reference in New Issue
Block a user