Ejemplo n.º 1
0
 public static void SendData(string data)
 {
     if (!string.IsNullOrEmpty(data))
     {
         client.SendData(Network.ConvertStringToBytes(data));
     }
 }
Ejemplo n.º 2
0
        private void Server_DataReceived(string ID, byte[] Data)
        {
            //Console.WriteLine(ID + ": " + Network.ConvertBytesToString(Data));
            string received = Network.ConvertBytesToString(Data);

            if (received == "getAllCreatures")
            {
                string data = NetContainer.GetAllCreatures(ID);
                server.SendData(ID, Network.ConvertStringToBytes(data));
            }
            else
            {
                foreach (var player in connectedPlayers)
                {
                    if (player.playerId == ID)
                    {
                        player.ParceFromServer(Network.ConvertBytesToString(Data));
                        break;
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void Client_Connected()
        {
            string message = "getAllCreatures";

            client.SendData(Network.ConvertStringToBytes(message));
        }
Ejemplo n.º 4
0
 public static void SendDataToAllUsers(string data)
 {
     server.Brodcast(Network.ConvertStringToBytes(data));
 }