添加声音
This commit is contained in:
@@ -47,6 +47,8 @@ const audioFils = {
|
||||
"https://static.shelingxingqiu.com/attachment/2025-07-14/dbbklgw2dk22ek7qha.mp3",
|
||||
射击无效:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-08-26/dcc9qc84rir8gkj3mo.mp3",
|
||||
距离不足5米:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-08-27/dcd59px1cavp1hogxi.mp3",
|
||||
};
|
||||
|
||||
class AudioManager {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { ref, onMounted, onBeforeUnmount } from "vue";
|
||||
import Guide from "@/components/Guide.vue";
|
||||
import BowPower from "@/components/BowPower.vue";
|
||||
import Avatar from "@/components/Avatar.vue";
|
||||
import audioManager from "@/audioManager";
|
||||
import { simulShootAPI } from "@/apis";
|
||||
import { checkConnection } from "@/util";
|
||||
import { MESSAGETYPES } from "@/constants";
|
||||
@@ -50,6 +51,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}环` : "未上靶");
|
||||
} else if (msg.constructor === MESSAGETYPES.InvalidShot) {
|
||||
distance.value = Number((msg.target.dst / 100).toFixed(2));
|
||||
audioManager.play("距离不足5米");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user