aboutsummaryrefslogtreecommitdiffstats
path: root/code/ui/character/LookingAtInfo.razor
blob: 3c9bbab82a1f80eac1c67b72b20be7bfa9f57f19 (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
43
44
45
46
47
48
49
50
51
52
53
54
@namespace MurderGame
@using Sandbox
@inherits Sandbox.UI.Panel

<style>
lookingatinfo {
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	position: absolute;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-direction: column;
}
.box {
	font-weight: 700;
	font-size: 20px;
	font-family: "Roboto";
	margin-top: 100px;
	text-shadow: 1px 1px 0 0 rgba(0,0,0,0.75);
}
.text {
	/* text-shadow: 1px 1px 0px 0px rgba(0,0,0,0.75); */
}
</style>

@if (GetLookingAtName() != "")
{
    <smallbox class="box" style="color: @GetLookingAtColour()">
        <span class="text">@GetLookingAtName()</span>
    </smallbox>
}

@code
{
    public string GetLookingAtName()
    {
        if (Game.LocalPawn is not Player player) return "";
        return player.LookingAt is not { } lookingAt ? "" : lookingAt.CharacterName ?? lookingAt.Client.Name;
    }

    public string GetLookingAtColour()
    {
        if (Game.LocalPawn is not Player player) return "white";
        return player.LookingAt is not { } lookingAt ? "white" : string.IsNullOrWhiteSpace(lookingAt.HexColor) ? "white" : lookingAt.HexColor;
    }

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