mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Added chat mode icons to speech bubbles
This commit is contained in:
parent
35ed03aa18
commit
2a0f0053d4
@ -105,9 +105,9 @@ impl ChatMsg {
|
||||
|
||||
pub fn icon(&self) -> SpeechBubbleIcon {
|
||||
match &self.chat_type {
|
||||
ChatType::Broadcast => SpeechBubbleIcon::Broadcast,
|
||||
ChatType::Private => SpeechBubbleIcon::Private,
|
||||
ChatType::Kill => SpeechBubbleIcon::Kill,
|
||||
ChatType::Broadcast => SpeechBubbleIcon::None,
|
||||
ChatType::Private => SpeechBubbleIcon::None,
|
||||
ChatType::Kill => SpeechBubbleIcon::None,
|
||||
ChatType::Tell(_u, _) => SpeechBubbleIcon::Tell,
|
||||
ChatType::Say(_u) => SpeechBubbleIcon::Say,
|
||||
ChatType::Group(_u, _s) => SpeechBubbleIcon::Group,
|
||||
@ -177,10 +177,6 @@ pub enum SpeechBubbleIcon {
|
||||
Group,
|
||||
Faction,
|
||||
World,
|
||||
// Server chat types
|
||||
Broadcast,
|
||||
Private,
|
||||
Kill,
|
||||
// For NPCs
|
||||
Quest, // TODO not implemented
|
||||
Trade, // TODO not implemented
|
||||
|
@ -25,7 +25,7 @@ pub use body::{
|
||||
humanoid, object, quadruped_medium, quadruped_small, AllBodies, Body, BodyData,
|
||||
};
|
||||
pub use character_state::{Attacking, CharacterState, StateUpdate};
|
||||
pub use chat::{ChatMode, ChatMsg, ChatType, Faction, Group, SpeechBubble};
|
||||
pub use chat::{ChatMode, ChatMsg, ChatType, Faction, Group, SpeechBubble, SpeechBubbleIcon};
|
||||
pub use controller::{
|
||||
Climb, ControlAction, ControlEvent, Controller, ControllerInputs, Input, InventoryManip,
|
||||
MountState, Mounting,
|
||||
|
@ -308,6 +308,13 @@ image_ids! {
|
||||
chat_tell_small: "voxygen.element.icons.chat.tell_small",
|
||||
chat_world_small: "voxygen.element.icons.chat.world_small",
|
||||
|
||||
chat_faction: "voxygen.element.icons.chat.faction",
|
||||
chat_group: "voxygen.element.icons.chat.group",
|
||||
chat_region: "voxygen.element.icons.chat.region",
|
||||
chat_say: "voxygen.element.icons.chat.say",
|
||||
chat_tell: "voxygen.element.icons.chat.tell",
|
||||
chat_world: "voxygen.element.icons.chat.world",
|
||||
|
||||
<BlankGraphic>
|
||||
nothing: (),
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ use crate::{
|
||||
settings::GameplaySettings,
|
||||
ui::{fonts::ConrodVoxygenFonts, Ingameable},
|
||||
};
|
||||
use common::comp::{Energy, SpeechBubble, Stats};
|
||||
use common::comp::{Energy, SpeechBubble, SpeechBubbleIcon, Stats};
|
||||
use conrod_core::{
|
||||
position::Align,
|
||||
widget::{self, Image, Rectangle, Text},
|
||||
@ -103,8 +103,9 @@ impl<'a> Ingameable for Overhead<'a> {
|
||||
// - 4 for HP + mana + fg + bg
|
||||
// If there's a speech bubble
|
||||
// - 1 Text::new for speech bubble
|
||||
// - 1 Image::new for icon
|
||||
// - 10 Image::new for speech bubble (9-slice + tail)
|
||||
7 + if self.bubble.is_some() { 11 } else { 0 }
|
||||
7 + if self.bubble.is_some() { 12 } else { 0 }
|
||||
}
|
||||
}
|
||||
|
||||
@ -263,6 +264,10 @@ impl<'a> Widget for Overhead<'a> {
|
||||
tail.set(state.ids.speech_bubble_tail, ui);
|
||||
text.depth(tail.get_depth() - 1.0)
|
||||
.set(state.ids.speech_bubble_text, ui);
|
||||
Image::new(bubble_icon(&bubble, &self.imgs))
|
||||
.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);
|
||||
}
|
||||
|
||||
let hp_percentage =
|
||||
@ -362,3 +367,18 @@ impl<'a> Widget for Overhead<'a> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn bubble_icon(sb: &SpeechBubble, imgs: &Imgs) -> conrod_core::image::Id {
|
||||
match sb.icon {
|
||||
// One for each chat mode
|
||||
SpeechBubbleIcon::Tell => imgs.chat_tell_small,
|
||||
SpeechBubbleIcon::Say => imgs.chat_say_small,
|
||||
SpeechBubbleIcon::Region => imgs.chat_region_small,
|
||||
SpeechBubbleIcon::Group => imgs.chat_group_small,
|
||||
SpeechBubbleIcon::Faction => imgs.chat_faction_small,
|
||||
SpeechBubbleIcon::World => imgs.chat_world_small,
|
||||
SpeechBubbleIcon::Quest => imgs.nothing, // TODO not implemented
|
||||
SpeechBubbleIcon::Trade => imgs.nothing, // TODO not implemented
|
||||
SpeechBubbleIcon::None => imgs.nothing, // No icon (default for npcs)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user