Exemplo n.º 1
0
    public void AddNewCard(string cardInfo, int price)
    {
        Credits -= price;
        int index = 999;

        for (int i = 0; i < PlayerDeck.Count; i++)
        {
            if (PlayerDeck[i].CardInfo == cardInfo)
            {
                index = i;
                break;
            }
        }
        if (index == 999)
        {
            DeckInventroyClass newCard = new DeckInventroyClass();
            newCard.CardAmount = 1;
            newCard.CardInfo   = cardInfo;
            PlayerDeck.Add(newCard);
        }
        else
        {
            PlayerDeck[index].CardAmount++;
        }

        SavePlayerInfo();
    }
Exemplo n.º 2
0
    void CombinePlayerDeck(List <string> cardInfo, List <int> cardAmount)
    {
        if (cardInfo == null)
        {
            return;
        }
        PlayerDeck = new List <DeckInventroyClass>();
        for (int i = 0; i < cardInfo.Count; i++)
        {
            DeckInventroyClass newCard = new DeckInventroyClass();
            newCard.CardInfo   = cardInfo[i];
            newCard.CardAmount = cardAmount[i];

            PlayerDeck.Add(newCard);
        }
    }