示例#1
0
    public void Login(Action onSuccess, Action onFailure)
    {
        if (PlayFabClientAPI.IsClientLoggedIn())
        {
            if (onSuccess != null)
            {
                onSuccess.Invoke();
            }
            return;
        }

        Debug.Log("Try to NetworkManager.Login");
        GetPlayerCombinedInfoRequestParams parameters = new GetPlayerCombinedInfoRequestParams()
        {
            GetUserAccountInfo = true
        };

        LoginWithAndroidDeviceIDRequest request = new LoginWithAndroidDeviceIDRequest()
        {
            TitleId       = PlayFabSettings.TitleId,
            CreateAccount = true,

            AndroidDeviceId = SystemInfo.deviceUniqueIdentifier,
            AndroidDevice   = SystemInfo.deviceModel,
            OS = SystemInfo.operatingSystem,
            InfoRequestParameters = parameters
        };

        PlayFabClientAPI.LoginWithAndroidDeviceID(request,
                                                  (result) => { OnLogin(onSuccess, onFailure, result); },
                                                  (error) => { OnFailedLogin(onFailure, error); }
                                                  );
    }
示例#2
0
 private void LogInWithIOSID(bool create)
 {
     Debug.Log("Login with IOS ID");
     if (!proceed)
     {
         proceed = true;
         //LoadingCanvas.enabled = true;
         ShowLoading();
         ShowCanvas(null);
         LoginWithIOSDeviceIDRequest        request       = new LoginWithIOSDeviceIDRequest();
         GetPlayerCombinedInfoRequestParams playerRequest = new GetPlayerCombinedInfoRequestParams();
         playerRequest.GetPlayerProfile = true;
         request.InfoRequestParameters  = playerRequest;
         request.CreateAccount          = create;
         request.DeviceId = SystemInfo.deviceUniqueIdentifier;
         request.TitleId  = PlayFabSettings.TitleId;
         //add to request OS and model
         if (create)
         {
             PlayFabClientAPI.LoginWithIOSDeviceID(request, LoginWithAccountCreated, OnPlayFabError);
         }
         else
         {
             PlayFabClientAPI.LoginWithIOSDeviceID(request, OnLoginSuccess, OnPlayFabError);
         }
     }
 }
示例#3
0
 public void Show(LoginManager loginManager, GetPlayerCombinedInfoRequestParams infoRequestParams = null, string email = "")
 {
     this.loginManager         = loginManager;
     this.infoRequestParams    = infoRequestParams;
     this.emailInputField.text = email;
     this.Dialog.Show();
 }
示例#4
0
        /// <summary>
        /// Logins the specified with password.
        /// </summary>
        /// <param name="withPassword">With the password.</param>
        /// <param name="withEmailid">With the emailid.</param>
        public static void Login(string withPassword, string withEmailid)
        {
            //create player info request.
            var playerinfo = new GetPlayerCombinedInfoRequestParams
            {
                GetCharacterInventories = true,
                GetCharacterList        = true,
                GetPlayerProfile        = true,
                GetPlayerStatistics     = true,
                GetTitleData            = true,
                GetUserAccountInfo      = true,
                GetUserData             = true,
                GetUserInventory        = true,
                GetUserReadOnlyData     = true,
                GetUserVirtualCurrency  = true,
                PlayerStatisticNames    = null,
                TitleDataKeys           = null,
                UserDataKeys            = null,
                UserReadOnlyDataKeys    = null
            };
            //create the request.
            var playfabLogin = new LoginWithEmailAddressRequest
            {
                Password = withPassword,
                Email    = withEmailid,
                TitleId  = PlayFabSettings.TitleId,
                LoginTitlePlayerAccountEntity = true,
                InfoRequestParameters         = playerinfo
            };

            //fire the api.
            PlayFabClientAPI.LoginWithEmailAddress(playfabLogin, Onsuccess,
                                                   OnFailure);
        }
    public static void GetAccountInfo(string _playfabId)
    {
        GetPlayerCombinedInfoRequestParams paramInfo = new GetPlayerCombinedInfoRequestParams()
        {
            GetTitleData           = true,
            GetUserInventory       = true,
            GetUserAccountInfo     = true,
            GetUserVirtualCurrency = true,
            GetPlayerProfile       = true,
            GetPlayerStatistics    = true,
            GetUserData            = true,
            GetUserReadOnlyData    = true
        };

        GetPlayerCombinedInfoRequest request = new GetPlayerCombinedInfoRequest()
        {
            PlayFabId             = _playfabId,
            InfoRequestParameters = paramInfo
        };

        PlayFabClientAPI.GetPlayerCombinedInfo(request, OnGotAccountInfo, OnAPIError);

        // Build the request, in this case, there are no parameters to set
        GetAccountInfoRequest req = new GetAccountInfoRequest();

        // Send the request, and provide 2 callbacks for when the request succeeds or fails
        PlayFabClientAPI.GetAccountInfo(req, OnGetAccountInfoSuccess, OnAPIError);
    }
示例#6
0
    public void TransferPlayFabAccount(string playerCustomId)
    {
        Debug.Log("Attempting to transfer account...");
        ShowConnectingLayer();
        menuManager.infoPanels[3].action           = "Transfer";
        menuManager.infoPanels[3].transferPasscode = playerCustomId;

        GetPlayerCombinedInfoRequestParams playerInfoRequest = new GetPlayerCombinedInfoRequestParams();

        playerInfoRequest.GetUserAccountInfo = true;
        playerInfoRequest.GetUserData        = true;

        #if UNITY_EDITOR
        LoginWithCustomIDRequest request = new LoginWithCustomIDRequest();
        request.CustomId              = playerCustomId;
        request.CreateAccount         = false;
        request.InfoRequestParameters = playerInfoRequest;

        PlayFabClientAPI.LoginWithCustomID(request, OnTransferSuccess, OnTransferError);
        #elif UNITY_IOS
        LoginWithIOSDeviceIDRequest request = new LoginWithIOSDeviceIDRequest();
        request.DeviceId              = playerCustomId;
        request.OS                    = SystemInfo.operatingSystem;
        request.DeviceModel           = SystemInfo.deviceModel;
        request.CreateAccount         = false;
        request.InfoRequestParameters = playerInfoRequest;

        PlayFabClientAPI.LoginWithIOSDeviceID(request, OnTransferSuccess, OnTransferError);
        #endif
    }
示例#7
0
    public void LoginToPlayFab(string playerCustomId)
    {
        Debug.Log("Logging into PlayFab...");
        ShowConnectingLayer();
        menuManager.infoPanels[3].action = "Login";

        GetPlayerCombinedInfoRequestParams playerInfoRequest = new GetPlayerCombinedInfoRequestParams();

        playerInfoRequest.GetUserData = true;

        #if UNITY_EDITOR
        LoginWithCustomIDRequest request = new LoginWithCustomIDRequest();
        request.CustomId              = playerCustomId;
        request.CreateAccount         = false;
        request.InfoRequestParameters = playerInfoRequest;

        PlayFabClientAPI.LoginWithCustomID(request, OnPlayFabLoginSuccess, OnPlayFabLoginError);
        #elif UNITY_IOS
        LoginWithIOSDeviceIDRequest request = new LoginWithIOSDeviceIDRequest();
        request.DeviceId              = playerCustomId;
        request.OS                    = SystemInfo.operatingSystem;
        request.DeviceModel           = SystemInfo.deviceModel;
        request.CreateAccount         = false;
        request.InfoRequestParameters = playerInfoRequest;

        PlayFabClientAPI.LoginWithIOSDeviceID(request, OnPlayFabLoginSuccess, OnPlayFabLoginError);
        #endif
    }
示例#8
0
        private GetPlayerCombinedInfoRequestParams GetCombinedInfoRequest(GetPlayerCombinedInfoRequestParams request)
        {
            request = request ?? new GetPlayerCombinedInfoRequestParams();
            request.GetUserVirtualCurrency = true;
            request.GetUserInventory       = true;
            request.GetUserAccountInfo     = true;

            return(request);
        }
示例#9
0
    void Start()
    {
        if (!PlayFabClientAPI.IsClientLoggedIn())
        {
            var infoRequestParameters = new GetPlayerCombinedInfoRequestParams()
            {
                GetPlayerProfile   = true,
                ProfileConstraints = new PlayerProfileViewConstraints()
                {
                    ShowDisplayName = true
                }
            };

#if !UNITY_EDITOR && UNITY_IOS
            string deviceId = UnityEngine.iOS.Device.vendorIdentifier;
            var    request  = new LoginWithIOSDeviceIDRequest {
                DeviceId              = deviceId,
                CreateAccount         = true,
                InfoRequestParameters = infoRequestParameters
            };
            PlayFabClientAPI.LoginWithIOSDeviceID(request, OnLoginSuccess, OnError);
#else
            string customId;
            if (!PlayerPrefs.HasKey("customId"))
            {
                Guid guid = Guid.NewGuid();
                customId = guid.ToString();
                PlayerPrefs.SetString("customId", customId);
            }
            else
            {
                customId = PlayerPrefs.GetString("customId");
            }

            var request = new LoginWithCustomIDRequest {
                CustomId              = customId,
                CreateAccount         = true,
                InfoRequestParameters = infoRequestParameters
            };
            PlayFabClientAPI.LoginWithCustomID(request, OnLoginSuccess, OnError);
#endif
        }
        else
        {
            if (string.IsNullOrEmpty(DisplayName))
            {
                PlayFabClientAPI.GetPlayerProfile(new GetPlayerProfileRequest()
                {
                    ProfileConstraints = new PlayerProfileViewConstraints()
                    {
                        ShowDisplayName = true
                    }
                }, OnGetProfileSuccess, OnError);
            }
        }
    }
示例#10
0
        public void OnLogInButtonPress()
        {
            var username = screenNameInputField.text;
            var password = passwordInputField.text;

            // save login in prefs
            PlayerPrefs.SetString("password", password);

            // lets server know we want account info returned so we can get screenName/email
            var requestParams = new GetPlayerCombinedInfoRequestParams()
            {
                GetUserAccountInfo = true
            };

            if (username.Contains("@")) // username is actually an email
            {
                var request = new LoginWithEmailAddressRequest
                {
                    InfoRequestParameters = requestParams,
                    Email    = username,
                    Password = password,
                    TitleId  = PlayFabSettings.TitleId
                };

                PlayFabClientAPI.LoginWithEmailAddress(
                    request,
                    SuccessfulLogin,
                    FailureCallback
                    );
            }
            else
            {
                // save login in prefs
                PlayerPrefs.SetString("screenName", username);

                var request = new LoginWithPlayFabRequest
                {
                    InfoRequestParameters = requestParams,
                    Username = username,
                    Password = password,
                    TitleId  = PlayFabSettings.TitleId
                };


                PlayFabClientAPI.LoginWithPlayFab(
                    request,
                    SuccessfulLogin,
                    FailureCallback
                    );
            }
        }
示例#11
0
    public void Login(HatchManager.HatchPlayer player)
    {
        GetPlayerCombinedInfoRequestParams infoRequestParameters = new GetPlayerCombinedInfoRequestParams
        {
            GetUserAccountInfo  = true,
            GetPlayerStatistics = true
        };
        LoginWithCustomIDRequest request2 = new LoginWithCustomIDRequest
        {
            TitleId               = this.GetPlayFabTitleID(),
            CustomId              = player.HatchID,
            CreateAccount         = new bool?(true),
            InfoRequestParameters = infoRequestParameters
        };

        PlayFabClientAPI.LoginWithCustomID(request2, new Action <LoginResult>(this.OnLoginSuccess), new Action <PlayFabError>(this.OnLoginError), null, null);
    }
        public override void Login(Action <object> LoginSuccessCallback, Action <LoginFailCode> LoginFailedCallback, GetPlayerCombinedInfoRequestParams infoRequestParams = null)
        {
            SuccessCallback = LoginSuccessCallback;
            FailedCallback  = LoginFailedCallback;
            infoParams      = infoRequestParams;

            if (!FB.IsInitialized)
            {
                // Initialize the Facebook SDK
                FB.Init(InitCallback, OnHideUnity);
            }
            else
            {
                // Already initialized, signal an app activation App Event
                Login();
            }
        }
示例#13
0
    public void updateUserprofile()
    {
        var infoRequestParameters = new GetPlayerCombinedInfoRequestParams();

        infoRequestParameters.GetPlayerProfile   = true;
        infoRequestParameters.GetTitleData       = true;
        infoRequestParameters.GetUserAccountInfo = true;
        infoRequestParameters.GetUserData        = true;
        infoRequestParameters.ProfileConstraints = new PlayerProfileViewConstraints {
            ShowDisplayName = true, ShowContactEmailAddresses = true
        };
        var request = new GetPlayerCombinedInfoRequest {
            InfoRequestParameters = infoRequestParameters
        };

        PlayFabClientAPI.GetPlayerCombinedInfo(request, GetPlayerCombinedInfoRequestSuccess, GetPlayerCombinedInfoRequestFail);

        /*var request = new GetAccountInfoRequest { };
         * PlayFabClientAPI.GetAccountInfo(request, onGetAccountInfoSuccess, onGetAccountInfoFail);*/
    }
示例#14
0
    private void Awake()
    {
        // We need 'Player Profile' and 'User data' on login.
        infoRequestParams = new GetPlayerCombinedInfoRequestParams()
        {
            GetPlayerProfile       = true,
            GetUserReadOnlyData    = true,
            GetUserVirtualCurrency = true,
            //GetPlayerStatistics = true
        };

        InitialiseLoginPathways();

        if (autoLogin)
        {
            LoginType currentLoginPathway = PlayFabAuthenticationBase.GetLoginPathway();

            LoginPathways[currentLoginPathway].Invoke();
        }
    }
        /// <summary>
        /// Registers the specified with display name.
        /// </summary>
        /// <param name="withDisplayName">Display name of the user.</param>
        /// <param name="withEmailId">The  email of the user.</param>
        /// <param name="withPassword">The password for the user.</param>
        /// <param name="isRequireBothUsernameAndEmail">The is require both username and email.</param>
        /// <param name="withTitleId">The title identifier.</param>
        /// <param name="withUserName">Name of the  user.</param>
        /// <param name="withPlayerSecret">The player secret.</param>
        /// <param name="withEncryptedRequest">Encrypted request.</param>
        /// <param name="wthRequestParameters">The request parameters.</param>
        /// <param name="withLoginTitlePlayerAccountEntity">if set to <c>true</c> [with login title player account entity].</param>
        public static void Register(string withDisplayName, string withEmailId, string withPassword,
                                    bool isRequireBothUsernameAndEmail, [Optional] string withTitleId, [Optional] string withUserName,
                                    [Optional] string withPlayerSecret, [Optional] string withEncryptedRequest,
                                    [Optional] GetPlayerCombinedInfoRequestParams wthRequestParameters,
                                    [Optional] bool withLoginTitlePlayerAccountEntity)
        {
            //create an request for register
            var playfabregistrationRequest = new RegisterPlayFabUserRequest
            {
                Email       = withEmailId,
                DisplayName = withDisplayName,
                Password    = withPassword,
                Username    = withUserName,
                RequireBothUsernameAndEmail = isRequireBothUsernameAndEmail,
            };

            //fire the api
            PlayFabClientAPI.RegisterPlayFabUser(playfabregistrationRequest, Onsuccess,
                                                 OnFailure, null, null);
        }
示例#16
0
    public static Promise <Player> GetPlayer()
    {
        var promise       = new Promise <Player>();
        var request       = new GetPlayerCombinedInfoRequest();
        var requestParams = new GetPlayerCombinedInfoRequestParams {
            GetPlayerStatistics = true, GetUserData = true, GetUserInventory = true, GetUserVirtualCurrency = true
        };

        request.InfoRequestParameters = requestParams;
        PlayFabClientAPI.GetPlayerCombinedInfo(request, (result) => {
            try {
                Player player = new Player();
                List <Currency> currencies = CurrencyService.CurrenciesFromDictionary(result.InfoResultPayload.UserVirtualCurrency);
                if (currencies != null)
                {
                    player.SetCurrencies(currencies);
                }
                List <Statistic> statistics = StatisticService.StatisticsFromList(result.InfoResultPayload.PlayerStatistics);
                if (statistics != null)
                {
                    player.SetStatistics(statistics);
                }
                Inventory inventory = ItemService.InventoryFromItemInstanceList(result.InfoResultPayload.UserInventory);
                if (inventory != null)
                {
                    player.SetInventory(inventory);
                }
                PlayerData playerData = DataService.PlayerDataFromDictionary(result.InfoResultPayload.UserData);
                if (playerData != null)
                {
                    player.SetData(playerData);
                }
                GetPlayerSuccessBallback(result);
                promise.Resolve(player);
            } catch (Exception ex) {
                promise.Reject(ex);
            }
        }, ErrorCallback);
        return(promise);
    }
示例#17
0
        public IEnumerator LoginWithEmailAndPasswordDialog(GetPlayerCombinedInfoRequestParams infoRequestParams = null)
        {
            if (PF.Login.HasEverLoggedIn)
            {
                if (PF.Login.AutoLoginWithDeviceId)
                {
                    var login = PF.Login.LoginWithDeviceId(false, PF.Login.DeviceId, infoRequestParams);

                    yield return(login);

                    if (login.HasError)
                    {
                        DialogManager.GetDialog <LogInDialog>().Show(infoRequestParams);
                    }
                    else if (PF.Login.IsLoggedIn)
                    {
                        yield break;
                    }
                    else
                    {
                        // NOTE [bgish]: This should never happen, but catching this case just in case
                        Debug.LogError("LoginHelper.LoginWithDeviceId failed, but didn't correctly report the error.");
                        DialogManager.GetDialog <LogInDialog>().Show(infoRequestParams);
                    }
                }
                else
                {
                    DialogManager.GetDialog <LogInDialog>().Show(infoRequestParams);
                }
            }
            else
            {
                DialogManager.GetDialog <SignUpDialog>().Show(infoRequestParams);
            }

            while (PF.Login.IsLoggedIn == false)
            {
                yield return(null);
            }
        }
示例#18
0
 public void LogIn()
 {
     if (!proceed)
     {
         if (Email.Length > 0 && Password.Length > 0)
         {
             proceed = true;
             //LoadingCanvas.enabled = true;
             ShowLoading();
             LoginCanvas.enabled = false;
             LoginWithEmailAddressRequest       request       = new LoginWithEmailAddressRequest();
             GetPlayerCombinedInfoRequestParams playerRequest = new GetPlayerCombinedInfoRequestParams();
             playerRequest.GetPlayerProfile = true;
             request.InfoRequestParameters  = playerRequest;
             request.Email    = Email;
             request.Password = Password;
             request.TitleId  = PlayFabSettings.TitleId;
             PlayFabClientAPI.LoginWithEmailAddress(request, OnLoginSuccess, OnPlayFabError);
             AuthMethod = "email";
         }
     }
 }
示例#19
0
        //setting up parameters and callbacks
        void Awake()
        {
            //make sure we keep one instance of this script in the game
            if (instance)
            {
                Destroy(gameObject);
                return;
            }
            DontDestroyOnLoad(this);

            //set static reference
            instance = this;
            bool validationOnly = false;

            #if PLAYFAB_VALIDATION
            validationOnly = true;
            #endif

            accountParams = new GetPlayerCombinedInfoRequestParams()
            {
                GetUserInventory       = !validationOnly,
                GetUserVirtualCurrency = !validationOnly,
                GetUserData            = !validationOnly,
                UserDataKeys           = new List <string>()
                {
                    DBManager.playerKey, DBManager.selectedKey
                }
            };

            if (validationOnly)
            {
                return;
            }
            //subscribe to selected events for handling them automatically
            ShopManager.itemSelectedEvent   += x => SetSelected();
            ShopManager.itemDeselectedEvent += x => SetSelected();
        }
        public override void Login(Action <object> LoginSuccessCallback, Action <LoginFailCode> LoginFailedCallback, GetPlayerCombinedInfoRequestParams infoRequestParams = null)
        {
            FailedCallback = LoginFailedCallback;

#if UNITY_ANDROID
            PlayFabClientAPI.LoginWithAndroidDeviceID(new LoginWithAndroidDeviceIDRequest
            {
                OS              = SystemInfo.operatingSystem,
                AndroidDevice   = SystemInfo.deviceModel,
                AndroidDeviceId = SystemInfo.deviceUniqueIdentifier,
                CreateAccount   = true,

                InfoRequestParameters = infoRequestParams
            }, (result) =>
            {
                SaveLoginPathway(LoginType.MobileSpecific);

                LoginSuccessCallback(result);
            }, ErrorCallback);
#elif UNITY_IPHONE
            PlayFabClientAPI.LoginWithIOSDeviceID(new LoginWithIOSDeviceIDRequest
            {
                DeviceId      = UnityEngine.iOS.Device.vendorIdentifier,
                OS            = SystemInfo.operatingSystem,
                DeviceModel   = SystemInfo.deviceModel,
                CreateAccount = true,

                InfoRequestParameters = infoRequestParams
            }, (result) =>
            {
                SaveLoginPathway(LoginType.MobileSpecific);

                LoginSuccessCallback(result);
            }, ErrorCallback);
#endif
        }
 public abstract void Login(Action <object> LoginSuccessCallback, Action <LoginFailCode> LoginFailedCallback, GetPlayerCombinedInfoRequestParams infoRequestParams = null);
        void LoginWithGameCenterAccount(string id, Action <object> LoginSuccessCallback, Action <LoginFailCode> LoginFailedCallback, GetPlayerCombinedInfoRequestParams infoRequestParams)
        {
#if UNITY_IOS
            LinkGameCenterAccountRequest request = new LinkGameCenterAccountRequest();
            request.GameCenterId = gameCenterId;
            request.ForceLink    = false;

            PlayFabClientAPI.LinkGameCenterAccount(request, (result) =>
            {
                SaveLoginPathway(LoginType.Google);

                SetSocialPlayformID(gameCenterId);

                ResultCallback(true);
            },
                                                   (error) =>
            {
                ResultCallback(false);
            });
#endif
        }
        public override void Login(Action <object> LoginSuccessCallback, Action <LoginFailCode> LoginFailedCallback, GetPlayerCombinedInfoRequestParams infoRequestParams = null)
        {
#if UNITY_IOS
            string socialPlatformID = GetSocialPlatformID();

            if (string.IsNullOrEmpty(socialPlatformID))
            {
                Debug.LogWarning("Not logged into GameCenter. Logging in..");

                Social.Active = new GameCenterPlatform();

                Social.localUser.Authenticate((bool success) =>
                {
                    if (success)
                    {
                        SetSocialPlayformID(Social.localUser.id);

                        LoginWithGameCenterAccount(socialPlatformID, LoginSuccessCallback, LoginFailedCallback, infoRequestParams);
                    }
                    else
                    {
                        LoginFailedCallback(LoginFailCode.SocialPlatformLoginFailed);
                    }
                });
            }
            else
            {
                LoginWithGameCenterAccount(socialPlatformID, LoginSuccessCallback, LoginFailedCallback, infoRequestParams);
            }
#endif
        }
示例#24
0
        void LoginWithGooglePlayAccount(string id, Action <object> LoginSuccessCallback, Action <LoginFailCode> LoginFailedCallback, GetPlayerCombinedInfoRequestParams infoRequestParams)
        {
            // NOTE: LoginWithGoogleAccount needs google credential (Auth2.0). PlayGamesPlatform login does not give that, so use google id as a custon id.
            PlayFabClientAPI.LoginWithCustomID(new LoginWithCustomIDRequest
            {
                CustomId              = id,
                CreateAccount         = false,
                InfoRequestParameters = infoRequestParams
            },
                                               (result) =>
            {
                SaveLoginPathway(LoginType.Google);

                LoginSuccessCallback(result);
            },
                                               (error) =>
            {
                Debug.Log(string.Format("GooglePlay Auth Error {0}: {1}, {2}", error.HttpCode, error.Error.ToString(), error.ErrorMessage));

                if (error.Error == PlayFabErrorCode.AccountNotFound)
                {
                    LoginFailedCallback(LoginFailCode.AccountNotFound);
                }
                else if (error.Error == PlayFabErrorCode.AccountBanned)
                {
                    LoginFailedCallback(LoginFailCode.AccountBanned);
                }
                else
                {
                    LoginFailedCallback(LoginFailCode.UnknownError);
                }
            });
        }
示例#25
0
        public override void Login(Action <object> LoginSuccessCallback, Action <LoginFailCode> LoginFailedCallback, GetPlayerCombinedInfoRequestParams infoRequestParams = null)
        {
            string socialPlatformID = GetSocialPlatformID();

            if (string.IsNullOrEmpty(socialPlatformID))
            {
                Debug.LogWarning("Not logged into Google. Logging in..");

#if (UNITY_ANDROID || (UNITY_IPHONE && !NO_GPGS))
                PlayGamesPlatform.DebugLogEnabled = true;

                PlayGamesPlatform.Activate();

                Social.localUser.Authenticate((bool success) =>
                {
                    if (success)
                    {
                        SetSocialPlayformID(Social.localUser.id);

                        LoginWithGooglePlayAccount(socialPlatformID, LoginSuccessCallback, LoginFailedCallback, infoRequestParams);
                    }
                    else
                    {
                        LoginFailedCallback(LoginFailCode.SocialPlatformLoginFailed);
                    }
                });
#else
                Debug.LogWarning("Only Android platfor or Ios with !NO_GPGS is allowed");
#endif
            }
            else
            {
                LoginWithGooglePlayAccount(socialPlatformID, LoginSuccessCallback, LoginFailedCallback, infoRequestParams);
            }
        }
示例#26
0
        private IEnumerator <LoginResult> LoginWithFacebookCoroutine(bool createAccount, GetPlayerCombinedInfoRequestParams combinedInfoParams, List <string> facebookPermissions)
        {
            #if !USING_FACEBOOK_SDK
            throw new FacebookException("USING_FACEBOOK_SDK is not defined!  Check your AppSettings.");
            #else
            // Making sure all passed in facebook permissions are appended to the global list
            if (facebookPermissions != null)
            {
                foreach (var facebookPermission in facebookPermissions)
                {
                    this.FacebookPermissions.AddIfUnique(facebookPermission);
                }
            }

            var accessToken = this.GetFacebookAccessToken();

            while (accessToken.IsDone == false)
            {
                yield return(default(LoginResult));
            }

            var facebookLoginRequest = new LoginWithFacebookRequest
            {
                AccessToken           = accessToken.Value,
                CreateAccount         = createAccount,
                InfoRequestParameters = this.GetCombinedInfoRequest(combinedInfoParams),
            };

            var facebookLogin = PF.Do <LoginWithFacebookRequest, LoginResult>(facebookLoginRequest, PlayFabClientAPI.LoginWithFacebook);

            while (facebookLogin.IsDone == false)
            {
                yield return(default(LoginResult));
            }

            yield return(facebookLogin.Value);
            #endif
        }
示例#27
0
 public UnityTask <LoginResult> LoginWithFacebook(bool createAccount, GetPlayerCombinedInfoRequestParams combinedInfoParams, List <string> facebookPermissions)
 {
     return(UnityTask <LoginResult> .Run(this.LoginWithFacebookCoroutine(createAccount, combinedInfoParams, facebookPermissions)));
 }
示例#28
0
 public UnityTask <LoginResult> LoginWithFacebook(bool createAccount, GetPlayerCombinedInfoRequestParams combinedInfoParams)
 {
     return(UnityTask <LoginResult> .Run(this.LoginWithFacebookCoroutine(createAccount, combinedInfoParams, null)));
 }
示例#29
0
 public UnityTask <LoginResult> LoginWithDeviceId(bool createAccount, string deviceId, GetPlayerCombinedInfoRequestParams combinedInfoParams = null)
 {
     if (Application.isEditor || Platform.IsIosOrAndroid == false)
     {
         return(PF.Do <LoginWithCustomIDRequest, LoginResult>(
                    new LoginWithCustomIDRequest
         {
             CreateAccount = createAccount,
             CustomId = deviceId,
             InfoRequestParameters = this.GetCombinedInfoRequest(combinedInfoParams),
         },
                    PlayFabClientAPI.LoginWithCustomID));
     }
     else if (Platform.CurrentDevicePlatform == DevicePlatform.iOS)
     {
         return(PF.Do <LoginWithIOSDeviceIDRequest, LoginResult>(
                    new LoginWithIOSDeviceIDRequest
         {
             CreateAccount = createAccount,
             DeviceId = deviceId,
             DeviceModel = SystemInfo.deviceModel,
             OS = SystemInfo.operatingSystem,
             InfoRequestParameters = this.GetCombinedInfoRequest(combinedInfoParams),
         },
                    PlayFabClientAPI.LoginWithIOSDeviceID));
     }
     else if (Platform.CurrentDevicePlatform == DevicePlatform.Android)
     {
         return(PF.Do <LoginWithAndroidDeviceIDRequest, LoginResult>(
                    new LoginWithAndroidDeviceIDRequest
         {
             CreateAccount = createAccount,
             AndroidDeviceId = deviceId,
             AndroidDevice = SystemInfo.deviceModel,
             OS = SystemInfo.operatingSystem,
             InfoRequestParameters = this.GetCombinedInfoRequest(combinedInfoParams),
         },
                    PlayFabClientAPI.LoginWithAndroidDeviceID));
     }
     else
     {
         throw new NotImplementedException();
     }
 }
示例#30
0
 public UnityTask <PlayFabLoginResultCommon> LoginWithEmail(bool createAccount, string email, string password, GetPlayerCombinedInfoRequestParams combinedInfoParams = null)
 {
     if (createAccount)
     {
         return(PF.Do <RegisterPlayFabUserRequest, PlayFabLoginResultCommon>(
                    new RegisterPlayFabUserRequest
         {
             Email = email,
             Password = password,
             InfoRequestParameters = this.GetCombinedInfoRequest(combinedInfoParams),
             RequireBothUsernameAndEmail = false,
         },
                    PlayFabClientAPI.RegisterPlayFabUser));
     }
     else
     {
         return(PF.Do <LoginWithEmailAddressRequest, PlayFabLoginResultCommon>(
                    new LoginWithEmailAddressRequest
         {
             Email = email,
             Password = password,
             InfoRequestParameters = this.GetCombinedInfoRequest(combinedInfoParams),
         },
                    PlayFabClientAPI.LoginWithEmailAddress));
     }
 }