blob: fed61c0f6f450292b3f20501baff7c3b80e12a11 (
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
42
|
@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 {Camera: not null } player)
{
var colour = TeamOperations.GetTeamColour(player.Camera.GetObservedTeam());
return string.IsNullOrWhiteSpace(colour) ? "white" : colour;
}
return "white";
}
protected override int BuildHash()
{
return GetTeamColour().GetHashCode();
}
}
|