Skip to content

Commit

Permalink
Highlight current player in the leaderboard
Browse files Browse the repository at this point in the history
  • Loading branch information
vladbat00 committed Jan 23, 2023
1 parent 77bc001 commit 7363f3b
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions libs/client_lib/src/ui/player_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,23 @@ pub fn leaderboard_ui(
(_, _, Some((_, RespawnPlayerReason::Death))) => "💀",
_ => "",
};
ui.label(player_status_icon);
if player_params.current_player_net_id.0 == Some(*net_id) {
ui.add(egui::Label::new(egui::RichText::new(&player.nickname)));
} else {
ui.label(&player.nickname);

let columns = [
egui::RichText::new(player_status_icon),
egui::RichText::new(&player.nickname),
egui::RichText::new(format!("{}", player.finishes)),
egui::RichText::new(format!("{}", player.deaths)),
];

for column in columns {
let label = if player_params.current_player_net_id.0 == Some(*net_id) {
column.strong()
} else {
column
};
ui.add(egui::Label::new(label));
}
ui.label(format!("{}", player.finishes));
ui.label(format!("{}", player.deaths));

ui.label("");
ui.end_row();
}
Expand Down

0 comments on commit 7363f3b

Please sign in to comment.