mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Better inactive/active audio slider logic
This commit is contained in:
parent
eb3cc2fd22
commit
a17bb0ad73
@ -96,6 +96,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Cultist Kit gives cape, rings and necklace in addition to armour and weapons.
|
- Cultist Kit gives cape, rings and necklace in addition to armour and weapons.
|
||||||
- Reworked minotaur to have unique attacks.
|
- Reworked minotaur to have unique attacks.
|
||||||
- Wiring is now turing complete
|
- Wiring is now turing complete
|
||||||
|
- Better active/inactive master sound slider logic
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@
|
|||||||
"hud.settings.reset_graphics": "Zresetuj ustawienia",
|
"hud.settings.reset_graphics": "Zresetuj ustawienia",
|
||||||
|
|
||||||
"hud.settings.master_volume": "Głośność ogólna",
|
"hud.settings.master_volume": "Głośność ogólna",
|
||||||
"hud.settings.inactive_master_volume": "Głośność ogólna (nieaktywne okno)",
|
"hud.settings.inactive_master_volume_perc": "Głośność ogólna (nieaktywne okno)",
|
||||||
"hud.settings.music_volume": "Głośność muzyki",
|
"hud.settings.music_volume": "Głośność muzyki",
|
||||||
"hud.settings.sound_effect_volume": "Głośność efektów dźwiękowych",
|
"hud.settings.sound_effect_volume": "Głośność efektów dźwiękowych",
|
||||||
"hud.settings.audio_device": "Urządzenie dźwiękowe",
|
"hud.settings.audio_device": "Urządzenie dźwiękowe",
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
"gameinput.togglewield": "Waffe ziehen/wegstecken",
|
"gameinput.togglewield": "Waffe ziehen/wegstecken",
|
||||||
"gameinput.interact": "Interagieren",
|
"gameinput.interact": "Interagieren",
|
||||||
"gameinput.freelook": "Freie Sicht",
|
"gameinput.freelook": "Freie Sicht",
|
||||||
"gameinput.autowalk": "Automatisch Laufen/Gleiten",
|
"gameinput.autowalk": "Automatisch Laufen/Schwimmen",
|
||||||
"gameinput.cameraclamp": "Kamera fixieren",
|
"gameinput.cameraclamp": "Kamera fixieren",
|
||||||
"gameinput.dance": "Tanzen",
|
"gameinput.dance": "Tanzen",
|
||||||
"gameinput.select": "Einheit auswählen",
|
"gameinput.select": "Einheit auswählen",
|
||||||
|
@ -41,10 +41,9 @@ Sobald du dich bereit dafür fühlst, kannst du Versuchen, dich den zahlreichen
|
|||||||
"hud.spell": "Zaubersprüche",
|
"hud.spell": "Zaubersprüche",
|
||||||
// Diary
|
// Diary
|
||||||
"hud.diary": "Tagebuch",
|
"hud.diary": "Tagebuch",
|
||||||
|
|
||||||
"hud.free_look_indicator": "Freie Sicht aktiv. Drücke {key} zum deaktivieren.",
|
"hud.free_look_indicator": "Freie Sicht aktiv. Drücke {key} zum deaktivieren.",
|
||||||
"hud.camera_clamp_indicator": "Vertikale Kamerafixierung aktib. Drücke {key} zum deaktivieren.",
|
"hud.camera_clamp_indicator": "Vertikale Kamerafixierung aktiv. Drücke {key} zum deaktivieren.",
|
||||||
"hud.auto_walk_indicator": "Auto gehen/gleiten aktiv",
|
"hud.auto_walk_indicator": "Auto Laufen/Schwimmen aktiv",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
"gameinput.togglewield": "Toggle Wield",
|
"gameinput.togglewield": "Toggle Wield",
|
||||||
"gameinput.interact": "Interact",
|
"gameinput.interact": "Interact",
|
||||||
"gameinput.freelook": "Free Look",
|
"gameinput.freelook": "Free Look",
|
||||||
"gameinput.autowalk": "Auto Walk/Glide",
|
"gameinput.autowalk": "Auto Walk/Swim",
|
||||||
"gameinput.cameraclamp": "Camera Clamp",
|
"gameinput.cameraclamp": "Camera Clamp",
|
||||||
"gameinput.dance": "Dance",
|
"gameinput.dance": "Dance",
|
||||||
"gameinput.select": "Select Entity",
|
"gameinput.select": "Select Entity",
|
||||||
|
@ -96,7 +96,7 @@
|
|||||||
|
|
||||||
|
|
||||||
"hud.settings.master_volume": "Master Volume",
|
"hud.settings.master_volume": "Master Volume",
|
||||||
"hud.settings.inactive_master_volume": "Master Volume (inactive window)",
|
"hud.settings.inactive_master_volume_perc": "Inactive Window Volume",
|
||||||
"hud.settings.music_volume": "Music Volume",
|
"hud.settings.music_volume": "Music Volume",
|
||||||
"hud.settings.sound_effect_volume": "Sound Effects Volume",
|
"hud.settings.sound_effect_volume": "Sound Effects Volume",
|
||||||
"hud.settings.audio_device": "Audio Device",
|
"hud.settings.audio_device": "Audio Device",
|
||||||
|
@ -44,7 +44,7 @@ Whenever you feel ready, try to get even better equipment from the many challeng
|
|||||||
|
|
||||||
"hud.free_look_indicator": "Free look active. Press {key} to disable.",
|
"hud.free_look_indicator": "Free look active. Press {key} to disable.",
|
||||||
"hud.camera_clamp_indicator": "Camera vertical clamp active. Press {key} to disable.",
|
"hud.camera_clamp_indicator": "Camera vertical clamp active. Press {key} to disable.",
|
||||||
"hud.auto_walk_indicator": "Auto walk/glide active",
|
"hud.auto_walk_indicator": "Auto walk/swim active",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@
|
|||||||
|
|
||||||
|
|
||||||
"hud.settings.master_volume": "Volume Principal",
|
"hud.settings.master_volume": "Volume Principal",
|
||||||
"hud.settings.inactive_master_volume": "Volume Principal (janela inativa)",
|
"hud.settings.inactive_master_volume_perc": "Volume Principal (janela inativa)",
|
||||||
"hud.settings.music_volume": "Volume da Música",
|
"hud.settings.music_volume": "Volume da Música",
|
||||||
"hud.settings.sound_effect_volume": "Volume dos Efeitos",
|
"hud.settings.sound_effect_volume": "Volume dos Efeitos",
|
||||||
"hud.settings.audio_device": "Dispositivo de Áudio",
|
"hud.settings.audio_device": "Dispositivo de Áudio",
|
||||||
|
@ -93,7 +93,7 @@
|
|||||||
"hud.settings.save_window_size": "Зберегти розмір вікна",
|
"hud.settings.save_window_size": "Зберегти розмір вікна",
|
||||||
|
|
||||||
"hud.settings.master_volume": "Гучність",
|
"hud.settings.master_volume": "Гучність",
|
||||||
"hud.settings.inactive_master_volume": "Гучність (якщо вікно неактивне)",
|
"hud.settings.inactive_master_volume_perc": "Гучність (якщо вікно неактивне)",
|
||||||
"hud.settings.music_volume": "Гучність Музики",
|
"hud.settings.music_volume": "Гучність Музики",
|
||||||
"hud.settings.sound_effect_volume": "Гучність Звукових Eфектів",
|
"hud.settings.sound_effect_volume": "Гучність Звукових Eфектів",
|
||||||
"hud.settings.audio_device": "Звуковий пристрій",
|
"hud.settings.audio_device": "Звуковий пристрій",
|
||||||
|
@ -26,8 +26,10 @@ widget_ids! {
|
|||||||
sfx_volume_text,
|
sfx_volume_text,
|
||||||
master_volume_slider,
|
master_volume_slider,
|
||||||
master_volume_text,
|
master_volume_text,
|
||||||
|
master_volume_number,
|
||||||
inactive_master_volume_slider,
|
inactive_master_volume_slider,
|
||||||
inactive_master_volume_text,
|
inactive_master_volume_text,
|
||||||
|
inactive_master_volume_number,
|
||||||
audio_device_list,
|
audio_device_list,
|
||||||
audio_device_text,
|
audio_device_text,
|
||||||
}
|
}
|
||||||
@ -98,6 +100,11 @@ impl<'a> Widget for Sound<'a> {
|
|||||||
.set(state.ids.window_scrollbar, ui);
|
.set(state.ids.window_scrollbar, ui);
|
||||||
|
|
||||||
// Master Volume ----------------------------------------------------
|
// Master Volume ----------------------------------------------------
|
||||||
|
let master_volume = self.global_state.settings.audio.master_volume;
|
||||||
|
let master_val = format!("{:2.0}", master_volume * 100.0);
|
||||||
|
let inactive_master_volume_perc =
|
||||||
|
self.global_state.settings.audio.inactive_master_volume_perc;
|
||||||
|
let inactive_val = format!("{:2.0}%", inactive_master_volume_perc * 100.0);
|
||||||
Text::new(&self.localized_strings.get("hud.settings.master_volume"))
|
Text::new(&self.localized_strings.get("hud.settings.master_volume"))
|
||||||
.top_left_with_margins_on(state.ids.window, 10.0, 10.0)
|
.top_left_with_margins_on(state.ids.window, 10.0, 10.0)
|
||||||
.font_size(self.fonts.cyri.scale(14))
|
.font_size(self.fonts.cyri.scale(14))
|
||||||
@ -121,12 +128,17 @@ impl<'a> Widget for Sound<'a> {
|
|||||||
{
|
{
|
||||||
events.push(AdjustMasterVolume(new_val));
|
events.push(AdjustMasterVolume(new_val));
|
||||||
}
|
}
|
||||||
|
Text::new(&master_val)
|
||||||
|
.right_from(state.ids.master_volume_slider, 8.0)
|
||||||
|
.font_size(self.fonts.cyri.scale(14))
|
||||||
|
.font_id(self.fonts.cyri.conrod_id)
|
||||||
|
.color(TEXT_COLOR)
|
||||||
|
.set(state.ids.master_volume_number, ui);
|
||||||
// Master Volume (inactive window) ----------------------------------
|
// Master Volume (inactive window) ----------------------------------
|
||||||
Text::new(
|
Text::new(
|
||||||
&self
|
&self
|
||||||
.localized_strings
|
.localized_strings
|
||||||
.get("hud.settings.inactive_master_volume"),
|
.get("hud.settings.inactive_master_volume_perc"),
|
||||||
)
|
)
|
||||||
.down_from(state.ids.master_volume_slider, 10.0)
|
.down_from(state.ids.master_volume_slider, 10.0)
|
||||||
.font_size(self.fonts.cyri.scale(14))
|
.font_size(self.fonts.cyri.scale(14))
|
||||||
@ -135,7 +147,7 @@ impl<'a> Widget for Sound<'a> {
|
|||||||
.set(state.ids.inactive_master_volume_text, ui);
|
.set(state.ids.inactive_master_volume_text, ui);
|
||||||
|
|
||||||
if let Some(new_val) = ImageSlider::continuous(
|
if let Some(new_val) = ImageSlider::continuous(
|
||||||
self.global_state.settings.audio.inactive_master_volume,
|
self.global_state.settings.audio.inactive_master_volume_perc,
|
||||||
0.0,
|
0.0,
|
||||||
1.0,
|
1.0,
|
||||||
self.imgs.slider_indicator,
|
self.imgs.slider_indicator,
|
||||||
@ -150,7 +162,12 @@ impl<'a> Widget for Sound<'a> {
|
|||||||
{
|
{
|
||||||
events.push(AdjustInactiveMasterVolume(new_val));
|
events.push(AdjustInactiveMasterVolume(new_val));
|
||||||
}
|
}
|
||||||
|
Text::new(&inactive_val)
|
||||||
|
.right_from(state.ids.inactive_master_volume_slider, 8.0)
|
||||||
|
.font_size(self.fonts.cyri.scale(14))
|
||||||
|
.font_id(self.fonts.cyri.conrod_id)
|
||||||
|
.color(TEXT_COLOR)
|
||||||
|
.set(state.ids.inactive_master_volume_number, ui);
|
||||||
// Music Volume -----------------------------------------------------
|
// Music Volume -----------------------------------------------------
|
||||||
Text::new(&self.localized_strings.get("hud.settings.music_volume"))
|
Text::new(&self.localized_strings.get("hud.settings.music_volume"))
|
||||||
.down_from(state.ids.inactive_master_volume_slider, 10.0)
|
.down_from(state.ids.inactive_master_volume_slider, 10.0)
|
||||||
|
@ -66,7 +66,8 @@ pub fn run(mut global_state: GlobalState, event_loop: EventLoop) {
|
|||||||
global_state.audio.set_master_volume(if focused {
|
global_state.audio.set_master_volume(if focused {
|
||||||
global_state.settings.audio.master_volume
|
global_state.settings.audio.master_volume
|
||||||
} else {
|
} else {
|
||||||
global_state.settings.audio.inactive_master_volume
|
global_state.settings.audio.inactive_master_volume_perc
|
||||||
|
* global_state.settings.audio.master_volume
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,8 +163,8 @@ impl SettingsChange {
|
|||||||
|
|
||||||
settings.audio.master_volume = master_volume;
|
settings.audio.master_volume = master_volume;
|
||||||
},
|
},
|
||||||
Audio::AdjustInactiveMasterVolume(inactive_master_volume) => {
|
Audio::AdjustInactiveMasterVolume(inactive_master_volume_perc) => {
|
||||||
settings.audio.inactive_master_volume = inactive_master_volume;
|
settings.audio.inactive_master_volume_perc = inactive_master_volume_perc;
|
||||||
},
|
},
|
||||||
Audio::AdjustMusicVolume(music_volume) => {
|
Audio::AdjustMusicVolume(music_volume) => {
|
||||||
global_state.audio.set_music_volume(music_volume);
|
global_state.audio.set_music_volume(music_volume);
|
||||||
|
@ -21,7 +21,8 @@ impl AudioOutput {
|
|||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct AudioSettings {
|
pub struct AudioSettings {
|
||||||
pub master_volume: f32,
|
pub master_volume: f32,
|
||||||
pub inactive_master_volume: f32,
|
#[serde(rename = "inactive_master_volume")]
|
||||||
|
pub inactive_master_volume_perc: f32,
|
||||||
pub music_volume: f32,
|
pub music_volume: f32,
|
||||||
pub sfx_volume: f32,
|
pub sfx_volume: f32,
|
||||||
pub max_sfx_channels: usize,
|
pub max_sfx_channels: usize,
|
||||||
@ -34,7 +35,7 @@ impl Default for AudioSettings {
|
|||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
master_volume: 1.0,
|
master_volume: 1.0,
|
||||||
inactive_master_volume: 0.5,
|
inactive_master_volume_perc: 0.5,
|
||||||
music_volume: 0.4,
|
music_volume: 0.4,
|
||||||
sfx_volume: 0.6,
|
sfx_volume: 0.6,
|
||||||
max_sfx_channels: 30,
|
max_sfx_channels: 30,
|
||||||
|
Loading…
Reference in New Issue
Block a user