From e3e8278d03c62eecdd54411050c59d0d10b194fe Mon Sep 17 00:00:00 2001 From: hut Date: Wed, 20 Mar 2024 18:54:22 +0100 Subject: [PATCH] prettier reply formatting --- src/hud.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/hud.rs b/src/hud.rs index aaf504c..d0397aa 100644 --- a/src/hud.rs +++ b/src/hud.rs @@ -12,6 +12,8 @@ pub const LOG_MAX_TIME_S: u64 = 20; pub const CHOICE_NONE: &str = ""; pub const AMBIENT_LIGHT: f32 = 0.0; // Space is DARK pub const AMBIENT_LIGHT_AR: f32 = 20.0; +//pub const REPLY_NUMBERS: [char; 10] = ['❶', '❷', '❸', '❹', '❺', '❻', '❼', '❽', '❾', '⓿']; +pub const REPLY_NUMBERS: [char; 10] = ['①', '②', '③', '④', '⑤', '⑥', '⑦', '⑧', '⑨', '⑩']; pub struct HudPlugin; impl Plugin for HudPlugin { @@ -370,10 +372,16 @@ fn update( if let Ok(mut chat) = query_chat.get_single_mut() { // Choices let mut choices: Vec = Vec::new(); - let mut count = 1; + let mut count = 0; for choice in &q_choices { - choices.push(format!("({}) <{}> {}", - count, choice.recipient, choice.text)); + if count > 9 { + 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; } chat.sections[2].value = choices.join("\n");