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 | |
| parent | 87d74b50bf443bf199be05bd03afdca6ece082ff (diff) | |
Diffstat (limited to 'code/ui')
26 files changed, 506 insertions, 587 deletions
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]
<style>
.hidden {
diff --git a/code/ui/Hud.razor.scss b/code/ui/Hud.razor.scss index fe07ac5..2f236d1 100644 --- a/code/ui/Hud.razor.scss +++ b/code/ui/Hud.razor.scss @@ -1,21 +1,17 @@ -Hud
-{
- .header
- {
- left: 128px;
- top: 128px;
- flex-direction: column;
+Hud {
+ .header {
+ left: 128px;
+ top: 128px;
+ flex-direction: column;
- label
- {
- font-family: Roboto;
- color: white;
- font-size: 32px;
+ label {
+ font-family: Roboto;
+ color: white;
+ font-size: 32px;
- &.subtitle
- {
- font-size: 16px;
- }
- }
+ &.subtitle {
+ font-size: 16px;
+ }
}
+ }
}
diff --git a/code/ui/PlayerInfo.razor b/code/ui/PlayerInfo.razor index 131b278..9b6a2fe 100644 --- a/code/ui/PlayerInfo.razor +++ b/code/ui/PlayerInfo.razor @@ -1,9 +1,7 @@ -@using System
-@using Sandbox;
-@using Sandbox.UI;
-
@namespace MurderGame
-@inherits Panel
+@using System
+@using Sandbox
+@inherits Sandbox.UI.Panel
<style>
playerinfo {
@@ -24,11 +22,11 @@ playerinfo { </style>
<box class="playerinfo">
- <Health Colour="@GetCharacterColour()"></Health>
- <NameInfo Colour="@GetCharacterColour()"></NameInfo>
+ <Health Colour="@GetCharacterColour()"></Health>
+ <NameInfo Colour="@GetCharacterColour()"></NameInfo>
</box>
<box class="teaminfo">
- <TeamInfo Colour="@GetTeamColour()"></TeamInfo>
+ <TeamInfo Colour="@GetTeamColour()"></TeamInfo>
</box>
@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
<style>
lookingatinfo {
@@ -31,27 +28,27 @@ lookingatinfo { @if (GetLookingAtName() != "")
{
-<smallbox class="box" style="color: @GetLookingAtColour()">
- <span class="text">@GetLookingAtName()</span>
-</smallbox>
+ <smallbox class="box" style="color: @GetLookingAtColour()">
+ <span class="text">@GetLookingAtName()</span>
+ </smallbox>
}
@code
{
- public string GetLookingAtName()
- {
- if (Game.LocalPawn is not Player player) return "";
- return player.LookingAt is not { } lookingAt ? "" : (lookingAt.CharacterName ?? lookingAt.Client.Name);
- }
-
- public string GetLookingAtColour()
- {
- if (Game.LocalPawn is not Player player) return "white";
- return player.LookingAt is not { } lookingAt ? "white" : (string.IsNullOrWhiteSpace(lookingAt.HexColor) ? "white" : lookingAt.HexColor);
- }
+ public string GetLookingAtName()
+ {
+ if (Game.LocalPawn is not Player player) return "";
+ return player.LookingAt is not { } lookingAt ? "" : lookingAt.CharacterName ?? lookingAt.Client.Name;
+ }
- protected override int BuildHash()
- {
- return GetLookingAtName().GetHashCode();
- }
-}
+ public string GetLookingAtColour()
+ {
+ if (Game.LocalPawn is not Player player) return "white";
+ return player.LookingAt is not { } lookingAt ? "white" : string.IsNullOrWhiteSpace(lookingAt.HexColor) ? "white" : lookingAt.HexColor;
+ }
+
+ protected override int BuildHash()
+ {
+ return GetLookingAtName().GetHashCode();
+ }
+}
\ No newline at end of file diff --git a/code/ui/character/NameInfo.razor b/code/ui/character/NameInfo.razor index f0a7488..69b7bca 100644 --- a/code/ui/character/NameInfo.razor +++ b/code/ui/character/NameInfo.razor @@ -1,8 +1,6 @@ -@using Sandbox;
-@using Sandbox.UI;
-
@namespace MurderGame
-@inherits Panel
+@using Sandbox
+@inherits Sandbox.UI.Panel
<style>
.team-info {
@@ -14,7 +12,7 @@ </style>
<div class="team-info" style="color: @(Colour)">
-@GetName()
+ @GetName()
</div>
@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
<style>
box {
@@ -14,4 +11,4 @@ box { padding: 10px;
backdrop-filter-blur: 2px;
}
-</style>
+</style>
\ 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
<style>
smallbox {
@@ -14,4 +11,4 @@ smallbox { padding: 5px;
backdrop-filter-blur: 2px;
}
-</style>
+</style>
\ 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
<style>
Health {
@@ -43,4 +41,4 @@ Health { {
return GetHealth().GetHashCode();
}
-}
+}
\ No newline at end of file diff --git a/code/ui/mainmenu/LoadingScreen.razor b/code/ui/mainmenu/LoadingScreen.razor index 9e3e5ae..5954065 100644 --- a/code/ui/mainmenu/LoadingScreen.razor +++ b/code/ui/mainmenu/LoadingScreen.razor @@ -1,11 +1,10 @@ -@using System
-@using Sandbox;
-@using Sandbox.UI;
-@using Sandbox.Menu;
@attribute [StyleSheet]
-@inherits RootPanel
+@inherits Sandbox.UI.RootPanel
@namespace DmMenu
-@implements Sandbox.Menu.ILoadingScreenPanel
+@using Sandbox
+@using Sandbox.Menu
+@using Sandbox.UI
+@implements ILoadingScreenPanel
<root class="loadingpanel">
@@ -16,8 +15,10 @@ {
<div class="progress">
<div class="bar" style="width: @(Progress.Percent)%;"></div>
- <div class="text-left">@(Progress.Percent.ToString("0") )%</div>
- <div class="text-right"><span>@(Progress.Mbps.ToString("0"))</span><span class="unit">Mbps</span></div>
+ <div class="text-left">@(Progress.Percent.ToString("0"))%</div>
+ <div class="text-right">
+ <span>@(Progress.Mbps.ToString("0"))</span><span class="unit">Mbps</span>
+ </div>
</div>
}
@@ -33,7 +34,7 @@ {
public LoadingProgress Progress;
- public void OnLoadingProgress( LoadingProgress progress )
+ public void OnLoadingProgress(LoadingProgress progress)
{
Progress = progress;
StateHasChanged();
diff --git a/code/ui/mainmenu/LoadingScreen.razor.scss b/code/ui/mainmenu/LoadingScreen.razor.scss index 894d259..026bafa 100644 --- a/code/ui/mainmenu/LoadingScreen.razor.scss +++ b/code/ui/mainmenu/LoadingScreen.razor.scss @@ -1,101 +1,88 @@ -.loadingpanel
-{
- background-image: url( "menu/boxes.webm" );
- background-position: center;
- background-size: cover;
- background-tint: #555;
- width: 100%;
- height: 100%;
- color: white;
- padding: 100px;
- justify-content: center;
- align-items: center;
- flex-direction: column;
- font-family: Poppins;
- pointer-events: all;
- color: #ccc;
+.loadingpanel {
+ background-image: url("menu/boxes.webm");
+ background-position: center;
+ background-size: cover;
+ background-tint: #555;
+ width: 100%;
+ height: 100%;
+ color: white;
+ padding: 100px;
+ justify-content: center;
+ align-items: center;
+ flex-direction: column;
+ font-family: Poppins;
+ pointer-events: all;
+ color: #ccc;
- > .title
- {
- font-size: 80px;
- font-weight: bolder;
- }
+ > .title {
+ font-size: 80px;
+ font-weight: bolder;
+ }
- > .subtitle
- {
- font-size: 30px;
- color: #aaa;
- font-weight: 200;
- }
+ > .subtitle {
+ font-size: 30px;
+ color: #aaa;
+ font-weight: 200;
+ }
- > .controls
- {
- position: absolute;
- bottom: 100px;
- right: 200px;
+ > .controls {
+ position: absolute;
+ bottom: 100px;
+ right: 200px;
- .button
- {
- font-size: 20px;
- padding: 10px 50px;
- background-color: #666;
- color: #111;
- font-weight: bold;
- cursor: pointer;
+ .button {
+ font-size: 20px;
+ padding: 10px 50px;
+ background-color: #666;
+ color: #111;
+ font-weight: bold;
+ cursor: pointer;
- &:hover
- {
- background-color: #888;
- }
- }
- }
+ &:hover {
+ background-color: #888;
+ }
+ }
+ }
- > .progress
- {
- margin: 50px 0px;
- background-color: #0003;
- width: 500px;
- border-radius: 5px;
- overflow: hidden;
+ > .progress {
+ margin: 50px 0px;
+ background-color: #0003;
+ width: 500px;
+ border-radius: 5px;
+ overflow: hidden;
- .bar
- {
- background-color: #fff1;
- position: absolute;
- height: 100%;
- }
+ .bar {
+ background-color: #fff1;
+ position: absolute;
+ height: 100%;
+ }
- .text-left
- {
- flex-grow: 1;
- flex-shrink: 0;
- }
+ .text-left {
+ flex-grow: 1;
+ flex-shrink: 0;
+ }
- .text-right
- {
- flex-shrink: 0;
- }
+ .text-right {
+ flex-shrink: 0;
+ }
- .text-left, .text-right
- {
- padding: 5px 20px;
- white-space: nowrap;
- font-weight: bold;
- opacity: 0.2;
- font-size: 20px;
- align-items: flex-end;
+ .text-left, .text-right {
+ padding: 5px 20px;
+ white-space: nowrap;
+ font-weight: bold;
+ opacity: 0.2;
+ font-size: 20px;
+ align-items: flex-end;
- .unit
- {
- font-size: 15px;
- opacity: 0.5;
- }
- }
- }
+ .unit {
+ font-size: 15px;
+ opacity: 0.5;
+ }
+ }
+ }
}
-choosemappage.navigator-body
-{
- margin: 0;
- padding: 0;
+choosemappage.navigator-body {
+ margin: 0;
+ padding: 0;
}
\ No newline at end of file diff --git a/code/ui/mainmenu/MainMenu.razor b/code/ui/mainmenu/MainMenu.razor index ccdf17a..a19cf56 100644 --- a/code/ui/mainmenu/MainMenu.razor +++ b/code/ui/mainmenu/MainMenu.razor @@ -1,8 +1,5 @@ -@using System
-@using Sandbox;
-@using Sandbox.MenuSystem;
-@using Sandbox.UI;
-@attribute [StyleSheet]
+@attribute [StyleSheet]
+@using Sandbox.UI
@inherits Sandbox.UI.GameMenu.DefaultGameMenu
<style>
@@ -27,4 +24,4 @@ <div class="navigator-canvas" slot="navigator-canvas"></div>
-</root>
+</root>
\ No newline at end of file diff --git a/code/ui/mainmenu/MainMenu.razor.scss b/code/ui/mainmenu/MainMenu.razor.scss index cbedff5..4cd97f8 100644 --- a/code/ui/mainmenu/MainMenu.razor.scss +++ b/code/ui/mainmenu/MainMenu.razor.scss @@ -1,257 +1,220 @@ -.gamemainmenu
-{
- background-image: url( "menu/boxes.webm" );
- background-position: center;
- background-size: cover;
- opacity: 1;
- flex-direction: column;
- font-size: 25px;
- width: 100%;
- height: 100%;
- position: absolute;
- transition: all 0.3s ease-out;
- color: white;
+.gamemainmenu {
+ background-image: url("menu/boxes.webm");
+ background-position: center;
+ background-size: cover;
+ opacity: 1;
+ flex-direction: column;
+ font-size: 25px;
+ width: 100%;
+ height: 100%;
+ position: absolute;
+ transition: all 0.3s ease-out;
+ color: white;
- &:intro
- {
- opacity: 0;
- transform: scaleX( 1.1 );
- }
+ &:intro {
+ opacity: 0;
+ transform: scaleX(1.1);
+ }
- &.ingame
- {
- background-color: #151313ee;
- background-image: none;
- }
+ &.ingame {
+ background-color: #151313ee;
+ background-image: none;
+ }
}
-.button, .block
-{
- padding: 4px 16px;
+.button, .block {
+ padding: 4px 16px;
- opacity: 0.8;
+ opacity: 0.8;
- font-size: 28px;
- font-family: Poppins;
- font-weight: 700;
- flex-shrink: 0;
+ font-size: 28px;
+ font-family: Poppins;
+ font-weight: 700;
+ flex-shrink: 0;
}
-.button
-{
- background-color: #000a;
- cursor: pointer;
+.button {
+ background-color: #000a;
+ cursor: pointer;
- &:hover
- {
- opacity: 1;
- }
+ &:hover {
+ opacity: 1;
+ }
- &:active
- {
- left: 2px;
- top: 3px;
- }
+ &:active {
+ left: 2px;
+ top: 3px;
+ }
}
-.gamemainmenu .navigator-canvas
-{
- height: 100%;
- flex-grow: 1;
- flex-shrink: 0;
- backdrop-filter: blur( 20px );
- padding: 0px 100px;
+.gamemainmenu .navigator-canvas {
+ height: 100%;
+ flex-grow: 1;
+ flex-shrink: 0;
+ backdrop-filter: blur(20px);
+ padding: 0px 100px;
- .navigator-body
- {
- width: 100%;
- height: 100%;
- flex-direction: column;
- padding: 100px 0px;
- }
+ .navigator-body {
+ width: 100%;
+ height: 100%;
+ flex-direction: column;
+ padding: 100px 0px;
+ }
}
-section
-{
- flex-direction: column;
- flex-grow: 1;
- flex-shrink: 0;
+section {
+ flex-direction: column;
+ flex-grow: 1;
+ flex-shrink: 0;
- &.nogrow
- {
- flex-grow: 0;
- }
+ &.nogrow {
+ flex-grow: 0;
+ }
- &.box
- {
- background-color: rgba( black, 0.5 );
-
- }
-}
+ &.box {
+ background-color: rgba(black, 0.5);
-.scroll
-{
- overflow-y: scroll;
- flex-shrink: 1;
- flex-grow: 0;
+ }
}
-h2
-{
- font-family: poppins;
- font-weight: 400;
- opacity: 0.2;
- margin-bottom: 16px;
- flex-shrink: 0;
+.scroll {
+ overflow-y: scroll;
+ flex-shrink: 1;
+ flex-grow: 0;
}
-.member-list
-{
- overflow-x: scroll;
- padding: 20px;
- gap: 8px;
+h2 {
+ font-family: poppins;
+ font-weight: 400;
+ opacity: 0.2;
+ margin-bottom: 16px;
+ flex-shrink: 0;
}
+.member-list {
+ overflow-x: scroll;
+ padding: 20px;
+ gap: 8px;
+}
-.hidden
-{
- display: none;
+.hidden {
+ display: none;
}
-.inset
-{
- overflow: hidden;
+.inset {
+ overflow: hidden;
}
-.layout
-{
- flex-direction: column;
+.layout {
+ flex-direction: column;
- > *
- {
- flex-shrink: 0;
- }
+ > * {
+ flex-shrink: 0;
+ }
- > .body
- {
- flex-grow: 1;
- flex-shrink: 0;
- flex-direction: column;
+ > .body {
+ flex-grow: 1;
+ flex-shrink: 0;
+ flex-direction: column;
- &.columned
- {
- flex-direction: row;
- flex-grow: 1;
- flex-shrink: 1;
- justify-content: space-around;
- align-items: center;
+ &.columned {
+ flex-direction: row;
+ flex-grow: 1;
+ flex-shrink: 1;
+ justify-content: space-around;
+ align-items: center;
- > .left
- {
- flex-grow: 0;
- flex-shrink: 0;
- overflow-y: scroll;
- flex-direction: column;
- }
+ > .left {
+ flex-grow: 0;
+ flex-shrink: 0;
+ overflow-y: scroll;
+ flex-direction: column;
+ }
- > .right
- {
- flex-grow: 0;
- flex-shrink: 0;
- flex-direction: column;
- }
- }
- }
+ > .right {
+ flex-grow: 0;
+ flex-shrink: 0;
+ flex-direction: column;
+ }
+ }
+ }
}
-.navbar
-{
- padding: 32px 0;
- flex-shrink: 0;
+.navbar {
+ padding: 32px 0;
+ flex-shrink: 0;
- .right, .left
- {
- flex-grow: 0;
- flex-shrink: 0;
- gap: 10px;
- }
+ .right, .left {
+ flex-grow: 0;
+ flex-shrink: 0;
+ gap: 10px;
+ }
- .left
- {
- flex-grow: 1;
- }
+ .left {
+ flex-grow: 1;
+ }
}
$form-row-height: 48px;
-.form
-{
- flex-direction: column;
- flex-shrink: 0;
- flex-grow: 0;
- gap: 2px;
- margin-bottom: 50px;
+.form {
+ flex-direction: column;
+ flex-shrink: 0;
+ flex-grow: 0;
+ gap: 2px;
+ margin-bottom: 50px;
- > .form-group
- {
- flex-direction: column;
- flex-shrink: 0;
- margin-bottom: 20px;
+ > .form-group {
+ flex-direction: column;
+ flex-shrink: 0;
+ margin-bottom: 20px;
- > .form-label
- {
- opacity: 0.5;
- height: $form-row-height;
- font-size: 20px;
- white-space: nowrap;
- }
- }
+ > .form-label {
+ opacity: 0.5;
+ height: $form-row-height;
+ font-size: 20px;
+ white-space: nowrap;
+ }
+ }
}
-.form .form-control
-{
- flex-grow: 1;
+.form .form-control {
+ flex-grow: 1;
+
+ SliderControl, > DropDown, > textentry, SliderControl textentry {
+ flex-grow: 1;
+ font-size: 20px;
+ height: $form-row-height;
+ }
- SliderControl, > DropDown, > textentry, SliderControl textentry
- {
- flex-grow: 1;
- font-size: 20px;
- height: $form-row-height;
- }
+ > textentry, SliderControl textentry {
+ flex-grow: 1;
+ background-color: #ffffff05;
+ height: $form-row-height;
+ color: #aaa;
+ width: 600px;
+ border-radius: 0;
+ padding: 5px;
- > textentry, SliderControl textentry
- {
- flex-grow: 1;
- background-color: #ffffff05;
- height: $form-row-height;
- color: #aaa;
- width: 600px;
- border-radius: 0;
- padding: 5px;
+ &:hover {
+ background-color: #ffffff11;
+ }
- &:hover
- {
- background-color: #ffffff11;
- }
+ &:focus {
+ background-color: #ffffff22;
+ color: #fff;
+ }
+ }
- &:focus
- {
- background-color: #ffffff22;
- color: #fff;
- }
- }
+ SliderControl {
- SliderControl
- {
-
- }
+ }
}
-choosemappage.navigator-body
-{
- padding: 0;
+choosemappage.navigator-body {
+ padding: 0;
}
\ No newline at end of file diff --git a/code/ui/overlay/BlindedOverlay.Network.cs b/code/ui/overlay/BlindedOverlay.Network.cs index 0a80628..83569ea 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 0cd397a..3afe578 100644 --- a/code/ui/overlay/BlindedOverlay.razor +++ b/code/ui/overlay/BlindedOverlay.razor @@ -1,8 +1,5 @@ -@using Sandbox;
-@using Sandbox.UI;
-
@namespace MurderGame
-@inherits Panel
+@inherits Sandbox.UI.Panel
<style>
@@keyframes fadeIn
@@ -41,7 +38,7 @@ blindedoverlay </style>
<div class="overlay-message">
-You shot a bystander!
+ You shot a bystander!
</div>
@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
<style>
@@keyframes fadeIn
@@ -72,15 +69,15 @@ deathoverlay { @if (ShowOverlay)
{
-<div class="overlay fade">
-</div>
-<div class="overlay blur">
-</div>
-<div class="box-container">
- <div class="box">
- You have died
- </div>
-</div>
+ <div class="overlay fade">
+ </div>
+ <div class="overlay blur">
+ </div>
+ <div class="box-container">
+ <div class="box">
+ You have died
+ </div>
+ </div>
}
@code
@@ -92,10 +89,10 @@ deathoverlay { Instance = this;
}
- public bool ShowOverlay { get; set; }
+ public bool ShowOverlay { get; set; }
- protected override int BuildHash()
- {
+ protected override int BuildHash()
+ {
return ShowOverlay.GetHashCode();
}
diff --git a/code/ui/overlay/RoleOverlay.Network.cs b/code/ui/overlay/RoleOverlay.Network.cs index 300d0bf..be69c24 100644 --- a/code/ui/overlay/RoleOverlay.Network.cs +++ b/code/ui/overlay/RoleOverlay.Network.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 cd3cd88..3afce0c 100644 --- a/code/ui/overlay/RoleOverlay.razor +++ b/code/ui/overlay/RoleOverlay.razor @@ -1,9 +1,6 @@ -
-@using Sandbox;
-@using Sandbox.UI;
-
@namespace MurderGame
-@inherits Panel
+@using Sandbox
+@inherits Sandbox.UI.Panel
<style>
roleoverlay
@@ -58,6 +55,7 @@ roleoverlay }
return "";
}
+
public string GetTeamDescription()
{
if (Game.LocalPawn is Player player)
@@ -66,6 +64,7 @@ roleoverlay }
return "";
}
+
public string GetTeamColour()
{
if (Game.LocalPawn is Player player)
@@ -81,7 +80,7 @@ roleoverlay public RoleOverlay()
{
- SetClass( "hidden", true );
+ SetClass("hidden", true);
Instance = this;
}
@@ -91,4 +90,4 @@ roleoverlay return ShowOverlay.GetHashCode();
}
-}
+}
\ No newline at end of file diff --git a/code/ui/overlay/TabListEntry.cs b/code/ui/overlay/TabListEntry.cs index b4d7769..5f78f55 100644 --- a/code/ui/overlay/TabListEntry.cs +++ b/code/ui/overlay/TabListEntry.cs @@ -6,14 +6,13 @@ namespace MurderGame; public class TabListEntry : Panel
{
-
public IClient Client;
+ public Label Ping;
public Label PlayerName;
- public Label Ping;
-
- RealTimeSince TimeSinceUpdate = 0;
-
+
+ private RealTimeSince TimeSinceUpdate = 0;
+
public TabListEntry()
{
AddClass( "entry" );
@@ -27,28 +26,33 @@ public class TabListEntry : Panel base.Tick();
if ( !IsVisible )
+ {
return;
+ }
if ( !Client.IsValid() )
+ {
return;
+ }
if ( TimeSinceUpdate < 0.1f )
+ {
return;
+ }
TimeSinceUpdate = 0;
UpdateData();
}
-
+
public virtual void UpdateData()
{
PlayerName.Text = Client.Name;
Ping.Text = Client.Ping.ToString();
}
-
+
public virtual void UpdateFrom( IClient client )
{
Client = client;
UpdateData();
}
-
}
diff --git a/code/ui/overlay/TabListOverlay.razor b/code/ui/overlay/TabListOverlay.razor index d240c9e..82c0959 100644 --- a/code/ui/overlay/TabListOverlay.razor +++ b/code/ui/overlay/TabListOverlay.razor @@ -1,11 +1,10 @@ <!-- this class is temporary and will be replaced with a proper scoreboard -->
+@namespace MurderGame
@using System.Collections.Generic
@using System.Linq
-@using Sandbox;
-@using Sandbox.UI;
-
-@namespace MurderGame
+@using Sandbox
+@using Sandbox.UI
@inherits Panel
<style>
@@ -75,27 +74,27 @@ tablistoverlay { </style>
<div class="container">
- <div class="tablist-header">
- <span class="text-header">Murder</span>
- <span class="text-aside" style="color: #FF4136">This game mode is still a work in progress. Source code available at https://github.com/LMBishop/murder.</span>
- </div>
+ <div class="tablist-header">
+ <span class="text-header">Murder</span>
+ <span class="text-aside" style="color: #FF4136">This game mode is still a work in progress. Source code available at https://github.com/LMBishop/murder.</span>
+ </div>
- <div class="list">
- <div class="list-header">
- <span class="name">Name</span>
- <span class="ping">Ping</span>
- </div>
+ <div class="list">
+ <div class="list-header">
+ <span class="name">Name</span>
+ <span class="ping">Ping</span>
+ </div>
- <div class="list-content" @ref="List">
+ <div class="list-content" @ref="List">
- </div>
- </div>
+ </div>
+ </div>
</div>
@code
{
- Dictionary<IClient, TabListEntry> Entries = new();
-
+ readonly Dictionary<IClient, TabListEntry> 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]
<div>
@@ -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
<style>
phasetimer {
@@ -26,14 +23,15 @@ phasetimer { @if (HasTime())
{
-<smallbox class="box">
- @GetTime()
-</smallbox>
-} else
+ <smallbox class="box">
+ @GetTime()
+ </smallbox>
+}
+else
{
-<smallbox class="box">
- @GetPhase()
-</smallbox>
+ <smallbox class="box">
+ @GetPhase()
+ </smallbox>
}
@code
@@ -42,11 +40,13 @@ phasetimer { {
return MurderGame.Instance.CurrentPhase.TimeLeft >= 0;
}
+
public string GetTime()
{
- TimeSpan timeSpan = TimeSpan.FromSeconds(MurderGame.Instance.CurrentPhase.TimeLeft);
+ var timeSpan = TimeSpan.FromSeconds(MurderGame.Instance.CurrentPhase.TimeLeft);
return timeSpan.ToString(@"mm\:ss");
}
+
public string GetPhase()
{
return MurderGame.Instance.CurrentPhase.Title;
@@ -56,4 +56,4 @@ phasetimer { {
return HashCode.Combine(MurderGame.Instance.CurrentPhase.TimeLeft.GetHashCode(), MurderGame.Instance.CurrentPhase.Title.GetHashCode());
}
-}
+}
\ No newline at end of file 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 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
<style>
.team-info {
@@ -14,7 +12,7 @@ </style>
<div class="team-info" style="color: @(Colour)">
-@GetTeamName()
+ @GetTeamName()
</div>
@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
<style>
crosshair {
@@ -19,5 +16,4 @@ crosshair { }
</style>
-<div class="dot"></div>
-
+<div class="dot"></div>
\ 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
<style>
@@keyframes blink {
@@ -46,37 +44,38 @@ reload { }
</style>
-@if (ReloadNeeded) {
-<!--<div class="box @(@Blink ? "blink" : "")">-->
-<div class="box blink">
- <div>Reload</div>
-</div>
+@if (ReloadNeeded)
+{
+ <!--<div class="box @(Blink ? "blink" : "")">-->
+ <div class="box blink">
+ <div>Reload</div>
+ </div>
}
@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 |
