diff options
Diffstat (limited to 'code/ui/character')
| -rw-r--r-- | code/ui/character/NameInfo.razor | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/code/ui/character/NameInfo.razor b/code/ui/character/NameInfo.razor new file mode 100644 index 0000000..8b6dce1 --- /dev/null +++ b/code/ui/character/NameInfo.razor @@ -0,0 +1,37 @@ +@using Sandbox;
+@using Sandbox.UI;
+
+@namespace MurderGame
+@inherits Panel
+
+<style>
+.team-info {
+ font-size: 30px;
+ font-weight: 700;
+ font-family: "Roboto";
+}
+</style>
+
+<div class="team-info" style="color: @(Colour)">
+@GetName()
+</div>
+
+@code
+{
+ public string Colour { get; set; }
+
+ public string GetName()
+ {
+ var clientPawn = Game.LocalPawn;
+ if (clientPawn is Player {Camera: not null } player)
+ {
+ return player.Camera.GetObservedName();
+ }
+ return "";
+ }
+
+ protected override int BuildHash()
+ {
+ return GetName().GetHashCode();
+ }
+}
|
