From 79c82025ee34d3f50d7b143c136b7934c12e2028 Mon Sep 17 00:00:00 2001 From: ShakeFlower Date: Thu, 22 May 2025 20:19:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=AE=9E=E9=AA=8C=E6=80=A7=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=EF=BC=9A=E9=9F=B3=E6=95=88=E6=B6=88=E6=8A=96=EF=BC=8C?= =?UTF-8?q?=E6=95=88=E6=9E=9C=E5=BE=85=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/control.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libs/control.js b/libs/control.js index 3d12be43..40c5e047 100644 --- a/libs/control.js +++ b/libs/control.js @@ -3096,10 +3096,17 @@ control.prototype.triggerBgm = function () { core.setLocalStorage('bgmStatus', core.musicStatus.bgmStatus); } +let playingSoundList = []; + ////// 播放音频 ////// -control.prototype.playSound = function (sound, pitch, callback) { +control.prototype.playSound = function (sound, pitch, inputCallback) { sound = core.getMappedName(sound); - if (main.mode != 'play' || !core.musicStatus.soundStatus || !core.material.sounds[sound]) return; + if (main.mode != 'play' || !core.musicStatus.soundStatus || !core.material.sounds[sound] || playingSoundList.includes(sound)) return; + playingSoundList.push(sound); + const callback = () => { + playingSoundList = playingSoundList.filter((soundName) => soundName !== sound); + inputCallback(); + } try { if (core.musicStatus.audioContext != null) { var source = core.musicStatus.audioContext.createBufferSource();