diff options
| author | Leonardo Bishop <me@leonardobishop.com> | 2023-07-31 02:59:08 +0100 |
|---|---|---|
| committer | Leonardo Bishop <me@leonardobishop.com> | 2023-07-31 02:59:08 +0100 |
| commit | 7cc6031dc112f72698d60e4e42453cb9bef09351 (patch) | |
| tree | 83f86946c39b9b28e306e9f21f5d4772f3b5e4a4 /code/ui | |
| parent | 6d38a73a43db7eec57cecf980eebe6e610df4de4 (diff) | |
Add looking at info
Diffstat (limited to 'code/ui')
| -rw-r--r-- | code/ui/Hud.razor | 1 | ||||
| -rw-r--r-- | code/ui/character/LookingAtInfo.razor | 57 |
2 files changed, 58 insertions, 0 deletions
diff --git a/code/ui/Hud.razor b/code/ui/Hud.razor index 9fcdfdc..d6fe5b6 100644 --- a/code/ui/Hud.razor +++ b/code/ui/Hud.razor @@ -14,6 +14,7 @@ <BlindedOverlay/>
<RoleOverlay/>
<DeathOverlay/>
+ <LookingAtInfo/>
<ChatBox/>
<VoiceList/>
<PhaseTimer/>
diff --git a/code/ui/character/LookingAtInfo.razor b/code/ui/character/LookingAtInfo.razor new file mode 100644 index 0000000..4a54b81 --- /dev/null +++ b/code/ui/character/LookingAtInfo.razor @@ -0,0 +1,57 @@ +@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.20);
+ padding: 10px;
+ color: white; */
+ font-weight: 700;
+ font-size: 25px;
+ font-family: "Roboto";
+ margin-top: 60px;
+}
+.text {
+ text-shadow: 1px 1px 0px 0px rgba(0,0,0,0.75);
+}
+</style>
+
+<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;
+ }
+
+ public string GetLookingAtColour()
+ {
+ if (Game.LocalPawn is not Player player) return "white";
+ return player.LookingAt is not { } lookingAt ? "white" : lookingAt.HexColor;
+ }
+
+ protected override int BuildHash()
+ {
+ return GetLookingAtName().GetHashCode();
+ }
+}
|
