From 0bba89a7858ce091f485e04284f853e1f7f304af Mon Sep 17 00:00:00 2001 From: Leonardo Bishop Date: Sun, 6 Aug 2023 17:21:45 +0100 Subject: Reformat --- code/ui/Hud.razor | 6 +- code/ui/Hud.razor.scss | 30 +-- code/ui/PlayerInfo.razor | 44 ++-- code/ui/character/LookingAtInfo.razor | 45 ++-- code/ui/character/NameInfo.razor | 10 +- code/ui/component/Box.razor | 7 +- code/ui/component/SmallBox.razor | 7 +- code/ui/health/Health.razor | 8 +- code/ui/mainmenu/LoadingScreen.razor | 19 +- code/ui/mainmenu/LoadingScreen.razor.scss | 161 ++++++------ code/ui/mainmenu/MainMenu.razor | 9 +- code/ui/mainmenu/MainMenu.razor.scss | 403 ++++++++++++++---------------- code/ui/overlay/BlindedOverlay.Network.cs | 24 +- code/ui/overlay/BlindedOverlay.razor | 9 +- code/ui/overlay/DeathOverlay.Network.cs | 26 +- code/ui/overlay/DeathOverlay.razor | 29 +-- code/ui/overlay/RoleOverlay.Network.cs | 24 +- code/ui/overlay/RoleOverlay.razor | 13 +- code/ui/overlay/TabListEntry.cs | 20 +- code/ui/overlay/TabListOverlay.razor | 61 +++-- code/ui/phase/PhaseInfo.razor | 14 +- code/ui/phase/PhaseTimer.razor | 28 +-- code/ui/spectator/Spectator.razor | 55 ++-- code/ui/team/TeamInfo.razor | 10 +- code/ui/weapon/Crosshair.razor | 8 +- code/ui/weapon/Reload.razor | 65 +++-- 26 files changed, 527 insertions(+), 608 deletions(-) (limited to 'code/ui') diff --git a/code/ui/Hud.razor b/code/ui/Hud.razor index d5e3a40..c7d1ffa 100644 --- a/code/ui/Hud.razor +++ b/code/ui/Hud.razor @@ -1,8 +1,6 @@ -@using Sandbox; -@using Sandbox.UI; - @namespace MurderGame -@inherits RootPanel +@using Sandbox.UI +@inherits Sandbox.UI.RootPanel @attribute [StyleSheet] - - + + - + @code @@ -38,25 +36,25 @@ playerinfo { var clientPawn = Game.LocalPawn; if (clientPawn is Player {Camera: not null } player) { - var colour = player.Camera.GetObservedColour(); - return string.IsNullOrWhiteSpace(colour) ? "white" : colour; + var colour = player.Camera.GetObservedColour(); + return string.IsNullOrWhiteSpace(colour) ? "white" : colour; + } + return "white"; + } + + public string GetTeamColour() + { + var clientPawn = Game.LocalPawn; + if (clientPawn is Player {Camera: not null } player) + { + var colour = TeamOperations.GetTeamColour(player.Camera.GetObservedTeam()); + return string.IsNullOrWhiteSpace(colour) ? "white" : colour; } return "white"; } - - public string GetTeamColour() - { - var clientPawn = Game.LocalPawn; - if (clientPawn is Player {Camera: not null } player) - { - var colour = TeamOperations.GetTeamColour(player.Camera.GetObservedTeam()); - return string.IsNullOrWhiteSpace(colour) ? "white" : colour; - } - return "white"; - } protected override int BuildHash() { - return HashCode.Combine(GetTeamColour().GetHashCode(), GetTeamColour().GetHashCode()); + return HashCode.Combine(GetTeamColour().GetHashCode(), GetTeamColour().GetHashCode()); } -} +} \ No newline at end of file diff --git a/code/ui/character/LookingAtInfo.razor b/code/ui/character/LookingAtInfo.razor index ab43527..3c9bbab 100644 --- a/code/ui/character/LookingAtInfo.razor +++ b/code/ui/character/LookingAtInfo.razor @@ -1,9 +1,6 @@ -@using Sandbox; -@using Sandbox.UI; -@using System; - @namespace MurderGame -@inherits Panel +@using Sandbox +@inherits Sandbox.UI.Panel
-@GetName() + @GetName()
@code @@ -35,4 +33,4 @@ { return GetName().GetHashCode(); } -} +} \ No newline at end of file diff --git a/code/ui/component/Box.razor b/code/ui/component/Box.razor index a1a88d3..ee0b1e4 100644 --- a/code/ui/component/Box.razor +++ b/code/ui/component/Box.razor @@ -1,8 +1,5 @@ -@using Sandbox.Razor -@using Sandbox.UI; - @namespace MurderGame -@inherits Panel +@inherits Sandbox.UI.Panel + \ No newline at end of file diff --git a/code/ui/component/SmallBox.razor b/code/ui/component/SmallBox.razor index f5775aa..2149da2 100644 --- a/code/ui/component/SmallBox.razor +++ b/code/ui/component/SmallBox.razor @@ -1,8 +1,5 @@ -@using Sandbox.Razor -@using Sandbox.UI; - @namespace MurderGame -@inherits Panel +@inherits Sandbox.UI.Panel + \ No newline at end of file diff --git a/code/ui/health/Health.razor b/code/ui/health/Health.razor index d350756..4ec7f67 100644 --- a/code/ui/health/Health.razor +++ b/code/ui/health/Health.razor @@ -1,8 +1,6 @@ -@using Sandbox; -@using Sandbox.UI; - @namespace MurderGame -@inherits Panel +@using Sandbox +@inherits Sandbox.UI.Panel
-You shot a bystander! + You shot a bystander!
@code @@ -52,7 +49,7 @@ You shot a bystander! public BlindedOverlay() { - SetClass( "hidden", true ); + SetClass("hidden", true); Instance = this; } diff --git a/code/ui/overlay/DeathOverlay.Network.cs b/code/ui/overlay/DeathOverlay.Network.cs index f1f3bb2..33e354c 100644 --- a/code/ui/overlay/DeathOverlay.Network.cs +++ b/code/ui/overlay/DeathOverlay.Network.cs @@ -4,15 +4,21 @@ namespace MurderGame; public partial class DeathOverlay { - [ClientRpc] - public static void Show( ) - { - if (Instance != null) Instance.ShowOverlay = true; - } + [ClientRpc] + public static void Show() + { + if ( Instance != null ) + { + Instance.ShowOverlay = true; + } + } - [ClientRpc] - public static void Hide() - { - if (Instance != null) Instance.ShowOverlay = false; - } + [ClientRpc] + public static void Hide() + { + if ( Instance != null ) + { + Instance.ShowOverlay = false; + } + } } diff --git a/code/ui/overlay/DeathOverlay.razor b/code/ui/overlay/DeathOverlay.razor index 23c3a17..7751a38 100644 --- a/code/ui/overlay/DeathOverlay.razor +++ b/code/ui/overlay/DeathOverlay.razor @@ -1,8 +1,5 @@ -@using Sandbox; -@using Sandbox.UI; - @namespace MurderGame -@inherits Panel +@inherits Sandbox.UI.Panel
-
- Murder - This game mode is still a work in progress. Source code available at https://github.com/LMBishop/murder. -
+
+ Murder + This game mode is still a work in progress. Source code available at https://github.com/LMBishop/murder. +
-
-
- Name - Ping -
+
+
+ Name + Ping +
-
+
-
-
+
+
@code { - Dictionary Entries = new(); - + readonly Dictionary Entries = new(); + public Panel List { get; set; } public static TabListOverlay Instance { get; private set; } @@ -105,38 +104,38 @@ tablistoverlay { Instance = this; } - public bool IsOpen => Input.Down( "score" ); + public bool IsOpen => Input.Down("score"); public override void Tick() { base.Tick(); - SetClass( "hidden", !IsOpen ); + SetClass("hidden", !IsOpen); - if ( !IsVisible ) + if (!IsVisible) return; - foreach ( IClient cl in Game.Clients.Except( Entries.Keys ) ) + foreach (var cl in Game.Clients.Except(Entries.Keys)) { TabListEntry entry = new(); Entries.Add(cl, entry); entry.UpdateFrom(cl); - entry.Parent = List; + entry.Parent = List; } - foreach ( IClient cl in Entries.Keys.Except( Game.Clients ) ) + foreach (var cl in Entries.Keys.Except(Game.Clients)) { - if( Entries.TryGetValue( cl, out var entry ) ) + if (Entries.TryGetValue(cl, out var entry)) { entry.Delete(); - Entries.Remove( cl ); + Entries.Remove(cl); } } - - // foreach ( var entry in Entries ) - // { - // entry.Value.Parent = List; - // } + + // foreach ( var entry in Entries ) + // { + // entry.Value.Parent = List; + // } } } \ No newline at end of file diff --git a/code/ui/phase/PhaseInfo.razor b/code/ui/phase/PhaseInfo.razor index 4509259..7c95da5 100644 --- a/code/ui/phase/PhaseInfo.razor +++ b/code/ui/phase/PhaseInfo.razor @@ -1,8 +1,6 @@ -@using Sandbox; -@using Sandbox.UI; - @namespace MurderGame -@inherits Panel +@using Sandbox.UI +@inherits Sandbox.UI.Panel @attribute [StyleSheet]
@@ -16,8 +14,8 @@ return MurderGame.Instance.CurrentPhase; } - protected override int BuildHash() - { - return GetPhase().GetHashCode(); + protected override int BuildHash() + { + return GetPhase().GetHashCode(); } -} +} \ No newline at end of file diff --git a/code/ui/phase/PhaseTimer.razor b/code/ui/phase/PhaseTimer.razor index 73f44e2..89766cb 100644 --- a/code/ui/phase/PhaseTimer.razor +++ b/code/ui/phase/PhaseTimer.razor @@ -1,9 +1,6 @@ -@using Sandbox; -@using System -@using Sandbox.UI; - @namespace MurderGame -@inherits Panel +@using System +@inherits Sandbox.UI.Panel -@if (Spectating) { -
-
Spectating @TargetName
-
+@if (Spectating) +{ +
+
Spectating @TargetName
+
} @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 diff --git a/code/ui/team/TeamInfo.razor b/code/ui/team/TeamInfo.razor index 71a2d66..cf5a7f8 100644 --- a/code/ui/team/TeamInfo.razor +++ b/code/ui/team/TeamInfo.razor @@ -1,8 +1,6 @@ -@using Sandbox; -@using Sandbox.UI; - @namespace MurderGame -@inherits Panel +@using Sandbox +@inherits Sandbox.UI.Panel
-@GetTeamName() + @GetTeamName()
@code @@ -35,4 +33,4 @@ { return GetTeamName().GetHashCode(); } -} +} \ No newline at end of file diff --git a/code/ui/weapon/Crosshair.razor b/code/ui/weapon/Crosshair.razor index 92cdcd3..f2196db 100644 --- a/code/ui/weapon/Crosshair.razor +++ b/code/ui/weapon/Crosshair.razor @@ -1,8 +1,5 @@ -@using Sandbox; -@using Sandbox.UI; - @namespace MurderGame -@inherits Panel +@inherits Sandbox.UI.Panel -
- +
\ No newline at end of file diff --git a/code/ui/weapon/Reload.razor b/code/ui/weapon/Reload.razor index 190a84c..22609e3 100644 --- a/code/ui/weapon/Reload.razor +++ b/code/ui/weapon/Reload.razor @@ -1,9 +1,7 @@ -@using Sandbox; -@using Sandbox.UI; -@using System; - @namespace MurderGame -@inherits Panel +@using System +@using Sandbox +@inherits Sandbox.UI.Panel -@if (ReloadNeeded) { - - +@if (ReloadNeeded) +{ + + } @code { - public bool ReloadNeeded { get; set; } - public bool Blink { get; set; } + public bool ReloadNeeded { get; set; } + public bool Blink { get; set; } - protected override int BuildHash() - { - var clientPawn = Game.LocalPawn; + protected override int BuildHash() + { + var clientPawn = Game.LocalPawn; if (clientPawn is Player {Camera: not null } player) - { - var inventory = player.Camera.GetObservedInventory(); - if (inventory?.GetCurrentWeapon() != null) - { - var weapon = inventory.GetCurrentWeapon(); - var ammo = weapon.Ammo; - ReloadNeeded = ammo == 0 && !weapon.Reloading; - Blink = !weapon.Reloading; - return HashCode.Combine(ReloadNeeded.GetHashCode(), Blink.GetHashCode()); - } - } - if (ReloadNeeded) - { - ReloadNeeded = false; - } - return ReloadNeeded.GetHashCode(); - } -} + { + var inventory = player.Camera.GetObservedInventory(); + if (inventory?.GetCurrentWeapon() != null) + { + var weapon = inventory.GetCurrentWeapon(); + var ammo = weapon.Ammo; + ReloadNeeded = ammo == 0 && !weapon.Reloading; + Blink = !weapon.Reloading; + return HashCode.Combine(ReloadNeeded.GetHashCode(), Blink.GetHashCode()); + } + } + if (ReloadNeeded) + { + ReloadNeeded = false; + } + return ReloadNeeded.GetHashCode(); + } +} \ No newline at end of file -- cgit v1.2.3-70-g09d2