예제 #1
0
    // Update is called once per frame
    void Update()
    {
        if (!cTextInput.isFocused)
        {
            cTextInput.ActivateInputField();
        }

        if (cCurrentChapter != null)
        {
            if (Input.anyKeyDown)
            {
                int iOutcomeIdx = cCurrentChapter.ValidateString(cTextInput.text);
                if (iOutcomeIdx >= 0)
                {
                    cTextInput.image.sprite = correctInputGraphic;
                }
                else
                {
                    cTextInput.image.sprite = incorrectInputGraphic;
                }

                if (Input.GetKeyDown(KeyCode.Return))
                {
                    cCurrentChapter.ChooseOutcome(iOutcomeIdx);
                    cTextInput.text         = "";
                    cTextInput.image.sprite = incorrectInputGraphic;
                }
            }
        }
    }