Exemple #1
0
        private void HandleiOSLoginMethod(Action <LoginResult> loginSuccess, Action <PlayFabError> loginFailure)
        {
#if UNITY_IOS
            if (GameServiceManager.GameService.IsSignedIn)
            {
                if (GameData.Current.LoginType != LoginType.Undefined && GameData.Current.LoginType != LoginType.GameService)
                {
                    HandleiOSDeviceIdLoginMethod(loginSuccess, loginFailure);
                    return;
                }


                var request = new LoginWithGameCenterRequest()
                {
                    PlayerId = GameServiceManager.GameService.PlayerId, CreateAccount = true
                };
                PlayFabClientAPI.LoginWithGameCenter(request, (LoginResult loginResult) => { OnPlayerLogin(loginResult); loginSuccess.Invoke(loginResult); IsLogged = true; PlayFabId = loginResult.PlayFabId; }, (PlayFabError e) => loginFailure.Invoke(e));
                GameData.Current.LoginType = LoginType.GameService;
            }
            else
            {
                HandleiOSDeviceIdLoginMethod(loginSuccess, loginFailure);
            }
#endif
        }
Exemple #2
0
        public override void OnEnter()
        {
            PlayFabSettings.TitleId = titleId.Value;

            var request = new LoginWithGameCenterRequest()
            {
                TitleId       = titleId.Value,
                PlayerId      = UnityEngine.Social.localUser.id,
                CreateAccount = createAccount.Value
            };

            PlayFabClientAPI.LoginWithGameCenter(request, OnLoginSucces, OnLoginFailure);
        }
        public void AuthenticateWithGameCenter()
        {
            LoginWithGameCenterRequest request = new LoginWithGameCenterRequest()
            {
                TitleId  = TITLE_ID,
                PlayerId = ""
            };

            PlayFabClientAPI.LoginWithGameCenter(request, (result) => {
                mPlayFabId     = result.PlayFabId;
                mSessionTicket = result.SessionTicket;

                IAuthenticationSuccess successResult = null;
                MyMessenger.Instance.Send <IAuthenticationSuccess>(BackendMessages.AUTH_SUCCESS, successResult);
            },
                                                 (error) => { HandleError(error, BackendMessages.AUTH_FAIL); });
        }
Exemple #4
0
        /// <summary>
        /// Not implemented yet.
        /// </summary>
        public static void LoginAccountNative()
        {
            //prompt for platform login Google Play, Gamecenter etc
            //then call native logins

            #if UNITY_ANDROID
            LoginWithGoogleAccountRequest request = new LoginWithGoogleAccountRequest()
            {
                TitleId               = PlayFabSettings.TitleId,
                ServerAuthCode        = "",
                InfoRequestParameters = instance.accountParams
            };
            PlayFabClientAPI.LoginWithGoogleAccount(request, OnLoggedIn, OnLoginError);
            #elif UNITY_IOS
            LoginWithGameCenterRequest request = new LoginWithGameCenterRequest()
            {
                TitleId  = PlayFabSettings.TitleId,
                PlayerId = "",
                InfoRequestParameters = instance.accountParams
            };
            PlayFabClientAPI.LoginWithGameCenter(request, OnLoggedIn, OnLoginError);
            #endif
        }
        public override void OnEnter()
        {
            PlayFabSettings.TitleId = titleId.Value;

#if UNITY_IOS
            var request = new LoginWithGameCenterRequest()
            {
                TitleId       = titleId.Value,
                PlayerId      = UnityEngine.Social.localUser.id,
                CreateAccount = createAccount.Value
            };

            PlayFabClientAPI.LoginWithGameCenter(request, OnLoginSucces, OnLoginFailure);
#elif UNITY_ANDROID
            var request = new LoginWithGoogleAccountRequest()
            {
                TitleId       = titleId.Value,
                AccessToken   = token.Value,
                CreateAccount = createAccount.Value
            };

            PlayFabClientAPI.LoginWithGoogleAccount(request, OnLoginSucces, OnLoginFailure);
#endif
        }