Пример #1
0
    // Update is called once per frame
    void Update()
    {
        if (!loggingIn && !loggedIn && !Registering)
        {
            if (UserLoginText.GetComponent <TMP_InputField>().text != "" &&
                PasswordText.GetComponent <TMP_InputField>().text != "")
            {
                LoginButton.SetActive(true);
                LoginButtonCover.SetActive(false);
            }
            else
            {
                LoginButton.SetActive(false);
                LoginButtonCover.SetActive(true);
            }
        }

        if (Registering)
        {
            if (RegisterName.GetComponent <TMP_InputField>().text != "" &&
                RegisterPassword.GetComponent <TMP_InputField>().text != "" &&
                RegisterAge.GetComponent <TMP_InputField>().text != "" &&
                RegisterLocation.GetComponent <TMP_InputField>().text != "")
            {
                SubmitCoverButton.SetActive(false);
                SubmitButton.SetActive(true);
            }
            else
            {
                SubmitCoverButton.SetActive(true); SubmitButton.SetActive(false);
            }
        }


        if (loggingIn)
        {
            if (loginConfirmed)
            {
                fakeLoginCount++;
                if (fakeLoginCount > 180)
                {
                    LoggedIn();
                    loggingIn      = false;
                    fakeLoginCount = 0;
                }
            }
        }

        if (loginFailed)
        {
            errorCount++;
            if (errorCount > 250)
            {
                loginFailed = false;
                errorCount  = 0;
                ErrorMessageBacking.SetActive(false);
                ErrorMessageText.SetActive(false);
            }
        }
    }
Пример #2
0
    public void LoggingIn()
    {
        loggingIn = true;
        LoginButtonText.GetComponent <TextMeshProUGUI>().fontSize = 15.0f;
        LoginButtonText.GetComponent <TextMeshProUGUI>().text     = "Connecting...";

        if (netManager)
        {
            if (netManager.IsConnectedToServer())
            {
                netManager.AttemptLogin(UserLoginText.GetComponent <TMP_InputField>().text, PasswordText.GetComponent <TMP_InputField>().text);
            }
        }
    }