Exemplo n.º 1
0
        /// <summary>
        /// Sends byte array to server.
        /// </summary>
        /// <param name="data">bytes to send</param>
        private static void SendDataToServer(byte[] data)
        {
            // Add data length at the beginning and send
            ByteBuffer buffer = new ByteBuffer();

            buffer.WriteLong(data.Length);
            buffer.WriteBytes(data);

            FoolWebClient.WriteToServer(buffer.ToArray());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Tries to reconnect if connection was lost
        /// </summary>
        public static void Reconnect()
        {
            Debug.Log("Trying to reconnect...");

            if (FoolWebClient.IsConnected)
            {
                Debug.Log("Already connected!");
                return;
            }

            FoolWebClient.ReconnectToGameServer();
        }
Exemplo n.º 3
0
 /// <summary>
 /// Call to connect game.
 /// </summary>
 public static void ConnectToGameServer(string ip, int port, string authToken)
 {
     FoolWebClient.ConnectToGameServer(ip, port, authToken);
     client = FoolWebClient.Instance;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Call to disconnect from game.
 /// </summary>
 public static void Disconnect(string reason = null)
 {
     FoolWebClient.Disconnect(reason);
 }