Hello everyone,
I am new to App42 and my question might sound trivial but I spent time on searching without any result still.
so here's the code:
private ScoreBoardResponse topNRankersCallBack = new ScoreBoardResponse ();
private IEnumerator GetTopNRankers(int max)
{
scoreBoardService = sp.BuildScoreBoardService (); // Initializing ScoreBoard Service.
scoreBoardService.GetTopNRankers (cons.gameName, max, topNRankersCallBack);
while (topNRankersCallBack.GetGame() == null)
yield return null;
IList<Game.Score> scoreList = topNRankersCallBack.GetGame ().GetScoreList ();
for (int i = 0; i < scoreList.Count; i++)
{
Game.Score.FacebookProfile fbProfile = scoreList [i].GetFacebookProfile ();
if (fbProfile != null)
print ("fbProfile");
else
print ("fbProfile is null");
usersListPanel.transform.FindChild ("Content").GetChild (i).FindChild ("Text_username").GetComponent<Text> ().text = scoreList [i].GetUserName ();
usersListPanel.transform.FindChild ("Content").GetChild (i).FindChild ("Text_score").GetComponent<Text> ().text = scoreList [i].GetValue ().ToString ();
}
}
And I always get printed "fb profile is null".
But username and score are displayed, which means I can't get the facebook profile from each score.
Here's were I link my user to fb.
public void FBLogin()
{
List<string> permissions = new List<string>();
permissions.Add("public_profile");
FB.LogInWithReadPermissions(permissions, AuthCallBack);
}
SocialResponse callBack = new SocialResponse();
void AuthCallBack(IResult result)
{
if (result.Error != null)
print(result.Error);
else
{
IsLoggedIn = FB.IsLoggedIn;
if (FB.IsLoggedIn)
{
FB.API("/me?fields=first_name" , HttpMethod.GET , ProfileNameCallBack);
FB.API ("/me/picture?type=square&height=128&width=128", HttpMethod.GET, ProfilePictureCallBack);
var aToken = Facebook.Unity.AccessToken.CurrentAccessToken;
s_Token = aToken.TokenString.ToString();
s_UserID = aToken.UserId.ToString();
socialService.LinkUserFacebookAccount(s_UserID , s_Token, callBack);
}
else
print("FB is not logged in");
}
print ("result: " + result);
}
Any hints please ?