コード例 #1
0
    public void InputUsername(string newUsername)
    {
        doneButton.interactable = false;

        if (!string.IsNullOrEmpty(newUsername))
        {
            Debug.Log("Checking username");
            highscores.ContainsUsername(newUsername, (bool containsNew) => {
                if (!containsNew)
                {
                    Debug.Log("Setting username to " + newUsername);

                    SetUsername(newUsername);
                    ClearError();

                    passwordPanel.SetActive(true);
                }
                else
                {
                    Debug.Log("Username taken");
                    ShowError("Username Taken");
                    usernameLoginField.text = newUsername;
                }
            });
        }
        else
        {
            SetUsername("");
            ShowError("");
            usernameLoginField.text = "";
        }
    }