Beispiel #1
0
        public void OnOpenShop(Shop shop, ShopConfig config, CurrencyDataHandler currency)
        {
            _config = config;
            _shop   = shop;
            _currencyDataHandler = currency;
            _currencyDataHandler.OnCurrencyChange += OnCurrencyChange;
            _cachedSelection             = null;
            _selectedBuyRoot.localScale  = Vector3.zero;
            _selectedSellRoot.localScale = Vector3.zero;
            SetBuyList(shop.FilteredShopProducts());

            _panel.Show();
            SwitchGroup(_buyGroup, true);
            _sellCategory.gameObject.SetActive(config.PurchaseItems);
        }
Beispiel #2
0
        public bool HasEnoughCurrencies(CurrencyDataHandler dataHandler)
        {
            if (dataHandler == null)
            {
                return(false);
            }

            for (int i = 0; i < BuyPrice.Length; i++)
            {
                var price = BuyPrice[i];
                if (dataHandler.HasEnoughCurrency(price.Currency.name, price.Count) == false)
                {
                    return(false);
                }
            }

            return(true);
        }