From 9869b2a8d7eb76ffce0839bbb26e6d9a59997792 Mon Sep 17 00:00:00 2001 From: Monty Marz Date: Wed, 5 Aug 2020 13:29:42 +0200 Subject: [PATCH] group leader colouring, offset fix when debug menu is open, fixed social tab visuals text width limit group interaction wording, group window adjustments --- .../element/misc_bg/social_tab_online.png | Bin 0 -> 644 bytes assets/voxygen/i18n/de_DE.ron | 14 ++- server/src/events/group_manip.rs | 47 ++++---- voxygen/src/hud/group.rs | 102 ++++++++++-------- voxygen/src/hud/img_ids.rs | 1 + voxygen/src/hud/social.rs | 19 +--- 6 files changed, 96 insertions(+), 87 deletions(-) create mode 100644 assets/voxygen/element/misc_bg/social_tab_online.png diff --git a/assets/voxygen/element/misc_bg/social_tab_online.png b/assets/voxygen/element/misc_bg/social_tab_online.png new file mode 100644 index 0000000000000000000000000000000000000000..d5c334086fa55b2907c4537f39f64856ce065b34 GIT binary patch literal 644 zcmV-~0((_`g8%^e{{R4h=>PzAFaQARU;qF*m;eA5Z<1fd zMgRZ;3Q0skRCwC#STRq+KotJor85ahlco-g238lhI=d3$>|hN30mJTM_yvSG_y=Hh z*3HEc5=RD!!9=5@$(;kd=6dbX0;TQXx0JiI_uluudyl(EN+|$9x7%I*$N(Y&0Pwdw zr;i7N0j*oZ!H!6BBGY%S>#8J=c`Sqo=ao_*A`lUzln_EdN(lhrd+l~R=9p3{76Hff zoWVwtz{aGMF-J^;wn$JA1aHU@)9KV_!%|9gI-QV&{uIa=I#Uk6E+ap4XKZ3JnfSVt zyaxpK4A$M$+S#|^X0tgrru;$}+agf7VNS(ZsOO*Gex8Q>dTpM_93{aqnZ7>UEywR4 zyD{}#0Knntg|9Q;TLDP}r&V0z9hqibrxcBesCdJrYg}47m7m8ZPR@Ig@#FpNR`a%c zT?%6<<-f-18f`jXnF7MO95Vj>`HJk$o2xSbKyZAt)#6XjFOhXouT`T~$BwtN*(}ou z=PL~F31)87wz?W`3TDQd z7iKsO99pyEkelJOY}os4kr|p8kH--w3fo*dV<7|_00%2im8nCPW2$X#G#W*kI*Y}E ztOaC~URBb&CM#Rl2mpv*_B>BT&P1!miP?5C+ekV~z4c@=Of8w*yGk;ulnO7_vA;RZ e0lnX4!`}e-OCI^2) { // 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(), )); } }, diff --git a/voxygen/src/hud/group.rs b/voxygen/src/hud/group.rs index 9da541edc3..a35a37db83 100644 --- a/voxygen/src/hud/group.rs +++ b/voxygen/src/hud/group.rs @@ -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() { diff --git a/voxygen/src/hud/img_ids.rs b/voxygen/src/hud/img_ids.rs index 79eda06010..04f60f0b3a 100644 --- a/voxygen/src/hud/img_ids.rs +++ b/voxygen/src/hud/img_ids.rs @@ -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", diff --git a/voxygen/src/hud/social.rs b/voxygen/src/hud/social.rs index ceb8f94674..e1158019a4 100644 --- a/voxygen/src/hud/social.rs +++ b/voxygen/src/hud/social.rs @@ -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,