public void LinkCallback(string platformUserInfo) { var jobject = JObject.Parse(platformUserInfo); var isGuest = (bool)jobject["isGuest"]; if (isGuest) { if (OnGuestModeActivated != null) OnGuestModeActivated(); return; } var userinfo = new PlatformUser(); try { userinfo.platformUserID = jobject["userID"].ToString(); userinfo.userName = jobject["userName"].ToString(); userinfo.platformID = int.Parse(jobject["platformID"].ToString()); userinfo.appID = Systems.AppId; } catch (Exception) { throw new Exception("Platform web script has passed in incorrect data"); } Systems.UserGetter.GetSocialPlayUser(userinfo, (user) => { if (OnRecievedUser != null) OnRecievedUser(user); }); }
public void GetSocialPlayUser(PlatformUser socialPlayUser, Action<WebserviceCalls.UserInfo> callback) { WebserviceCalls webserviceCalls = GameObject.FindObjectOfType(typeof(WebserviceCalls)) as WebserviceCalls; //todo remove email webserviceCalls.GetUserFromWorld(socialPlayUser.appID, socialPlayUser.platformID, socialPlayUser.platformUserID, socialPlayUser.userName, null, (WebserviceCalls.UserInfo x) => { WebserviceCalls.UserInfo userGuid = x; callback(userGuid); }); }
// Use this for initialization void Start() { Debug.Log("In Editor, Logging in as Test User with access token: " + GameAuthentication.GetAppID()); var socialPlayUserObj = new PlatformUser(); socialPlayUserObj.appID = new Guid(GameAuthentication.GetAppID()); socialPlayUserObj.platformID = 1; socialPlayUserObj.platformUserID = "2"; socialPlayUserObj.userName = "******"; Systems.UserGetter.GetSocialPlayUser(socialPlayUserObj, GameAuthentication.OnUserAuthorized); }
public void LoginWithPlatformUser(Guid AppID, int platformID, string platformUserID, string userName) { PlatformUser platformUser = new PlatformUser(); platformUser.appID = AppID; platformUser.platformID = platformID; platformUser.platformUserID = platformUserID; platformUser.userName = userName; SocialPlayUserWebServiceGetter userGetter = new SocialPlayUserWebServiceGetter(); userGetter.GetSocialPlayUser(platformUser, OnReceivedUserInfo); }
void UserNameCallBack(FBResult response) { Dictionary<string, object> FBInfo = Facebook.MiniJSON.Json.Deserialize(response.Text) as Dictionary<string, object>; if (string.IsNullOrEmpty(response.Error)) { var socialPlayUserObj = new PlatformUser(); socialPlayUserObj.appID = new Guid(GameAuthentication.GetAppID()); socialPlayUserObj.platformID = 1; socialPlayUserObj.platformUserID = FB.UserId; socialPlayUserObj.userName = FBInfo["first_name"].ToString(); Systems.UserGetter.GetSocialPlayUser(socialPlayUserObj, GameAuthentication.OnUserAuthorized); if (OnRecivedUserInfo != null) { OnRecivedUserInfo(); } } }