Merge branch 'bafon/toggle-hotkey-hints-setting' into 'master'

Add setting to disable hotkey hints

See merge request veloren/veloren!2849
This commit is contained in:
Snowram 2021-09-24 16:03:06 +00:00
commit 0b26f456f9
6 changed files with 37 additions and 2 deletions

View File

@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added a setting to always show health and energy bars - Added a setting to always show health and energy bars
- Added a crafting station icon to the crafting menu sidebar for items that could be crafted at a crafting station - Added a crafting station icon to the crafting menu sidebar for items that could be crafted at a crafting station
- Added a setting to disable the hotkey hints
### Changed ### Changed

View File

@ -12,6 +12,7 @@
"hud.settings.debug_info": "Debug Info", "hud.settings.debug_info": "Debug Info",
"hud.settings.show_hitboxes": "Show hitboxes", "hud.settings.show_hitboxes": "Show hitboxes",
"hud.settings.show_chat": "Show chat", "hud.settings.show_chat": "Show chat",
"hud.settings.show_hotkey_hints": "Show hotkey hints",
"hud.settings.tips_on_startup": "Tips-On-Startup", "hud.settings.tips_on_startup": "Tips-On-Startup",
"hud.settings.ui_scale": "UI-Scale", "hud.settings.ui_scale": "UI-Scale",
"hud.settings.relative_scaling": "Relative Scaling", "hud.settings.relative_scaling": "Relative Scaling",

View File

@ -2465,7 +2465,7 @@ impl Hud {
.font_size(self.fonts.cyri.scale(14)) .font_size(self.fonts.cyri.scale(14))
.set(self.ids.debug_info, ui_widgets); .set(self.ids.debug_info, ui_widgets);
} }
} else { } else if global_state.settings.interface.toggle_hotkey_hints {
prof_span!("help window"); prof_span!("help window");
// Help Window // Help Window
if let Some(help_key) = global_state.settings.controls.get_binding(GameInput::Help) { if let Some(help_key) = global_state.settings.controls.get_binding(GameInput::Help) {

View File

@ -40,6 +40,8 @@ widget_ids! {
hitboxes_button_label, hitboxes_button_label,
chat_button, chat_button,
chat_button_label, chat_button_label,
hotkey_hints_button,
hotkey_hints_button_label,
ch_title, ch_title,
ch_transp_slider, ch_transp_slider,
ch_transp_value, ch_transp_value,
@ -221,6 +223,7 @@ impl<'a> Widget for Interface<'a> {
.graphics_for(state.ids.load_tips_button) .graphics_for(state.ids.load_tips_button)
.color(TEXT_COLOR) .color(TEXT_COLOR)
.set(state.ids.load_tips_button_label, ui); .set(state.ids.load_tips_button_label, ui);
// Debug // Debug
let show_debug = ToggleButton::new( let show_debug = ToggleButton::new(
self.show.debug, self.show.debug,
@ -293,9 +296,33 @@ impl<'a> Widget for Interface<'a> {
.color(TEXT_COLOR) .color(TEXT_COLOR)
.set(state.ids.chat_button_label, ui); .set(state.ids.chat_button_label, ui);
// Hotkey hints
let show_hotkey_hints = ToggleButton::new(
self.global_state.settings.interface.toggle_hotkey_hints,
self.imgs.checkbox,
self.imgs.checkbox_checked,
)
.w_h(18.0, 18.0)
.down_from(state.ids.chat_button, 8.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.hotkey_hints_button, ui);
if self.global_state.settings.interface.toggle_hotkey_hints != show_hotkey_hints {
events.push(ToggleHotkeyHints(show_hotkey_hints));
}
Text::new(self.localized_strings.get("hud.settings.show_hotkey_hints"))
.right_from(state.ids.hotkey_hints_button, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
.graphics_for(state.ids.hotkey_hints_button)
.color(TEXT_COLOR)
.set(state.ids.hotkey_hints_button_label, ui);
// Ui Scale // Ui Scale
Text::new(self.localized_strings.get("hud.settings.ui_scale")) Text::new(self.localized_strings.get("hud.settings.ui_scale"))
.down_from(state.ids.chat_button, 20.0) .down_from(state.ids.hotkey_hints_button, 20.0)
.font_size(self.fonts.cyri.scale(18)) .font_size(self.fonts.cyri.scale(18))
.font_id(self.fonts.cyri.conrod_id) .font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR) .color(TEXT_COLOR)

View File

@ -100,6 +100,7 @@ pub enum Interface {
ToggleHitboxes(bool), ToggleHitboxes(bool),
ToggleChat(bool), ToggleChat(bool),
ToggleTips(bool), ToggleTips(bool),
ToggleHotkeyHints(bool),
CrosshairTransp(f32), CrosshairTransp(f32),
CrosshairType(CrosshairType), CrosshairType(CrosshairType),
@ -454,6 +455,9 @@ impl SettingsChange {
Interface::ToggleTips(loading_tips) => { Interface::ToggleTips(loading_tips) => {
settings.interface.loading_tips = loading_tips; settings.interface.loading_tips = loading_tips;
}, },
Interface::ToggleHotkeyHints(toggle_hotkey_hints) => {
settings.interface.toggle_hotkey_hints = toggle_hotkey_hints;
},
Interface::CrosshairTransp(crosshair_opacity) => { Interface::CrosshairTransp(crosshair_opacity) => {
settings.interface.crosshair_opacity = crosshair_opacity; settings.interface.crosshair_opacity = crosshair_opacity;
}, },

View File

@ -13,6 +13,7 @@ pub struct InterfaceSettings {
pub toggle_egui_debug: bool, pub toggle_egui_debug: bool,
pub toggle_hitboxes: bool, pub toggle_hitboxes: bool,
pub toggle_chat: bool, pub toggle_chat: bool,
pub toggle_hotkey_hints: bool,
pub sct: bool, pub sct: bool,
pub sct_player_batch: bool, pub sct_player_batch: bool,
pub sct_damage_batch: bool, pub sct_damage_batch: bool,
@ -51,6 +52,7 @@ impl Default for InterfaceSettings {
toggle_egui_debug: false, toggle_egui_debug: false,
toggle_hitboxes: false, toggle_hitboxes: false,
toggle_chat: true, toggle_chat: true,
toggle_hotkey_hints: true,
sct: true, sct: true,
sct_player_batch: false, sct_player_batch: false,
sct_damage_batch: false, sct_damage_batch: false,