Esempio n. 1
0
    protected internal override IEnumerator RespondToCommandInternal(string inputCommand)
    {
        string[] split = inputCommand.ToLowerInvariant().Trim().Split(' ');
        if (split.Length != 2 || !split[0].EqualsAny("submit", "answer"))
        {
            yield break;
        }

        if (!int.TryParse(split[1], out int desiredIndex) || desiredIndex < 1)
        {
            yield break;
        }
        desiredIndex--;
        yield return(null);

        int currentIndex = (int)IndexField.GetValue(_englishTestComponent);

        while ((int)IndexField.GetValue(_englishTestComponent) != desiredIndex)
        {
            yield return(DoInteractionClick(_selectButton));

            if ((int)IndexField.GetValue(_englishTestComponent) != currentIndex)
            {
                continue;
            }
            yield return
                ($"sendtochaterror I can't select answer #{desiredIndex + 1} because that answer doesn't exist.");

            yield break;
        }
        yield return(DoInteractionClick(_submitButton));
    }