示例#1
0
    public void OnInput()
    {
        m_wordCoundown = 0.0f;

        bool correct   = false;
        Text inputText = m_inputText.GetComponent <Text>();

        if (inputText.text == null)
        {
            // null input.
            return;
        }
        if (inputText.text == m_currentWord.Item.Answer)
        {
            correct = true;
        }
        else
        {
            m_currentWord.UpdateRecord(false);
        }

        Text  judge = m_judgeText.GetComponent <Text> ();
        float alpha = 1.0f;

        if (correct)
        {
            judge.text = "正 确!";
            Color color = Color.green;
            color.a     = alpha;
            judge.color = color;
        }
        else
        {
            judge.text = "错: " + m_currentWord.Item.Answer;
            Color color = Color.red;
            color.a     = alpha;
            judge.color = color;
        }

        InputField field = m_inputPanel.GetComponentInChildren <InputField>();

        field.text = "";

        m_judgeText.SetActive(true);
        m_currentWord.UpdateRecord(correct);
        m_progress.CountOneEntry(DateTime.Now, true);
        m_progress.ReBelance();
        SwitchState(PageState.Wait, 1.0f, m_currentWord.m_word);
    }