void Start() { DontDestroyOnLoad(this); Facebook.onLogin += delegate(bool result, JsonData reply) { if (result) { Facebook.graphRequest("/me"); tipo = tipoGui.step3; //get url My Picture (you can use 'me' or your Facebook id //you can learn at https://developers.facebook.com/tools/explorer string ruta = Facebook.getInfo("/me/picture?type=normal"); } }; Facebook.onGraphRequest += delegate(bool result, JsonData reply) { if (result) { FBName = reply ["name"].ToString(); if (!string.IsNullOrEmpty(FBName)) { PlayerPrefs.SetString("Username", FBName); } } }; StartCoroutine("MakeLoginProccess"); }
IEnumerator MakeLoginProccess() { yield return(new WaitForSeconds(1f)); Debug.Log("OMG IM MAKING IT THROUGH"); Facebook.login("email,publish_actions,publish_stream"); Facebook.graphRequest("/me"); tipo = tipoGui.step2; yield return(new WaitForSeconds(1f)); }
// Use this for initialization void Start() { Facebook.onLogin += delegate(bool result, JsonData reply) { if (result) { tipo = tipoGui.step3; //get url My Picture (you can use 'me' or your Facebook id //you can learn at https://developers.facebook.com/tools/explorer string ruta = Facebook.getInfo("/me/picture?type=normal"); //Get My Picture StartCoroutine(getImage(ruta)); } }; Facebook.onGraphRequest += delegate(bool result, JsonData reply) { if (result) { text1.text = reply["name"].ToString(); text2.text = reply["username"].ToString(); text3.text = reply["id"].ToString(); text4.text = reply["religion"].ToString(); } }; Facebook.onGetLoginStatusdos += delegate(bool result, string status) { if (result) { text6.text = "Status+: " + status; //text6.text = "Status+: " + reply[0].ToString() + "\n" + reply[1]["accessToken"].ToString() + "\n" + reply[1]["expiresIn"].ToString() + "\n" + reply[1]["signedRequest"].ToString() + "\n" + reply[1]["userID"].ToString(); } else { text6.text = "Status-: "; } }; }
// Use this for initialization void Start () { Facebook.onLogin += delegate(bool result, JsonData reply) { if (result) { tipo = tipoGui.step3; //get url My Picture (you can use 'me' or your Facebook id //you can learn at https://developers.facebook.com/tools/explorer string ruta = Facebook.getInfo("/me/picture?type=normal"); //Get My Picture StartCoroutine(getImage(ruta)); } }; Facebook.onGraphRequest += delegate(bool result, JsonData reply) { if (result) { text1.text = reply["name"].ToString(); text2.text = reply["username"].ToString(); text3.text = reply["id"].ToString(); text4.text = reply["religion"].ToString(); } }; Facebook.onGetLoginStatusdos += delegate(bool result, string status) { if (result) { text6.text = "Status+: " + status; //text6.text = "Status+: " + reply[0].ToString() + "\n" + reply[1]["accessToken"].ToString() + "\n" + reply[1]["expiresIn"].ToString() + "\n" + reply[1]["signedRequest"].ToString() + "\n" + reply[1]["userID"].ToString(); } else { text6.text = "Status-: "; } }; }
void OnGUI() { switch (tipo) { case tipoGui.step1: if (GUI.Button(new Rect(10, 10, Screen.width - 20, Screen.height - 20), "Enter")) { Facebook.login("email,publish_actions,publish_stream"); tipo = tipoGui.step2; } break; case tipoGui.step3: GUI.Label(new Rect(Screen.width * 0.82F, Screen.height * 0.12F, 125, 125), "", foto); if (GUI.Button(new Rect(Screen.width - 190, Screen.height / 2 - 100, 170, 30), "User Information")) { Facebook.graphRequest("/me"); } if (GUI.Button(new Rect(Screen.width - 190, Screen.height / 2 - 60, 170, 30), "Get Status")) { Facebook.getLoginStatusdos(); } if (GUI.Button(new Rect(770, 385, 170, 30), "Send invitations")) { Facebook.uiAppRequest("Title Request", "I invite you to try this application"); } if (GUI.Button(new Rect(770, 385 + 35, 170, 30), "Post with Pop Up")) { Facebook.uiFeedRequest("http://www.google.com", "http://www.google.com/logos/2012/tsiolkovsky12-hp.jpg", "Resaltado - ..........", "Facebook desde la Web", "Descripcion..... ... ..... .... ... ....... ."); } if (GUI.Button(new Rect(770, 385 + 70, 170, 30), "Post without Pop Up")) { //string to, string message, string name, string description, string picture, string caption, string link Facebook.postear("me", "Post Message", "Name...", "Des", "http://www.google.com/logos/2012/tsiolkovsky12-hp.jpg", "Facebook Web Cap", "http://www.google.com"); } if (GUI.Button(new Rect(770, 385 + 105, 170, 30), "Post Video")) { Facebook.postearv("me", "Post Message", "Name...", "Des", "http://img.youtube.com/vi/9bZkp7q19f0/0.jpg", "Facebook Web Cap", "http://www.youtube.com/e/9bZkp7q19f0", "http://www.youtube.com/watch?v=9bZkp7q19f0"); } if (GUI.Button(new Rect(770, 385 + 140, 170, 30), "Friends")) { StartCoroutine(getInfoFriends(Facebook.getInfo("/me/friends?fields=id,name,gender,picture"))); } if (GUI.Button(new Rect(770, 384 + 175, 170, 30), "Post Photo")) { Facebook.photo("Message...", "http://a.lyecorp.com/marcador.jpg"); } break; } }