From ad01eb2dbb3519388c64ffe0cda8dddc457f0ce7 Mon Sep 17 00:00:00 2001 From: streakingman Date: Mon, 26 Sep 2022 23:40:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=98=B2=E6=AD=A2=E9=9F=B3=E9=A2=91?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E9=94=99=E8=AF=AF=E6=97=B6=E9=98=BB=E5=A1=9E?= =?UTF-8?q?=E4=B8=BB=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.tsx | 21 +++++++++++++++------ src/components/ConfigDialog.tsx | 2 +- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 547dd4c..7abf58f 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -215,9 +215,9 @@ const App: FC = () => { if (!bgmRef.current) return; if (bgmOn) { bgmRef.current.volume = 0.5; - bgmRef.current.play(); + bgmRef.current.play().then(); } else { - bgmRef.current?.pause(); + bgmRef.current.pause(); } }, [bgmOn]); @@ -416,9 +416,13 @@ const App: FC = () => { symbol.status = 1; // 点击音效 - if (soundRefMap.current) { + // 不知道为啥敲可选链会提示错误。。。 + if ( + soundRefMap.current && + soundRefMap.current[symbol.icon.clickSound] + ) { soundRefMap.current[symbol.icon.clickSound].currentTime = 0; - soundRefMap.current[symbol.icon.clickSound].play(); + soundRefMap.current[symbol.icon.clickSound].play().then(); } let updateQueue = queue.slice(); @@ -440,11 +444,16 @@ const App: FC = () => { if (find) { find.status = 2; // 三连音效 - if (soundRefMap.current) { + if ( + soundRefMap.current && + soundRefMap.current[symbol.icon.tripleSound] + ) { soundRefMap.current[ symbol.icon.tripleSound ].currentTime = 0; - soundRefMap.current[symbol.icon.tripleSound].play(); + soundRefMap.current[symbol.icon.tripleSound] + .play() + .then(); } } } diff --git a/src/components/ConfigDialog.tsx b/src/components/ConfigDialog.tsx index 893b40e..806f78d 100644 --- a/src/components/ConfigDialog.tsx +++ b/src/components/ConfigDialog.tsx @@ -399,7 +399,7 @@ export const ConfigDialog: FC<{ /> {customThemeInfo?.background?.startsWith('https') && ( <> - 毛玻璃效果: + 毛玻璃: