/// <summary>
    /// Tests attempts to use device identifier as a valid login credentials. If the device has been used before this will succeed, otherwise fail.
    /// </summary>
    public static void TestDeviceIdHasAccount()
    {
        if (GetDeviceId())
        {
            LoginMethodUsed = LoginPathways.deviceId;
            if (!string.IsNullOrEmpty(android_id))
            {
                Debug.Log("Testing Android Device ID: " + android_id);
                LoginWithAndroidDeviceIDRequest request = new LoginWithAndroidDeviceIDRequest();
                request.AndroidDeviceId = android_id;
                request.TitleId         = PlayFabSettings.TitleId;
                request.CreateAccount   = false;

                PlayFabClientAPI.LoginWithAndroidDeviceID(request, OnLoginResult, OnTestDeviceIdHasAccountError);
            }
            else if (!string.IsNullOrEmpty(ios_id))
            {
                Debug.Log("Testing IOS Device ID: " + ios_id);
                LoginWithIOSDeviceIDRequest request = new LoginWithIOSDeviceIDRequest();
                request.DeviceId      = ios_id;
                request.TitleId       = PlayFabSettings.TitleId;
                request.CreateAccount = false;

                PlayFabClientAPI.LoginWithIOSDeviceID(request, OnLoginResult, OnTestDeviceIdHasAccountError);
            }
        }
    }
Пример #2
0
    void ChangeLoginPathway(LoginPathways path, Button btn)
    {
        LoginPathwayChange(path, btn);

        Vector2 pos = btn.GetComponent <RectTransform>().anchoredPosition;

        arrow.GetComponent <RectTransform>().anchoredPosition = new Vector2(pos.x, arrow.GetComponent <RectTransform>().anchoredPosition.y);
    }
    /// <summary>
    /// Sign on using a google token.
    /// </summary>
    /// <param name="token">Token obtained with a native Google-Play plugin</param>
    public static void SignOnWithGoogle(string token)
    {
        LoginMethodUsed = LoginPathways.googlePlus;
        LoginWithGoogleAccountRequest request = new LoginWithGoogleAccountRequest();

        request.AccessToken   = token;
        request.CreateAccount = true;

        PlayFabClientAPI.LoginWithGoogleAccount(request, OnLoginResult, OnLoginError);
    }
    /// <summary>
    /// Login with Facebook token.
    /// </summary>
    /// <param name="token">Token obtained through the FB plugin. (works on mobile and FB canvas only)</param>
    private static void LoginWithFacebook(string token)
    {
        LoginMethodUsed = LoginPathways.facebook;
        LoginWithFacebookRequest request = new LoginWithFacebookRequest();

        request.AccessToken   = token;
        request.TitleId       = PlayFabSettings.TitleId;
        request.CreateAccount = false;

        PlayFabClientAPI.LoginWithFacebook(request, OnLoginResult, OnLoginError);
    }
 /// <summary>
 /// Login with PlayFab username.
 /// </summary>
 /// <param name="user">Username to use</param>
 /// <param name="pass">Password to use</param>
 public static void LoginWithUsername(string user, string password)
 {
     if (user.Length > 0 && password.Length > 0)
     {
         LoginMethodUsed = LoginPathways.pf_username;
         LoginWithPlayFabRequest request = new LoginWithPlayFabRequest();
         request.Username = user;
         request.Password = password;
         request.TitleId  = PlayFabSettings.TitleId;
         PlayFabClientAPI.LoginWithPlayFab(request, OnLoginResult, OnLoginError);
     }
     else
     {
         if (OnPlayFabError != null)
         {
             OnLoginFail("User Name and Password cannot be blank.");
         }
     }
 }
    /// <summary>
    /// Login using the email associated with a PlayFab account.
    /// </summary>
    /// <param name="user">User.</param>
    /// <param name="password">Password.</param>
    public static void LoginWithEmail(string user, string password)
    {
        if (user.Length > 0 && password.Length > 0)
        {
            LoginMethodUsed = LoginPathways.pf_email;
            LoginWithEmailAddressRequest request = new LoginWithEmailAddressRequest();
            request.Email    = user;
            request.Password = password;
            request.TitleId  = PlayFabSettings.TitleId;

            PlayFabClientAPI.LoginWithEmailAddress(request, OnLoginResult, OnLoginError);
        }
        else
        {
            if (OnPlayFabError != null)
            {
                OnLoginFail("Username or Password is invalid. Check credentails and try again");
            }
        }
    }