예제 #1
0
        public void SetData(List <ShopItem> shopItems = null)
        {
            foreach (var itemSlot in shopItemSlots)
            {
                if (itemSlot != null)
                {
                    Destroy(itemSlot.gameObject);
                }
            }
            shopItemSlots.Clear();
            if (shopItems != null && shopItems.Count > 0)
            {
                Debug.Log("ShopUi --> " + shopItems.Count);

                foreach (var item in shopItems)
                {
                    var x = Instantiate(shopItemSlot, BuyTab.transform);
                    x.SetData(item);
                    x.PurchasingEvent += OnPurchasingEvent;
                    shopItemSlots.Add(x);
                }
                uiAnimation.OpenPanel();
                uiAnimation.ActivateButtons(true);
            }
            else
            {
                uiAnimation.ActivateButtons(false);
                uiAnimation.ClosePanel();
                Sell = false;
                Buy  = false;
                ShopManager.Instance.SellWindowActive = Sell;
            }
            TabButtonEvent(ButtonType.Buy);
        }