private IEnumerator BoxPokemonClickedCoroutine(byte pokemonIndex)
        {
            textBoxController.Show();

            string choicePrompt = "What would you like to do with " + CurrentBoxPokemon[pokemonIndex].GetDisplayName() + "?";

            yield return(StartCoroutine(textBoxController.WaitForUserChoice(
                                            boxPokemonSelectedOptions,
                                            choicePrompt
                                            )));

            switch (textBoxController.userChoiceIndexSelected)
            {
            case 0:
                //Do nothing
                break;

            case 1:
                yield return(StartCoroutine(TryWithdrawBoxPokemon(pokemonIndex)));

                RefreshPartyPokemon();
                RefreshCurrentBox();
                break;

            default:
                Debug.LogError("Unknown choice selected");
                break;
            }

            textBoxController.Hide();
            SetControlEnabled(true);
            ReturnToSelectedGameObjectBeforePokemonClicked();
        }
示例#2
0
        private IEnumerator OnItemSelected_Buy(int index)
        {
            controlAllowed = false;
            textBoxController.Show();

            Item item = currentItems[index];

            string[] userChoices = GetBuyUserChoices(item);

            yield return(StartCoroutine(textBoxController.WaitForUserChoice(
                                            userChoices,
                                            "How much would you like to buy?"
                                            )));

            if (textBoxController.userChoiceIndexSelected == 0) //Cancel
            {
                //Do nothing and proceed to ending this coroutine (after the else block)
            }
            else
            {
                //1 is subtracted as first option is cancel
                ushort quantitySelected = buyQuantityOptions[textBoxController.userChoiceIndexSelected - 1];
                int    totalCost        = item.BuyPrice * quantitySelected;

                bool userCanAffordSelected = PlayerData.singleton.profile.money >= totalCost;

                if (userCanAffordSelected)
                {
                    PlayerData.singleton.inventory.AddItem(item, quantitySelected);
                    PlayerData.singleton.profile.money -= totalCost;
                    RefreshPlayerMoneyText();

                    //TODO - sound fx for purchase made
                    yield return(StartCoroutine(
                                     textBoxController.RevealText("Thank you for your purchase", true)
                                     ));
                }
                else
                {
                    yield return(StartCoroutine(
                                     textBoxController.RevealText("Sorry but you don't seem to have enough money for that.", true)
                                     ));
                }
            }

            textBoxController.Hide();
            controlAllowed = true;
        }
示例#3
0
 private void SetUpScene()
 {
     tradeUIController.SetUp(this);
     tradeAnimationController.Hide();
     textBoxController.Hide();
 }