Example #1
0
    IEnumerator PostNewHighScoreCoroutine(ScorePair pair, CompletePostDelegate onComplete)
    {
        WWWForm form = new WWWForm();

        form.AddField("Name", pair.Name);
        form.AddField("Score", pair.Score);

        using (var request = UnityWebRequest.Post(serverUrl, form))
        {
            yield return(request.SendWebRequest());

            if (request.error == null)
            {
                onComplete();
            }
            else
            {
                print(request.error);
            }
        }
    }
Example #2
0
 //
 // Post a new high score to the server
 public void PostNewHighScore(ScorePair pair, CompletePostDelegate onComplete)
 {
     StartCoroutine(PostNewHighScoreCoroutine(pair, onComplete));
 }