ui/PlayerList.razor

A UI Razor component that renders a list of other players. It gets the local player from Manager.Instance and iterates Manager.Instance.Players, creating a PlayerIcon component for each player except the local player. It forces rebuilds by combining a time-based hash.

Networking
@namespace Sandbox
@using Sandbox;
@using Sandbox.UI;
@using System;
@inherits Panel
@attribute [StyleSheet("PlayerList.razor.scss")]

<root>
	@{
		var localPlayer = Manager.Instance.LocalPlayer;
	}

	@foreach(var otherPlayer in Manager.Instance.Players)
	{
		if(localPlayer != otherPlayer)
		{
			<PlayerIcon Player=@otherPlayer />	
		}
	}
</root>

@code {
	protected override int BuildHash()
	{
		return HashCode.Combine(RealTime.Now);
	}
}