mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Added checkbox in the settings for poisebar
See [this message on Discord](https://discord.com/channels/449602562165833758/1014778601368997958/1033838446575370351).
This commit is contained in:
parent
b35225a13d
commit
9b692d072f
@ -29,6 +29,7 @@ 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-always_show_bars = Always show Energybars
|
||||
hud-settings-enable_poise_bar = Enable Poise bar
|
||||
hud-settings-experience_numbers = Experience Numbers
|
||||
hud-settings-accumulate_experience = Accumulate Experience Numbers
|
||||
hud-settings-values = Values
|
||||
|
@ -66,6 +66,8 @@ widget_ids! {
|
||||
show_bar_numbers_percentage_text,
|
||||
always_show_bars_button,
|
||||
always_show_bars_label,
|
||||
enable_poise_bar_button,
|
||||
enable_poise_bar_label,
|
||||
//
|
||||
show_shortcuts_button,
|
||||
show_shortcuts_text,
|
||||
@ -1153,13 +1155,41 @@ impl<'a> Widget for Interface<'a> {
|
||||
.color(TEXT_COLOR)
|
||||
.set(state.ids.always_show_bars_label, ui);
|
||||
|
||||
// Enable poise bar
|
||||
let enable_poise_bar = ToggleButton::new(
|
||||
self.global_state.settings.interface.enable_poise_bar,
|
||||
self.imgs.checkbox,
|
||||
self.imgs.checkbox_checked,
|
||||
)
|
||||
.w_h(18.0, 18.0)
|
||||
.down_from(state.ids.always_show_bars_button, 20.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.enable_poise_bar_button, ui);
|
||||
|
||||
if enable_poise_bar != self.global_state.settings.interface.enable_poise_bar {
|
||||
events.push(TogglePoiseBar(enable_poise_bar));
|
||||
}
|
||||
|
||||
Text::new(
|
||||
&self
|
||||
.localized_strings
|
||||
.get_msg("hud-settings-enable_poise_bar"),
|
||||
)
|
||||
.right_from(state.ids.enable_poise_bar_button, 10.0)
|
||||
.font_size(self.fonts.cyri.scale(14))
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.graphics_for(state.ids.enable_poise_bar_button)
|
||||
.color(TEXT_COLOR)
|
||||
.set(state.ids.enable_poise_bar_label, ui);
|
||||
|
||||
// Experience Numbers
|
||||
Text::new(
|
||||
&self
|
||||
.localized_strings
|
||||
.get_msg("hud-settings-experience_numbers"),
|
||||
)
|
||||
.down_from(state.ids.always_show_bars_button, 20.0)
|
||||
.down_from(state.ids.enable_poise_bar_button, 20.0)
|
||||
.font_size(self.fonts.cyri.scale(18))
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.color(TEXT_COLOR)
|
||||
|
@ -399,8 +399,9 @@ impl<'a> Skillbar<'a> {
|
||||
|| (self.health.current() - self.health.maximum()).abs() > Health::HEALTH_EPSILON;
|
||||
let show_energy = self.global_state.settings.interface.always_show_bars
|
||||
|| (self.energy.current() - self.energy.maximum()).abs() > Energy::ENERGY_EPSILON;
|
||||
let show_poise = self.global_state.settings.interface.always_show_bars
|
||||
|| (self.poise.current() - self.poise.maximum()).abs() > Poise::POISE_EPSILON;
|
||||
let show_poise = self.global_state.settings.interface.enable_poise_bar
|
||||
&& (self.global_state.settings.interface.always_show_bars
|
||||
|| (self.poise.current() - self.poise.maximum()).abs() > Poise::POISE_EPSILON);
|
||||
let decayed_health = 1.0 - self.health.maximum() as f64 / self.health.base_max() as f64;
|
||||
|
||||
if show_health && !self.health.is_dead || decayed_health > 0.0 {
|
||||
|
@ -122,6 +122,7 @@ pub enum Interface {
|
||||
ToggleXpBar(XpBar),
|
||||
ToggleBarNumbers(BarNumbers),
|
||||
ToggleAlwaysShowBars(bool),
|
||||
TogglePoiseBar(bool),
|
||||
ToggleShortcutNumbers(ShortcutNumbers),
|
||||
BuffPosition(BuffPosition),
|
||||
|
||||
@ -571,6 +572,9 @@ impl SettingsChange {
|
||||
Interface::ToggleAlwaysShowBars(always_show_bars) => {
|
||||
settings.interface.always_show_bars = always_show_bars;
|
||||
},
|
||||
Interface::TogglePoiseBar(enable_poise_bar) => {
|
||||
settings.interface.enable_poise_bar = enable_poise_bar;
|
||||
},
|
||||
Interface::ToggleShortcutNumbers(shortcut_numbers) => {
|
||||
settings.interface.shortcut_numbers = shortcut_numbers;
|
||||
},
|
||||
|
@ -30,6 +30,7 @@ pub struct InterfaceSettings {
|
||||
pub buff_position: BuffPosition,
|
||||
pub bar_numbers: BarNumbers,
|
||||
pub always_show_bars: bool,
|
||||
pub enable_poise_bar: bool,
|
||||
pub ui_scale: ScaleMode,
|
||||
pub map_zoom: f64,
|
||||
pub map_show_topo_map: bool,
|
||||
@ -73,6 +74,7 @@ impl Default for InterfaceSettings {
|
||||
buff_position: BuffPosition::Bar,
|
||||
bar_numbers: BarNumbers::Values,
|
||||
always_show_bars: false,
|
||||
enable_poise_bar: false,
|
||||
ui_scale: ScaleMode::RelativeToWindow([1920.0, 1080.0].into()),
|
||||
map_zoom: 10.0,
|
||||
map_show_topo_map: true,
|
||||
|
Loading…
Reference in New Issue
Block a user