From 92127292d4f4742a314f64f3c1b649db0999c92d Mon Sep 17 00:00:00 2001 From: CapsizeGlimmer <> Date: Sat, 13 Jun 2020 23:13:01 -0400 Subject: [PATCH] Added option to disable speech bubble icons. Aligned settings>gameplay menu again. --- assets/voxygen/i18n/en.ron | 2 + voxygen/src/hud/mod.rs | 4 ++ voxygen/src/hud/overhead.rs | 3 +- voxygen/src/hud/settings_window.rs | 76 ++++++++++++++++++++++-------- voxygen/src/session.rs | 4 ++ voxygen/src/settings.rs | 2 + 6 files changed, 70 insertions(+), 21 deletions(-) diff --git a/assets/voxygen/i18n/en.ron b/assets/voxygen/i18n/en.ron index 6ad73201ec..e4afafe9cd 100644 --- a/assets/voxygen/i18n/en.ron +++ b/assets/voxygen/i18n/en.ron @@ -252,7 +252,9 @@ magically infused items?"#, "hud.settings.cumulated_damage": "Cumulated Damage", "hud.settings.incoming_damage": "Incoming Damage", "hud.settings.cumulated_incoming_damage": "Cumulated Incoming Damage", + "hud.settings.speech_bubble": "Speech Bubble", "hud.settings.speech_bubble_dark_mode": "Speech Bubble Dark Mode", + "hud.settings.speech_bubble_icon": "Speech Bubble Icon", "hud.settings.energybar_numbers": "Energybar Numbers", "hud.settings.values": "Values", "hud.settings.percentages": "Percentages", diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index 0b7af0b1f9..0169f0344e 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -265,6 +265,7 @@ pub enum Event { SctPlayerBatch(bool), SctDamageBatch(bool), SpeechBubbleDarkMode(bool), + SpeechBubbleIcon(bool), ToggleDebug(bool), UiScale(ScaleChange), CharacterSelection, @@ -1629,6 +1630,9 @@ impl Hud { settings_window::Event::SpeechBubbleDarkMode(sbdm) => { events.push(Event::SpeechBubbleDarkMode(sbdm)); }, + settings_window::Event::SpeechBubbleIcon(sbi) => { + events.push(Event::SpeechBubbleIcon(sbi)); + }, settings_window::Event::Sct(sct) => { events.push(Event::Sct(sct)); }, diff --git a/voxygen/src/hud/overhead.rs b/voxygen/src/hud/overhead.rs index e4124471ab..2863dfb103 100644 --- a/voxygen/src/hud/overhead.rs +++ b/voxygen/src/hud/overhead.rs @@ -284,7 +284,8 @@ impl<'a> Widget for Overhead<'a> { } } text_shadow.set(state.ids.speech_bubble_shadow, ui); - Image::new(bubble_icon(&bubble, &self.imgs)) + let icon = if self.settings.speech_bubble_icon { bubble_icon(&bubble, &self.imgs) } else { self.imgs.nothing }; + Image::new(icon) .w_h(16.0, 16.0) .top_left_with_margin_on(state.ids.speech_bubble_text, -16.0) .set(state.ids.speech_bubble_icon, ui); diff --git a/voxygen/src/hud/settings_window.rs b/voxygen/src/hud/settings_window.rs index 778bf020db..bd7fb37e19 100644 --- a/voxygen/src/hud/settings_window.rs +++ b/voxygen/src/hud/settings_window.rs @@ -11,7 +11,7 @@ use crate::{ }; use conrod_core::{ color, - position::Relative, + position::{Align, Relative}, widget::{self, Button, DropDownList, Image, Rectangle, Scrollbar, Text}, widget_ids, Borderable, Color, Colorable, Labelable, Positionable, Sizeable, Widget, WidgetCommon, @@ -153,8 +153,11 @@ widget_ids! { sct_num_dur_text, sct_num_dur_slider, sct_num_dur_value, + speech_bubble_text, speech_bubble_dark_mode_text, speech_bubble_dark_mode_button, + speech_bubble_icon_text, + speech_bubble_icon_button, free_look_behavior_text, free_look_behavior_list, auto_walk_behavior_text, @@ -241,6 +244,7 @@ pub enum Event { SctPlayerBatch(bool), SctDamageBatch(bool), SpeechBubbleDarkMode(bool), + SpeechBubbleIcon(bool), ChangeLanguage(LanguageMetadata), ChangeBinding(GameInput), ChangeFreeLookBehavior(PressBehavior), @@ -926,24 +930,31 @@ impl<'a> Widget for SettingsWindow<'a> { } // Speech bubble dark mode + Text::new(&self.localized_strings.get("hud.settings.speech_bubble")) + .down_from( + if self.global_state.settings.gameplay.sct { + state.ids.sct_batch_inc_radio + } else { + state.ids.sct_show_radio + }, + 20.0, + ) + .x_align(Align::Start) + .x_relative_to(state.ids.sct_show_text, -40.0) + .font_size(self.fonts.cyri.scale(18)) + .font_id(self.fonts.cyri.conrod_id) + .color(TEXT_COLOR) + .set(state.ids.speech_bubble_text, ui); let speech_bubble_dark_mode = ToggleButton::new( self.global_state.settings.gameplay.speech_bubble_dark_mode, self.imgs.checkbox, self.imgs.checkbox_checked, ) - .down_from( - if self.global_state.settings.gameplay.sct { - state.ids.sct_batch_inc_radio - } else { - state.ids.sct_show_radio - }, - 20.0, - ) - .x(0.0) - .w_h(18.0, 18.0) - .hover_images(self.imgs.checkbox_mo, self.imgs.checkbox_checked_mo) - .press_images(self.imgs.checkbox_press, self.imgs.checkbox_checked) - .set(state.ids.speech_bubble_dark_mode_button, ui); + .down_from(state.ids.speech_bubble_text, 10.0) + .w_h(18.0, 18.0) + .hover_images(self.imgs.checkbox_mo, self.imgs.checkbox_checked_mo) + .press_images(self.imgs.checkbox_press, self.imgs.checkbox_checked) + .set(state.ids.speech_bubble_dark_mode_button, ui); if self.global_state.settings.gameplay.speech_bubble_dark_mode != speech_bubble_dark_mode { @@ -951,19 +962,44 @@ impl<'a> Widget for SettingsWindow<'a> { } Text::new( &self - .localized_strings - .get("hud.settings.speech_bubble_dark_mode"), + .localized_strings + .get("hud.settings.speech_bubble_dark_mode"), ) - .right_from(state.ids.speech_bubble_dark_mode_button, 10.0) - .font_size(self.fonts.cyri.scale(18)) + .right_from(state.ids.speech_bubble_dark_mode_button, 10.0) + .font_size(self.fonts.cyri.scale(15)) + .font_id(self.fonts.cyri.conrod_id) + .color(TEXT_COLOR) + .set(state.ids.speech_bubble_dark_mode_text, ui); + // Speech bubble icon + let speech_bubble_icon = ToggleButton::new( + self.global_state.settings.gameplay.speech_bubble_icon, + self.imgs.checkbox, + self.imgs.checkbox_checked, + ) + .down_from(state.ids.speech_bubble_dark_mode_button, 10.0) + .w_h(18.0, 18.0) + .hover_images(self.imgs.checkbox_mo, self.imgs.checkbox_checked_mo) + .press_images(self.imgs.checkbox_press, self.imgs.checkbox_checked) + .set(state.ids.speech_bubble_icon_button, ui); + if self.global_state.settings.gameplay.speech_bubble_icon != speech_bubble_icon + { + events.push(Event::SpeechBubbleIcon(speech_bubble_icon)); + } + Text::new( + &self + .localized_strings + .get("hud.settings.speech_bubble_icon"), + ) + .right_from(state.ids.speech_bubble_icon_button, 10.0) + .font_size(self.fonts.cyri.scale(15)) .font_id(self.fonts.cyri.conrod_id) .color(TEXT_COLOR) - .set(state.ids.speech_bubble_dark_mode_text, ui); + .set(state.ids.speech_bubble_icon_text, ui); // Energybars Numbers // Hotbar text Text::new(&self.localized_strings.get("hud.settings.energybar_numbers")) - .down_from(state.ids.speech_bubble_dark_mode_button, 20.0) + .down_from(state.ids.speech_bubble_icon_button, 20.0) .font_size(self.fonts.cyri.scale(18)) .font_id(self.fonts.cyri.conrod_id) .color(TEXT_COLOR) diff --git a/voxygen/src/session.rs b/voxygen/src/session.rs index 9d5b5c2beb..83b3d8220d 100644 --- a/voxygen/src/session.rs +++ b/voxygen/src/session.rs @@ -649,6 +649,10 @@ impl PlayState for SessionState { global_state.settings.gameplay.speech_bubble_dark_mode = sbdm; global_state.settings.save_to_file_warn(); }, + HudEvent::SpeechBubbleIcon(sbi) => { + global_state.settings.gameplay.speech_bubble_icon = sbi; + global_state.settings.save_to_file_warn(); + }, HudEvent::ToggleDebug(toggle_debug) => { global_state.settings.gameplay.toggle_debug = toggle_debug; global_state.settings.save_to_file_warn(); diff --git a/voxygen/src/settings.rs b/voxygen/src/settings.rs index d888c9f083..792d643a71 100644 --- a/voxygen/src/settings.rs +++ b/voxygen/src/settings.rs @@ -458,6 +458,7 @@ pub struct GameplaySettings { pub sct_player_batch: bool, pub sct_damage_batch: bool, pub speech_bubble_dark_mode: bool, + pub speech_bubble_icon: bool, pub mouse_y_inversion: bool, pub smooth_pan_enable: bool, pub crosshair_transp: f32, @@ -486,6 +487,7 @@ impl Default for GameplaySettings { sct_player_batch: true, sct_damage_batch: false, speech_bubble_dark_mode: false, + speech_bubble_icon: true, crosshair_transp: 0.6, chat_transp: 0.4, crosshair_type: CrosshairType::Round,