private void KMNeedyModule_OnNeedyActivation()
 {
     _active = true;
     Connector.SetDisplayActive(TranslatedVentingGasConnector.Texts.VentingComplete, false);
     if (Random.Range(0f, 1f) < 0.1f)
     {
         _correctButton = VentingGasButton.N;
         Connector.SetDisplayActive(TranslatedVentingGasConnector.Texts.Detonate, true);
         Connector.SetDisplayActive(TranslatedVentingGasConnector.Texts.DetonateYN, true);
         Log(_translation.Language.LogPromptDetonate);
         if (_multilineDetonate)
         {
             Connector.SetDisplayText(TranslatedVentingGasConnector.Texts.InputText, _translation.Language.YesNo);
         }
     }
     else
     {
         _correctButton = VentingGasButton.Y;
         Connector.SetDisplayActive(TranslatedVentingGasConnector.Texts.VentGas, true);
         Connector.SetDisplayActive(TranslatedVentingGasConnector.Texts.VentYN, true);
         Log(_translation.Language.LogPromptVentGas);
         if (_multilineVent)
         {
             Connector.SetDisplayText(TranslatedVentingGasConnector.Texts.InputText, _translation.Language.YesNo);
         }
     }
     Connector.SetDisplayActive(TranslatedVentingGasConnector.Texts.InputText, true);
 }
        public void TwitchPress(VentingGasButton button)
        {
            if (this.TestMode)
            {
                TwitchExtensions.Click(this.TestModelButtons[(int)button]);
            }
#if (!DEBUG)
            else
            {
                TwitchExtensions.Click(this.buttons[(int)button]);
            }
#endif
        }
    private IEnumerator ButtonPressedCoroutine(VentingGasButton button)
    {
        button = button == VentingGasButton.Y ^ _translation.Language.RightToLeft ? VentingGasButton.Y : VentingGasButton.N;

        var   label          = button == VentingGasButton.Y ? _translation.Language.Yes : _translation.Language.No;
        float inputTime      = button == VentingGasButton.Y ? 1.5f : 1.0f;
        float charInputDelay = inputTime / label.Length;

        Connector.InputText = "";
        for (int i = 0; i < label.Length; i++)
        {
            if (_translation.Language.RightToLeft)
            {
                Connector.InputText = label[label.Length - 1 - i] + Connector.InputText;
            }
            else
            {
                Connector.InputText += label[i];
            }
            yield return(new WaitForSeconds(charInputDelay));
        }
        yield return(new WaitForSeconds(0.5f));

        bool correctPress = button == _correctButton;

        if (_correctButton == VentingGasButton.N)
        {
            if (button == _correctButton)
            {
                Log(_translation.Language.LogNoCorrect);
            }
            else
            {
                Log(_translation.Language.LogYesIncorrect);
                Connector.KMNeedyModule.HandleStrike();
            }
            Connector.KMNeedyModule.HandlePass();
            DisarmNeedy();
            yield break;
        }
        else if (button == _correctButton)
        {
            Log(_translation.Language.LogYesCorrect);
            Connector.KMNeedyModule.HandlePass();
            DisarmNeedy(true);
            yield break;
        }
        else
        {
            Log(_translation.Language.LogNoIncorrect);
            Connector.DisableDisplay();
            Connector.InputText = string.Empty;
            Connector.SetDisplayActive(TranslatedVentingGasConnector.Texts.VentingPreventsExplosions, true);
            yield return(new WaitForSeconds(0.75f));

            Connector.SetDisplayActive(TranslatedVentingGasConnector.Texts.VentingPreventsExplosions, false);
            yield return(new WaitForSeconds(0.4f));

            Connector.SetDisplayActive(TranslatedVentingGasConnector.Texts.VentingPreventsExplosions, true);
            yield return(new WaitForSeconds(0.75f));

            Connector.SetDisplayActive(TranslatedVentingGasConnector.Texts.VentingPreventsExplosions, false);
            yield return(new WaitForSeconds(0.4f));

            Connector.SetDisplayActive(TranslatedVentingGasConnector.Texts.VentingPreventsExplosions, true);
            yield return(new WaitForSeconds(1f));

            Connector.SetDisplayActive(TranslatedVentingGasConnector.Texts.VentingPreventsExplosions, false);
            Connector.SetDisplayActive(TranslatedVentingGasConnector.Texts.VentGas, true);
            Connector.SetDisplayActive(TranslatedVentingGasConnector.Texts.VentYN, true);
            Connector.SetDisplayActive(TranslatedVentingGasConnector.Texts.InputText, true);
            if (_multilineVent)
            {
                Connector.SetDisplayText(TranslatedVentingGasConnector.Texts.InputText, _translation.Language.YesNo);
            }
            _coroutine = null;
        }
    }
 public VentingGasButtonEventArgs(VentingGasButton button) => this.Button = button;