public void AddCard(CardAsset asset) { //if we are browsing the collection if (!InDeckBuildingMode) { return; } //if the deck is already full if (deckList.Count == AmountOfCardsInDeck) { return; } int count = NumberOfThisCardInDeck(asset); int limitOfThisCardInDeck = SameCardLimit; //if something else if specified in the CardAsset, we use that if (asset.OverrideLimitOfThisCardInDeck > 0) { limitOfThisCardInDeck = asset.OverrideLimitOfThisCardInDeck; } if (count < limitOfThisCardInDeck) { deckList.Add(asset); //added one to count if we are adding this card count++; //add to card count if (CardCount.Instance.count < 20) { CardCount.Instance.count++; //CardCount.Instance.SetCountText (); } //do all the graphical stuff if (ribbons.ContainsKey(asset)) { //update quantity ribbons [asset].SetQuantity(count); } else { // add card's name to the list GameObject cardName = Instantiate(cardNamePrefab, content) as GameObject; cardName.transform.SetAsLastSibling(); cardName.transform.localScale = Vector3.one; CardNameRibbon ribbon = cardName.GetComponent <CardNameRibbon> (); ribbon.ApplyAsset(asset, count); ribbons.Add(asset, ribbon); } if (CardCount.Instance.count <= 20) { CardCount.Instance.SetCountText(); } } }
public void RemoveCard(CardAsset asset) { CardNameRibbon ribbonToRemove = _ribbons[asset]; ribbonToRemove.SetQuantity(ribbonToRemove.Quantity - 1); if (NumberOfThisCardInDeck(asset) == 1) { _ribbons.Remove(asset); Destroy(ribbonToRemove.gameObject); } _deckList.Remove(asset); CheckDeckCompleteFrame(); DeckBuildingScreen.Instance.CollectionBrowserScript.UpdateQuantitiesOnPage(); }
public void AddCard(CardAsset asset) { if (!InDeckBuildingMode) { return; } if (_deckList.Count == AmountOfCardsInDeck) { return; } int count = NumberOfThisCardInDeck(asset); int limitOfThisCardInDeck = SameCardLimit; if (asset.OverrideLimitOfThisCardInDeck > 0) { limitOfThisCardInDeck = asset.OverrideLimitOfThisCardInDeck; } if (count < limitOfThisCardInDeck) { _deckList.Add(asset); CheckDeckCompleteFrame(); count++; if (_ribbons.ContainsKey(asset)) { _ribbons[asset].SetQuantity(count); } else { GameObject cardName = Instantiate(CardNamePrefab, Content) as GameObject; cardName.transform.SetAsLastSibling(); cardName.transform.localScale = Vector3.one; CardNameRibbon ribbon = cardName.GetComponent <CardNameRibbon>(); ribbon.ApplyAsset(asset, count); _ribbons.Add(asset, ribbon); } } }
public void RemoveCard(CardAsset asset) { Debug.Log("InRemoveCard"); CardNameRibbon ribbonToRemove = ribbons[asset]; ribbonToRemove.SetQuantity(ribbonToRemove.Quantity - 1); if (NumberOfThisCardInDeck(asset) == 1) { ribbons.Remove(asset); Destroy(ribbonToRemove.gameObject); } deckList.Remove(asset); CheckDeckCompleteFrame(); // update quantities of all cards that we currently show in the collection // this should be after deckList.Remove(asset); line to show correct quantities DeckBuildingScreen.Instance.CollectionBrowserScript.UpdateQuantitiesOnPage(); }
public void RemoveCard(CardAsset asset) { CardNameRibbon ribbonToRemove = ribbons [asset]; ribbonToRemove.SetQuantity(ribbonToRemove.Quantity - 1); if (NumberOfThisCardInDeck(asset) == 1) { ribbons.Remove(asset); Destroy(ribbonToRemove.gameObject); } //subtract from card count if (CardCount.Instance.count > 0) { CardCount.Instance.count--; CardCount.Instance.SetCountText(); } deckList.Remove(asset); //update quantities of all cards taht we currently show in the collection CCScreen.Instance.CollectionBrowserScript.UpdateQuantitiesOnPage(); }