Exemplo n.º 1
0
    // Upload key logging data to the server
    private IEnumerator PostKeyLog(int matchId, float time, string keyPress, string playerName)
    {
        // Gather the KeyData and convert to a string
        KeyData data = new KeyData(matchId, time, keyPress, playerName);
        string  hash = data.Md5Sum(secretKey);

        string post_url = addLogUrl + data.AsUrlParams() + "&hash=" + hash;

        // Post the URL to the site and create a download object to get the result.
        WWW hs_post = new WWW(post_url);

        yield return(hs_post); // Wait until the download is done

        if (hs_post.error != null)
        {
            print("There was an error posting the key press: " + hs_post.error);
        }
    }
Exemplo n.º 2
0
    // Input logger
    IEnumerator InputLog(string input, string player)
    {
        // Record for the player who pressed the key
        KeyData data     = new KeyData(UFE.GetTimer(), input, player, null);
        string  write_to = Constants.addLogUrl + data.AsUrlParams() + "&hash=" + data.Md5Sum(Constants.notSoSecretKey);

        Debug.Log(write_to);

        // Enqueue for POSTing to server
        if (UFE.GetLocalPlayer() == 1)
        {
            PostDataToServer.postQueueP1.Add(new WWW(write_to));
        }
        else
        {
            PostDataToServer.postQueueP2.Add(new WWW(write_to));
        }
        yield return(null);
    }