GameObject CreateOptionWindow(Yarn.Options optionsCollection)
    {
        GameObject          optionWindow  = Instantiate <GameObject> (optionWindowPrefab);
        OptionSetController setController = optionWindow.GetComponent <OptionSetController> ();

        setController.Init(this);
        setController.transform.SetParent(dialogueCanvas.transform, false);
        //setController.rectTransform.sizeDelta = new Vector2 ();
        GameObject newButton;

        // populate it with buttons
        string parsedOptString;

        foreach (var optionString in optionsCollection.options)
        {
            parsedOptString = YarnUtils.ParseYarnText(dialogueRunner.variableStorage, optionString);
            newButton       = Instantiate <GameObject>(setController.buttonPrefab);
            setController.AddOption(newButton, parsedOptString);
        }

        // let's put it in the middle-right of the screen
        //setController.rectTransform.ApplyAnchorPreset(TextAnchor.MiddleRight, false, false);
        setController.rectTransform.PositionRelativeToParent(TextAnchor.MiddleRight);

        return(optionWindow);
    }
예제 #2
0
    /// Show a list of options, and wait for the player to make a selection.
    public override IEnumerator RunOptions(Yarn.Options optionsCollection,
                                           Yarn.OptionChooser optionChooser)
    {
        // Do a little bit of safety checking
        if (optionsCollection.options.Count > optionButtons.Count)
        {
            Debug.LogWarning("There are more options to present than there are" +
                             "buttons to present them in. This will cause problems.");
        }

        // Display each option in a button, and make it visible
        int i = 0;

        foreach (var optionString in optionsCollection.options)
        {
            optionButtons[i].gameObject.SetActive(true);
            optionButtons[i].GetComponentInChildren <TextMeshProUGUI>().text = optionString;
            i++;
        }

        // Record that we're using it
        SetSelectedOption = optionChooser;
        deciding          = true;
        // Wait until the chooser has been used and then removed (see SetOption below)
        while (SetSelectedOption != null)
        {
            yield return(null);
        }

        // Hide all the buttons
        foreach (var button in optionButtons)
        {
            button.gameObject.SetActive(false);
        }
    }
예제 #3
0
    /// Show a list of options, and wait for the player to make a selection.
    public override IEnumerator RunOptions(Yarn.Options optionsCollection,
                                           Yarn.OptionChooser optionChooser)
    {
        //Make sure the text is visible
        lineText.gameObject.SetActive(true);

        // Do a little bit of safety checking
        if (optionsCollection.options.Count > optionButtons.Length)
        {
            Debug.LogWarning("There are more options to present than there are" +
                             "buttons to present them in. This will cause problems.");
        }

        // Display each option in a button, and make it visible
        int i = 0;

        foreach (var optionString in optionsCollection.options)
        {
            optionButtons[i].gameObject.SetActive(true);
            optionButtons[i].GetComponentInChildren <Text>().text = optionString;
            i++;
        }

        // Record that we're using it
        SetSelectedOption = optionChooser;

        //Start UI animation
        GetComponent <PlayableDirector>().Play();

        yield return(new WaitForSeconds(WaitForUITransition)); //Wait for it to play

        GetComponent <PlayableDirector>().Pause();             //Stop on idle

        // Wait until the chooser has been used and then removed (see SetOption below)
        while (SetSelectedOption != null)
        {
            yield return(null);
        }

        //Play the anim out
        GetComponent <PlayableDirector>().Play();

        //wait again
        yield return(new WaitForSeconds(WaitForUITransition * 2));

        // Hide all the buttons
        foreach (var button in optionButtons)
        {
            button.gameObject.SetActive(false);
        }

        //Reset playable
        GetComponent <PlayableDirector>().time = 0;
        GetComponent <PlayableDirector>().Pause();
    }
예제 #4
0
    /// Show a list of options, and wait for the player to make a selection.
    public override IEnumerator RunOptions(Yarn.Options optionsCollection,
                                           Yarn.OptionChooser optionChooser)
    {
        // Do a little bit of safety checking

        /*if (optionsCollection.options.Count > optionButtons.Count) {
         * Debug.LogWarning("There are more options to present than there are" +
         *               "buttons to present them in. This will cause problems.");
         * }*/

        // Display each option in a button, and make it visible
        // *** Going to try to remove this, and replace it with my menu system.

        /*
         *      int i = 0;
         * foreach (var optionString in optionsCollection.options) {
         * optionButtons [i].gameObject.SetActive (true);
         * optionButtons [i].GetComponentInChildren<Text> ().text = optionString;
         * i++;
         * }*/

        // Make an array out of the the options list strings.
        string[] optionStrings;
        optionStrings = new string[optionsCollection.options.Count];

        int i = 0;

        foreach (var optionString in optionsCollection.options)
        {
            optionStrings [i] = optionString;
            i++;
        }

        // My menu system:
        GAME_menu_manager.Instance.SetMenu(optionStrings, true, SetOption);

        // Record that we're using it
        SetSelectedOption = optionChooser;

        // Wait until the chooser has been used and then removed (see SetOption below)
        while (SetSelectedOption != null)
        {
            yield return(null);
        }

        // Hide all the buttons

        /*foreach (var button in optionButtons) {
         *      button.gameObject.SetActive (false);
         * }*/
    }
예제 #5
0
    /// Show a list of options, and wait for the player to make a selection.
    public override IEnumerator RunOptions(Yarn.Options optionsCollection,
                                           Yarn.OptionChooser optionChooser)
    {
        // Do a little bit of safety checking
        if (optionsCollection.options.Count > optionButtons.Count)
        {
            Debug.LogWarning("There are more options to present than there are" +
                             "buttons to present them in. This will cause problems.");
        }

        // Display each option in a button, and make it visible
        int i = 0;

        foreach (var optionString in optionsCollection.options)
        {
            optionButtons[i].gameObject.SetActive(true);
            //TO DO animate the button
            optionButtons[i].GetComponentInChildren <TMP_Text>().text = optionString;
            i++;
        }

        //start the timer of how long the player takes to answer
        //count = true;
        //if (count == true)
        //{
        //    optionButtons[0].GetComponent<TimerDialogue>().StartCount();
        //    count = false;
        //}

        // Record that we're using it
        SetSelectedOption = optionChooser;

        // Wait until the chooser has been used and then removed (see SetOption below)
        while (SetSelectedOption != null)
        {
            yield return(null);
        }

        // Hide all the buttons
        foreach (var button in optionButtons)
        {
            button.gameObject.SetActive(false);
            //TO DO animate the button going away
        }
    }
예제 #6
0
    public override IEnumerator RunOptions(Yarn.Options optionsCollection,
                                           Yarn.OptionChooser optionChooser)
    {
        // Do a little bit of safety checking
        if (optionsCollection.options.Count > optionButtons.Count)
        {
            Debug.LogWarning("There are more options to present than there are" +
                             "buttons to present them in. This will cause problems.");
        }

        //empty dialogue box text
        dialoguePanelController.nameText.text     = "";
        dialoguePanelController.dialogueText.text = "";
        dialoguePanelController.nameTextPanel.SetActive(false);

        // Display each option in a button, and make it visible
        int i = 0;

        foreach (var optionString in optionsCollection.options)
        {
            optionButtons[i].gameObject.SetActive(true);
            optionButtons[i].GetComponentInChildren <Text>().text = optionString;
            i++;
        }

        // Record that we're using it
        SetSelectedOption = optionChooser;

        // Wait until the chooser has been used and then removed (see SetOption below)
        while (SetSelectedOption != null)
        {
            yield return(null);
        }

        EventManager.TriggerEvent("ButtonClicked");

        // Hide all the buttons
        foreach (var button in optionButtons)
        {
            button.gameObject.SetActive(false);
        }
        inputPressed = false;
    }
예제 #7
0
    /// Show a list of options, and wait for the player to make a selection.
    public override IEnumerator RunOptions(Yarn.Options optionsCollection,
                                           Yarn.OptionChooser optionChooser)
    {
        // Do a little bit of safety checking
        if (optionsCollection.options.Count > optionButtons.Count)
        {
            Debug.LogWarning("There are more options to present than there are" +
                             "buttons to present them in. This will cause problems.");
        }

        // Display each option in a button, and make it visible
        int i = 0;

        foreach (var optionString in optionsCollection.options)
        {
            optionButtons[i].gameObject.SetActive(true);
            optionButtons[i].GetComponentInChildren <TextMeshProUGUI>().text = optionString;
            i++;
        }

        // THIS IS A HACK TO MAKE THE FIRST SELECTED BUTTON ACTUALLY APPEAR SELECTED
        // Deselect and reselect first button to correctly display highlight after enabling parent GO
        EventSystem es = GameObject.Find("EventSystem").GetComponent <EventSystem>();

        es.SetSelectedGameObject(null);
        es.SetSelectedGameObject(es.firstSelectedGameObject);

        // Record that we're using it
        SetSelectedOption = optionChooser;

        // Wait until the chooser has been used and then removed (see SetOption below)
        while (SetSelectedOption != null)
        {
            yield return(null);
        }

        // Hide all the buttons
        foreach (var button in optionButtons)
        {
            button.gameObject.SetActive(false);
        }
    }
    public override IEnumerator RunOptions(Yarn.Options optionsCollection, Yarn.OptionChooser optionChooser)
    {
        // create the option dialog window, giving it one button for each option
        //Debug.Log("Running options!");
        optionWindow = CreateOptionWindow(optionsCollection);

        SetSelectedOption = optionChooser;

        // until an option is chosen, keep the dialogue runner effectively paused
        // (good thing we don't need to use its paused flag here, eh?)
        while (SetSelectedOption != null)
        {
            yield return(null);
        }

        Destroy(optionWindow);         // won't need this anymore!

        optionWindow = null;
        yield return(null);
    }
예제 #9
0
    public override System.Collections.IEnumerator RunOptions(Yarn.Options optionsCollection, Yarn.OptionChooser optionChooser)
    {
        if (optionsHandler != null)
        {
            optionsHandler(optionsCollection, optionChooser);
        }

        if (expectedOptions.Count > 0)
        {
            var selection = expectedOptions.Dequeue();

            var index = optionsCollection.options.IndexOf(selection);

            Assert.AreNotEqual(index, -1, "Failed to find option \"{0}\"", selection);

            Assert.Less(index, optionsCollection.options.Count);
            optionChooser(index);
        }

        yield break;
    }
예제 #10
0
    IEnumerator ShowOptions(Yarn.Options optionsCollection, Yarn.OptionChooser optionChooser)
    {
        contentField.enabled = false;
        if (optionsCollection.options.Count > optionButtons.Length)
        {
            Debug.LogWarning("There are more options to present than there are" +
                             "buttons to present them in. This will cause problems.");
        }

        showingOptions = true;

        for (int i = 0; i < Math.Min(optionButtons.Length, optionsCollection.options.Count); i++)
        {
            optionButtons[i].button.enabled    = true;
            optionButtons[i].buttonBG.enabled  = true;
            optionButtons[i].textField.enabled = true;
            optionButtons[i].textField.text    = optionsCollection.options[i];
            int index = i;
            optionButtons[i].button.onClick.AddListener(() =>
            {
                showingOptions = false;
                optionChooser(index);
            }
                                                        );
        }

        while (showingOptions)
        {
            yield return(null);
        }

        for (int i = 0; i < optionButtons.Length; i++)
        {
            optionButtons[i].button.enabled    = false;
            optionButtons[i].buttonBG.enabled  = false;
            optionButtons[i].textField.enabled = false;
            optionButtons[i].button.onClick.RemoveAllListeners();
        }
    }
예제 #11
0
    // Called when it is time to present options to the player
    public override IEnumerator RunOptions(Yarn.Options optionsCollection,
                                           Yarn.OptionChooser optionChooser)
    {
        ChoicePanel.gameObject.SetActive(true);

        for (int i = 0; i < optionsCollection.options.Count; i++)
        {
            string optionString = optionsCollection.options[i];
            ChoiceTexts[i].transform.parent.gameObject.SetActive(true);
            ChoiceTexts[i].text = optionString;
        }

        SetSelectedOption = optionChooser;

        while (SetSelectedOption != null)
        {
            yield return(null);
        }

        foreach (var button in ChoiceTexts)
        {
            button.transform.parent.gameObject.SetActive(false);
        }
    }
예제 #12
0
 public OptionSetResult(IList<string> optionStrings, OptionChooser setSelectedOption)
 {
     var options = new Options();
     options.options = optionStrings;
     this.options = options;
     this.setSelectedOptionDelegate = setSelectedOption;
 }
예제 #13
0
    public override IEnumerator RunOptions(Yarn.Options optionsCollection, Yarn.OptionChooser optionChooser)
    {
        if (optionsCollection.options.Count > optionButtons.Count)
        {
            Debug.LogWarning("There are more options to present than there are" +
                             "buttons to present them in. This will cause problems.");
        }
        List <SelectedOptionAction> actions = new List <SelectedOptionAction>();
        int optionIndex  = 0;
        int successIndex = -1;
        int failureIndex = -1;

        foreach (var optionString in optionsCollection.options)
        {
            switch (optionString.Trim())
            {
            case "SUCCESS":
                successIndex = optionIndex;
                break;

            case "FAILURE":
                failureIndex = optionIndex;
                break;
            }
            optionIndex++;
        }
        optionIndex = 0;
        foreach (var optionString in optionsCollection.options)
        {
            switch (optionString.Trim())
            {
            case "COMMANDS":
                foreach (BitmaskOperation op in storage.EnabledOperations())
                {
                    actions.Add(new SelectedOptionAction(op, ref puzzle_, optionIndex, successIndex, failureIndex));
                }
                break;

            case "ABORT":
                actions.Add(new SelectedOptionAction(optionIndex, "Abort"));
                break;

            case "SUCCESS":
                break;

            case "FAILURE":
                break;

            default:
                actions.Add(new SelectedOptionAction(optionIndex, optionString));
                break;
            }
            optionIndex++;
        }
        if (actions.Count > 0)
        {
            int buttonIndex = 0;
            if (actions.Count > optionButtons.Count)
            {
                Debug.LogWarning("Attempting to add options but count is greater than number of buttons!");
            }
            foreach (SelectedOptionAction action in actions)
            {
                optionButtons[buttonIndex].gameObject.SetActive(true);
                optionButtons[buttonIndex].GetComponentInChildren <Text>().text = action.label;
                SetSelectedOptionMap.Add(buttonIndex, action);
                buttonIndex++;
            }
        }
        if (optionsCollection.options.Count > 0)
        {
            optionButtons[0].GetComponent <Button>().Select();
        }
        SetSelectedOption = optionChooser;
        while (SetSelectedOption != null)
        {
            yield return(null);
        }
        DisableButtons();
    }
예제 #14
0
    // Show a list of options, and wait for the player to make a selection.
    public override IEnumerator RunOptions(Yarn.Options optionsCollection,
                                           Yarn.OptionChooser optionChooser)
    {
        while (!ReadytoShowOptions)
        {
            //check again next frame
            yield return(null);
        }

        Debug.Log("This should not be using GameObject.Find - ie");
        GameObject.Find("SettingsPlus").GetComponent <UnityEngine.UI.Button> ().interactable = true;


        lineText.text = "";

        DOC.SpreadToAllButtons(optionsCollection.options.Count);

        // Do a little bit of safety checking
        if (optionsCollection.options.Count > optionButtons.Count)
        {
            Debug.LogWarning("There are more options to present than there are" +
                             "buttons to present them in. This will cause problems.");
        }

        // Display each option in a button, and make it visible
        int i = 0;

        foreach (var optionString in optionsCollection.options)
        {
            optionButtons[i].gameObject.SetActive(true);
            optionButtons[i].GetComponentInChildren <Text>().text = optionString;
            i++;
        }

        // Record that we're using it

        if (!optionsCollection.options[0].ToLower().Contains("ask me"))
        {
            SetSelectedOption  = DOC.MoveToQuestionSelected;
            SetSelectedOption += optionChooser;
        }
        else
        {
            SetSelectedOption = optionChooser;
        }

        // Wait until the chooser has been used and then removed (see SetOption below)
        while (SetSelectedOption != null)
        {
            yield return(null);
        }

        if (!optionsCollection.options[0].ToLower().Contains("ask me"))
        {
            // Hide all the buttons
            foreach (var button in optionButtons)
            {
                button.GetComponent <DialogueButtonController>().Disable(true);
                GameObject.Find("SettingsPlus").GetComponent <UnityEngine.UI.Button> ().interactable = false;
            }
        }

        yield return(new WaitWhile(DOC.Busy));
    }
예제 #15
0
            public void RunOptions(Options optionsGroup, OptionChooser optionChooser)
            {
                Console.WriteLine("Options:");
                for (int i = 0; i < optionsGroup.options.Count; i++) {
                    var optionDisplay = string.Format ("{0}. {1}", i + 1, optionsGroup.options [i]);
                    Console.WriteLine (optionDisplay);
                }
                do {
                    Console.Write ("? ");
                    try {
                        var selectedKey = Console.ReadKey ().KeyChar.ToString();
                        var selection = int.Parse (selectedKey) - 1;
                        Console.WriteLine();

                        if (selection > optionsGroup.options.Count) {
                            Console.WriteLine ("Invalid option.");
                        } else {
                            optionChooser(selection);
                            break;
                        }
                    } catch (FormatException) {}

                } while (true);
            }
예제 #16
0
    public override IEnumerator RunOptions(Yarn.Options optionsCollection,
                                           Yarn.OptionChooser optionChooser)
    {
        options.gameObject.SetActive(true);

        // todo: make sure that the options aren't too big to fit in the box
        // i don't really know how to check this without actually blitting the
        // text (if i figure that out, change the convoluted logic in RunCommand)

        uint numOptions = (uint)optionsCollection.options.Count;

        if (numOptions > options.Count())
        {
            Debug.LogWarning("Too many options");
        }

        // display all needed options
        for (int i = 0; i < options.Count(); i++)
        {
            DialogueOption option = options.GetOption(i);
            if (i < numOptions)
            {
                option.gameObject.SetActive(true);
                option.SetText(optionsCollection.options[i]);
            }
            else
            {
                option.gameObject.SetActive(false);
            }
        }

        // quick explanation of how cursor math works. bottom-most option is
        // option 0. the one above is option 1 and so on. so with 3 options
        // where the cursor is currently on the the top-most option:
        // -> [option 2]
        //    [option 1]
        //    [option 0]

        // enable and put cursor next to topmost option
        uint currCursorOption = numOptions - 1;

        options.PlaceCursor(currCursorOption);

        while (!Input.GetButtonDown("interact"))
        {
            // move cursor if we get an up or down input
            bool moveCursor = Input.GetButtonDown("vertical");
            if (moveCursor)
            {
                float updown = Input.GetAxisRaw("vertical");
                if (updown == 1)
                {
                    currCursorOption = (currCursorOption + 1) % numOptions;
                }
                else   // updown == -1 (can't be 0 if button was pressed)
                {
                    currCursorOption = (currCursorOption - 1) % numOptions;
                }
                options.PlaceCursor(currCursorOption);
            }
            yield return(null);
        }

        options.gameObject.SetActive(false);
        optionChooser((int)currCursorOption);
        yield return(null);
    }
예제 #17
0
            public void RunOptions(Options optionsGroup, OptionChooser optionChooser)
            {
                Console.WriteLine("Options:");
                for (int i = 0; i < optionsGroup.options.Count; i++)
                {
                    var optionDisplay = string.Format(CultureInfo.CurrentCulture, "{0}. {1}", i + 1, optionsGroup.options[i]);
                    Console.WriteLine(optionDisplay);
                }


                // Check to see if the number of expected options
                // is what we're expecting to see
                if (numberOfExpectedOptions != -1 &&
                    optionsGroup.options.Count != numberOfExpectedOptions)
                {
                    // TODO: Output diagnostic info here
                    Error(string.Format(CultureInfo.CurrentCulture, "[ERROR: Expected {0} options, but received {1}]", numberOfExpectedOptions, optionsGroup.options.Count));
                }

                // If we were told to automatically select an option, do so
                if (autoSelectOptionNumber != -1)
                {
                    Note(string.Format(CultureInfo.CurrentCulture, "[Received {0} options, choosing option {1}]", optionsGroup.options.Count, autoSelectOptionNumber));

                    optionChooser(autoSelectOptionNumber);

                    autoSelectOptionNumber = -1;

                    return;
                }

                // Reset the expected options counter
                numberOfExpectedOptions = -1;



                if (autoSelectFirstOption == true)
                {
                    Note("[automatically choosing option 1]");
                    optionChooser(0);
                    return;
                }

                do
                {
                    Console.Write("? ");
                    try
                    {
                        var selectedKey = Console.ReadKey().KeyChar.ToString(CultureInfo.InvariantCulture);
                        int selection;

                        if (int.TryParse(selectedKey, out selection) == true)
                        {
                            Console.WriteLine();

                            // we present the list as 1,2,3, but the API expects
                            // answers as 0,1,2
                            selection -= 1;

                            if (selection > optionsGroup.options.Count)
                            {
                                Console.WriteLine("Invalid option.");
                            }
                            else
                            {
                                optionChooser(selection);
                                break;
                            }
                        }
                    }
                    catch (FormatException) { }
                } while (true);
            }
예제 #18
0
    /// Show a list of options and wait for input
    public override IEnumerator RunOptions(Yarn.Options optionsCollection, Yarn.OptionChooser optionChooser)
    {
        if (optionsCollection.options.Count > 0)
        {
            choices.SetActive(true);
        }
        // Display each option in a button, and make it visible
        GameObject[] buttons = new GameObject[optionsCollection.options.Count];
        for (int i = 0; i < optionsCollection.options.Count; ++i)
        {
            GameObject choice = Instantiate(bookButton);
            buttons[i] = choice;
            choice.GetComponent <TextMeshProUGUI>().text = optionsCollection.options[i];
            choice.transform.SetParent(choices.transform, false);
            int o = i;
            int p = int.Parse(Regex.Match(optionsCollection.options[i], @"urn to page (\d*)").Groups[1].Value);
            choice.GetComponent <Button>().onClick.AddListener(() => SetOption(o, p));
        }

        SetSelectedOption = optionChooser;

        // Wait until the chooser has been used and then removed (see SetOption below)
        while (SetSelectedOption != null)
        {
            yield return(null);
        }

        // disable interaction
        foreach (GameObject go in buttons)
        {
            go.GetComponent <TextMeshProUGUI>().raycastTarget = false;
        }

        // start flips
        bool  flipDir  = int.Parse(pageNumberL.text) < page;
        int   numFlips = Mathf.Clamp(Mathf.Abs(int.Parse(pageNumberL.text) - page) / 2, 6, 24);
        float speed    = 12.0f / numFlips;

        for (int i = 0; i < numFlips; ++i)
        {
            GetComponent <PageFlip>().Flip(flipDir, 0.07f * i * speed + Random.Range(0.0f, 0.03f), i == 0 || i == numFlips - 1);
        }
        GetComponent <AudioSource>().pitch = Mathf.Clamp(1.0f / (speed), 0.75f, 1.25f) + Random.Range(-.1f, 0.1f);
        GetComponent <AudioSource>().Play();

        // wait until flips are partially done
        yield return(new WaitForSeconds(1.2f));

        // fade out text
        Color c = pageMat.GetColor(pageMatColorIdx);

        for (int i = 1; i <= 15; ++i)
        {
            c.a = 1.0f - i / 15.0f;
            pageMat.SetColor(pageMatColorIdx, c);
            yield return(new WaitForEndOfFrame());
        }

        // clear old page
        description.text          = "";
        descriptionContinued.text = "";
        pageNumberL.text          = "";
        pageNumberR.text          = "";

        // Destroy buttons, hide divider
        while (choices.transform.childCount > 1)
        {
            Transform lastChoice = choices.transform.GetChild(choices.transform.childCount - 1);
            lastChoice.SetParent(null);
            Destroy(lastChoice.gameObject);
        }
        choices.SetActive(false);
    }
예제 #19
0
            public void RunOptions(Options optionsGroup, OptionChooser optionChooser)
            {
                Console.WriteLine("Options:");
                for (int i = 0; i < optionsGroup.options.Count; i++) {
                    var optionDisplay = string.Format ("{0}. {1}", i + 1, optionsGroup.options [i]);
                    Console.WriteLine (optionDisplay);
                }

                // Check to see if the number of expected options
                // is what we're expecting to see
                if (numberOfExpectedOptions != -1 &&
                    optionsGroup.options.Count != numberOfExpectedOptions) {
                    // TODO: Output diagnostic info here
                    Console.WriteLine (string.Format("[ERROR: Expected {0} options, but received {1}]", numberOfExpectedOptions, optionsGroup.options.Count));
                    Environment.Exit (1);
                }

                // If we were told to automatically select an option, do so
                if (autoSelectOptionNumber != -1) {
                    Console.WriteLine ("[Received {0} options, choosing option {1}]", optionsGroup.options.Count, autoSelectOptionNumber);

                    optionChooser (autoSelectOptionNumber);

                    autoSelectOptionNumber = -1;

                    return;

                }

                // Reset the expected options counter
                numberOfExpectedOptions = -1;

                if (autoSelectFirstOption == true) {
                    Console.WriteLine ("[automatically choosing option 1]");
                    optionChooser (0);
                    return;
                }

                do {
                    Console.Write ("? ");
                    try {
                        var selectedKey = Console.ReadKey ().KeyChar.ToString();
                        var selection = int.Parse (selectedKey) - 1;
                        Console.WriteLine();

                        if (selection > optionsGroup.options.Count) {
                            Console.WriteLine ("Invalid option.");
                        } else {
                            optionChooser(selection);
                            break;
                        }
                    } catch (FormatException) {}

                } while (true);
            }