prettier reply formatting

This commit is contained in:
yuni 2024-03-20 18:54:22 +01:00
parent 538ad92e3a
commit e3e8278d03

View file

@ -12,6 +12,8 @@ pub const LOG_MAX_TIME_S: u64 = 20;
pub const CHOICE_NONE: &str = ""; pub const CHOICE_NONE: &str = "";
pub const AMBIENT_LIGHT: f32 = 0.0; // Space is DARK pub const AMBIENT_LIGHT: f32 = 0.0; // Space is DARK
pub const AMBIENT_LIGHT_AR: f32 = 20.0; pub const AMBIENT_LIGHT_AR: f32 = 20.0;
//pub const REPLY_NUMBERS: [char; 10] = ['❶', '❷', '❸', '❹', '❺', '❻', '❼', '❽', '❾', '⓿'];
pub const REPLY_NUMBERS: [char; 10] = ['①', '②', '③', '④', '⑤', '⑥', '⑦', '⑧', '⑨', '⑩'];
pub struct HudPlugin; pub struct HudPlugin;
impl Plugin for HudPlugin { impl Plugin for HudPlugin {
@ -370,10 +372,16 @@ fn update(
if let Ok(mut chat) = query_chat.get_single_mut() { if let Ok(mut chat) = query_chat.get_single_mut() {
// Choices // Choices
let mut choices: Vec<String> = Vec::new(); let mut choices: Vec<String> = Vec::new();
let mut count = 1; let mut count = 0;
for choice in &q_choices { for choice in &q_choices {
choices.push(format!("({}) <{}> {}", if count > 9 {
count, choice.recipient, choice.text)); break;
}
let press_this = REPLY_NUMBERS[count];
let reply = &choice.text;
//let recipient = &choice.recipient;
// TODO: indicate recipients if there's more than one
choices.push(format!("{press_this} {reply}"));
count += 1; count += 1;
} }
chat.sections[2].value = choices.join("\n"); chat.sections[2].value = choices.join("\n");