diff options
| author | Leonardo Bishop <me@leonardobishop.com> | 2023-08-06 17:21:45 +0100 |
|---|---|---|
| committer | Leonardo Bishop <me@leonardobishop.com> | 2023-08-06 17:21:45 +0100 |
| commit | 0bba89a7858ce091f485e04284f853e1f7f304af (patch) | |
| tree | 89ba42616e0f245cc84c96cc5b353eea117057d0 /code/ui/spectator | |
| parent | 87d74b50bf443bf199be05bd03afdca6ece082ff (diff) | |
Diffstat (limited to 'code/ui/spectator')
| -rw-r--r-- | code/ui/spectator/Spectator.razor | 55 |
1 files changed, 27 insertions, 28 deletions
diff --git a/code/ui/spectator/Spectator.razor b/code/ui/spectator/Spectator.razor index fe0d662..3853233 100644 --- a/code/ui/spectator/Spectator.razor +++ b/code/ui/spectator/Spectator.razor @@ -1,9 +1,7 @@ -@using Sandbox;
-@using Sandbox.UI;
-@using System;
-
@namespace MurderGame
-@inherits Panel
+@using System
+@using Sandbox
+@inherits Sandbox.UI.Panel
<style>
spectator {
@@ -29,31 +27,32 @@ spectator { }
</style>
-@if (Spectating) {
-<div class="box">
- <div>Spectating @TargetName</div>
-</div>
+@if (Spectating)
+{
+ <div class="box">
+ <div>Spectating @TargetName</div>
+ </div>
}
@code
{
- public bool Spectating { get; set; }
- public string TargetName { get; set; }
+ public bool Spectating { get; set; }
+ public string TargetName { get; set; }
- protected override int BuildHash()
- {
- var localPawn = Game.LocalPawn;
- if (localPawn is Player player && player.Camera is SpectatorCameraComponent spectator)
- {
- var target = spectator.Target;
- Spectating = true;
- TargetName = (target != null && target.IsValid() && target.LifeState == LifeState.Alive) ? target.Client.Name : "";
- return HashCode.Combine(Spectating.GetHashCode(), TargetName.GetHashCode());
- }
- if (Spectating)
- {
- Spectating = false;
- }
- return Spectating.GetHashCode();
- }
-}
+ protected override int BuildHash()
+ {
+ var localPawn = Game.LocalPawn;
+ if (localPawn is Player player && player.Camera is SpectatorCameraComponent spectator)
+ {
+ var target = spectator.Target;
+ Spectating = true;
+ TargetName = target != null && target.IsValid() && target.LifeState == LifeState.Alive ? target.Client.Name : "";
+ return HashCode.Combine(Spectating.GetHashCode(), TargetName.GetHashCode());
+ }
+ if (Spectating)
+ {
+ Spectating = false;
+ }
+ return Spectating.GetHashCode();
+ }
+}
\ No newline at end of file |
