From 4ae38adb208c435ff6a021cdd0517768c5314fe6 Mon Sep 17 00:00:00 2001 From: Leonardo Bishop Date: Sun, 30 Jul 2023 19:12:09 +0100 Subject: Add observed health and team colours to spectator mode --- code/ui/PlayerInfo.razor | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'code/ui/PlayerInfo.razor') diff --git a/code/ui/PlayerInfo.razor b/code/ui/PlayerInfo.razor index 2acdef0..fed61c0 100644 --- a/code/ui/PlayerInfo.razor +++ b/code/ui/PlayerInfo.razor @@ -26,12 +26,13 @@ playerinfo { { public string GetTeamColour() { - var ClientPawn = Game.LocalPawn; - if (ClientPawn is Player) + var clientPawn = Game.LocalPawn; + if (clientPawn is Player {Camera: not null } player) { - return TeamOperations.GetTeamColour(((Player)ClientPawn).CurrentTeam); + var colour = TeamOperations.GetTeamColour(player.Camera.GetObservedTeam()); + return string.IsNullOrWhiteSpace(colour) ? "white" : colour; } - return ""; + return "white"; } protected override int BuildHash() -- cgit v1.2.3-70-g09d2