From d53d2300a6036d22baa56b8701ad3a38d59e8c54 Mon Sep 17 00:00:00 2001 From: Bafon Date: Fri, 24 Sep 2021 16:03:05 +0000 Subject: [PATCH] Add setting to disable hotkey hints --- CHANGELOG.md | 1 + assets/voxygen/i18n/en/hud/settings.ron | 1 + voxygen/src/hud/mod.rs | 2 +- voxygen/src/hud/settings_window/interface.rs | 29 +++++++++++++++++++- voxygen/src/session/settings_change.rs | 4 +++ voxygen/src/settings/interface.rs | 2 ++ 6 files changed, 37 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea33f6c140..4108ccf082 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 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 diff --git a/assets/voxygen/i18n/en/hud/settings.ron b/assets/voxygen/i18n/en/hud/settings.ron index b66d9d7ff8..c605d1093b 100644 --- a/assets/voxygen/i18n/en/hud/settings.ron +++ b/assets/voxygen/i18n/en/hud/settings.ron @@ -12,6 +12,7 @@ "hud.settings.debug_info": "Debug Info", "hud.settings.show_hitboxes": "Show hitboxes", "hud.settings.show_chat": "Show chat", + "hud.settings.show_hotkey_hints": "Show hotkey hints", "hud.settings.tips_on_startup": "Tips-On-Startup", "hud.settings.ui_scale": "UI-Scale", "hud.settings.relative_scaling": "Relative Scaling", diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index c0fbedc081..a26f542db2 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -2465,7 +2465,7 @@ impl Hud { .font_size(self.fonts.cyri.scale(14)) .set(self.ids.debug_info, ui_widgets); } - } else { + } else if global_state.settings.interface.toggle_hotkey_hints { prof_span!("help window"); // Help Window if let Some(help_key) = global_state.settings.controls.get_binding(GameInput::Help) { diff --git a/voxygen/src/hud/settings_window/interface.rs b/voxygen/src/hud/settings_window/interface.rs index 1fc12eb74b..0aee62f2f1 100644 --- a/voxygen/src/hud/settings_window/interface.rs +++ b/voxygen/src/hud/settings_window/interface.rs @@ -40,6 +40,8 @@ widget_ids! { hitboxes_button_label, chat_button, chat_button_label, + hotkey_hints_button, + hotkey_hints_button_label, ch_title, ch_transp_slider, ch_transp_value, @@ -221,6 +223,7 @@ impl<'a> Widget for Interface<'a> { .graphics_for(state.ids.load_tips_button) .color(TEXT_COLOR) .set(state.ids.load_tips_button_label, ui); + // Debug let show_debug = ToggleButton::new( self.show.debug, @@ -293,9 +296,33 @@ impl<'a> Widget for Interface<'a> { .color(TEXT_COLOR) .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 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_id(self.fonts.cyri.conrod_id) .color(TEXT_COLOR) diff --git a/voxygen/src/session/settings_change.rs b/voxygen/src/session/settings_change.rs index f3ca3b85a7..d76f667876 100644 --- a/voxygen/src/session/settings_change.rs +++ b/voxygen/src/session/settings_change.rs @@ -100,6 +100,7 @@ pub enum Interface { ToggleHitboxes(bool), ToggleChat(bool), ToggleTips(bool), + ToggleHotkeyHints(bool), CrosshairTransp(f32), CrosshairType(CrosshairType), @@ -454,6 +455,9 @@ impl SettingsChange { Interface::ToggleTips(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) => { settings.interface.crosshair_opacity = crosshair_opacity; }, diff --git a/voxygen/src/settings/interface.rs b/voxygen/src/settings/interface.rs index ccb1a312dd..1756186893 100644 --- a/voxygen/src/settings/interface.rs +++ b/voxygen/src/settings/interface.rs @@ -13,6 +13,7 @@ pub struct InterfaceSettings { pub toggle_egui_debug: bool, pub toggle_hitboxes: bool, pub toggle_chat: bool, + pub toggle_hotkey_hints: bool, pub sct: bool, pub sct_player_batch: bool, pub sct_damage_batch: bool, @@ -51,6 +52,7 @@ impl Default for InterfaceSettings { toggle_egui_debug: false, toggle_hitboxes: false, toggle_chat: true, + toggle_hotkey_hints: true, sct: true, sct_player_batch: false, sct_damage_batch: false,