Exemple #1
0
    private void ManageInput()
    {
        string charToTest = Input.inputString;

        if (rx.IsMatch(charToTest) && !gameManager.isGameOver)
        {
            currentInput[currentInput.Count - 1] = charToTest.ToLower();
            currentInput.Add("|");
        }

        if (Input.GetKey(KeyCode.Backspace) && canBackspace && currentInput.Count > 1)
        {
            canBackspace = false;
            currentInput.RemoveAt(currentInput.Count - 2);
            LeanTween.delayedCall(0.1f, () => canBackspace = true);
        }
        ;

        if (Input.GetKeyDown(KeyCode.Return) && !gameManager.isGameOver && canPressEnter)
        {
            canPressEnter = false;
            LeanTween.delayedCall(0.5f, () => canPressEnter = true);
            string submittedString = string.Join("", currentInput.GetRange(0, currentInput.Count - 1));
            ClearText();
            Debug.Log(submittedString);
            wordChecker.CheckWord(submittedString);
            timer.ResetTimer();
        }
    }
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            //wordChecker.ClearWord();
        }
        if (Input.GetMouseButton(0))
        {
            selectLetter = pointer();
            if (!(selectLetter.transform.parent.GetChild(1).gameObject.active))
            {
                highlightSelection();
                AddLetterToWord();
            }
        }

        if (Input.GetMouseButtonUp(0))
        {
            selectionSprite.SetActive(false);
            wordChecker.CheckWord();
            wordChecker.ClearWord();
        }
    }