A small Blazor/Razor UI panel component for s&box. It displays a message "You need at least 2 players." and, during updates, checks a game object's state; if the game is active and has at least two players it broadcasts an RPC that destroys the panel component on clients.
@inherits PanelComponent
<root> <div class="ynal2p"> @t </div> </root>
@code
{
[Property] public game g {get;set;}
string t = "You need at least 2 players.";
protected override void OnUpdate()
{
if (g.IsActive && g.Players.Count >= 2)
d(this);
}
[Rpc.Broadcast]
public void d(PanelComponent pc)
{pc.Destroy();}
}