protected internal override IEnumerator RespondToCommandInternal(string inputCommand) { inputCommand = inputCommand.Trim(); string[] commandParts = inputCommand.Split(' '); if (commandParts.Length == 1 && commandParts[0].Equals("toggle", StringComparison.InvariantCultureIgnoreCase)) { yield return("password"); for (int i = 0; i < 5; i++) { yield return(DoInteractionClick(_downButtons[i])); } yield break; } if (commandParts.Length > 0 && commandParts[0].Equals("cycle", StringComparison.InvariantCultureIgnoreCase)) { HashSet <int> alreadyCycled = new HashSet <int>(); foreach (string cycle in commandParts.Skip(1)) { if (!int.TryParse(cycle, out int spinnerIndex) || !alreadyCycled.Add(spinnerIndex) || spinnerIndex < 1 || spinnerIndex > _downButtons.Length) { continue; } IEnumerator spinnerCoroutine = CycleCharacterSpinnerCoroutine(spinnerIndex - 1); while (spinnerCoroutine.MoveNext()) { yield return(spinnerCoroutine.Current); } } yield break; } string lettersToSubmit = // Special case for Korean (convert Hangul to Jamos) commandParts[0].Length > 0 && commandParts[0][0] >= '가' && commandParts[0][0] <= '힣' ? commandParts[0].SelectMany(ch => TranslatedModulesSettings.CallMethod <string>("DeconstructHangulSyllableToJamos", null, ch)).Select(ch => SimilarJamos.ContainsKey(ch) ? SimilarJamos[ch] : ch).Join("") : // Special case for Hebrew (expects input back to front) TranslatedModuleHelper.GetLanguageCode(_component, PasswordComponentType) == "he" ? commandParts[0].Reverse().Join("") : // Usual case commandParts[0]; if (lettersToSubmit.Length != 5) { yield break; } yield return("password"); IEnumerator solveCoroutine = SolveCoroutine(lettersToSubmit); while (solveCoroutine.MoveNext()) { yield return(solveCoroutine.Current); } }
public TranslatedNeedyVentComponentSolver(TwitchModule module) : base(module) { _yesButton = (MonoBehaviour)YesButtonField.GetValue(module.BombComponent.GetComponent(NeedyVentComponentSolverType)); _noButton = (MonoBehaviour)NoButtonField.GetValue(module.BombComponent.GetComponent(NeedyVentComponentSolverType)); ModInfo = ComponentSolverFactory.GetModuleInfo(GetModuleType(), "!{0} yes, !{0} y [answer yes] | !{0} no, !{0} n [answer no]").Clone(); LanguageCode = TranslatedModuleHelper.GetLanguageCode(module.BombComponent.GetComponent(NeedyVentComponentSolverType), NeedyVentComponentSolverType); ModInfo.moduleDisplayName = $"Needy Vent Gas Translated{TranslatedModuleHelper.GetModuleDisplayNameAddon(module.BombComponent.GetComponent(NeedyVentComponentSolverType), NeedyVentComponentSolverType)}"; Module.HeaderText = ModInfo.moduleDisplayName; }
public TranslatedWhosOnFirstComponentSolver(TwitchModule module) : base(module) { Component component = module.BombComponent.GetComponent(ComponentType); _buttons = (KMSelectable[])ButtonsField.GetValue(component); ModInfo = ComponentSolverFactory.GetModuleInfo(GetModuleType(), "!{0} what? [press the button that says \"WHAT?\"] | !{0} press 3 [press the third button in english reading order] | The phrase must match exactly | Not case sensitive | If the language used asks for pressing a literally blank button, use \"!{0} literally blank\"").Clone(); LanguageCode = TranslatedModuleHelper.GetLanguageCode(component, ComponentType); ModInfo.moduleDisplayName = $"Who's on First Translated{TranslatedModuleHelper.GetModuleDisplayNameAddon(component, ComponentType)}"; Module.HeaderText = ModInfo.moduleDisplayName; }
public TranslatedPasswordComponentSolver(TwitchModule module) : base(module) { _component = module.BombComponent.GetComponent(PasswordComponentType); _downButtons = (KMSelectable[])DownButtonField.GetValue(_component); _submitButton = (MonoBehaviour)SubmitButtonField.GetValue(_component); _display = (TextMesh[])DisplayField.GetValue(_component); ModInfo = ComponentSolverFactory.GetModuleInfo(GetModuleType(), "!{0} cycle 1 3 5 [cycle through the letters in columns 1, 3, and 5] | !{0} toggle [move all columns down one letter] | !{0} world [try to submit a word]").Clone(); LanguageCode = TranslatedModuleHelper.GetLanguageCode(_component, PasswordComponentType); ModInfo.moduleDisplayName = $"Passwords Translated{TranslatedModuleHelper.GetModuleDisplayNameAddon(_component, PasswordComponentType)}"; Module.HeaderText = ModInfo.moduleDisplayName; }
public TranslatedMorseCodeComponentSolver(TwitchModule module) : base(module) { _component = module.BombComponent.GetComponent(MorseCodeComponentType); _upButton = (MonoBehaviour)UpButtonField.GetValue(_component); _downButton = (MonoBehaviour)DownButtonField.GetValue(_component); _transmitButton = (MonoBehaviour)TransmitButtonField.GetValue(_component); ModInfo = ComponentSolverFactory.GetModuleInfo(GetModuleType(), "!{0} transmit 3.573, !{0} trans 573, !{0} transmit 3.573 MHz, !{0} tx 573 [transmit frequency 3.573]").Clone(); LanguageCode = TranslatedModuleHelper.GetLanguageCode(_component, MorseCodeComponentType); ModInfo.moduleDisplayName = $"Morse Code Translated{TranslatedModuleHelper.GetModuleDisplayNameAddon(_component, MorseCodeComponentType)}"; Module.HeaderText = ModInfo.moduleDisplayName; }
public TranslatedButtonComponentSolver(TwitchModule module) : base(module) { var component = module.BombComponent.GetComponent(ComponentType); _button = (KMSelectable)ButtonField.GetValue(component); ModInfo = ComponentSolverFactory.GetModuleInfo(GetModuleType(), "!{0} tap [tap the button] | !{0} hold [hold the button] | !{0} release 7 [release when the digit shows 7]").Clone(); Selectable selectable = module.BombComponent.GetComponent <Selectable>(); selectable.OnCancel += () => { SelectedField.SetValue(component, false); return(true); }; LanguageCode = TranslatedModuleHelper.GetLanguageCode(component, ComponentType); ModInfo.moduleDisplayName = $"Big Button Translated{TranslatedModuleHelper.GetModuleDisplayNameAddon(component, ComponentType)}"; Module.HeaderText = ModInfo.moduleDisplayName; var mat = (Material)StripMaterialField.GetValue(component); StripMaterialField.SetValue(component, Object.Instantiate(mat)); }