Exemplo n.º 1
0
        void UpdateInfo()
        {
            int diff = ammoItem.MaxAmount - ammoItem.CurrentAmount;

            if (diff > ammoItem.AmountToBuy)
            {
                diff = ammoItem.AmountToBuy;
            }

            int diffAll = ammoItem.MaxAmount - ammoItem.CurrentAmount;


            buyText.text    = GetBuyText(diff);
            buyAllText.text = GetBuyAllText(diffAll);

            priceText.text =
                MoneyFormatter.FormatMoney(shop.GetAmmoPrice(ammoItem, diff));
            priceAllText.text =
                MoneyFormatter.FormatMoney(shop.GetAmmoPrice(ammoItem, diffAll));

            currentAmountText.text = GetAmountText(ammoItem.CurrentAmount, ammoItem.MaxAmount);
            SetAmountPercentage((float)ammoItem.CurrentAmount / ammoItem.MaxAmount);

            buyButton.interactable    = diff != 0 && shop.EnoughMoneyToBuy(ammoItem, diff);
            buyAllButton.interactable = diffAll != 0 && shop.EnoughMoneyToBuy(ammoItem, diffAll);
        }
Exemplo n.º 2
0
        string GetRepairText(int price)
        {
            if (repairTranslation == null)
            {
                repairTranslation = repairText.GetComponent <TranslatedText>();
            }

            string translated;

            try
            {
                translated = repairTranslation.GetValue();
            }
            catch
            {
                translated = "Repair {0}";
            }

            return(string.Format(translated, MoneyFormatter.FormatMoney(price)));
        }
Exemplo n.º 3
0
        string GetBuyText(int price)
        {
            if (buyTranslation == null)
            {
                buyTranslation = buyText.GetComponent <TranslatedText>();
            }

            string translated;

            try
            {
                translated = buyTranslation.GetValue();
            }
            catch
            {
                translated = "Buy {0}";
            }

            return(string.Format(translated, MoneyFormatter.FormatMoney(price)));
        }
Exemplo n.º 4
0
 void SetMoneyAmount(int amount)
 {
     moneyAmountText.text = MoneyFormatter.FormatMoney(amount);
 }