Esempio n. 1
0
    IEnumerator FetchScores(HighScoreManager.GameTypes gameType)
    {
        fetchingComplete = false;
        string tableName = "";

        switch (gameType)
        {
        case HighScoreManager.GameTypes.Free:
            tableName = "highscoresfree";
            break;

        case HighScoreManager.GameTypes.Time:
            tableName = "highscorestime";
            break;

        case HighScoreManager.GameTypes.Gold:
            tableName = "highscoresgold";
            break;
        }
        WWWForm form = new WWWForm();

        form.AddField("tableName", tableName);
        WWW www = new WWW(hostURL + "getScores.php", form);

        yield return(www);

        dbLines          = www.text.Split(';');
        fetchingComplete = true;
    }
Esempio n. 2
0
    IEnumerator UploadScoreAwait(string companyName, string score, HighScoreManager.GameTypes gameType)
    {
        string tableName = "";

        switch (gameType)
        {
        case HighScoreManager.GameTypes.Free:
            tableName = "highscoresfree";
            break;

        case HighScoreManager.GameTypes.Time:
            tableName = "highscorestime";
            break;

        case HighScoreManager.GameTypes.Gold:
            tableName = "highscoresgold";
            break;
        }

        WWWForm form = new WWWForm();

        form.AddField("playerID", userID);
        form.AddField("companyName", companyName);
        form.AddField("score", score);
        form.AddField("tableName", tableName);

        WWW www = new WWW(hostURL + "uploadScore.php", form);

        yield return(www);

        if (www.text == "0")
        {
            Debug.Log("Score not updated.");
        }
        else if (www.text == "1")
        {
            Debug.Log("Score updated.");
        }
    }
Esempio n. 3
0
 public void UploadScore(string companyName, string score, HighScoreManager.GameTypes gameType)
 {
     StartCoroutine(UploadScoreAwait(companyName, score, gameType));
 }