IEnumerator OnChoiceSelected(Script.Menu menu, Script.Choice choice) { // Show the choice text after the choice has been selected textbox.text = choice.ToString(); yield return(new WaitForSecondsRealtime(2f)); }
// 선택을 어떻게 입력할까, 입력을 구현하는 곳 // 정확히는 여러 인덱스 중 하나를 골라서 내보내는 것을 구현 protected IEnumerator <int?> SelectChoice(Script.Menu menu) { // 선택을 표시하기 위한 버튼들 인스턴스화 for (int i = 0; i < menu.TrueCount; i++) { VNController.menuDisplayer.AddNewSelection(menu.TrueChoices[i].Text, menu.TrueChoices[i].Index); } StartCoroutine("AutoMoveNextForWaitSelect"); while (true) { if (VNController.menuDisplayer.selectedButton) { break; } yield return(null); } StopCoroutine("AutoMoveNextForWaitSelect"); // 결정된 선택지를 가져오고 버튼들 화면에서 지우기 int selectedIndex = VNController.menuDisplayer.selectedButton.index; VNController.menuDisplayer.RemoveAllSelections(); // 선택된 것을 리턴 yield return(menu.TrueChoices[selectedIndex].Index); }
// 선택지가 선택된 순간에 무엇을 할까 // 선택에 의해 스토리 분기가 달라지는 것은 VGPrompter에 이미 구현되있음 // 여기서는 선택지에 Hook 되어 같이 발동될 무언가를 구현하는 곳 // 입력: 선택된 것이 온다 private IEnumerator OnChoiceSelected(Script.Menu menu, Script.Choice choice) { // Do nothing for now // Show the choice text after the choice has been selected Debug.Log(choice.ToString()); yield return(null); }
IEnumerator <int?> SelectChoice(Script.Menu menu) { // Show the menu and return the choice index once selected int n = 0; textbox.text = string.Join("\n", menu.TrueChoices .Select((x, i) => string.Format("[{0}] {1}", i, x.Text)) .ToArray()); while (!(DigitWasPressed(ref n) && n >= 0 && n < menu.TrueCount)) { yield return(null); } yield return(menu.TrueChoices[n].Index); }
//선택을 어떻게 입력할까, 입력을 구현하는 곳 // 정확히는 여러 인덱스 중 하나를 골라서 내보내는 것을 구현 IEnumerator <int?> SelectChoice(Script.Menu menu) { // Show the menu and return the choice index once selected yield return(menu.TrueChoices[0].Index); }
int SelectChoice(Script.Menu menu) { return((new Random()).Next(menu.Count - 1)); }