diff --git a/src/audioManager.js b/src/audioManager.js index dfd13e2..ca72ac2 100644 --- a/src/audioManager.js +++ b/src/audioManager.js @@ -1,4 +1,6 @@ const audioFils = { + 激光已校准: + "https://static.shelingxingqiu.com/attachment/2025-10-29/ddupaur1vdkyhzaqdc.mp3", 胜利: "https://static.shelingxingqiu.com/attachment/2025-09-17/dcuo9yjp0kt5msvmvd.mp3", 失败: "https://static.shelingxingqiu.com/attachment/2025-09-17/dcuo9yht2sdwhuqygy.mp3", 请射箭测试距离: @@ -64,9 +66,9 @@ function debugLog(...args) { // 获取当前环境信息 const accountInfo = uni.getAccountInfoSync(); const envVersion = accountInfo.miniProgram.envVersion; - + // 只在体验版打印日志,正式版(release)和开发版(develop)不打印 - if (envVersion === 'trial') { + if (envVersion === "trial") { console.log(...args); } } @@ -77,13 +79,13 @@ class AudioManager { this.currentPlayingKey = null; this.retryCount = new Map(); this.maxRetries = 3; - + // 串行加载相关属性 this.audioKeys = []; this.currentLoadingIndex = 0; this.isLoading = false; this.loadingPromise = null; - + this.initAudios(); } @@ -98,11 +100,11 @@ class AudioManager { this.isLoading = true; this.audioKeys = Object.keys(audioFils); this.currentLoadingIndex = 0; - + this.loadingPromise = new Promise((resolve) => { this.loadNextAudio(resolve); }); - + return this.loadingPromise; } @@ -116,8 +118,12 @@ class AudioManager { } const key = this.audioKeys[this.currentLoadingIndex]; - debugLog(`开始加载音频 ${this.currentLoadingIndex + 1}/${this.audioKeys.length}: ${key}`); - + debugLog( + `开始加载音频 ${this.currentLoadingIndex + 1}/${ + this.audioKeys.length + }: ${key}` + ); + this.createAudio(key, () => { this.currentLoadingIndex++; setTimeout(() => { @@ -182,12 +188,14 @@ class AudioManager { if (currentRetries < this.maxRetries) { this.retryCount.set(key, currentRetries + 1); debugLog(`音频 ${key} 开始第 ${currentRetries + 1} 次重试...`); - + setTimeout(() => { this.retryLoadAudio(key); }, 1000); } else { - console.error(`音频 ${key} 重试 ${this.maxRetries} 次后仍然失败,停止重试`); + console.error( + `音频 ${key} 重试 ${this.maxRetries} 次后仍然失败,停止重试` + ); const failedAudio = this.audioMap.get(key); if (failedAudio) { failedAudio.destroy(); diff --git a/src/components/BowPower.vue b/src/components/BowPower.vue index 19d59fa..79cf959 100644 --- a/src/components/BowPower.vue +++ b/src/components/BowPower.vue @@ -6,6 +6,8 @@ const power = ref(0); const timer = ref(null); onMounted(async () => { + const data = await getDeviceBatteryAPI(); + power.value = data.battery; timer.value = setInterval(async () => { const data = await getDeviceBatteryAPI(); power.value = data.battery; diff --git a/src/constants.js b/src/constants.js index 6177499..fbdb42c 100644 --- a/src/constants.js +++ b/src/constants.js @@ -24,6 +24,7 @@ export const MESSAGETYPES = { LvlUpdate: 3958625354, TeamUpdate: 4168086616, InvalidShot: 4168086617, + Calibration: 4168086625, }; export const topThreeColors = ["#FFD947", "#D2D2D2", "#FFA515"]; diff --git a/src/pages/calibration.vue b/src/pages/calibration.vue index 5b286b8..9bc7b49 100644 --- a/src/pages/calibration.vue +++ b/src/pages/calibration.vue @@ -1,9 +1,11 @@