From 8b69e65e51507118b014a0426ae6f957b78a0707 Mon Sep 17 00:00:00 2001 From: Leonardo Bishop Date: Thu, 27 Jul 2023 22:30:22 +0100 Subject: Reformat --- code/Game.cs | 6 -- code/entity/DroppedWeapon.cs | 2 +- code/event/MurderEvent.cs | 10 +-- code/team/Team.cs | 8 +- code/ui/Hud.razor | 4 +- code/ui/PlayerInfo.razor | 50 ++++++------ code/ui/health/Health.razor | 38 ++++----- code/ui/mainmenu/MainMenu.razor | 22 +++--- code/ui/overlay/BlindedOverlay.Network.cs | 24 +++--- code/ui/overlay/BlindedOverlay.razor | 70 ++++++++--------- code/ui/overlay/RoleOverlay.cs | 24 +++--- code/ui/overlay/RoleOverlay.razor | 126 +++++++++++++++--------------- code/ui/phase/PhaseInfo.razor | 18 ++--- code/ui/phase/PhaseTimer.razor | 66 ++++++++-------- code/ui/team/TeamInfo.razor | 34 ++++---- code/ui/weapon/Crosshair.razor | 16 ++-- code/weapon/Weapon.cs | 14 ++-- 17 files changed, 263 insertions(+), 269 deletions(-) diff --git a/code/Game.cs b/code/Game.cs index e603fda..f235df0 100644 --- a/code/Game.cs +++ b/code/Game.cs @@ -14,12 +14,6 @@ public partial class MurderGame : Sandbox.GameManager { Game.RootPanel = new Hud(); } - // if ( Game.IsServer ) - // { - // // The packageName should always match org.ident - // // In this case, we ask to download gvar.citizen_zombie -> https://asset.party/gvar/citizen_zombie - // DownloadAsset( "gvar.citizen_zombie" ); - // } } public static MurderGame Instance diff --git a/code/entity/DroppedWeapon.cs b/code/entity/DroppedWeapon.cs index f0cad67..0cea7da 100644 --- a/code/entity/DroppedWeapon.cs +++ b/code/entity/DroppedWeapon.cs @@ -27,7 +27,7 @@ public partial class DroppedWeapon : AnimatedEntity if ( !Game.IsServer ) return; if ( !other.Tags.Has( "livingplayer" ) ) return; - MurderGame.Player player = (MurderGame.Player)other; + MurderGame.Player player = (MurderGame.Player)other; if ( player.Inventory == null || player.Inventory.PrimaryWeapon != null || !player.Inventory.AllowPickup) return; diff --git a/code/event/MurderEvent.cs b/code/event/MurderEvent.cs index aed2a80..e197403 100644 --- a/code/event/MurderEvent.cs +++ b/code/event/MurderEvent.cs @@ -4,10 +4,10 @@ namespace MurderGame; public static class MurderEvent { - public const string Kill = "kill"; + public const string Kill = "kill"; - public class KillAttribute : EventAttribute - { - public KillAttribute() : base( Kill ) { } - } + public class KillAttribute : EventAttribute + { + public KillAttribute() : base( Kill ) { } + } } diff --git a/code/team/Team.cs b/code/team/Team.cs index e5cb8dd..ccca6eb 100644 --- a/code/team/Team.cs +++ b/code/team/Team.cs @@ -8,10 +8,10 @@ namespace MurderGame; public enum Team : ushort { - Spectator = 0, - Murderer = 1, - Detective = 2, - Bystander = 3 + Spectator = 0, + Murderer = 1, + Detective = 2, + Bystander = 3 } // why are c# enums so bad diff --git a/code/ui/Hud.razor b/code/ui/Hud.razor index 6ea6103..7ec500e 100644 --- a/code/ui/Hud.razor +++ b/code/ui/Hud.razor @@ -6,12 +6,12 @@ @attribute [StyleSheet] - + diff --git a/code/ui/PlayerInfo.razor b/code/ui/PlayerInfo.razor index 53a71df..2acdef0 100644 --- a/code/ui/PlayerInfo.razor +++ b/code/ui/PlayerInfo.razor @@ -5,18 +5,18 @@ @inherits Panel @@ -24,18 +24,18 @@ @code { - public string GetTeamColour() - { - var ClientPawn = Game.LocalPawn; - if (ClientPawn is Player) - { - return TeamOperations.GetTeamColour(((Player)ClientPawn).CurrentTeam); - } - return ""; - } + public string GetTeamColour() + { + var ClientPawn = Game.LocalPawn; + if (ClientPawn is Player) + { + return TeamOperations.GetTeamColour(((Player)ClientPawn).CurrentTeam); + } + return ""; + } - protected override int BuildHash() - { - return GetTeamColour().GetHashCode(); - } + protected override int BuildHash() + { + return GetTeamColour().GetHashCode(); + } } diff --git a/code/ui/health/Health.razor b/code/ui/health/Health.razor index 9d7037b..3da2c01 100644 --- a/code/ui/health/Health.razor +++ b/code/ui/health/Health.razor @@ -6,33 +6,33 @@
@code { - public string Colour { get; set; } + public string Colour { get; set; } - public int GetHealth() - { - var ClientPawn = Game.LocalPawn; - if (ClientPawn is Player) - { - return ClientPawn.Health.CeilToInt(); - } - return 0; - } + public int GetHealth() + { + var ClientPawn = Game.LocalPawn; + if (ClientPawn is Player) + { + return ClientPawn.Health.CeilToInt(); + } + return 0; + } - protected override int BuildHash() - { - return GetHealth().GetHashCode(); - } + protected override int BuildHash() + { + return GetHealth().GetHashCode(); + } } diff --git a/code/ui/mainmenu/MainMenu.razor b/code/ui/mainmenu/MainMenu.razor index ffca318..ccdf17a 100644 --- a/code/ui/mainmenu/MainMenu.razor +++ b/code/ui/mainmenu/MainMenu.razor @@ -7,22 +7,22 @@ -
Work in progress! Expect bugs, missing features, and general weird-ness. Things *will* break.
+
Work in progress! Expect bugs, missing features, and general weird-ness. Things *will* break.
diff --git a/code/ui/overlay/BlindedOverlay.Network.cs b/code/ui/overlay/BlindedOverlay.Network.cs index c81751e..0a80628 100644 --- a/code/ui/overlay/BlindedOverlay.Network.cs +++ b/code/ui/overlay/BlindedOverlay.Network.cs @@ -4,17 +4,17 @@ namespace MurderGame; public partial class BlindedOverlay { - [ClientRpc] - public static void Show( ) - { - Instance.SetClass( "hidden", false ); - Instance.ShowOverlay = true; - } + [ClientRpc] + public static void Show( ) + { + Instance.SetClass( "hidden", false ); + Instance.ShowOverlay = true; + } - [ClientRpc] - public static void Hide() - { - Instance.SetClass( "hidden", true ); - Instance.ShowOverlay = false; - } + [ClientRpc] + public static void Hide() + { + Instance.SetClass( "hidden", true ); + Instance.ShowOverlay = false; + } } diff --git a/code/ui/overlay/BlindedOverlay.razor b/code/ui/overlay/BlindedOverlay.razor index 024c31a..0cd397a 100644 --- a/code/ui/overlay/BlindedOverlay.razor +++ b/code/ui/overlay/BlindedOverlay.razor @@ -5,39 +5,39 @@ @inherits Panel
@@ -50,14 +50,14 @@ You shot a bystander! public bool ShowOverlay { get; set; } = false; - public BlindedOverlay() + public BlindedOverlay() { SetClass( "hidden", true ); Instance = this; } - protected override int BuildHash() + protected override int BuildHash() { return ShowOverlay.GetHashCode(); } diff --git a/code/ui/overlay/RoleOverlay.cs b/code/ui/overlay/RoleOverlay.cs index 84758b7..300d0bf 100644 --- a/code/ui/overlay/RoleOverlay.cs +++ b/code/ui/overlay/RoleOverlay.cs @@ -4,17 +4,17 @@ namespace MurderGame; public partial class RoleOverlay { - [ClientRpc] - public static void Show( ) - { - Instance.SetClass( "hidden", false ); - Instance.ShowOverlay = true; - } + [ClientRpc] + public static void Show( ) + { + Instance.SetClass( "hidden", false ); + Instance.ShowOverlay = true; + } - [ClientRpc] - public static void Hide() - { - Instance.SetClass( "hidden", true ); - Instance.ShowOverlay = false; - } + [ClientRpc] + public static void Hide() + { + Instance.SetClass( "hidden", true ); + Instance.ShowOverlay = false; + } } diff --git a/code/ui/overlay/RoleOverlay.razor b/code/ui/overlay/RoleOverlay.razor index c41e359..40cbce0 100644 --- a/code/ui/overlay/RoleOverlay.razor +++ b/code/ui/overlay/RoleOverlay.razor @@ -6,87 +6,87 @@ @inherits Panel
-
- @GetTeamName() -
-
- @GetTeamDescription() -
+
+ @GetTeamName() +
+
+ @GetTeamDescription() +
@code { - public string GetTeamName() - { - if (Game.LocalPawn is Player player) - { - return TeamOperations.GetTeamName(player.CurrentTeam); - } - return ""; - } - public string GetTeamDescription() - { - if (Game.LocalPawn is Player player) - { - return TeamOperations.GetTeamDescription(player.CurrentTeam); - } - return ""; - } - public string GetTeamColour() - { - if (Game.LocalPawn is Player player) - { - return TeamOperations.GetTeamColour(player.CurrentTeam); - } - return ""; - } + public string GetTeamName() + { + if (Game.LocalPawn is Player player) + { + return TeamOperations.GetTeamName(player.CurrentTeam); + } + return ""; + } + public string GetTeamDescription() + { + if (Game.LocalPawn is Player player) + { + return TeamOperations.GetTeamDescription(player.CurrentTeam); + } + return ""; + } + public string GetTeamColour() + { + if (Game.LocalPawn is Player player) + { + return TeamOperations.GetTeamColour(player.CurrentTeam); + } + return ""; + } public static RoleOverlay Instance { get; private set; } public bool ShowOverlay { get; set; } = false; - public RoleOverlay() + public RoleOverlay() { SetClass( "hidden", true ); Instance = this; } - protected override int BuildHash() + protected override int BuildHash() { return ShowOverlay.GetHashCode(); } diff --git a/code/ui/phase/PhaseInfo.razor b/code/ui/phase/PhaseInfo.razor index 74bf237..4509259 100644 --- a/code/ui/phase/PhaseInfo.razor +++ b/code/ui/phase/PhaseInfo.razor @@ -6,18 +6,18 @@ @attribute [StyleSheet]
- @GetPhase().Title + @GetPhase().Title
@code { - public BasePhase GetPhase() - { - return MurderGame.Instance.CurrentPhase; - } + public BasePhase GetPhase() + { + return MurderGame.Instance.CurrentPhase; + } - protected override int BuildHash() - { - return GetPhase().GetHashCode(); - } + protected override int BuildHash() + { + return GetPhase().GetHashCode(); + } } diff --git a/code/ui/phase/PhaseTimer.razor b/code/ui/phase/PhaseTimer.razor index 1fb0baa..9293976 100644 --- a/code/ui/phase/PhaseTimer.razor +++ b/code/ui/phase/PhaseTimer.razor @@ -7,55 +7,55 @@ @if (HasTime()) {
- @GetTime() + @GetTime()
} else {
- @GetPhase() + @GetPhase()
} @code { - public bool HasTime() - { - return MurderGame.Instance.CurrentPhase.TimeLeft >= 0; - } - public string GetTime() - { - TimeSpan timeSpan = TimeSpan.FromSeconds(MurderGame.Instance.CurrentPhase.TimeLeft); - return timeSpan.ToString(@"mm\:ss"); - } - public string GetPhase() - { - return MurderGame.Instance.CurrentPhase.Title; - } + public bool HasTime() + { + return MurderGame.Instance.CurrentPhase.TimeLeft >= 0; + } + public string GetTime() + { + TimeSpan timeSpan = TimeSpan.FromSeconds(MurderGame.Instance.CurrentPhase.TimeLeft); + return timeSpan.ToString(@"mm\:ss"); + } + public string GetPhase() + { + return MurderGame.Instance.CurrentPhase.Title; + } - protected override int BuildHash() - { - return HashCode.Combine(MurderGame.Instance.CurrentPhase.TimeLeft.GetHashCode(), MurderGame.Instance.CurrentPhase.Title.GetHashCode()); - } + protected override int BuildHash() + { + return HashCode.Combine(MurderGame.Instance.CurrentPhase.TimeLeft.GetHashCode(), MurderGame.Instance.CurrentPhase.Title.GetHashCode()); + } } diff --git a/code/ui/team/TeamInfo.razor b/code/ui/team/TeamInfo.razor index 18e1f7f..883dcf0 100644 --- a/code/ui/team/TeamInfo.razor +++ b/code/ui/team/TeamInfo.razor @@ -6,9 +6,9 @@ @@ -18,20 +18,20 @@ @code { - public string Colour { get; set; } + public string Colour { get; set; } - public string GetTeamName() - { - var ClientPawn = Game.LocalPawn; - if (ClientPawn is Player) - { - return TeamOperations.GetTeamName(((Player)ClientPawn).CurrentTeam); - } - return ""; - } + public string GetTeamName() + { + var ClientPawn = Game.LocalPawn; + if (ClientPawn is Player) + { + return TeamOperations.GetTeamName(((Player)ClientPawn).CurrentTeam); + } + return ""; + } - protected override int BuildHash() - { - return GetTeamName().GetHashCode(); - } + protected override int BuildHash() + { + return GetTeamName().GetHashCode(); + } } diff --git a/code/ui/weapon/Crosshair.razor b/code/ui/weapon/Crosshair.razor index 2dc5db1..92cdcd3 100644 --- a/code/ui/weapon/Crosshair.razor +++ b/code/ui/weapon/Crosshair.razor @@ -6,16 +6,16 @@ diff --git a/code/weapon/Weapon.cs b/code/weapon/Weapon.cs index 2af8ba6..4519adc 100644 --- a/code/weapon/Weapon.cs +++ b/code/weapon/Weapon.cs @@ -202,13 +202,13 @@ public partial class Weapon : AnimatedEntity vm.Owner = Owner; ViewModelEntity = vm; if (!string.IsNullOrEmpty(HandsModelPath)) - { - HandModelEntity = new BaseViewModel(); - HandModelEntity.Owner = Owner; - HandModelEntity.EnableViewmodelRendering = true; - HandModelEntity.SetModel(HandsModelPath); - HandModelEntity.SetParent(ViewModelEntity, true); - } + { + HandModelEntity = new BaseViewModel(); + HandModelEntity.Owner = Owner; + HandModelEntity.EnableViewmodelRendering = true; + HandModelEntity.SetModel(HandsModelPath); + HandModelEntity.SetParent(ViewModelEntity, true); + } } [ClientRpc] -- cgit v1.2.3-70-g09d2