示例#1
0
    // Output the blackboard as a string
    public IEnumerator BlackBoardLog(string player)
    {
        bool ai = false;

        // Check if player is AI
        if (player == Constants.p1Key)
        {
            UFEController p1Control = UFE.GetPlayer1Controller();
            if (p1Control.isCPU)
            {
                ai = true;
            }
        }
        if (player == Constants.p2Key)
        {
            UFEController p2Control = UFE.GetPlayer2Controller();
            if (p2Control.isCPU)
            {
                ai = true;
            }
        }

        // Record data for this player
        // Append _AI to all AI players
        KeyData data;

        if (ai)
        {
            data = new KeyData(UFE.GetTimer(), "BlackBoard Update", (flags[player][Constants.playerName] == "" ? player + "_AI" : flags[player][Constants.playerName] + "_AI"), BlackBoardToString());
        }
        else
        {
            data = new KeyData(UFE.GetTimer(), "BlackBoard Update", (flags[player][Constants.playerName] == "" ? player : flags[player][Constants.playerName]), BlackBoardToString());
        }

        string write_to = Constants.addLogUrl + data.AsUrlParams() + "&hash=" + data.Md5Sum(Constants.notSoSecretKey);

        //Debug.Log("Write to: " + write_to);
        // Enqueue for POSTing to server

        if (player == Constants.p1Key)
        {
            PostDataToServer.postQueueP1.Add(new WWW(write_to));
        }
        else if (player == Constants.p2Key)
        {
            PostDataToServer.postQueueP2.Add(new WWW(write_to));
        }
        else
        {
            Debug.Log("Error: 3 Players");
        }
        yield return(null);
    }
示例#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);
    }