예제 #1
0
    public void OnClickLogin()
    {
        registerManager.ResetLabels();
        registerManager.ToggleButtons(false);
        bool nameLenghtValidation = registerManager.CheckUsernameLength();

        registerManager.ToggleUsernameFilling(nameLenghtValidation);
        bool userExists = registerManager.CheckIfUserExists();

        registerManager.ToggleUsernameNotFound(userExists);
        bool passwordLenghtValidation = registerManager.CheckPasswordLength();

        registerManager.TogglePasswordFilling(userExists, passwordLenghtValidation);
        if (useFirebase)
        {
            DoFirebaseLogin();
            return;
        }
        if (nameLenghtValidation && userExists && passwordLenghtValidation && CheckUserPassword())
        {
            registerManager.Remember();
            LoadGame();
        }
        registerManager.ToggleButtons(true);
    }