/// <summary> /// /// Initialise the object with card data. Refreshes the text properties of the card. Used for library lists /// /// </summary> public void InitCardObject(CardData _cardData, int numCards, int?_deckId = null, DeckListUI _deckListUI = null, ReserveForcesUI _reserveForcesUI = null, bool _isReserved = false) { cardData = _cardData; //Needs to pass in the deck list UI to this object in order to know which deck is being edited deckListUI = _deckListUI; reserveForcesUI = _reserveForcesUI; isReserved = _isReserved; deckId = _deckId; nameText.text = cardData.Name; typeText.text = cardData.CardType.ToString(); cardCountText.text = cardData.IsHero ? "Hero" : $"x{numCards}"; rarityBorder.color = GameManager.instance.colourManager.GetRarityColour(cardData.Rarity, cardData.Class); totalCostText.text = StringHelpers.GenerateResourceText(cardData.GetResources); }
/// <summary> /// /// Refreshes the card list /// /// </summary> public void RefreshCardList(DeckData _deckData = null, DeckListUI _deckListUI = null, ReserveForcesUI _reserveForcesUI = null, bool _isReserved = false, bool _hideCards = false) { deckListUI = _deckListUI; reserveForcesUI = _reserveForcesUI; isReserved = _isReserved; GameManager.DestroyAllChildren(cardListArea); //Certain situations may require an empty card list, so will leave the object empty if (_deckData != null) { deckData = _deckData; deckCardList = deckData.CardList; deckUpgradeList = deckData.UpgradeList; hideCards = _hideCards; if (reserveForcesUI == null) { //Add the hero card to the list if (!hideCards) { AddHeroCard(deckData); } //Add the upgrades to the list AddUpgrades(); } //Add the cards to the list if (!hideCards) { AddCards(); } //Update the card count text cardCountText.text = $"Cards: {deckData.DeckCount}"; } }