Added option to disable speech bubble icons. Aligned settings>gameplay menu again.

This commit is contained in:
CapsizeGlimmer 2020-06-13 23:13:01 -04:00 committed by Forest Anderson
parent a204072e78
commit 92127292d4
6 changed files with 70 additions and 21 deletions

View File

@ -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",

View File

@ -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));
},

View File

@ -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);

View File

@ -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)

View File

@ -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();

View File

@ -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,