- Home /
Facebook leaderboard issue
Goodmorning everyone, Tomorrow should be available my new game, but today doing some tests I realized that the game is not the scores of my friends (apart from my brother who is developing the game with me).
Yesterday I put it available to all of facebook as you can see from the image.
Unfortunately for lack of things (game trailer) we could send in review only yesterday, my question is to see the scores of friends we have to wait the end of the review by facebook? or there is something wrong in my script? (The one below)
public void SetScores() { var scoreData = new Dictionary (); scoreData ["score"] = currentScore.ToString ();
FB.API ("/me/scores", Facebook.HttpMethod.POST, delegate(FBResult result) {
Debug.Log ("Score submit result: " + result.Text);
}, scoreData);
}
public void QueryScores()
{
FB.API ("/app/scores?fields=score,user.limit(30)", Facebook.HttpMethod.GET, ScoresCallback);
}
private void ScoresCallback (FBResult result)
{
Debug.Log ("Scores callback" + result.Text);
scoresList = Util.DeserializeScores (result.Text);
foreach(Transform child in ScoreScrollList.transform)
{
GameObject.Destroy (child.gameObject);
}
foreach(object score in scoresList)
{
var entry = (Dictionary<string,object>) score;
var user = (Dictionary<string,object>) entry["user"];
GameObject ScorePanel;
ScorePanel = Instantiate (ScoreEntryPanel) as GameObject;
ScorePanel.transform.SetParent(ScoreScrollList.transform, false);
Transform ThisScoreScore = ScorePanel.transform.Find("Friend Score");
Text ScoreScore = ThisScoreScore.GetComponent<Text>();
ScoreScore.text = entry["score"].ToString ();
Transform TheUserAvatar = ScorePanel.transform.Find ("FriendAvatar");
Image UserAvatar = TheUserAvatar.GetComponent<Image>();
FB.API (Util.GetPictureURL(user["id"].ToString (), 128,128), Facebook.HttpMethod.GET, delegate(FBResult pictureResult)
{
string imageUrl = DeserializePictureURLString(pictureResult.Text);
StartCoroutine(LoadPictureEnumerator(imageUrl,pictureTexture =>
{
UserAvatar.sprite = Sprite.Create (pictureTexture, new Rect(0,0,128,128), new Vector2(0,0));
}));
});
}
}
delegate void LoadPictureCallback (Texture2D texture);
IEnumerator LoadPictureEnumerator(string url, LoadPictureCallback callback)
{
WWW www = new WWW(url);
yield return www;
callback(www.texture);
}
public string DeserializePictureURLString(string response)
{
return DeserializePictureURLObject(Json.Deserialize(response));
}
public string DeserializePictureURLObject(object pictureObj)
{
var picture = (Dictionary<string, object>)(((Dictionary<string, object>)pictureObj)["data"]);
object urlH = null;
if (picture.TryGetValue("url", out urlH))
{
return (string)urlH;
}
return null;
}
private string GetPictureURL(string facebookID, int? width = null, int? height = null, string type = null)
{
string url = string.Format("/{0}/picture", facebookID);
string query = width != null ? "&width=" + width.ToString() : "";
query += height != null ? "&height=" + height.ToString() : "";
query += type != null ? "&type=" + type : "";
query += "&redirect=false";
if (query != "") url += ("?g" + query);
return url;
}
I know it's a question a little silly but I need to know.
Thanks in advance.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Implement own highscore script into existing FB SDK example 1 Answer
How I do load scene by Singleton Patten Score and Countdown Timer in Unity # C 0 Answers
Getting multiple photos at once but in the correct order with Facebook SDK 1 Answer