group leader colouring, offset fix when debug menu is open,

fixed social tab visuals

text width limit

group interaction wording, group window adjustments
This commit is contained in:
Monty Marz 2020-08-05 13:29:42 +02:00
parent 28a8f847cc
commit 14b0d9a7fe
6 changed files with 99 additions and 87 deletions

BIN
assets/voxygen/element/misc_bg/social_tab_online.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -69,6 +69,7 @@ VoxygenLocalization(
"common.error": "Fehler",
"common.fatal_error": "Fataler Fehler",
"common.decline": "Ablehnen",
"common.you": "Ihr",
/// End Common section
// Message when connection to the server is lost
@ -321,15 +322,17 @@ magischen Gegenstände ergattern?"#,
"hud.social.zone" : "Gebiet",
"hud.group": "Gruppe",
"hud.group.invite": "Einladen",
"hud.group.leave": "Verlassen",
"hud.group.add_friend": "Freund hinzufügen",
"hud.group.invite_to_join": "{name} lädt euch in seine Gruppe ein!",
"hud.group.invite": "Einladen",
"hud.group.kick": "Kicken",
"hud.group.assign_leader": "Anführer",
"hud.group.kick": "Entfernen",
"hud.group.invite_to_join": "{name} hat euch zu seiner Gruppe eingeladen!",
"hud.group.leave": "Gruppe Verlassen",
"hud.group.dead" : "Tot",
"hud.group.out_of_range": "Außer Reichweite",
"hud.group.add_friend": "Freund hinzufügen",
"hud.group.link_group": "Gruppen verbinden",
"hud.group.in_menu": "In Menü",
"hud.group.members": "Gruppen Mitglieder",
"hud.crafting": "Herstellen",
"hud.crafting.recipes": "Rezepte",
@ -394,6 +397,7 @@ magischen Gegenstände ergattern?"#,
"gameinput.dance": "Tanzen",
"gameinput.declinegroupinvite": "Ablehnen",
"gameinput.acceptgroupinvite": "Annehmen",
"gameinput.select": "Auswählen",
/// End GameInput section

View File

@ -26,7 +26,7 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
if let Some(client) = clients.get_mut(entity) {
client.notify(
ChatType::Meta
.server_msg("Invite failed, target does not exist".to_owned()),
.server_msg("Invite failed, target does not exist.".to_owned()),
);
}
return;
@ -54,7 +54,7 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
if client.invited_to_group.is_some() {
already_has_invite = true;
} else {
client.notify(ServerMsg::GroupInvite((*inviter_uid)));
client.notify(ServerMsg::GroupInvite(*inviter_uid));
client.invited_to_group = Some(entity);
}
// Would be cool to do this in agent system (e.g. add an invited
@ -72,15 +72,16 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
.write_storage()
.insert(invitee, comp::Agent::default());
} else if let Some(client) = clients.get_mut(entity) {
client.notify(ChatType::Meta.server_msg("Invite rejected".to_owned()));
client.notify(ChatType::Meta.server_msg("Invite rejected.".to_owned()));
}
if already_has_invite {
// Inform inviter that there is already an invite
if let Some(client) = clients.get_mut(entity) {
client.notify(ChatType::Meta.server_msg(
"Invite failed target already has a pending invite".to_owned(),
));
client.notify(
ChatType::Meta
.server_msg("This player already has a pending invite.".to_owned()),
);
}
}
@ -143,7 +144,7 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
// Inform inviter of rejection
if let Some(client) = clients.get_mut(inviter) {
// TODO: say who declined the invite
client.notify(ChatType::Meta.server_msg("Invite declined".to_owned()));
client.notify(ChatType::Meta.server_msg("Invite declined.".to_owned()));
}
}
},
@ -181,7 +182,7 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
if let Some(client) = clients.get_mut(entity) {
client.notify(
ChatType::Meta
.server_msg("Kick failed, target does not exist".to_owned()),
.server_msg("Kick failed, target does not exist.".to_owned()),
);
}
return;
@ -193,7 +194,7 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
{
if let Some(client) = clients.get_mut(entity) {
client.notify(
ChatType::Meta.server_msg("Kick failed, can't kick pet".to_owned()),
ChatType::Meta.server_msg("Kick failed, you can't kick pets.".to_owned()),
);
}
return;
@ -202,7 +203,8 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
if uids.get(entity).map_or(false, |u| *u == uid) {
if let Some(client) = clients.get_mut(entity) {
client.notify(
ChatType::Meta.server_msg("Kick failed, can't kick yourself".to_owned()),
ChatType::Meta
.server_msg("Kick failed, you can't kick yourself.".to_owned()),
);
}
return;
@ -238,19 +240,20 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
// Tell them the have been kicked
if let Some(client) = clients.get_mut(target) {
client.notify(
ChatType::Meta.server_msg("The group leader kicked you".to_owned()),
ChatType::Meta
.server_msg("You were removed from the group.".to_owned()),
);
}
// Tell kicker that they were succesful
if let Some(client) = clients.get_mut(entity) {
client.notify(ChatType::Meta.server_msg("Kick complete".to_owned()));
client.notify(ChatType::Meta.server_msg("Player kicked.".to_owned()));
}
},
Some(_) => {
// Inform kicker that they are not the leader
if let Some(client) = clients.get_mut(entity) {
client.notify(ChatType::Meta.server_msg(
"Kick failed: you are not the leader of the target's group".to_owned(),
"Kick failed: You are not the leader of the target's group.".to_owned(),
));
}
},
@ -259,7 +262,7 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
if let Some(client) = clients.get_mut(entity) {
client.notify(
ChatType::Meta.server_msg(
"Kick failed: your target is not in a group".to_owned(),
"Kick failed: Your target is not in a group.".to_owned(),
),
);
}
@ -309,14 +312,16 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
);
// Tell them they are the leader
if let Some(client) = clients.get_mut(target) {
client.notify(ChatType::Meta.server_msg(
"The group leader has passed leadership to you".to_owned(),
));
client.notify(
ChatType::Meta.server_msg("You are the group leader now.".to_owned()),
);
}
// Tell the old leader that the transfer was succesful
if let Some(client) = clients.get_mut(target) {
client
.notify(ChatType::Meta.server_msg("Leadership transferred".to_owned()));
client.notify(
ChatType::Meta
.server_msg("You are no longer the group leader.".to_owned()),
);
}
},
Some(_) => {
@ -324,7 +329,7 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
if let Some(client) = clients.get_mut(entity) {
client.notify(
ChatType::Meta.server_msg(
"Transfer failed: you are not the leader of the target's group"
"Transfer failed: You are not the leader of the target's group."
.to_owned(),
),
);
@ -334,7 +339,7 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
// Inform transferer that the target is not in a group
if let Some(client) = clients.get_mut(entity) {
client.notify(ChatType::Meta.server_msg(
"Transfer failed: your target is not in a group".to_owned(),
"Transfer failed: Your target is not in a group.".to_owned(),
));
}
},

View File

@ -1,6 +1,6 @@
use super::{
img_ids::Imgs, Show, BLACK, GROUP_COLOR, HP_COLOR, KILL_COLOR, LOW_HP_COLOR, MANA_COLOR,
TEXT_COLOR, TEXT_COLOR_GREY, UI_HIGHLIGHT_0, UI_MAIN,
img_ids::Imgs, Show, BLACK, ERROR_COLOR, GROUP_COLOR, HP_COLOR, KILL_COLOR, LOW_HP_COLOR,
MANA_COLOR, TEXT_COLOR, TEXT_COLOR_GREY, UI_HIGHLIGHT_0, UI_MAIN,
};
use crate::{
@ -25,7 +25,7 @@ widget_ids! {
group_button,
bg,
title,
close,
title_bg,
btn_bg,
btn_friend,
btn_leader,
@ -35,7 +35,6 @@ widget_ids! {
scroll_area,
scrollbar,
members[],
invite_bubble,
bubble_frame,
btn_accept,
btn_decline,
@ -178,8 +177,8 @@ impl<'a> Widget for Group<'a> {
// broken
if self.show.group_menu || open_invite.is_some() {
// Frame
Rectangle::fill_with([220.0, 165.0], color::Color::Rgba(0.0, 0.0, 0.0, 0.8))
.bottom_left_with_margins_on(ui.window, 220.0, 10.0)
Rectangle::fill_with([220.0, 140.0], color::Color::Rgba(0.0, 0.0, 0.0, 0.8))
.bottom_left_with_margins_on(ui.window, 108.0, 490.0)
.crop_kids()
.set(state.ids.bg, ui);
}
@ -187,7 +186,7 @@ impl<'a> Widget for Group<'a> {
// Group Menu button
Button::image(self.imgs.group_icon)
.w_h(49.0, 26.0)
.bottom_left_with_margins_on(ui.window, 190.0, 10.0)
.bottom_left_with_margins_on(ui.window, 10.0, 490.0)
.set(state.ids.group_button, ui);
// Show timeout bar
let max_time = 90.0;
@ -213,7 +212,7 @@ impl<'a> Widget for Group<'a> {
self.imgs.group_icon
})
.w_h(49.0, 26.0)
.bottom_left_with_margins_on(ui.window, 190.0, 10.0)
.bottom_left_with_margins_on(ui.window, 10.0, 490.0)
.hover_image(self.imgs.group_icon_hover)
.press_image(self.imgs.group_icon_press)
.set(state.ids.group_button, ui)
@ -221,6 +220,18 @@ impl<'a> Widget for Group<'a> {
{
self.show.group_menu = !self.show.group_menu;
};
Text::new(&group_name)
.up_from(state.ids.group_button, 5.0)
.font_size(14)
.font_id(self.fonts.cyri.conrod_id)
.color(BLACK)
.set(state.ids.title_bg, ui);
Text::new(&group_name)
.bottom_right_with_margins_on(state.ids.title_bg, 1.0, 1.0)
.font_size(14)
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
.set(state.ids.title, ui);
// Member panels
let group_size = group_members.len();
if state.ids.member_panels_bg.len() < group_size {
@ -298,7 +309,7 @@ impl<'a> Widget for Group<'a> {
// change panel positions when debug info is shown
let offset = if self.global_state.settings.gameplay.toggle_debug {
240.0
290.0
} else {
110.0
};
@ -316,10 +327,15 @@ impl<'a> Widget for Group<'a> {
21..=40 => LOW_HP_COLOR,
_ => HP_COLOR,
};
let lead = if uid == leader { true } else { false };
// Don't show panel for the player!
// Panel BG
back.w_h(152.0, 36.0)
.color(Some(TEXT_COLOR))
.color(if lead {
Some(ERROR_COLOR)
} else {
Some(TEXT_COLOR)
})
.set(state.ids.member_panels_bg[i], ui);
// Health
Image::new(self.imgs.bar_content)
@ -375,12 +391,14 @@ impl<'a> Widget for Group<'a> {
.font_size(20)
.font_id(self.fonts.cyri.conrod_id)
.color(BLACK)
.w(300.0) // limit name length display
.set(state.ids.member_panels_txt_bg[i], ui);
Text::new(&char_name)
.bottom_left_with_margins_on(state.ids.member_panels_txt_bg[i], 2.0, 2.0)
.font_size(20)
.font_id(self.fonts.cyri.conrod_id)
.color(GROUP_COLOR)
.color(if lead { ERROR_COLOR } else { GROUP_COLOR })
.w(300.0) // limit name length display
.set(state.ids.member_panels_txt[i], ui);
if let Some(energy) = energy {
let stam_perc = energy.current() as f64 / energy.maximum() as f64;
@ -434,19 +452,13 @@ impl<'a> Widget for Group<'a> {
if self.show.group_menu {
let selected = state.selected_member;
Text::new(&group_name)
.mid_top_with_margin_on(state.ids.bg, 2.0)
.font_size(20)
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
.set(state.ids.title, ui);
if Button::image(self.imgs.button)
if Button::image(self.imgs.button) // Change button behaviour and style when the friendslist is working
.w_h(90.0, 22.0)
.top_right_with_margins_on(state.ids.bg, 30.0, 5.0)
.hover_image(self.imgs.button) // Change this when the friendslist is working
.press_image(self.imgs.button) // Change this when the friendslist is working
.label_color(TEXT_COLOR_GREY) // Change this when the friendslist is working
.image_color (TEXT_COLOR_GREY) // Change this when the friendslist is working
.top_right_with_margins_on(state.ids.bg, 5.0, 5.0)
.hover_image(self.imgs.button)
.press_image(self.imgs.button)
.label_color(TEXT_COLOR_GREY)
.image_color(TEXT_COLOR_GREY)
.label(&self.localized_strings.get("hud.group.add_friend"))
.label_font_id(self.fonts.cyri.conrod_id)
.label_font_size(self.fonts.cyri.scale(10))
@ -495,19 +507,19 @@ impl<'a> Widget for Group<'a> {
}
};
if Button::image(self.imgs.button)
.w_h(90.0, 22.0)
.mid_bottom_with_margin_on(state.ids.btn_leader, -27.0)
.hover_image(self.imgs.button)
.press_image(self.imgs.button)
.label(&self.localized_strings.get("hud.group.link_group"))
.hover_image(self.imgs.button) // Change this when the friendslist is working
.press_image(self.imgs.button) // Change this when the friendslist is working
.label_color(TEXT_COLOR_GREY) // Change this when the friendslist is working
.image_color (TEXT_COLOR_GREY) // Change this when the friendslist is working
.label_font_id(self.fonts.cyri.conrod_id)
.label_font_size(self.fonts.cyri.scale(10))
.set(state.ids.btn_link, ui)
.was_clicked()
.w_h(90.0, 22.0)
.mid_bottom_with_margin_on(state.ids.btn_leader, -27.0)
.hover_image(self.imgs.button)
.press_image(self.imgs.button)
.label(&self.localized_strings.get("hud.group.link_group"))
.hover_image(self.imgs.button)
.press_image(self.imgs.button)
.label_color(TEXT_COLOR_GREY)
.image_color(TEXT_COLOR_GREY)
.label_font_id(self.fonts.cyri.conrod_id)
.label_font_size(self.fonts.cyri.scale(10))
.set(state.ids.btn_link, ui)
.was_clicked()
{};
if Button::image(self.imgs.button)
.w_h(90.0, 22.0)
@ -546,8 +558,8 @@ impl<'a> Widget for Group<'a> {
}
// Scrollable area for group member names
Rectangle::fill_with([110.0, 135.0], color::TRANSPARENT)
.top_left_with_margins_on(state.ids.bg, 30.0, 5.0)
.scroll_kids()
.top_left_with_margins_on(state.ids.bg, 5.0, 5.0)
.crop_kids()
.scroll_kids_vertically()
.set(state.ids.scroll_area, ui);
Scrollbar::y_axis(state.ids.scroll_area)
@ -558,7 +570,6 @@ impl<'a> Widget for Group<'a> {
for (i, &uid) in group_members.iter().copied().enumerate() {
let selected = state.selected_member.map_or(false, |u| u == uid);
let char_name = uid_to_name_text(uid, &self.client);
// TODO: Do something special visually if uid == leader
if Button::image(if selected {
self.imgs.selection
@ -578,7 +589,11 @@ impl<'a> Widget for Group<'a> {
.crop_kids()
.label_x(Relative::Place(Place::Start(Some(4.0))))
.label(&char_name)
.label_color(TEXT_COLOR)
.label_color(if uid == leader {
ERROR_COLOR
} else {
TEXT_COLOR
})
.label_font_id(self.fonts.cyri.conrod_id)
.label_font_size(self.fonts.cyri.scale(12))
.set(state.ids.members[i], ui)
@ -609,10 +624,11 @@ impl<'a> Widget for Group<'a> {
.get("hud.group.invite_to_join")
.replace("{name}", &name);
Text::new(&invite_text)
.mid_top_with_margin_on(state.ids.bg, 20.0)
.mid_top_with_margin_on(state.ids.bg, 5.0)
.font_size(12)
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
.w(165.0) // Text stays within frame
.set(state.ids.title, ui);
// Accept Button
let accept_key = self
@ -632,7 +648,7 @@ impl<'a> Widget for Group<'a> {
))
.label_color(TEXT_COLOR)
.label_font_id(self.fonts.cyri.conrod_id)
.label_font_size(self.fonts.cyri.scale(15))
.label_font_size(self.fonts.cyri.scale(12))
.set(state.ids.btn_accept, ui)
.was_clicked()
{
@ -657,7 +673,7 @@ impl<'a> Widget for Group<'a> {
))
.label_color(TEXT_COLOR)
.label_font_id(self.fonts.cyri.conrod_id)
.label_font_size(self.fonts.cyri.scale(15))
.label_font_size(self.fonts.cyri.scale(12))
.set(state.ids.btn_decline, ui)
.was_clicked()
{

View File

@ -66,6 +66,7 @@ image_ids! {
social_frame_fact: "voxygen.element.misc_bg.social_frame",
social_bg_fact: "voxygen.element.misc_bg.social_bg",
social_tab_act: "voxygen.element.buttons.social_tab_active",
social_tab_online: "voxygen.element.misc_bg.social_tab_online",
social_tab_inact: "voxygen.element.buttons.social_tab_inactive",
social_tab_inact_hover: "voxygen.element.buttons.social_tab_inactive",
social_tab_inact_press: "voxygen.element.buttons.social_tab_inactive",

View File

@ -27,7 +27,6 @@ widget_ids! {
scrollbar,
online_align,
online_tab,
online_tab_icon,
names_align,
name_txt,
player_levels[],
@ -205,18 +204,10 @@ impl<'a> Widget for Social<'a> {
// Tabs Buttons
// Online Tab Button
if Button::image(match &self.show.social_tab {
SocialTab::Online => self.imgs.social_tab_act,
SocialTab::Online => self.imgs.social_tab_online,
_ => self.imgs.social_tab_inact,
})
.w_h(30.0, 44.0)
.hover_image(match &self.show.social_tab {
SocialTab::Online => self.imgs.social_tab_act,
_ => self.imgs.social_tab_inact_hover,
})
.press_image(match &self.show.social_tab {
SocialTab::Online => self.imgs.social_tab_act,
_ => self.imgs.social_tab_inact_press,
})
.image_color(match &self.show.social_tab {
SocialTab::Online => UI_MAIN,
_ => Color::Rgba(1.0, 1.0, 1.0, 0.6),
@ -227,14 +218,6 @@ impl<'a> Widget for Social<'a> {
{
events.push(Event::ChangeSocialTab(SocialTab::Online));
}
Image::new(self.imgs.chat_online_small)
.w_h(20.0, 20.0)
.top_right_with_margins_on(state.ids.online_tab, 12.0, 7.0)
.color(match &self.show.social_tab {
SocialTab::Online => Some(TEXT_COLOR),
_ => Some(UI_MAIN),
})
.set(state.ids.online_tab_icon, ui);
// Friends Tab Button
if Button::image(match &self.show.social_tab {
SocialTab::Friends => self.imgs.social_tab_act,