public void OnClick() { Color btnColor = GetComponent <Image>().color; if (!selected) { btnColor = selectColor; if (type == Type.Buy) { StoreManager.Get().SelectItem(item); } else { SellManager.Get().SelectItem(item); } AudioManager.Get().PlaySound(AudioManager.SoundClipName.Select); } else { btnColor = Color.white; if (type == Type.Buy) { StoreManager.Get().DeselectItem(item); } else { SellManager.Get().DeselectItem(item); } AudioManager.Get().PlaySound(AudioManager.SoundClipName.Deselect); } GetComponent <Image>().color = btnColor; selected = !selected; }
// Update is called once per frame // Need to get value from StoreManager on buy panel, from SellManager for sell panel void Update() { if (type == Type.Buy) { text.text = StoreManager.Get().GetSelectedCost().ToString(); } else { text.text = SellManager.Get().GetSelectedCost().ToString(); } }
public void Display() { // Clear current list foreach (GameObject box in itemBoxes) { Destroy(box); } // Build from Inventory list foreach (Item item in SellManager.Get().GetInvItems()) { //Debug.Log(item.GetName()); GameObject itemBox = Instantiate(listItemTemplate); itemBox.GetComponent <ItemBox>().type = ItemBox.Type.Sell; itemBox.GetComponent <ItemBox>().SetItem(item); itemBox.transform.SetParent(listParent.transform, false); itemBoxes.Add(itemBox); } }
public void Sell() { SellManager.Get().Sell(); // Rebuilds display Display(); }