From 1e5c6393a6b29eb00dbb8fb137d86647cb0c356b Mon Sep 17 00:00:00 2001 From: Leonardo Bishop Date: Fri, 28 Jul 2023 22:06:03 +0100 Subject: Add TryUnstuck and death overlay --- code/ui/overlay/DeathOverlay.razor | 89 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 code/ui/overlay/DeathOverlay.razor (limited to 'code/ui/overlay/DeathOverlay.razor') diff --git a/code/ui/overlay/DeathOverlay.razor b/code/ui/overlay/DeathOverlay.razor new file mode 100644 index 0000000..15848f6 --- /dev/null +++ b/code/ui/overlay/DeathOverlay.razor @@ -0,0 +1,89 @@ +@using Sandbox; +@using Sandbox.UI; + +@namespace MurderGame +@inherits Panel + + + +@if (ShowOverlay) +{ +
+
+
+
+ You have died +
+
+} + +@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(); + } + +} \ No newline at end of file -- cgit v1.2.3-70-g09d2