public static void SendOtherPlayerCharacterListRequest(int index) { PacketBuffer buffer = new PacketBuffer(); try { buffer.Write(Outbound.OtherPlayerCharacterListRequest); List <Client> clientList = ServerTCP.FetchOtherClients(index); buffer.Write(clientList.Count); if (clientList.Count > 0) { foreach (Client client in clientList) { buffer.Write(client.properties.Username); buffer.Write(client.properties.Position.X); buffer.Write(client.properties.Position.Y); buffer.Write(client.properties.ID); } } ServerTCP.SendDataTo(index, buffer.ToArray()); } catch (Exception e) { Console.WriteLine(e.Message); } finally { buffer.Dispose(); } }
public static void TellOPCsAPlayerIsMoving(int index, Vector2 position) { List <Client> clientList = ServerTCP.FetchOtherClients(index); if (clientList.Count == 0) { return; } foreach (Client item in clientList) { ServerOutput.Compose(Outbound.EntityMoveQuery, item.index, position); } }