/// <summary> /// Sets the details of the menu including actions to take when each button is used /// </summary> /// <param name="pokemon">The pokmeon to use for consideration</param> /// <param name="replaceMove">Whether the menu is being used for replacing a move (instead of for cancelling learning the move)</param> /// <param name="replacedMoveIndex">(Only relevant if replaceMove is true) The index of the move that is being considered for replacement</param> public void SetDetails(PokemonInstance pokemon, int newMoveId, bool replaceMove, int replacedMoveIndex = -1) { if (textBoxController == null) { SetTextBoxController(); } PokemonMove newMove = PokemonMove.GetPokemonMoveById(newMoveId); noButton.onClick.AddListener(() => learnMoveUIController.ConfirmAction_ReturnToLearnMoveMenu()); if (replaceMove) { if (replacedMoveIndex < 0 || replacedMoveIndex > 3) { Debug.LogError("replacedMoveIndex was invalid when setting details for replacing a move"); } string prompt = replaceMovePrompt .Replace("{pokemonName}", pokemon.GetDisplayName()) .Replace("{oldMoveName}", PokemonMove.GetPokemonMoveById(pokemon.moveIds[replacedMoveIndex]).name) .Replace("{newMoveName}", newMove.name); textBoxController.SetTextInstant(prompt); yesButton.onClick.AddListener(() => learnMoveUIController.ConfirmAction_ReplaceMove(replacedMoveIndex)); } else { string prompt = cancelLearnMovePrompt .Replace("{pokemonName}", pokemon.GetDisplayName()) .Replace("{moveName}", newMove.name); textBoxController.SetTextInstant(prompt); yesButton.onClick.AddListener(() => learnMoveUIController.ConfirmAction_CancelLearningMove()); } }
private IEnumerator SetUIForWaitingForOtherUserDecisionOnOffer() { if (otherUserOfferedPokemon == null || playerOfferedPokemonLocator == null) { Debug.LogError("Trying to set up for waiting for other user deciding on offer when an offered pokemon isn't set"); yield break; } tradeUIController.SetInteractionEnabled(false); textBoxController.Show(); textBoxController.SetTextInstant(waitingForOtherUserOfferDecisionMessagePrefix + otherUserName + waitingForOtherUserOfferDecisionMessageSuffix); }
private void ShowLearnMoveMenu() { menuLearnMoveController.Show(); textBoxController.SetTextInstant("Which move do you not want?"); if (!menuLearnMoveController.selectionListenersSetUp) { menuLearnMoveController.SetUpSelectionListeners(); } EventSystem.current.SetSelectedGameObject(menuLearnMoveController.newMoveButton.gameObject); }
private void OnActionChosen_Use() { if (CurrentItem.CanBeUsedFromBag()) { if (CurrentItem is GeneralItem generalCurrentItem && !generalCurrentItem.GetRequireTargetPokemon()) { // General items that don't require a pokemon target to be used // Items are handled for individual cases as functionalities are too unique to generalise // Switch statement for different possible items that are being used switch (generalCurrentItem.id) { case GeneralItem.repelId: case GeneralItem.superRepelId: case GeneralItem.maxRepelId: OnActionChosen_Use_Repel(generalCurrentItem); break; default: Debug.LogError("Unhandled general no-target-pokemon item id - " + generalCurrentItem.id); break; } PlayerData.singleton.inventory.RemoveItem(CurrentItem, 1); textBoxController.Show(); textBoxController.SetTextInstant($"{CurrentItem.itemName} was used"); textBoxController.SetHideDelay(1.5F); ChangeToSectionSelection(false); } else { // Default case pokemonSelectionMode = PokemonSelectionMode.Use; ChangeToPokemonSelection(); } }