예제 #1
0
    // Update is called once per frame
    void Update()
    {
        if (!inputField.isFocused)
        {
            inputField.ActivateInputField();
        }
        if (ControllerInputManager.GetLeftStickVertical() != 0)
        {
            if (m_isAxisInUse == false)
            {
                if (ControllerInputManager.GetLeftStickVertical() > 0)
                {
                    currentIndex  = add(currentIndex, alphabet.Length);
                    switcher.text = "" + alphabet [currentIndex] + "";
                    next.text     = "" + alphabet [add(currentIndex, alphabet.Length)] + "";
                    prev.text     = "" + alphabet [sub(currentIndex, alphabet.Length)] + "";
                }
                if (ControllerInputManager.GetLeftStickVertical() < 0)
                {
                    currentIndex  = sub(currentIndex, alphabet.Length);
                    switcher.text = "" + alphabet [currentIndex] + "";
                    next.text     = "" + alphabet [add(currentIndex, alphabet.Length)] + "";
                    prev.text     = "" + alphabet [sub(currentIndex, alphabet.Length)] + "";
                }
                m_isAxisInUse = true;
            }
        }
        if (ControllerInputManager.GetLeftStickVertical() == 0)
        {
            m_isAxisInUse = false;
        }

        if (ControllerInputManager.GetAButton())
        {
            if (inputField.text.Length < 10)
            {
                inputField.text += "" + alphabet [currentIndex] + "";
            }
        }
        if (ControllerInputManager.GetBButton())
        {
            if (inputField.text.Length > 0)
            {
                inputField.text = inputField.text.Substring(0, inputField.text.Length - 1);
            }
        }
        if (InputManager.GetSubmitName())
        {
            if (inputField.text.Length > 0)
            {
                HighscoreEntry entry = new HighscoreEntry(inputField.text, GameManager.score);
                HSManager.addHighscore(entry);
                userInterface.showHighscores();
            }
        }
    }