fix:替换射击无效语音,开战房间播放靶纸尺寸语音
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
export const audioFils = {
|
||||
"20CM全环靶": "https://static.shelingxingqiu.com/shootmini/static/audio/20CM%E5%85%A8%E7%8E%AF%E9%9D%B6-%E6%97%A0%E6%95%88.mp3",
|
||||
"40CM全环靶": "https://static.shelingxingqiu.com/shootmini/static/audio/40CM%E5%85%A8%E7%8E%AF%E9%9D%B6-%E6%97%A0%E6%95%88.mp3",
|
||||
// 激光已校准:
|
||||
// "https://static.shelingxingqiu.com/attachment/2025-10-29/ddupaur1vdkyhzaqdc.mp3",
|
||||
胜利: "https://static.shelingxingqiu.com/attachment/2025-09-17/dcuo9yjp0kt5msvmvd.mp3",
|
||||
@@ -36,7 +38,7 @@ export const audioFils = {
|
||||
请开始射击:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-09-17/dcutzdrl5u0iromqhf.mp3",
|
||||
射击无效:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-09-17/dcutya55ufiiw8oo55.mp3",
|
||||
"https://static.shelingxingqiu.com/shootmini/static/audio/%E5%B0%84%E7%AE%AD%E6%97%A0%E6%95%88%E6%A3%80%E6%9F%A5%E8%B7%9D%E7%A6%BB%E5%92%8C%E9%9D%B6%E7%BA%B8.mp3",
|
||||
未上靶:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-11-12/de6n45o3tsm1v4unam.mp3",
|
||||
"1环":
|
||||
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
import { MESSAGETYPES, MESSAGETYPESV2 } from "@/constants";
|
||||
import useStore from "@/store";
|
||||
import { storeToRefs } from "pinia";
|
||||
import audioManager from "@/audioManager";
|
||||
const store = useStore();
|
||||
const { user } = storeToRefs(store);
|
||||
|
||||
@@ -55,6 +56,8 @@ const ready = ref(false);
|
||||
const allReady = ref(false);
|
||||
const timer = ref(null);
|
||||
const goBattle = ref(false);
|
||||
/** 从结算页返回时为 true,跳过进场靶纸语音 */
|
||||
const skipTargetAudio = ref(false);
|
||||
|
||||
/**
|
||||
* 从服务端刷新当前房间数据,更新成员列表、准备状态等信息
|
||||
@@ -301,6 +304,8 @@ onShow(() => {
|
||||
* - 同步到 Pinia Store(供 Header 组件展示房号胶囊)
|
||||
*/
|
||||
onLoad(async (options) => {
|
||||
// 从结算页跳回时携带 fromResult=1,标记跳过进场语音
|
||||
if (options.fromResult) skipTargetAudio.value = true;
|
||||
if (options.roomNumber) {
|
||||
roomNumber.value = options.roomNumber;
|
||||
store.updateRoomNumber(options.roomNumber);
|
||||
@@ -325,6 +330,13 @@ onMounted(() => {
|
||||
keepScreenOn: true,
|
||||
});
|
||||
uni.$on("socket-inbox", onReceiveMessage);
|
||||
// 页面加载完成 1 秒后根据靶纸尺寸播报对应语音;从结算页返回时跳过
|
||||
setTimeout(() => {
|
||||
if (!skipTargetAudio.value) {
|
||||
const key = targetSize.value === 40 ? '40CM全环靶' : '20CM全环靶';
|
||||
audioManager.play(key);
|
||||
}
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
|
||||
@@ -275,7 +275,7 @@ async function exit() {
|
||||
return;
|
||||
}
|
||||
uni.redirectTo({
|
||||
url: `/pages/battle-room?roomNumber=${data.value.roomId}`,
|
||||
url: `/pages/battle-room?roomNumber=${data.value.roomId}&fromResult=1`,
|
||||
});
|
||||
} else {
|
||||
uni.redirectTo({
|
||||
|
||||
Reference in New Issue
Block a user