// 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); }
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); } }
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); } }