mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Added chat toggle
This commit is contained in:
parent
8ab222bf80
commit
b84708ca75
@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Added debug line info to release builds, enhancing the usefulness of panic backtraces
|
||||
- NPCs and animals can now make sounds in response to certain events
|
||||
- Players can press H to greet others
|
||||
- Ability to toggle chat visibility
|
||||
|
||||
### Changed
|
||||
- Entity-entity pushback is no longer applied in forced movement states like rolling and leaping.
|
||||
|
@ -11,6 +11,7 @@
|
||||
"hud.settings.help_window": "Help Window",
|
||||
"hud.settings.debug_info": "Debug Info",
|
||||
"hud.settings.show_hitboxes": "Show hitboxes",
|
||||
"hud.settings.show_chat": "Show chat",
|
||||
"hud.settings.tips_on_startup": "Tips-On-Startup",
|
||||
"hud.settings.ui_scale": "UI-Scale",
|
||||
"hud.settings.relative_scaling": "Relative Scaling",
|
||||
|
@ -2706,6 +2706,7 @@ impl Hud {
|
||||
.retain(|m| !matches!(m.chat_type, comp::ChatType::Npc(_, _)));
|
||||
|
||||
// Chat box
|
||||
if global_state.settings.interface.toggle_chat {
|
||||
for event in Chat::new(
|
||||
&mut self.new_messages,
|
||||
&client,
|
||||
@ -2745,6 +2746,7 @@ impl Hud {
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.new_messages = VecDeque::new();
|
||||
self.new_notifications = VecDeque::new();
|
||||
|
@ -38,6 +38,8 @@ widget_ids! {
|
||||
debug_button_label,
|
||||
hitboxes_button,
|
||||
hitboxes_button_label,
|
||||
chat_button,
|
||||
chat_button_label,
|
||||
ch_title,
|
||||
ch_transp_slider,
|
||||
ch_transp_value,
|
||||
@ -266,9 +268,33 @@ impl<'a> Widget for Interface<'a> {
|
||||
.color(TEXT_COLOR)
|
||||
.set(state.ids.hitboxes_button_label, ui);
|
||||
|
||||
// Chat
|
||||
let show_chat = ToggleButton::new(
|
||||
self.global_state.settings.interface.toggle_chat,
|
||||
self.imgs.checkbox,
|
||||
self.imgs.checkbox_checked,
|
||||
)
|
||||
.w_h(18.0, 18.0)
|
||||
.down_from(state.ids.hitboxes_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.chat_button, ui);
|
||||
|
||||
if self.global_state.settings.interface.toggle_chat != show_chat {
|
||||
events.push(ToggleChat(show_chat));
|
||||
}
|
||||
|
||||
Text::new(&self.localized_strings.get("hud.settings.show_chat"))
|
||||
.right_from(state.ids.chat_button, 10.0)
|
||||
.font_size(self.fonts.cyri.scale(14))
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.graphics_for(state.ids.chat_button)
|
||||
.color(TEXT_COLOR)
|
||||
.set(state.ids.chat_button_label, ui);
|
||||
|
||||
// Ui Scale
|
||||
Text::new(&self.localized_strings.get("hud.settings.ui_scale"))
|
||||
.down_from(state.ids.hitboxes_button, 20.0)
|
||||
.down_from(state.ids.chat_button, 20.0)
|
||||
.font_size(self.fonts.cyri.scale(18))
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.color(TEXT_COLOR)
|
||||
|
@ -97,6 +97,7 @@ pub enum Interface {
|
||||
ToggleHelp(bool),
|
||||
ToggleDebug(bool),
|
||||
ToggleHitboxes(bool),
|
||||
ToggleChat(bool),
|
||||
ToggleTips(bool),
|
||||
|
||||
CrosshairTransp(f32),
|
||||
@ -450,6 +451,9 @@ impl SettingsChange {
|
||||
Interface::ToggleHitboxes(toggle_hitboxes) => {
|
||||
settings.interface.toggle_hitboxes = toggle_hitboxes;
|
||||
},
|
||||
Interface::ToggleChat(toggle_chat) => {
|
||||
settings.interface.toggle_chat = toggle_chat;
|
||||
},
|
||||
Interface::ToggleTips(loading_tips) => {
|
||||
settings.interface.loading_tips = loading_tips;
|
||||
},
|
||||
|
@ -11,6 +11,7 @@ use vek::*;
|
||||
pub struct InterfaceSettings {
|
||||
pub toggle_debug: bool,
|
||||
pub toggle_hitboxes: bool,
|
||||
pub toggle_chat: bool,
|
||||
pub sct: bool,
|
||||
pub sct_player_batch: bool,
|
||||
pub sct_damage_batch: bool,
|
||||
@ -46,6 +47,7 @@ impl Default for InterfaceSettings {
|
||||
Self {
|
||||
toggle_debug: false,
|
||||
toggle_hitboxes: false,
|
||||
toggle_chat: true,
|
||||
sct: true,
|
||||
sct_player_batch: false,
|
||||
sct_damage_batch: false,
|
||||
|
Loading…
Reference in New Issue
Block a user