更新音频
This commit is contained in:
@@ -1,54 +1,62 @@
|
||||
const audioFils = {
|
||||
胜利: "https://static.shelingxingqiu.com/attachment/2025-09-15/dcsz3389qp0vph9zjl.mp3",
|
||||
失败: "https://static.shelingxingqiu.com/attachment/2025-09-15/dcsz33746j2laokpdx.mp3",
|
||||
请射箭测试距离:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-09-15/dcszloz51yo7agju3z.mp3",
|
||||
距离合格:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-09-15/dcszloz55jzwupxdfd.mp3",
|
||||
距离不足:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-09-15/dcszloz2l6rikmbjlj.mp3",
|
||||
轮到你了:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-09-15/dcszv5hsbhdvjroggf.mp3",
|
||||
第一轮:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-07-14/dbblu6fl26qrspvy79.mp3",
|
||||
"https://static.shelingxingqiu.com/attachment/2025-09-15/dct08cwf81d9ibgwvj.mp3",
|
||||
第二轮:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-07-14/dbblu6fehshrpe5ook.mp3",
|
||||
"https://static.shelingxingqiu.com/attachment/2025-09-15/dct08cvasp6fca4utl.mp3",
|
||||
第三轮:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-07-14/dbblu6fgbz3iimk7yy.mp3",
|
||||
"https://static.shelingxingqiu.com/attachment/2025-09-15/dct08cvws0a45n43yd.mp3",
|
||||
第四轮:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-07-14/dbblu6fjwf50tlxxbi.mp3",
|
||||
"https://static.shelingxingqiu.com/attachment/2025-09-15/dct08cwfjy508hllbe.mp3",
|
||||
第五轮:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-07-14/dbblu6fg63lqrslhm7.mp3",
|
||||
"https://static.shelingxingqiu.com/attachment/2025-09-15/dct08cvpctfwjzkqgf.mp3",
|
||||
决金箭轮:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-07-14/dbblu6fhjycwubbwil.mp3",
|
||||
"https://static.shelingxingqiu.com/attachment/2025-09-15/dct08cvuumxo4jybpr.mp3",
|
||||
请蓝方射箭:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-07-14/dbblu6fr0zpluiabph.mp3",
|
||||
"https://static.shelingxingqiu.com/attachment/2025-09-15/dct08cwg1k059xeiya.mp3",
|
||||
请红方射箭:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-07-14/dbblu6fu169yerpwey.mp3",
|
||||
"https://static.shelingxingqiu.com/attachment/2025-09-15/dct08cwfhm13t1paxt.mp3",
|
||||
中场休息:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-07-14/dbblu6fug8faqrbtwd.mp3",
|
||||
"https://static.shelingxingqiu.com/attachment/2025-09-15/dct0c3qxmht5ypubwm.mp3",
|
||||
比赛结束:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-07-14/dbblsdl717ilr0b3o0.mp3",
|
||||
"https://static.shelingxingqiu.com/attachment/2025-09-15/dct1uodgi5i98q41ht.mp3",
|
||||
比赛开始:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-07-14/dbblsdl7qlkqgvthfr.mp3",
|
||||
"https://static.shelingxingqiu.com/attachment/2025-09-15/dct1uoddlg85tmo9bc.mp3",
|
||||
请开始射击:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-07-14/dbbljrfx5guqt5oulk.mp3",
|
||||
未上靶:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-07-14/dbbkxm60bul0khcoqq.mp3",
|
||||
"1环":
|
||||
"https://static.shelingxingqiu.com/attachment/2025-07-14/dbbklufj59qmdo96ha.mp3",
|
||||
"2环":
|
||||
"https://static.shelingxingqiu.com/attachment/2025-07-14/dbbklufogy49ousbv4.mp3",
|
||||
"3环":
|
||||
"https://static.shelingxingqiu.com/attachment/2025-07-14/dbbklufl3hhijeasck.mp3",
|
||||
"4环":
|
||||
"https://static.shelingxingqiu.com/attachment/2025-07-14/dbbklufo8vo7k6jxdz.mp3",
|
||||
"5环":
|
||||
"https://static.shelingxingqiu.com/attachment/2025-07-14/dbbklkzq7lrbfpr6ij.mp3",
|
||||
"6环":
|
||||
"https://static.shelingxingqiu.com/attachment/2025-07-14/dbbkll0fw7hbmmhxkl.mp3",
|
||||
"7环":
|
||||
"https://static.shelingxingqiu.com/attachment/2025-07-14/dbbkll0fkirkanghmf.mp3",
|
||||
"8环":
|
||||
"https://static.shelingxingqiu.com/attachment/2025-07-14/dbbkll0cly2noykieg.mp3",
|
||||
"9环":
|
||||
"https://static.shelingxingqiu.com/attachment/2025-07-14/dbbkll0gsuumekhpkn.mp3",
|
||||
"10环":
|
||||
"https://static.shelingxingqiu.com/attachment/2025-07-14/dbbklgw2dk22ek7qha.mp3",
|
||||
"https://static.shelingxingqiu.com/attachment/2025-09-15/dct1uod2ol85bptsth.mp3",
|
||||
射击无效:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-08-26/dcc9qc84rir8gkj3mo.mp3",
|
||||
距离不足5米:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-08-27/dcd59px1cavp1hogxi.mp3",
|
||||
"https://static.shelingxingqiu.com/attachment/2025-09-15/dct1uocy6y4ipqzmum.mp3",
|
||||
未上靶:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-09-15/dct08cw7mqlmloxf0l.mp3",
|
||||
"1环":
|
||||
"https://static.shelingxingqiu.com/attachment/2025-09-15/dct08cw3qvjznfzaof.mp3",
|
||||
"2环":
|
||||
"https://static.shelingxingqiu.com/attachment/2025-09-15/dct08cwb0of0vb3cje.mp3",
|
||||
"3环":
|
||||
"https://static.shelingxingqiu.com/attachment/2025-09-15/dct08cwd9o2zv1qmbi.mp3",
|
||||
"4环":
|
||||
"https://static.shelingxingqiu.com/attachment/2025-09-15/dct08cwc499rhc5k9r.mp3",
|
||||
"5环":
|
||||
"https://static.shelingxingqiu.com/attachment/2025-09-15/dct08cw2ruyvchecw2.mp3",
|
||||
"6环":
|
||||
"https://static.shelingxingqiu.com/attachment/2025-09-15/dct08cw50qqkfvhmpe.mp3",
|
||||
"7环":
|
||||
"https://static.shelingxingqiu.com/attachment/2025-09-15/dct08cwbgkprfhognw.mp3",
|
||||
"8环":
|
||||
"https://static.shelingxingqiu.com/attachment/2025-09-15/dct08cweula94nxwna.mp3",
|
||||
"9环":
|
||||
"https://static.shelingxingqiu.com/attachment/2025-09-15/dct08cwdc7bibtk3ze.mp3",
|
||||
"10环":
|
||||
"https://static.shelingxingqiu.com/attachment/2025-09-15/dct08cwdq83u3fadj9.mp3",
|
||||
};
|
||||
|
||||
class AudioManager {
|
||||
@@ -123,7 +131,9 @@ class AudioManager {
|
||||
this.retryLoadAudio(key);
|
||||
}, this.retryDelay);
|
||||
} else {
|
||||
console.error(`音频 ${key} 重试 ${this.maxRetries} 次后仍然失败,停止重试`);
|
||||
console.error(
|
||||
`音频 ${key} 重试 ${this.maxRetries} 次后仍然失败,停止重试`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,7 +208,7 @@ class AudioManager {
|
||||
|
||||
// 重新加载所有音频
|
||||
reloadAllAudios() {
|
||||
console.log('重新加载所有音频...');
|
||||
console.log("重新加载所有音频...");
|
||||
this.audioMap.forEach((audio, key) => {
|
||||
audio.destroy();
|
||||
});
|
||||
|
||||
@@ -12,12 +12,13 @@ const melee = ref(false);
|
||||
const timer = ref(null);
|
||||
const sound = ref(true);
|
||||
const currentSound = ref("");
|
||||
const currentRound = ref(1);
|
||||
const currentRound = ref(0);
|
||||
const currentRoundEnded = ref(false);
|
||||
const ended = ref(false);
|
||||
const halfTime = ref(false);
|
||||
const currentShot = ref(0);
|
||||
const totalShot = ref(0);
|
||||
const yourTurn = ref(false);
|
||||
|
||||
watch(
|
||||
() => tips.value,
|
||||
@@ -25,21 +26,27 @@ watch(
|
||||
let key = "";
|
||||
if (newVal.includes("红队")) key = "请红方射箭";
|
||||
if (newVal.includes("蓝队")) key = "请蓝方射箭";
|
||||
if (key && sound.value) {
|
||||
if (!sound.value) return;
|
||||
if (currentRoundEnded.value) {
|
||||
currentRound.value += 1;
|
||||
console.log(11111, currentRound.value);
|
||||
// 播放当前轮次语音
|
||||
audioManager.play(
|
||||
`第${["一", "二", "三", "四", "五"][currentRound.value - 1]}轮`
|
||||
);
|
||||
}
|
||||
// 延迟播放队伍提示音
|
||||
setTimeout(
|
||||
() => {
|
||||
if (key) {
|
||||
if (!yourTurn.value) audioManager.play(key);
|
||||
else audioManager.play("轮到你了");
|
||||
}
|
||||
currentRoundEnded.value = false;
|
||||
if (currentRound.value === 1) audioManager.play("第一轮");
|
||||
if (currentRound.value === 2) audioManager.play("第二轮");
|
||||
if (currentRound.value === 3) audioManager.play("第三轮");
|
||||
if (currentRound.value === 4) audioManager.play("第四轮");
|
||||
if (currentRound.value === 5) audioManager.play("第五轮");
|
||||
setTimeout(() => {
|
||||
audioManager.play(key);
|
||||
}, 1000);
|
||||
} else {
|
||||
audioManager.play(key);
|
||||
}
|
||||
}
|
||||
yourTurn.value = false;
|
||||
},
|
||||
currentRoundEnded.value ? 1000 : 0
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -60,6 +67,8 @@ async function onReceiveMessage(messages = []) {
|
||||
: "未上靶";
|
||||
audioManager.play(currentSound.value);
|
||||
}
|
||||
} else if (msg.constructor === MESSAGETYPES.ToSomeoneShoot) {
|
||||
yourTurn.value = user.value.id === msg.userId;
|
||||
} else if (msg.constructor === MESSAGETYPES.InvalidShot) {
|
||||
if (msg.userId === user.value.id) {
|
||||
uni.showToast({
|
||||
@@ -82,7 +91,7 @@ async function onReceiveMessage(messages = []) {
|
||||
} else if (msg.constructor === MESSAGETYPES.CurrentRoundEnded) {
|
||||
currentShot.value = 0;
|
||||
if (msg.preRoundResult && msg.preRoundResult.currentRound) {
|
||||
currentRound.value = msg.preRoundResult.currentRound + 1;
|
||||
currentRound.value = msg.preRoundResult.currentRound;
|
||||
currentRoundEnded.value = true;
|
||||
}
|
||||
} else if (msg.constructor === MESSAGETYPES.HalfTimeOver) {
|
||||
|
||||
@@ -33,6 +33,7 @@ const updateTimer = (value) => {
|
||||
count.value = Math.round(value);
|
||||
};
|
||||
onMounted(() => {
|
||||
audioManager.play("请射箭测试距离");
|
||||
timer.value = setInterval(() => {
|
||||
if (count.value > 0) count.value -= 1;
|
||||
else clearInterval(timer.value);
|
||||
@@ -51,10 +52,10 @@ async function onReceiveMessage(messages = []) {
|
||||
power.value = msg.target.battery;
|
||||
distance.value = Number((msg.target.dst / 100).toFixed(2));
|
||||
debugInfo.value = msg.target;
|
||||
audioManager.play(msg.target.ring ? `${msg.target.ring}环` : "未上靶");
|
||||
audioManager.play("距离合格");
|
||||
} else if (msg.constructor === MESSAGETYPES.InvalidShot) {
|
||||
distance.value = Number((msg.target.dst / 100).toFixed(2));
|
||||
audioManager.play("距离不足5米");
|
||||
audioManager.play("距离不足");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import Avatar from "@/components/Avatar.vue";
|
||||
import UserUpgrade from "@/components/UserUpgrade.vue";
|
||||
import { getGameAPI } from "@/apis";
|
||||
import { topThreeColors, getBattleResultTips } from "@/constants";
|
||||
import audioManager from "@/audioManager";
|
||||
import useStore from "@/store";
|
||||
import { storeToRefs } from "pinia";
|
||||
const store = useStore();
|
||||
@@ -79,6 +80,7 @@ onLoad(async (options) => {
|
||||
ifWin.value = battleInfo.mode === 1 && mine.team === battleInfo.winner;
|
||||
}
|
||||
}
|
||||
audioManager.play(ifWin.value ? "胜利" : "失败");
|
||||
});
|
||||
|
||||
const checkBowData = () => {
|
||||
|
||||
Reference in New Issue
Block a user