add phonebook display under the achievements in the menu screen
This commit is contained in:
parent
678979db7e
commit
da956130c5
|
@ -27,6 +27,8 @@ pub const CHATS: &[&str] = &[
|
|||
];
|
||||
|
||||
pub const CONTACTS: &[&str] = &["icarus", "travel", "luna", "nox"];
|
||||
pub const CONTACTS_PRETTY: &[&str] = &["Icarus", "FASTravel", "Luna", "Nox"];
|
||||
pub const CONTACTS_UNKNOWN: &str = "[unknown]";
|
||||
|
||||
pub const TEXT_CONTINUE: &str = "Continue...";
|
||||
|
||||
|
|
39
src/menu.rs
39
src/menu.rs
|
@ -274,6 +274,16 @@ pub fn setup(
|
|||
sections.extend(Vec::from_iter(
|
||||
(0..achievement_count).map(|_| TextSection::new("", style_achievement.clone())),
|
||||
));
|
||||
sections.push(TextSection::new(
|
||||
"\nPhonebook\n",
|
||||
style_achievement_header.clone(),
|
||||
));
|
||||
sections.extend(Vec::from_iter((0..chat::CONTACTS.len()).map(|_| {
|
||||
TextSection::new(
|
||||
chat::CONTACTS_UNKNOWN.to_string() + "\n",
|
||||
style_achievement.clone(),
|
||||
)
|
||||
})));
|
||||
builder.spawn((
|
||||
MenuAchievements,
|
||||
TextBundle {
|
||||
|
@ -463,8 +473,7 @@ pub fn update_menu(
|
|||
if boolean { "On" } else { "Off" }.to_string()
|
||||
}
|
||||
|
||||
let bools = achievement_tracker.to_bool_vec();
|
||||
let rendered = achievement_tracker.to_textsections();
|
||||
// Footer
|
||||
if let (Ok(mut text), Some(player_pos), Some(jupiter_pos)) = (
|
||||
q_footer.get_single_mut(),
|
||||
id2pos.0.get(cmd::ID_PLAYER),
|
||||
|
@ -480,16 +489,38 @@ pub fn update_menu(
|
|||
settings.version.as_str()
|
||||
);
|
||||
}
|
||||
|
||||
// Achievements
|
||||
let achievement_bools = achievement_tracker.to_bool_vec();
|
||||
let rendered = achievement_tracker.to_textsections();
|
||||
if let Ok(mut text) = q_achievement_text.get_single_mut() {
|
||||
for i in 0..text.sections.len() - 1 {
|
||||
text.sections[i + 1].style.color = if bools[i] {
|
||||
for i in 0..achievement_bools.len() - 1 {
|
||||
text.sections[i + 1].style.color = if achievement_bools[i] {
|
||||
settings.hud_color_achievement_accomplished
|
||||
} else {
|
||||
settings.hud_color_achievement
|
||||
};
|
||||
text.sections[i + 1].value = rendered[i].clone();
|
||||
}
|
||||
|
||||
// Phonebook
|
||||
for (i, contact) in chat::CONTACTS.iter().enumerate() {
|
||||
let text_index = i + achievement_bools.len() + 2;
|
||||
let registered = prefs.contacts.contains(&contact.to_string());
|
||||
text.sections[text_index].style.color = if registered {
|
||||
settings.hud_color_achievement_accomplished
|
||||
} else {
|
||||
settings.hud_color_achievement
|
||||
};
|
||||
text.sections[text_index].value = if registered {
|
||||
chat::CONTACTS_PRETTY[i].to_string() + "\n"
|
||||
} else {
|
||||
String::from(chat::CONTACTS_UNKNOWN.to_string() + "\n")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Menu
|
||||
if let Ok(mut text) = q_text.get_single_mut() {
|
||||
for i in 0..text.sections.len() {
|
||||
if menustate.cursor == i {
|
||||
|
|
Loading…
Reference in a new issue