• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Bistudio · Apr 30, 2015 at 10:40 PM · c#facebookscoreleaderboardreview

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.

alt text

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.

immagine.png (30.1 kB)
Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Bistudio · May 04, 2015 at 12:14 PM 0
Share

Do you have any suggestions?

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

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

Making a 3d text object represent the "health" of an object? 1 Answer

How can i implement facebook friends leaderboard? 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges