コード例 #1
0
ファイル: UrlHelper.cs プロジェクト: ZekNikZ/KtaneTwitchPlays
    public string ManualFor(string module, string type = "html", bool useVanillaRuleModifier = false)
    {
        if (useVanillaRuleModifier && VanillaRuleModifier.GetRuleSeed() != 1)
        {
            return($"{Repository}manual/{Escape(module)}.html?VanillaRuleSeed={VanillaRuleModifier.GetRuleSeed()}");
        }

        return(string.Format(Repository + "{0}/{1}.{2}", type.ToUpper(), Escape(module), type));
    }
コード例 #2
0
 public static string ManualFor(string module, string type = "html", bool useVanillaRuleModifier = false) => string.Format(TwitchPlaySettings.data.RepositoryUrl + "{0}/{1}.{2}{3}", type.ToUpper(), NameToUrl(module), type, (useVanillaRuleModifier && type.Equals("html")) ? $"#{VanillaRuleModifier.GetRuleSeed()}" : "");
コード例 #3
0
    private IEnumerator ReleaseCoroutineModded(string second)
    {
        bool longwait = false;

        string[]   list        = second.Split(' ');
        List <int> sortedTimes = new List <int>();

        foreach (string value in list)
        {
            if (!int.TryParse(value, out int time))
            {
                int pos = value.LastIndexOf(':');
                if (pos == -1)
                {
                    continue;
                }
                int hour = 0;
                if (!int.TryParse(value.Substring(0, pos), out int min))
                {
                    int pos2 = value.IndexOf(":");
                    if ((pos2 == -1) || (pos == pos2))
                    {
                        continue;
                    }
                    if (!int.TryParse(value.Substring(0, pos2), out hour))
                    {
                        continue;
                    }
                    if (!int.TryParse(value.Substring(pos2 + 1, pos - pos2 - 1), out min))
                    {
                        continue;
                    }
                }
                if (!int.TryParse(value.Substring(pos + 1), out int sec))
                {
                    continue;
                }
                time = (hour * 3600) + (min * 60) + sec;
            }
            sortedTimes.Add(time);
        }
        sortedTimes.Sort();
        sortedTimes.Reverse();
        if (sortedTimes.Count == 0)
        {
            yield break;
        }

        yield return("release");

        TimerComponent timerComponent = BombCommander.Bomb.GetTimer();

        int timeTarget = sortedTimes[0];

        sortedTimes.RemoveAt(0);

        int waitTime = (int)(timerComponent.TimeRemaining + 0.25f);

        waitTime -= timeTarget;
        if (waitTime >= 30)
        {
            yield return("elevator music");

            if (waitTime >= 120)
            {
                yield return(string.Format("sendtochat !!!WARNING!!! - you might want to do a !cancel right about now, as you will be waiting for {0} minutes and {1} seconds for button release. Seed #{2} applies to this button.", waitTime / 60, waitTime % 60, VanillaRuleModifier.GetRuleSeed()));

                yield return(string.Format("sendtochat Click the button with !{0} tap. Click the button at time with !{0} tap 8:55 8:44 8:33. Hold the button with !{0} hold. Release the button with !{0} release 9:58 9:49 9:30.", Code));

                longwait = true;
            }
        }

        float timeRemaining = float.PositiveInfinity;

        while (timeRemaining > 0.0f)
        {
            if (Canceller.ShouldCancel)
            {
                Canceller.ResetCancel();
                if (timeTarget < 10)
                {
                    yield return(string.Format("sendtochat The button was not {0} due to a request to cancel. Remember that the rule set that applies is seed #{1}", _held ? "released" : "tapped", VanillaRuleModifier.GetRuleSeed()));
                }
                else
                {
                    yield return(string.Format("sendtochat The button was not {0} due to a request to cancel.", _held ? "released" : "tapped"));
                }
                yield break;
            }

            timeRemaining = (int)(timerComponent.TimeRemaining + 0.25f);

            if (timeRemaining < timeTarget)
            {
                if (sortedTimes.Count == 0)
                {
                    yield return(string.Format("sendtochaterror The button was not {0} because all of your specfied times are greater than the time remaining.", _held ? "released" : "tapped"));

                    yield break;
                }
                timeTarget = sortedTimes[0];
                sortedTimes.RemoveAt(0);

                waitTime  = (int)timeRemaining;
                waitTime -= timeTarget;
                if (waitTime >= 30)
                {
                    yield return("elevator music");

                    if (waitTime >= 120 && !longwait)
                    {
                        yield return(string.Format("sendtochat !!!WARNING!!! - you might want to do a !cancel right about now, as you will be waiting for {0} minutes and {1} seconds for button release. Seed #{2} applies to this button.", waitTime / 60, waitTime % 60, VanillaRuleModifier.GetRuleSeed()));

                        yield return(string.Format("sendtochat Click the button with !{0} tap. Click the button at time with !{0} tap 8:55 8:44 8:33. Hold the button with !{0} hold. Release the button with !{0} release 9:58 9:49 9:30.", Code));
                    }
                    longwait = true;
                }

                continue;
            }
            if (Math.Abs(timeRemaining - timeTarget) < 0.1f)
            {
                if (!_held)
                {
                    DoInteractionStart(_button);
                    yield return(new WaitForSeconds(0.1f));
                }
                DoInteractionEnd(_button);
                _held = false;
                yield break;
            }

            yield return(null);
        }
    }