示例#1
0
    IEnumerator save_score_to_database()
    {
        WWWForm form = new WWWForm();

        form.AddField("userid", USERID);
        form.AddField("hs", SCORE);

        WWW updateScorephp = new WWW(save_score_url, form);

        yield return(updateScorephp);

        if (!updateScorephp.Equals("1"))
        {
            yield return(new WaitForSecondsRealtime(reconnect_time));

            // Not: WaitForSeconds: Oyun pause olunca yani Time.timeScale = 0; olunca duracaktır.
            // Ama bu fonksiyon oyundan bağımsız olduğu için WaitForSecondsRealtime methodu kullanılmalıdır.
            StartCoroutine(save_score_to_database());
        }
    }