aboutsummaryrefslogtreecommitdiffstats
path: root/code/ui/PlayerInfo.razor
blob: 2acdef0c00af0bc58a420a1bbfd3dd5475865107 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
@using Sandbox;
@using Sandbox.UI;

@namespace MurderGame
@inherits Panel

<style>
playerinfo {
	position: absolute;
	left: 30px;
	bottom: 30px;
	background-color: rgba(0, 0, 0, 0.20);
	backdrop-filter-blur: 8px;
	display: flex;
	align-items: center;
	flex-direction: row;
	gap: 10px;
	padding: 10px;
}
</style>

<Health Colour="@GetTeamColour()"></Health>
<TeamInfo Colour="@GetTeamColour()"></TeamInfo>

@code
{
    public string GetTeamColour()
    {
        var ClientPawn = Game.LocalPawn;
        if (ClientPawn is Player)
        {
            return TeamOperations.GetTeamColour(((Player)ClientPawn).CurrentTeam);
        }
        return "";
    }

    protected override int BuildHash()
    {
        return GetTeamColour().GetHashCode();
    }
}