Exemple #1
0
    // Input Loop -----------------------------
    void Update()
    {
        if (cardHolder.IsReleaseOver())
        {
            input.Clear();
            inputText = "";
        }
        if (listen)
        {
            foreach (char c in Input.inputString)
            {   // if the char is valid
                if (Array.IndexOf(forbidenChars, c) < 0)
                {
                    if (c == "\b"[0] && input.Count > 0)
                    {   // backspace
                        input.RemoveAt(input.Count - 1);
                    }
                    else if (input.Count < 20 && c != "\b"[0] && c != "\n"[0] && c != "\r"[0])
                    {   // if the players input is shorter then 20 and he doesn't inputs 'enter' or 'space'
                        input.Add(c);
                    }
                }
            }

            // builds the string & updates the inputfield
            inputText = MakeString(input).ToLower();
            cardHolder.UpdateCard(inputText);
        }
    }