public static Prompter List(this Prompter prompter, string name, FunctionOrColorString message, IEnumerable <string> choices, Action <ListQuestion> setupQuestion = null) { var question = new ListQuestion(name, message, choices); setupQuestion?.Invoke(question); prompter.Add(question); return(prompter); }
//TODO: Enforce a converter parameter here public static Prompter List <TValue>(this Prompter prompter, string name, FunctionOrColorString message, IEnumerable <string> choices, Func <int, TValue> converter, Action <ListQuestion <TValue> > setupQuestion = null) { if (converter is null) { throw new ArgumentNullException(nameof(converter)); } var question = new ListQuestion <TValue>(name, message, choices); question.Transform(converter); setupQuestion?.Invoke(question); prompter.Add(question); return(prompter); }
// Create the iterator from the given input json file // Return true if file has at least 1 question, false otherwise public bool begin(string inputFile) { json = JsonUtility.FromJson <ListQuestion>(Resources.Load <TextAsset>(inputFile).ToString()); index = 0; return(json.questions.Length != 0); }