private void AddButtons() { //var notCollectableColor = Color.red; //notCollectableColor.a = 0.3f; var collectableColor = Color.black; collectableColor.a = 0.3f; for (int i = 0; i < ConstellationManager.Instance.constellationItemList.Count; i++) { if (ConstellationManager.Instance.constellationItemList[i].collectable == 1) { ConstellationsScrollViewButton newButton = AddButton(i); newButton.GetComponent <Image>().color = collectableColor; } } for (int i = 0; i < ConstellationManager.Instance.constellationItemList.Count; i++) { if (ConstellationManager.Instance.constellationItemList[i].collectable == 0) { ConstellationsScrollViewButton newButton = AddButton(i); newButton.constellationImage.sprite = ConstellationManager.Instance.constellationItemList[i].finishedIcon; //newButton.GetComponent<Image>().color = notCollectableColor; } } }
private ConstellationsScrollViewButton AddButton(int i) { Constellation item = ConstellationManager.Instance.constellationItemList[i]; GameObject newButton = GameManager.Instance.GetPool().GetObject(); newButton.transform.SetParent(contentPanel, false); ConstellationsScrollViewButton sampleButton = newButton.GetComponent <ConstellationsScrollViewButton>(); sampleButton.Setup(item, this, i); return(sampleButton); }