Game Development Reference
In-Depth Information
" http://www.ifc0nfig.com/Facebook/UnityGame/ " +
"&type=user_agent&display=page");
showTokenBox = true;
}
GUI.EndGroup ();
}
else if(showTokenBox)
{
GUI.BeginGroup (Rect (10, 10, 200, 100));
GUI.Box (Rect (0,0,200,100), "Magic Token");
MagicToken = GUI.TextField (Rect (25, 30, 150, 30),
MagicToken, 120);
if(GUI.Button(Rect( 50, 65, 90, 30), "Authenticate"))
{
UFacebook.MagicToken = MagicToken;
RequestUserDetails();
PlayerPrefs.SetString("FACEBOOKTOKEN",
MagicToken);
}
GUI.EndGroup ();
}
scrollViewVector = GUI.BeginScrollView
(Rect(250,10, 400, 400),
scrollViewVector,
Rect (0, 0, 600, 600));
UFacebook.LastRequest = GUI.TextArea
(Rect (0, 0, 600, 600),
UFacebook.LastRequest);
GUI.EndScrollView();
}
Step 8. Play. A scrollbox will now display with information obtained
from your Facebook profile. The RequestUserDetails() function
does all the work, calling functions in the existing C# code in the
Project's Plugins direction. Using your Magic Token it calls one of
the Facebook Graph API URLs. In this case, https://graph.facebook
.com/me .
Step 9. Your profile picture is available by calling http://graph
.facebook.com/YOUR_USERNAME/picture . The user name can be
obtained from previous data and placed in the URL with code as
shown in Listing 8.15 . Note that the picture is downloaded in the
same way as images in the Twitter workshop.
Search Nedrilad ::




Custom Search