Beispiel #1
0
    public void LogIn()
    {
        playSound("Button");

        LoadingPanel.SetActive(true);
        BacktoryUser.LoginInBackground(usernameLogIn.text, passwordLogIn.text, loginResponse =>
        {
            // Login operation done (fail or success), handling it:
            if (loginResponse.Successful)
            {
                PlayerPrefs.SetString("Username", usernameLogIn.text);
                PlayerPrefs.SetString("PassWord", passwordLogIn.text);
                // Login successful
                LogInPanel.SetTrigger("Idle");
                DownloadData();
                ShowLeaderBoard();
            }
            else if (loginResponse.Code == (int)BacktoryHttpStatusCode.Unauthorized)
            {
                // Username 'mohx' with password '123456' is wrong
                Debug.Log("Either username or password is wrong.");
                LogInLogText.text = GameManager.Language("نام کاربری یا رزم عبور اشتباه است", "Either username or password is wrong.", LogInLogText);
                LoadingPanel.SetActive(false);
            }
            else
            {
                // Operation generally failed, maybe internet connection issue
                Debug.Log("Login failed for other reasons like network issues.");
                LogInLogText.text = GameManager.Language("خطلا در ورود", "Login failed", LogInLogText);
                LoadingPanel.SetActive(false);
            }
        });
    }
Beispiel #2
0
 public void OpenLogInPanel()
 {
     signUpPanel.SetTrigger("Idle");
     LogInName.text = GameManager.Language("ورود", "Log In", LogInName);
     if (PlayerPrefs.GetString("Language") == "Persian")
     {
         UserNameLogInText.text = "نام کاربری";
         PassWordLogInText.text = "رمز ورود";
     }
     else
     {
         UserNameLogInText.text = "Username";
         PassWordLogInText.text = "Password";
     }
     LogInPanel.SetTrigger("Enter");
 }
Beispiel #3
0
    public void exitLogIn()
    {
        playSound("Button");

        LogInPanel.SetTrigger("Idle");
    }