Exemplo n.º 1
0
    public void Login()
    {
        Debug.Log("Logging in");
        Debug.Log(emailInput.text);
        Debug.Log(passwordInput.text);
        if (emailInput.text.Equals("") || passwordInput.text.Equals(""))
        {
            PlayfabUtils.OnError(feedbackText, "Login needs email and password!");
            return;
        }
        if (passwordInput.text.Length < 6)
        {
            PlayfabUtils.OnError(feedbackText, "Password needs to be at least 6 characters!");
            return;
        }
        var request = new LoginWithEmailAddressRequest
        {
            Email    = emailInput.text,
            Password = passwordInput.text,
            InfoRequestParameters = new GetPlayerCombinedInfoRequestParams
            {
                GetPlayerProfile   = true,
                GetUserData        = true,
                GetUserAccountInfo = true
            }
        };

        Debug.Log("Sending the data...");
        PlayFabClientAPI.LoginWithEmailAddress(request, OnLoginSuccess, OnError);
    }
Exemplo n.º 2
0
 public void OnPageActive()
 {
     loginManager      = gameObject.GetComponent <PlayfabLogin>();
     feedbackText.text = "";
     usernameText.text = loginManager.getDisplayName();
     if (loginManager.isLoggedIn())
     {
         GetLeaderboard();
     }
     else
     {
         PlayfabUtils.OnError(feedbackText, "You must login first to see the leaderboard!");
     }
 }
Exemplo n.º 3
0
    public void ResetPassword()
    {
        if (emailInput.text.Equals(""))
        {
            PlayfabUtils.OnError(feedbackText, "Reset Password needs email!");
            return;
        }
        var request = new SendAccountRecoveryEmailRequest
        {
            Email   = emailInput.text,
            TitleId = PlayfabUtils.TITLE_ID
        };

        PlayFabClientAPI.SendAccountRecoveryEmail(request, OnPasswordRecoverySent, OnError);
    }
Exemplo n.º 4
0
    public void ResetPassword()
    {
        if (loginManager.getEmail() == "")
        {
            PlayfabUtils.OnError(feedbackText, "Reset Password needs login!");
            return;
        }
        var request = new SendAccountRecoveryEmailRequest
        {
            Email   = loginManager.getEmail(),
            TitleId = PlayfabUtils.TITLE_ID
        };

        PlayFabClientAPI.SendAccountRecoveryEmail(request, OnPasswordRecoverySent, OnError);
    }
Exemplo n.º 5
0
    public void UpdateDisplayName()
    {
        if (!loginManager.isLoggedIn())
        {
            PlayfabUtils.OnError(feedbackText, "Please login first!");
            return;
        }
        if (nameInput.text == "")
        {
            PlayfabUtils.OnError(feedbackText, "New Display Name must not be empty!");
            return;
        }
        var request = new UpdateUserTitleDisplayNameRequest
        {
            DisplayName = nameInput.text
        };

        PlayFabClientAPI.UpdateUserTitleDisplayName(request, OnNameUpdated, OnError);
    }
Exemplo n.º 6
0
    public void OnPageActive()
    {
        loginManager      = gameObject.GetComponent <PlayfabLogin>();
        feedbackText.text = "";
        leaveBtn.SetActive(false);
        playBtn.SetActive(false);

        usernameText.text = loginManager.getDisplayName();
        enemyText.text    = "Loading...";
        if (loginManager.isLoggedIn())
        {
            backBtn.GetComponent <Button>().interactable = false;
            StartMatchmaking();
        }
        else
        {
            backBtn.GetComponent <Button>().interactable = true;
            PlayfabUtils.OnError(feedbackText, "You must login first to start matchmaking!");
        }
    }
Exemplo n.º 7
0
    private void OnTicketGet(GetMatchmakingTicketResult res)
    {
        PlayfabUtils.OnSuccess(feedbackText, $"Matchmaking Status: {res.Status}");

        switch (res.Status)
        {
        case "Matched":
            StopCoroutine(pollTicketCoroutine);
            leaveBtn.SetActive(false);
            PrepareMatch(res.MatchId);
            break;

        case "Canceled":
            PlayfabUtils.OnError(feedbackText, "Matchmaking timeout! Please try again...");
            StopCoroutine(pollTicketCoroutine);
            leaveBtn.SetActive(false);
            backBtn.GetComponent <Button>().interactable = true;
            break;
        }
    }
Exemplo n.º 8
0
    public void Register()
    {
        if (emailInput.text.Equals("") || nameInput.text.Equals("") || passwordInput.text.Equals(""))
        {
            PlayfabUtils.OnError(feedbackText, "Register needs email, name, and password!");
            return;
        }
        if (passwordInput.text.Length < 6)
        {
            PlayfabUtils.OnError(feedbackText, "Password needs to be at least 6 characters!");
            return;
        }
        var request = new RegisterPlayFabUserRequest
        {
            Email       = emailInput.text,
            Password    = passwordInput.text,
            DisplayName = nameInput.text,
            RequireBothUsernameAndEmail = false
        };

        PlayFabClientAPI.RegisterPlayFabUser(request, OnRegisterSuccess, OnError);
    }
Exemplo n.º 9
0
 private void OnError(PlayFabError error)
 {
     PlayfabUtils.OnError(feedbackText, error.ErrorMessage);
 }