private IEnumerator CloseConfirmation() { Message message = ui_manager.ShowMessage(CLOSE_MESSAGE); yield return(new WaitUntil(() => message.on_final_line && !message.writing)); Choice choice = ui_manager.ShowChoices(Choice.YES_NO_CHOICE); yield return(new WaitUntil(() => choice.finished)); int selection = choice.chosen_selection; GameObject.Destroy(message.gameObject); GameObject.Destroy(choice.gameObject); if (selection == 0) { message = ui_manager.ShowMessage(SAVE_MESSAGE); yield return(new WaitUntil(() => message.finished)); GameObject.Destroy(message.gameObject); CloseMenuAndSaveOptions(); } else { CloseMenu(); } }
private IEnumerator ShowPokemonChoices(Pokemon.Pokemon pokemon) { // Lock control and modify view awaiting_input = false; message_panel.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, MESSAGE_PANEL_SHORT_WIDTH); message_text_field.text = SELECT_MESSAGE; // Determine choices to show List <string> valid_choices = new List <string>(); valid_choices.Add(SELECT_OPTIONS[0]); if (party.size > 1) { valid_choices.Add(SELECT_OPTIONS[1]); } if (pokemon.egg_steps == 0) { valid_choices.Add(SELECT_OPTIONS[2]); } valid_choices.Add(SELECT_OPTIONS[3]); ChoicePackage choice_package = new ChoicePackage(valid_choices.ToArray(), 0, valid_choices.Count - 1); // Show choices Choice choice = ui_manager.ShowChoices(choice_package); Image choice_panel = choice.GetComponent <Image>(); choice_panel.rectTransform.Translate(Vector3.down * CHOICE_MENU_OFFSET); // Hide choices yield return(new WaitUntil(() => choice.finished)); PartySelectChoices selection = (PartySelectChoices)Enum.Parse(typeof(PartySelectChoices), valid_choices[choice.chosen_selection], true); GameObject.Destroy(choice.gameObject); // Act on selection switch (selection) { case PartySelectChoices.Summary: open_screen = ui_manager.ShowSummaryScreen(); SummaryScreen summary = open_screen.GetComponent <SummaryScreen>(); summary.pokemon_selection = current_selection; summary.in_pc = false; summary.learning_move = false; yield return(new WaitUntil(() => open_screen == null)); StartCoroutine(ShowPokemonChoices(pokemon)); break; case PartySelectChoices.Swap: InitiateSwap(current_selection); break; case PartySelectChoices.Item: Debug.Log("Open bag to give item"); EndPokemonChoices(); // TODO: replace this with giving item break; default: EndPokemonChoices(); break; } }