public void SetFBLoginInfo(string RawResult) { // fb 유저정보 기록 string strResult = RawResult.Replace(@"\/", @"/"); _fbLoginVO = new FBLoginVO(strResult); Debug.Log("## USER:SetFBLoginInfo >> RawResult = " + strResult); // fb게임 친구 정보 요청 StartCoroutine(LoadAppFriends()); // fb초대가능유저 정보 요청 GetFBInvitableFriends(null); }
/// <summary> /// 서버 접속 정보 요청 /// </summary> public void SendRQLobbyLogin(Action <string, string> response, Action <string> timeout) { if (USER.I.IsGuestLogin) { PK.Login.SendData loginItem = new PK.Login.SendData(USER.I._TempGuestID, "", "guest", "", "", "", "", 0, "guest"); PK.Login.SEND command = new PK.Login.SEND(PKID.LobbyLogin, loginItem); _NetSocket.SendData(xLitJson.JsonMapper.ToJson(command), PKID.LobbyLogin, response, timeout); if (!string.IsNullOrEmpty(USER.I._TempGuestID)) { PlayerPrefHelper.SetUserID(USER.I._TempGuestID); USER.I._TempGuestID = ""; } } else // facebook login { FBLoginVO facebookLoginInfo = Main.FB.GetFbLoginInfo(); PK.Login.SendData loginItem = new PK.Login.SendData(facebookLoginInfo.id, facebookLoginInfo.email, facebookLoginInfo.first_name, facebookLoginInfo.gender, facebookLoginInfo.picUrl, facebookLoginInfo.last_name, facebookLoginInfo.locale, facebookLoginInfo.timezone, facebookLoginInfo.name); PK.Login.SEND command = new PK.Login.SEND(PKID.LobbyLogin, loginItem); _NetSocket.SendData(xLitJson.JsonMapper.ToJson(command), PKID.LobbyLogin, response, timeout); } }
/// <summary> /// 인증이 안된 유저의 첫 페이스북 로그인 /// </summary> public void FBLogin(OnUserInfoCallback complete) { #if UNITY_EDITOR string tempResult = PlayerPrefHelper.GetFBLoginResult(); if (!string.IsNullOrEmpty(tempResult)) { // 유저 정보 string strResult = tempResult.Replace(@"\/", @"/"); _fbLoginVO = new FBLoginVO(strResult); // frineds tempResult = PlayerPrefHelper.GetFBFriendsResult(); if (!string.IsNullOrEmpty(tempResult)) { strResult = tempResult.Replace(@"\/", @"/"); _FBFriends = new FBAppFriendsVO(strResult); _AppFriendsIDs = new List <string>(); for (int i = 0; i < _FBFriends._packet.data.Length; i++) { if (_FBFriends._packet.data[i].installed) { _AppFriendsIDs.Add(_FBFriends._packet.data[i].id); } } } // Invitable frineds tempResult = PlayerPrefHelper.GetFBInvitableFriendsResult(); strResult = tempResult.Replace(@"\/", @"/"); _FBInvitableFriends = new FBInvitableFriendsVO(strResult); if (complete != null) { complete(true); } return; } #endif var perms = new List <string>() { "public_profile", "email", "user_friends" }; FB.LogInWithReadPermissions(perms, (result) => { if (result == null) { if (complete != null) { complete(false); } return; } if (!string.IsNullOrEmpty(result.Error)) { Debug.Log("## FBController : CallbackUserInfo >> Error = " + result.Error); if (complete != null) { complete(false); } } else if (result.Cancelled) { Debug.Log("## FBController : CallbackUserInfo >> Cancelled = " + result.Cancelled); if (complete != null) { complete(false); } } else if (!string.IsNullOrEmpty(result.RawResult)) { xLitJson.JsonData data = xLitJson.JsonMapper.ToObject(result.RawResult); string strAccessToken = (string)data["access_token"]; PlayerPrefHelper.SetFbAccessToken(strAccessToken); Debug.Log("## FBController : CallbackAuth >> Success Response = " + result.RawResult); LoadUserInfo(complete); } }); }