v26110447 踢腿音效改成偶尔随机响(2 成概率 + 至少隔 40 秒)
This commit is contained in:
@@ -154,8 +154,13 @@
|
||||
} catch (e) {}
|
||||
};
|
||||
['touchstart', 'touchend', 'pointerdown', 'click'].forEach(t => addEventListener(t, unlock, { passive: true, capture: true }));
|
||||
/* 11-05 用户:「不是每一次都出现,随机、偶尔出现一次就行」→ 每次踢只有 2 成概率响,且离上一声至少 40 秒(大约一两分钟才响一次) */
|
||||
let lastSnd = 0;
|
||||
function kickSound(delay) {
|
||||
if (!ac || ac.state !== 'running') return;
|
||||
const nowMs = Date.now();
|
||||
if (!DEBUG && (nowMs - lastSnd < 40000 || Math.random() > .2)) return;
|
||||
lastSnd = nowMs;
|
||||
try { if (localStorage.getItem('mb_kick_snd') === '0') return; } catch (e) {} // 「我的 → 隐私与权限 → 宝宝踢腿音效」关了就不响
|
||||
const t = ac.currentTime + delay / 1000, out = ac.createGain();
|
||||
out.gain.value = 0.9; out.connect(ac.destination);
|
||||
|
||||
Reference in New Issue
Block a user