diff --git a/godot/scenes/ui/player_listing.tscn b/godot/scenes/ui/player_listing.tscn index 73d247c..d574e5e 100644 --- a/godot/scenes/ui/player_listing.tscn +++ b/godot/scenes/ui/player_listing.tscn @@ -19,6 +19,7 @@ ping_high = ExtResource("3_kx1on") ping_high_color = Color(0.99999994, 0.22953579, 0.17418489, 1) ping_icon = NodePath("ping_icon") stats_button = NodePath("stats_button") +self_color = Color(1, 1, 0.41000003, 1) size_flags_horizontal = 3 theme = ExtResource("4_kx1on") diff --git a/rust/src/ui/player_listing.rs b/rust/src/ui/player_listing.rs index 1dd01a6..a592a63 100644 --- a/rust/src/ui/player_listing.rs +++ b/rust/src/ui/player_listing.rs @@ -35,6 +35,9 @@ pub struct PlayerListing { #[export] stats_button: Option>, + #[export] + self_color: Color, + pub player_id: Option, #[export] @@ -86,25 +89,38 @@ impl PlayerListing { pub fn update(&mut self) { if let Some(player_id) = self.player_id { if let Some(game) = Game::singleton() { + let is_self = player_id == game.bind().self_id.unwrap_or(0); if let Some(player) = game.bind().find_player(player_id) { if let Some(name_label) = &mut self.name_label { name_label.set_text(&player.data.name); + if is_self { + name_label.set_modulate(self.self_color); + } } if let Some(kills_label) = &mut self.kills_label { kills_label.set_text(&player.stats.kills.to_string()); + if is_self { + kills_label.set_modulate(self.self_color); + } } if let Some(deaths_label) = &mut self.deaths_label { deaths_label.set_text(&player.stats.deaths.to_string()); + if is_self { + deaths_label.set_modulate(self.self_color); + } } + + let (icon, color) = match player.data.ping { + ..100 => (self.ping_low.clone(), self.ping_low_color), + 100..200 => (self.ping_medium.clone(), self.ping_medium_color), + 200.. => (self.ping_high.clone(), self.ping_high_color), + }; + if let Some(ping_label) = &mut self.ping_label { ping_label.set_text(&player.data.ping.to_string()); + ping_label.set_modulate(color); } if let Some(ping_icon) = &mut self.ping_icon { - let (icon, color) = match player.data.ping { - ..100 => (self.ping_low.clone(), self.ping_low_color), - 100..200 => (self.ping_medium.clone(), self.ping_medium_color), - 200.. => (self.ping_high.clone(), self.ping_high_color), - }; if let Some(icon) = icon { ping_icon.set_texture(&icon); }