Exemplo n.º 1
0
    // Get high score list for a single level
    public void GetHighScores(GetHighScoresCallback callback, int levelID)
    {
        // First make sure all player data is up to date on the server
        UpdateCompleteCallback cb = (s) => GetLeaderboardPlayerUpdateComplete(callback, levelID, s);

        UpdatePlayerData(cb);
    }
Exemplo n.º 2
0
 private void GetLeaderboardPlayerUpdateComplete(GetHighScoresCallback callback, int levelID, bool success)
 {
     if (success)
     {
         HTTPRequestHandler.ReturnDataHTTPDelegate del = (e, s, res) => GetHighScoreResultCallback(callback, e, s, res);
         StartCoroutine(_httpHandler.GetBestTimes(levelID, del));
     }
     else
     {
         callback(false, null);
     }
 }
Exemplo n.º 3
0
 private void GetHighScoreResultCallback(GetHighScoresCallback callback, bool networkError, bool success, string jsonData)
 {
     if (success)
     {
         Debug.Log("{times:" + jsonData + "}");
         BestTimeDataList highScores = JsonUtility.FromJson <BestTimeDataList>("{\"times\":" + jsonData + "}");
         callback(true, highScores.times);
     }
     else
     {
         callback(false, null);
     }
 }