コード例 #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 ReturnFromRegistration()
    {
        HeadingText.GetComponent <TextMeshProUGUI>().text = "User Login";
        LoginButton.SetActive(true);
        LoginButtonCover.SetActive(true);
        UserLoginText.SetActive(true);
        PasswordText.SetActive(true);
        RegisterButton.SetActive(true);
        //RegisterName, RegisterPassword, RegisterLocation, RegisterAge, SubmitCoverButton, SubmitButton;
        RegisterName.SetActive(false);
        RegisterPassword.SetActive(false);
        RegisterLocation.SetActive(false);
        RegisterAge.SetActive(false);
        SubmitCoverButton.SetActive(false);
        SubmitButton.SetActive(false);
        Registering = false;

        if (netManager)
        {
            if (netManager.IsConnectedToServer())
            {
                netManager.AttemptAccountCreation(RegisterName.GetComponent <TMP_InputField>().text, RegisterPassword.GetComponent <TMP_InputField>().text);
            }
        }
    }