public void AddCardUI(int id) { //Debug.Log("AddCardUI() Log: Function entered " + id); Vector2 spawnPos = new Vector2(0, 0); Button listCard = Instantiate(listPrefab, spawnPos, Quaternion.identity) as Button; listCard.transform.SetParent(GetListTransform().transform, false); var txt = listCard.GetComponentInChildren <Text>(); var ident = listCard.GetComponent <CardIdentity>(); ident.id = id; txt.text = ident.GetName(); var list = CardLibrary.Get().cardList; for (int i = 0; i < list.Count; i++) { if (list[i].cardID == ident.id) { Debug.Log(ident.id); LibraryCard.Cult libCult = CardLibrary.Get().cardList[i].cult; string cult = LibraryCard.CultToString(libCult); listCard.GetComponent <Image>().color = CultColorUI(cult); break; } } uiCards.Add(listCard); MoveCardsUI(); deckCounterTxt.text = "Size: " + deck.Count; }
public static string CultToString(LibraryCard.Cult cEnum) { string cult = null; switch ((int)cEnum) { case 0: cult = "greed"; break; case 1: cult = "envy"; break; case 2: cult = "wrath"; break; case 3: cult = "pride"; break; case 4: cult = "gluttony"; break; case 5: cult = "lust"; break; case 6: cult = "sloth"; break; } return(cult); }