Пример #1
0
        public void Refresh()
        {
            current = this;
            foreach (Transform t in itemContainer.transform)
            {
                GameObject.Destroy(t.gameObject);
            }


            if (!SellMode)
            {
                for (int i = 0; i < CurrentShopContent.Items.Count; i++)
                {
                    ShopItemSlot slot = GameObject.Instantiate <ShopItemSlot>(itemSlotPrefab);
                    slot.SetData(CurrentShopContent.Items[i], CurrentShopContent.valueOverrides[i], SellMode);
                    slot.transform.SetParent(itemContainer.transform, false);
                    slot.GetComponent <RectTransform>().localScale = new Vector3(1, 1, 1);
                }
            }
            else
            {
                for (int i = 0; i < characterSelector.SelectedCharacter.inventroy.items.Count; i++)
                {
                    ShopItemSlot slot = GameObject.Instantiate <ShopItemSlot>(itemSlotPrefab);
                    slot.SetData(characterSelector.SelectedCharacter.inventroy.items[i], characterSelector.SelectedCharacter.inventroy.items[i].item.Value, SellMode);
                    slot.transform.SetParent(itemContainer.transform, false);
                    slot.GetComponent <RectTransform>().localScale = new Vector3(1, 1, 1);
                }
            }
            moneyCounter.text = GameManager.saveData.PlayerMoney.ToString();
        }
Пример #2
0
        public void Init(Shop content)
        {
            header.text        = "Buy";
            CurrentShopContent = content;
            if (CurrentShopContent.original == null)
            {
                Shop copy = CurrentShopContent.Clone() as Shop;
                copy.original      = CurrentShopContent;
                CurrentShopContent = copy;
            }
            foreach (Transform t in itemContainer.transform)
            {
                GameObject.Destroy(t.gameObject);
            }
            characterSelector.Initialize(CurrentShopContent.getCharacters(), () => Refresh());

            for (int i = 0; i < CurrentShopContent.Items.Count; i++)
            {
                ShopItemSlot slot = GameObject.Instantiate <ShopItemSlot>(itemSlotPrefab);
                slot.SetData(CurrentShopContent.Items[i], CurrentShopContent.valueOverrides[i], SellMode);
                slot.transform.SetParent(itemContainer.transform, false);
                slot.GetComponent <RectTransform>().localScale = new Vector3(1, 1, 1);
            }
            moneyCounter.text = GameManager.saveData.PlayerMoney.ToString();
        }
Пример #3
0
        public override void OnSelect(BaseEventData eventData)
        {
            base.OnSelect(eventData);
            if (current != this)
            {
                current = this;
            }

            ShopUI.current.infoDisplayer.BuildUI(stack.item);
        }
Пример #4
0
        public override void OnPointerEnter(PointerEventData eventData)
        {
            base.OnPointerEnter(eventData);

            if (current != this)
            {
                current = this;
            }

            ShopUI.current.infoDisplayer.BuildUI(stack.item);
        }