aboutsummaryrefslogtreecommitdiffstats
path: root/code/ui/overlay/DeathOverlay.razor
blob: 15848f66f83c9ba3070becc7f253d7968bdb5d63 (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
@using Sandbox;
@using Sandbox.UI;

@namespace MurderGame
@inherits Panel

<style>
@@keyframes fadeIn 
{
	0% { opacity: 0; }
	100% { opacity: 1; }
}
deathoverlay {
}
.overlay {
	position: absolute;
	left: 0;
	top: 0;
	width: 100vw;
	height: 100vh;

	background-color: rgba(80, 1, 1, 0.90);
	backdrop-filter-blur: 64px;
	animation-name: fadeIn;
	animation-duration: 2.5s;
	animation-iteration-count: 1;
	animation-timing-function: ease-in;
	animation-fill-mode: forwards;
}
.box {
	backdrop-filter-blur: 8px;
	background-color: rgba(0, 0, 0, 0.20);
	padding: 10px;
	color: white;
	font-weight: 700;
	font-size: 35px;
	font-family: "Roboto";
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 300px;
}
.box-container {
	position: absolute;
	left: 0;
	top: 0;
	width: 100vw;
	height: 100vh;

	display: flex;
	align-items: center;
	justify-content: flex-end;
	flex-direction: column;
}
</style>

@if (ShowOverlay)
{
<div class="overlay">
</div>
<div class="box-container">
	<div class="box">
	You have died
	</div>
</div>
}

@code
{
    public static DeathOverlay Instance { get; private set; }

    public DeathOverlay()
    {
        Instance = this;
    }

	public bool ShowOverlay { get; set; }

	protected override int BuildHash()
	{
		var clientPawn = Game.LocalPawn;
		if (clientPawn is Player player)
		{
			ShowOverlay = player.LifeState == LifeState.Dead && player.Spectator == null;
		}
        return ShowOverlay.GetHashCode();
    }

}