feat: add SFX volume control and improve audio feedback
- Implemented separate sound effects volume control in settings. - Updated backend to handle new `sfx_volume` parameter. - Enhanced UI to include sound effects volume slider in admin panel. - Integrated sound effects for various user interactions (clicks, navigation, alerts). - Added a new global sound engine to manage audio synthesis without external files. - Updated documentation for Docker deployment and Windows packaging. - Refactored audio context management to ensure sound effects are available post user interaction.
This commit is contained in:
+14
-1
@@ -222,7 +222,20 @@
|
||||
volumeLabel.textContent = volumeRange.value + '%';
|
||||
if (volTimer) clearTimeout(volTimer);
|
||||
volTimer = setTimeout(function () {
|
||||
post('/api/settings', { volume: Number(volumeRange.value) }, function () { toast('音量已更新'); });
|
||||
post('/api/settings', { volume: Number(volumeRange.value) }, function () { toast('媒体音量已更新'); });
|
||||
}, 300);
|
||||
});
|
||||
}
|
||||
|
||||
var sfxVolumeRange = document.getElementById('sfxVolumeRange');
|
||||
var sfxVolumeLabel = document.getElementById('sfxVolumeLabel');
|
||||
var sfxVolTimer = null;
|
||||
if (sfxVolumeRange && sfxVolumeLabel) {
|
||||
sfxVolumeRange.addEventListener('input', function () {
|
||||
sfxVolumeLabel.textContent = sfxVolumeRange.value + '%';
|
||||
if (sfxVolTimer) clearTimeout(sfxVolTimer);
|
||||
sfxVolTimer = setTimeout(function () {
|
||||
post('/api/settings', { sfx_volume: Number(sfxVolumeRange.value) }, function () { toast('音效音量已更新'); });
|
||||
}, 300);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user