blob: dceb6270fd2fcd448ee219c14cf8df824e5d440e (
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
55
56
57
58
59
60
|
@using Sandbox;
@using Sandbox.UI;
@using System;
@namespace MurderGame
@inherits 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 {
backdrop-filter-blur: 8px;
background-color: rgba(0, 0, 0, 0.10);
padding: 5px;
color: white;
font-weight: 700;
font-size: 20px;
font-family: "Roboto";
margin-top: 100px;
}
.text {
/* text-shadow: 1px 1px 0px 0px rgba(0,0,0,0.75); */
}
</style>
@if (GetLookingAtName() != "")
{
<div class="box" style="color: @GetLookingAtColour()">
<span class="text">@GetLookingAtName()</span>
</div>
}
@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();
}
}
|