diff options
| author | Leonardo Bishop <me@leonardobishop.com> | 2023-07-30 19:12:09 +0100 |
|---|---|---|
| committer | Leonardo Bishop <me@leonardobishop.com> | 2023-07-30 19:12:09 +0100 |
| commit | 4ae38adb208c435ff6a021cdd0517768c5314fe6 (patch) | |
| tree | 18ccbffd5fd3d385983ba41f3cd0031586995733 /code/ui/PlayerInfo.razor | |
| parent | 970e3de202b1482ae72b85487414d9b933818774 (diff) | |
Add observed health and team colours to spectator mode
Diffstat (limited to 'code/ui/PlayerInfo.razor')
| -rw-r--r-- | code/ui/PlayerInfo.razor | 9 |
1 files changed, 5 insertions, 4 deletions
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()
|
