private void SendPlayersListToJustConnectedClient()
{
_outgoingMessage = LidgrenSessionManager.Server.CreateMessage();
_outgoingMessage.Write((byte)LidgrenMessages.SendPlayersListToJustConnectedClient);
_outgoingMessage.WriteVariableInt32(_allPlayers.Count);
foreach (IdentifiedPlayer identifiedPlayer in _allPlayers)
{
_outgoingMessage.Write(identifiedPlayer.UniqueId.ToString());
_outgoingMessage.Write(identifiedPlayer.DisplayName);
_outgoingMessage.Write(identifiedPlayer.IsHost);
_outgoingMessage.Write(identifiedPlayer.IsLocal);
// if true, the player is on the Server & the Client will have to retrieve the IPEndPoint from the connection to the server
// if false, the player is on a remote client & the client will have to retrieve the IPEndPoint by reading another bytes on the message
if (!identifiedPlayer.IsLocal)
_outgoingMessage.Write(_remotePlayerIpEndPoints[identifiedPlayer]);
//else
// _outgoingMessage.Write(LidgrenSessionManager.Client.ServerConnection.RemoteEndPoint);
}
LidgrenSessionManager.Server.SendMessage(_outgoingMessage, _incomingMessage.SenderConnection, NetDeliveryMethod.ReliableOrdered);
}