public void GetFacebookInfo(FacebookInfoCallback callback) { FB.API("/me?fields=gender,birthday", HttpMethod.GET, (IGraphResult result) => { Debug.Log(result.RawResult); IDictionary <string, object> dict = result.ResultDictionary; FacebookInfoReply reply; if (!string.IsNullOrEmpty(result.Error)) { reply = new FacebookInfoReply(false, result.Error); } else { reply = new FacebookInfoReply(true); reply.gender = dict["gender"].ToString(); if (!dict.ContainsKey("birthday")) { reply.birthdate = (long)DateTime.Now.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds; } else { string[] birthDate = dict["birthday"].ToString().Split('/'); Debug.Log(dict["birthday"].ToString()); reply.birthdate = (long)new DateTime(int.Parse(birthDate[2]), int.Parse(birthDate[0]), int.Parse(birthDate[1])).Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds; } } callback(reply); }); }
public void UpdateFacebookInfo(FacebookInfoReply reply, StardomAPICallback callback = null) { LogEventRequest_UpdateFacebookInfo req = new LogEventRequest_UpdateFacebookInfo(); req.Set_gender(reply.gender); req.Set_birthdate(reply.birthdate); req.Send((response) => { if (callback != null) { if (response.HasErrors) { callback(new StardomAPIReply(false, "GS failed to update fb info, " + response.Errors.ToString())); } else { callback(new StardomAPIReply(true)); } } }); }