public static V_CardPresenter selectedCard; // The card presenter we're currently selecting void Start() { // load saved decks if there's any, else, make a random one.... if (PlayerPrefs.HasKey("deck0")) { ReloadDecks(); } else { for (int i = 0; i < decks.Length; i++) { SaveDeckJson(i); } ReloadDecks(); } // Card previews for card database (in future updates, an inventory system will be implemented so this will be revised): cardDatabase = FindObjectOfType <V_CardCollections>(); foreach (V_Card card in cardDatabase.gameCards) { V_CardPresenter prsntr = Instantiate(cardDatabase.cardPresenter, cardDatabase.cardsListContent.transform).GetComponent <V_CardPresenter>(); prsntr.index = System.Array.IndexOf(cardDatabase.gameCards, card); prsntr.index = cardDatabase.cardsListContent.transform.childCount - 1; prsntr.Refresh(); } }
// OTHER COMMANDS: public void SetCard(int deck, int newCardIndex) { decks[deck].cards[selectedCard.transform.GetSiblingIndex()] = newCardIndex; cardCollectionList.SetActive(false); selectedCard = null; UpdateCardsInDeck(deck); UpdateToPlayer(); }
public void Deselect() { selectedCard = null; cardCollectionList.SetActive(false); }
// CARD SELECTION: public void Select(V_CardPresenter card) { selectedCard = null; selectedCard = card; cardCollectionList.SetActive(true); }