添加轮数的声音
This commit is contained in:
@@ -75,6 +75,8 @@ export const audioFils = {
|
||||
"https://static.shelingxingqiu.com/attachment/2025-11-12/de6ellen3zoalxcb06.mp3",
|
||||
向左上调整:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-11-12/de6ellf37a2iw6w4pu.mp3",
|
||||
最后30秒:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-11-13/de7kzzllq0futwynso.mp3",
|
||||
};
|
||||
|
||||
// 版本控制日志函数
|
||||
|
||||
@@ -168,14 +168,16 @@ async function onReceiveMessage(messages = []) {
|
||||
return;
|
||||
}
|
||||
if (wait.value !== msg.wait) {
|
||||
wait.value = msg.wait;
|
||||
if (msg.wait === 20) {
|
||||
halfTime.value = true;
|
||||
audioManager.play("中场休息");
|
||||
}
|
||||
if (msg.wait === 0) {
|
||||
halfTime.value = false;
|
||||
}
|
||||
setTimeout(() => {
|
||||
wait.value = msg.wait;
|
||||
if (msg.wait === 20) {
|
||||
halfTime.value = true;
|
||||
audioManager.play("中场休息");
|
||||
}
|
||||
if (msg.wait === 0) {
|
||||
halfTime.value = false;
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
} else if (msg.constructor === MESSAGETYPES.MatchOver) {
|
||||
audioManager.play("比赛结束");
|
||||
|
||||
@@ -27,6 +27,7 @@ const practiseId = ref("");
|
||||
const showGuide = ref(false);
|
||||
const tips = ref("");
|
||||
const wait = ref(0);
|
||||
const timer = ref(null);
|
||||
|
||||
const onReady = async () => {
|
||||
const result = await createPractiseAPI(total);
|
||||
@@ -34,9 +35,7 @@ const onReady = async () => {
|
||||
currentRound.value = 0;
|
||||
scores.value = [];
|
||||
start.value = true;
|
||||
setTimeout(() => {
|
||||
uni.$emit("play-sound", "请开始射击");
|
||||
}, 300);
|
||||
audioManager.play(["请开始射击", "第一轮"]);
|
||||
};
|
||||
|
||||
async function onReceiveMessage(messages = []) {
|
||||
@@ -55,6 +54,10 @@ async function onReceiveMessage(messages = []) {
|
||||
}, 3000);
|
||||
}
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (scores.value.length === 3) audioManager.play("第二轮");
|
||||
if (scores.value.length === 9) audioManager.play("第四轮");
|
||||
}, 500);
|
||||
} else if (msg.constructor === MESSAGETYPES.ShootSyncMePracticeID) {
|
||||
if (practiseId.value && practiseId.value === msg.practice.id) {
|
||||
setTimeout(() => {
|
||||
@@ -69,7 +72,19 @@ async function onReceiveMessage(messages = []) {
|
||||
} else if (msg.constructor === MESSAGETYPES.HalfTimeOver) {
|
||||
wait.value = msg.wait;
|
||||
if (msg.wait === 20) uni.$emit("update-ramain", 0);
|
||||
if (msg.wait === 0) uni.$emit("update-ramain", 60);
|
||||
if (msg.wait === 0) {
|
||||
let count = 60;
|
||||
uni.$emit("update-ramain", count);
|
||||
if (scores.value.length === 6) audioManager.play("第三轮");
|
||||
setInterval(() => {
|
||||
count -= 1;
|
||||
if (count === 30) {
|
||||
audioManager.play("最后30秒");
|
||||
clearInterval(timer.value);
|
||||
timer.value = null;
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -95,6 +110,7 @@ const onClickShare = debounce(async () => {
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
audioManager.play("第一轮");
|
||||
uni.setKeepScreenOn({
|
||||
keepScreenOn: true,
|
||||
});
|
||||
@@ -109,6 +125,10 @@ onBeforeUnmount(() => {
|
||||
uni.$off("socket-inbox", onReceiveMessage);
|
||||
uni.$off("share-image", onClickShare);
|
||||
audioManager.stopAll();
|
||||
if (timer.value) {
|
||||
clearTimeout(timer.value);
|
||||
timer.value = null;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user