mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Moved some code around to put it in logical order
This commit is contained in:
parent
6ad02b1fb0
commit
2d092635ed
@ -125,6 +125,20 @@ impl<'a> Widget for Sound<'a> {
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.color(TEXT_COLOR)
|
||||
.set(state.ids.master_volume_text, ui);
|
||||
// Master Volume Muted Indicator
|
||||
let master_muted = ToggleButton::new(
|
||||
self.global_state.settings.audio.master_volume.muted,
|
||||
self.imgs.button_mute,
|
||||
self.imgs.button_muted,
|
||||
)
|
||||
.w_h(24.0, 25.0)
|
||||
.down_from(state.ids.master_volume_text, 10.0)
|
||||
.hover_images(self.imgs.button_mute_hover, self.imgs.button_muted_hover)
|
||||
.press_images(self.imgs.button_mute_press, self.imgs.button_muted_press)
|
||||
.set(state.ids.master_volume_muted, ui);
|
||||
if master_muted != self.global_state.settings.audio.master_volume.muted {
|
||||
events.push(MuteMasterVolume(master_muted));
|
||||
}
|
||||
// Master Volume Slider
|
||||
if let Some(new_val) = ImageSlider::continuous(
|
||||
self.global_state.settings.audio.master_volume.volume,
|
||||
@ -152,20 +166,6 @@ impl<'a> Widget for Sound<'a> {
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.color(TEXT_COLOR)
|
||||
.set(state.ids.master_volume_number, ui);
|
||||
// Master Volume Muted Indicator
|
||||
let master_muted = ToggleButton::new(
|
||||
self.global_state.settings.audio.master_volume.muted,
|
||||
self.imgs.button_mute,
|
||||
self.imgs.button_muted,
|
||||
)
|
||||
.w_h(24.0, 25.0)
|
||||
.down_from(state.ids.master_volume_text, 10.0)
|
||||
.hover_images(self.imgs.button_mute_hover, self.imgs.button_muted_hover)
|
||||
.press_images(self.imgs.button_mute_press, self.imgs.button_muted_press)
|
||||
.set(state.ids.master_volume_muted, ui);
|
||||
if master_muted != self.global_state.settings.audio.master_volume.muted {
|
||||
events.push(MuteMasterVolume(master_muted));
|
||||
}
|
||||
|
||||
// Master Volume (inactive window)
|
||||
Text::new(
|
||||
@ -178,6 +178,31 @@ impl<'a> Widget for Sound<'a> {
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.color(TEXT_COLOR)
|
||||
.set(state.ids.inactive_master_volume_text, ui);
|
||||
// Master Volume (inactive window) Muted Indicator
|
||||
let inactive_master_muted = ToggleButton::new(
|
||||
self.global_state
|
||||
.settings
|
||||
.audio
|
||||
.inactive_master_volume_perc
|
||||
.muted,
|
||||
self.imgs.button_mute,
|
||||
self.imgs.button_muted,
|
||||
)
|
||||
.w_h(24.0, 25.0)
|
||||
.down_from(state.ids.inactive_master_volume_text, 10.0)
|
||||
.hover_images(self.imgs.button_mute_hover, self.imgs.button_muted_hover)
|
||||
.press_images(self.imgs.button_mute_press, self.imgs.button_muted_press)
|
||||
.set(state.ids.inactive_master_volume_muted, ui);
|
||||
if inactive_master_muted
|
||||
!= self
|
||||
.global_state
|
||||
.settings
|
||||
.audio
|
||||
.inactive_master_volume_perc
|
||||
.muted
|
||||
{
|
||||
events.push(MuteInactiveMasterVolume(inactive_master_muted));
|
||||
}
|
||||
// Master Volume (inactive window) Slider
|
||||
if let Some(new_val) = ImageSlider::continuous(
|
||||
self.global_state
|
||||
@ -214,31 +239,6 @@ impl<'a> Widget for Sound<'a> {
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.color(non_master_volume_text_color)
|
||||
.set(state.ids.inactive_master_volume_number, ui);
|
||||
// Master Volume (inactive window) Muted Indicator
|
||||
let inactive_master_muted = ToggleButton::new(
|
||||
self.global_state
|
||||
.settings
|
||||
.audio
|
||||
.inactive_master_volume_perc
|
||||
.muted,
|
||||
self.imgs.button_mute,
|
||||
self.imgs.button_muted,
|
||||
)
|
||||
.w_h(24.0, 25.0)
|
||||
.down_from(state.ids.inactive_master_volume_text, 10.0)
|
||||
.hover_images(self.imgs.button_mute_hover, self.imgs.button_muted_hover)
|
||||
.press_images(self.imgs.button_mute_press, self.imgs.button_muted_press)
|
||||
.set(state.ids.inactive_master_volume_muted, ui);
|
||||
if inactive_master_muted
|
||||
!= self
|
||||
.global_state
|
||||
.settings
|
||||
.audio
|
||||
.inactive_master_volume_perc
|
||||
.muted
|
||||
{
|
||||
events.push(MuteInactiveMasterVolume(inactive_master_muted));
|
||||
}
|
||||
|
||||
// Music Volume
|
||||
Text::new(&self.localized_strings.get_msg("hud-settings-music_volume"))
|
||||
@ -247,6 +247,20 @@ impl<'a> Widget for Sound<'a> {
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.color(TEXT_COLOR)
|
||||
.set(state.ids.music_volume_text, ui);
|
||||
// Music Muted Indicator
|
||||
let music_muted = ToggleButton::new(
|
||||
self.global_state.settings.audio.music_volume.muted,
|
||||
self.imgs.button_mute,
|
||||
self.imgs.button_muted,
|
||||
)
|
||||
.w_h(24.0, 25.0)
|
||||
.down_from(state.ids.music_volume_text, 10.0)
|
||||
.hover_images(self.imgs.button_mute_hover, self.imgs.button_muted_hover)
|
||||
.press_images(self.imgs.button_mute_press, self.imgs.button_muted_press)
|
||||
.set(state.ids.music_volume_muted, ui);
|
||||
if music_muted != self.global_state.settings.audio.music_volume.muted {
|
||||
events.push(MuteMusicVolume(music_muted));
|
||||
}
|
||||
// Music Volume Slider
|
||||
if let Some(new_val) = ImageSlider::continuous(
|
||||
self.global_state.settings.audio.music_volume.volume,
|
||||
@ -274,20 +288,6 @@ impl<'a> Widget for Sound<'a> {
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.color(non_master_volume_text_color)
|
||||
.set(state.ids.music_volume_number, ui);
|
||||
// Music Muted Indicator
|
||||
let music_muted = ToggleButton::new(
|
||||
self.global_state.settings.audio.music_volume.muted,
|
||||
self.imgs.button_mute,
|
||||
self.imgs.button_muted,
|
||||
)
|
||||
.w_h(24.0, 25.0)
|
||||
.down_from(state.ids.music_volume_text, 10.0)
|
||||
.hover_images(self.imgs.button_mute_hover, self.imgs.button_muted_hover)
|
||||
.press_images(self.imgs.button_mute_press, self.imgs.button_muted_press)
|
||||
.set(state.ids.music_volume_muted, ui);
|
||||
if music_muted != self.global_state.settings.audio.music_volume.muted {
|
||||
events.push(MuteMusicVolume(music_muted));
|
||||
}
|
||||
|
||||
// SFX Volume
|
||||
Text::new(
|
||||
@ -300,6 +300,20 @@ impl<'a> Widget for Sound<'a> {
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.color(TEXT_COLOR)
|
||||
.set(state.ids.sfx_volume_text, ui);
|
||||
// SFX Volume Muted Indicator
|
||||
let sfx_muted = ToggleButton::new(
|
||||
self.global_state.settings.audio.sfx_volume.muted,
|
||||
self.imgs.button_mute,
|
||||
self.imgs.button_muted,
|
||||
)
|
||||
.w_h(24.0, 25.0)
|
||||
.down_from(state.ids.sfx_volume_text, 10.0)
|
||||
.hover_images(self.imgs.button_mute_hover, self.imgs.button_muted_hover)
|
||||
.press_images(self.imgs.button_mute_press, self.imgs.button_muted_press)
|
||||
.set(state.ids.sfx_volume_muted, ui);
|
||||
if sfx_muted != self.global_state.settings.audio.sfx_volume.muted {
|
||||
events.push(MuteSfxVolume(sfx_muted));
|
||||
}
|
||||
// SFX Volume Slider
|
||||
if let Some(new_val) = ImageSlider::continuous(
|
||||
self.global_state.settings.audio.sfx_volume.volume,
|
||||
@ -327,20 +341,6 @@ impl<'a> Widget for Sound<'a> {
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.color(non_master_volume_text_color)
|
||||
.set(state.ids.sfx_volume_number, ui);
|
||||
// SFX Volume Muted Indicator
|
||||
let sfx_muted = ToggleButton::new(
|
||||
self.global_state.settings.audio.sfx_volume.muted,
|
||||
self.imgs.button_mute,
|
||||
self.imgs.button_muted,
|
||||
)
|
||||
.w_h(24.0, 25.0)
|
||||
.down_from(state.ids.sfx_volume_text, 10.0)
|
||||
.hover_images(self.imgs.button_mute_hover, self.imgs.button_muted_hover)
|
||||
.press_images(self.imgs.button_mute_press, self.imgs.button_muted_press)
|
||||
.set(state.ids.sfx_volume_muted, ui);
|
||||
if sfx_muted != self.global_state.settings.audio.sfx_volume.muted {
|
||||
events.push(MuteSfxVolume(sfx_muted));
|
||||
}
|
||||
|
||||
// Ambience Volume
|
||||
Text::new(
|
||||
@ -353,6 +353,20 @@ impl<'a> Widget for Sound<'a> {
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.color(TEXT_COLOR)
|
||||
.set(state.ids.ambience_volume_text, ui);
|
||||
// Ambience Volume Muted Indicator
|
||||
let ambience_muted = ToggleButton::new(
|
||||
self.global_state.settings.audio.ambience_volume.muted,
|
||||
self.imgs.button_mute,
|
||||
self.imgs.button_muted,
|
||||
)
|
||||
.w_h(24.0, 25.0)
|
||||
.down_from(state.ids.ambience_volume_text, 10.0)
|
||||
.hover_images(self.imgs.button_mute_hover, self.imgs.button_muted_hover)
|
||||
.press_images(self.imgs.button_mute_press, self.imgs.button_muted_press)
|
||||
.set(state.ids.ambience_volume_muted, ui);
|
||||
if ambience_muted != self.global_state.settings.audio.ambience_volume.muted {
|
||||
events.push(MuteAmbienceVolume(ambience_muted));
|
||||
}
|
||||
// Ambience Volume Slider
|
||||
if let Some(new_val) = ImageSlider::continuous(
|
||||
self.global_state.settings.audio.ambience_volume.volume,
|
||||
@ -380,20 +394,6 @@ impl<'a> Widget for Sound<'a> {
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.color(non_master_volume_text_color)
|
||||
.set(state.ids.ambience_volume_number, ui);
|
||||
// Ambience Volume Muted Indicator
|
||||
let ambience_muted = ToggleButton::new(
|
||||
self.global_state.settings.audio.ambience_volume.muted,
|
||||
self.imgs.button_mute,
|
||||
self.imgs.button_muted,
|
||||
)
|
||||
.w_h(24.0, 25.0)
|
||||
.down_from(state.ids.ambience_volume_text, 10.0)
|
||||
.hover_images(self.imgs.button_mute_hover, self.imgs.button_muted_hover)
|
||||
.press_images(self.imgs.button_mute_press, self.imgs.button_muted_press)
|
||||
.set(state.ids.ambience_volume_muted, ui);
|
||||
if ambience_muted != self.global_state.settings.audio.ambience_volume.muted {
|
||||
events.push(MuteAmbienceVolume(ambience_muted));
|
||||
}
|
||||
|
||||
// Music spacing
|
||||
Text::new(&self.localized_strings.get_msg("hud-settings-music_spacing"))
|
||||
|
Loading…
Reference in New Issue
Block a user