diff options
Diffstat (limited to 'code/ui')
| -rw-r--r-- | code/ui/PlayerInfo.razor | 43 | ||||
| -rw-r--r-- | code/ui/character/NameInfo.razor | 37 | ||||
| -rw-r--r-- | code/ui/health/Health.razor | 2 | ||||
| -rw-r--r-- | code/ui/overlay/RoleOverlay.razor | 6 | ||||
| -rw-r--r-- | code/ui/team/TeamInfo.razor | 2 |
5 files changed, 78 insertions, 12 deletions
diff --git a/code/ui/PlayerInfo.razor b/code/ui/PlayerInfo.razor index fed61c0..9c23586 100644 --- a/code/ui/PlayerInfo.razor +++ b/code/ui/PlayerInfo.razor @@ -1,3 +1,4 @@ +@using System
@using Sandbox;
@using Sandbox.UI;
@@ -7,8 +8,10 @@ <style>
playerinfo {
position: absolute;
- left: 30px;
- bottom: 30px;
+ width: 100vw;
+ height: 100vh;
+}
+.box {
background-color: rgba(0, 0, 0, 0.20);
backdrop-filter-blur: 8px;
display: flex;
@@ -17,26 +20,52 @@ playerinfo { gap: 10px;
padding: 10px;
}
+.playerinfo {
+ position: absolute;
+ left: 30px;
+ bottom: 30px;
+}
+.teaminfo {
+ position: absolute;
+ right: 30px;
+ bottom: 30px;
+}
</style>
-<Health Colour="@GetTeamColour()"></Health>
-<TeamInfo Colour="@GetTeamColour()"></TeamInfo>
+<div class="playerinfo box">
+ <Health Colour="@GetCharacterColour()"></Health>
+ <NameInfo Colour="@GetCharacterColour()"></NameInfo>
+</div>
+<div class="teaminfo box">
+ <TeamInfo Colour="@GetTeamColour()"></TeamInfo>
+</div>
@code
{
- public string GetTeamColour()
+ public string GetCharacterColour()
{
var clientPawn = Game.LocalPawn;
if (clientPawn is Player {Camera: not null } player)
{
- var colour = TeamOperations.GetTeamColour(player.Camera.GetObservedTeam());
+ 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";
+ }
protected override int BuildHash()
{
- return GetTeamColour().GetHashCode();
+ return HashCode.Combine(GetTeamColour().GetHashCode(), GetTeamColour().GetHashCode());
}
}
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();
+ }
+}
diff --git a/code/ui/health/Health.razor b/code/ui/health/Health.razor index 9600c8b..afef6ef 100644 --- a/code/ui/health/Health.razor +++ b/code/ui/health/Health.razor @@ -6,7 +6,7 @@ <style>
Health {
- width: 400px;
+ width: 350px;
height: 100%;
background-color: rgba(0, 0, 0, 0.90);
}
diff --git a/code/ui/overlay/RoleOverlay.razor b/code/ui/overlay/RoleOverlay.razor index 40cbce0..cd3cd88 100644 --- a/code/ui/overlay/RoleOverlay.razor +++ b/code/ui/overlay/RoleOverlay.razor @@ -54,7 +54,7 @@ roleoverlay {
if (Game.LocalPawn is Player player)
{
- return TeamOperations.GetTeamName(player.CurrentTeam);
+ return TeamOperations.GetTeamName(player.Team);
}
return "";
}
@@ -62,7 +62,7 @@ roleoverlay {
if (Game.LocalPawn is Player player)
{
- return TeamOperations.GetTeamDescription(player.CurrentTeam);
+ return TeamOperations.GetTeamDescription(player.Team);
}
return "";
}
@@ -70,7 +70,7 @@ roleoverlay {
if (Game.LocalPawn is Player player)
{
- return TeamOperations.GetTeamColour(player.CurrentTeam);
+ return TeamOperations.GetTeamColour(player.Team);
}
return "";
}
diff --git a/code/ui/team/TeamInfo.razor b/code/ui/team/TeamInfo.razor index 4451810..cb2b55d 100644 --- a/code/ui/team/TeamInfo.razor +++ b/code/ui/team/TeamInfo.razor @@ -6,7 +6,7 @@ <style>
.team-info {
- font-size: 35px;
+ font-size: 30px;
font-weight: 700;
font-family: "Roboto";
}
|
