Esempio n. 1
0
    IEnumerator TwitchHandleForcedSolve()
    {
        while (Animating)
        {
            yield return(true); yield return(new WaitForSeconds(0.1f));
        }
        {
            if (!ModuleSolved)
            {
                for (int x = 0; x < 5; x++)
                {
                    BottomRenderer[x].sprite = null;
                }

                for (int x = 0; x < 5; x++)
                {
                    while (Display.sprite != Letters[RealNumbers[x]])
                    {
                        Arrows[1].OnInteract();
                        yield return(new WaitForSeconds(0.1f));
                    }
                    SendButton.OnInteract();
                    yield return(new WaitForSeconds(0.1f));
                }
                SubmitButton.OnInteract();
            }
            while (!ModuleSolved)
            {
                yield return(true); yield return(new WaitForSeconds(0.1f));
            }
        }
    }
Esempio n. 2
0
    IEnumerator TwitchHandleForcedSolve()
    {
        yield return(new WaitForSeconds(0.0001f));

        while (nowCoroutine != null || subCoroutine != null || updating)
        {
            yield return(true); yield return(new WaitForSeconds(0.1f));
        }
        for (int i = 0; i < shapeSolution.Length; i++)
        {
            if (myShape[i] != shapeSolution[i])
            {
                ModuleButtons[i].OnInteract();
                yield return(new WaitForSeconds(0.1f));
            }
        }
        SubmitButton.OnInteract();
    }
    IEnumerator TwitchHandleForcedSolve()
    {
        int start = nowStage;

        for (int i = start; i < 3; i++)
        {
            while (beatStage)
            {
                yield return(true);
            }
            ;
            for (int j = 0; j < correctPatterns[i].Length; j++)
            {
                if ((correctPatterns[i][j] == 'X' && nowPattern[j] == 'O') || (correctPatterns[i][j] == 'O' && nowPattern[j] == 'X'))
                {
                    ModuleButtons[j].OnInteract();
                    yield return(new WaitForSeconds(0.1f));
                }
            }
            SubmitButton.OnInteract();
        }
    }
Esempio n. 4
0
    #pragma warning restore 414
    IEnumerator ProcessTwitchCommand(string command)
    {
        string[] parameters = command.Split(' ');
        if (Regex.IsMatch(command, @"^\s*send\s*$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant))
        {
            yield return(null);

            SendButton.OnInteract();
            yield break;
        }

        if (Regex.IsMatch(command, @"^\s*submit\s*$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant))
        {
            yield return(null);

            for (int x = 0; x < 5; x++)
            {
                if (BottomRenderer[x].sprite == null)
                {
                    yield return("sendtochaterror Pressing submit will only work when 5 letters have been sent!");

                    yield break;
                }
            }
            yield return("strike");

            yield return("solve");

            SubmitButton.OnInteract();
        }

        if (Regex.IsMatch(parameters[0], @"^\s*left\s*$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant))
        {
            yield return(null);

            if (parameters.Length == 1)
            {
                Arrows[0].OnInteract();
            }

            else if (parameters.Length == 2)
            {
                int  temp  = 0;
                bool check = int.TryParse(parameters[1], out temp);
                if (!check)
                {
                    yield return("sendtochaterror The specified number of times to press the left button '" + parameters[1] + "' is not a number!");

                    yield break;
                }

                if (temp < 1 || temp > 32)
                {
                    yield return("sendtochaterror The specified number of times to press the left button '" + parameters[1] + "' is under 1 or over 32!");

                    yield break;
                }

                for (int i = 0; i < temp; i++)
                {
                    Arrows[0].OnInteract();
                    yield return(new WaitForSecondsRealtime(0.1f));
                }
            }

            else if (parameters.Length == 3)
            {
                int  temp  = 0;
                bool check = int.TryParse(parameters[1], out temp);
                if (!check)
                {
                    yield return("sendtochaterror The specified number of times to press the left button '" + parameters[1] + "' is not a number!");

                    yield break;
                }

                if (temp < 1 || temp > 32)
                {
                    yield return("sendtochaterror The specified number of times to press the left button '" + parameters[1] + "' is under 1 or over 32!");

                    yield break;
                }

                if (!Regex.IsMatch(parameters[2], @"^\s*slow\s*$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant))
                {
                    yield return("sendtochaterror A third parameter is only valid if it's 'slow'! Your parameter: '" + parameters[2] + "'.");

                    yield break;
                }

                for (int i = 0; i < temp; i++)
                {
                    Arrows[0].OnInteract();
                    yield return(new WaitForSecondsRealtime(1f));
                }
            }

            else if (parameters.Length > 3)
            {
                yield return("sendtochaterror Too many parameters!");
            }
        }

        if (Regex.IsMatch(parameters[0], @"^\s*right\s*$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant))
        {
            yield return(null);

            if (parameters.Length == 1)
            {
                Arrows[1].OnInteract();
            }

            else if (parameters.Length == 2)
            {
                int  temp  = 0;
                bool check = int.TryParse(parameters[1], out temp);
                if (!check)
                {
                    yield return("sendtochaterror The specified number of times to press the left button '" + parameters[1] + "' is not a number!");

                    yield break;
                }

                if (temp < 1 || temp > 32)
                {
                    yield return("sendtochaterror The specified number of times to press the left button '" + parameters[1] + "' is under 1 or over 32!");

                    yield break;
                }

                for (int i = 0; i < temp; i++)
                {
                    Arrows[1].OnInteract();
                    yield return("trycancel Halted slow button presses due to a request to cancel!");

                    yield return(new WaitForSecondsRealtime(0.1f));
                }
            }

            else if (parameters.Length == 3)
            {
                int  temp  = 0;
                bool check = int.TryParse(parameters[1], out temp);
                if (!check)
                {
                    yield return("sendtochaterror The specified number of times to press the left button '" + parameters[1] + "' is not a number!");

                    yield break;
                }

                if (temp < 1 || temp > 32)
                {
                    yield return("sendtochaterror The specified number of times to press the left button '" + parameters[1] + "' is under 1 or over 32!");

                    yield break;
                }

                if (!Regex.IsMatch(parameters[2], @"^\s*slow\s*$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant))
                {
                    yield return("sendtochaterror A third parameter is only valid if it's 'slow'! Your parameter: '" + parameters[2] + "'.");

                    yield break;
                }

                for (int i = 0; i < temp; i++)
                {
                    Arrows[1].OnInteract();
                    yield return("trycancel Halted slow button presses due to a request to cancel!");

                    yield return(new WaitForSecondsRealtime(1f));
                }
            }

            else if (parameters.Length > 3)
            {
                yield return("sendtochaterror Too many parameters!");
            }
        }
    }