aboutsummaryrefslogtreecommitdiffstats
path: root/code/ui/overlay/RoleOverlay.razor
blob: c41e359638d21f7cc6d3bc6a75acf1cc4c84c002 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
@using Sandbox;
@using Sandbox.UI;

@namespace MurderGame
@inherits Panel

<style>
    roleoverlay
    {
        position: absolute;
        left: 0;
        top: 0;
        background-color: #000000;
        width: 100vw;
        height: 100vh;
		z-index: 10000;
    }
	.container {
		display: flex;
		align-items: center;
		flex-direction: column;
		max-width: 700px;
		text-align: center;
		gap: 50px;
		margin: 0 auto;
		top: 200px;
	}
    .name
    {
        font-size: 50;
		font-weight: 700;
        font-family: "Roboto";
    }
    .description
    {
        font-size: 30;
        font-family: "Roboto";
    }
</style>

<div class="container">
	<div class="name" style="color: @(GetTeamColour())">
		@GetTeamName()
	</div>
	<div class="description" style="color: @(GetTeamColour())">
		@GetTeamDescription()
	</div>
</div>

@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 static RoleOverlay Instance { get; private set; }

    public bool ShowOverlay { get; set; } = false;

	public RoleOverlay()
    {
        SetClass( "hidden", true );

        Instance = this;
    }

	protected override int BuildHash()
    {
        return ShowOverlay.GetHashCode();
    }

}