コード例 #1
0
    private void CmdPlayerPlaysCard(int cardID, bool playedByHost)
    {
        CardDefinition card = CardDefinition.GetCardDefinitionWithID(cardID);

        if (ServerSidePlayCard(card, playedByHost))
        {
            RpcPlayerSuccessfullyPlaysCard(cardID, playedByHost);
        }
    }
コード例 #2
0
    public Library(int[] arrayOfCardDefIDs)
    {
        cards = new List <Card>();

        for (int i = 0; i < arrayOfCardDefIDs.Length; i++)
        {
            CardDefinition definition = CardDefinition.GetCardDefinitionWithID(arrayOfCardDefIDs[i]);

            if (definition == null)
            {
                Debug.LogError("Can't finish constructing library. Given array to construct contains invalud IDs.");
                continue;
            }
            else
            {
                Card instance = definition.GetCardInstance();
                cards.Add(instance);
            }
        }
    }
コード例 #3
0
ファイル: Deck.cs プロジェクト: KyleGChapman76/ThesisCardGame
    //add some number of a card to the deck
    public void AddCard(int cardID, int numberToAdd = 1)
    {
        if (numberToAdd <= 0)
        {
            Debug.LogError("Tried to put a 0/negative number of a single card into the deck.");
            return;
        }

        int maxCopiesOfCard = CardDefinition.GetCardDefinitionWithID(cardID).MaxCopiesInDeck;

        if (deck.ContainsKey(cardID))
        {
            if ((deck[cardID] + numberToAdd) > maxCopiesOfCard)
            {
                Debug.LogError("Putting " + numberToAdd + " cards in would make the current number " + deck[cardID].ToString() + " go over the limit for that card: " + maxCopiesOfCard.ToString());
                return;
            }
            else
            {
                deck[cardID] += numberToAdd;
                cardCount    += numberToAdd;
            }
        }
        else
        {
            if (numberToAdd > maxCopiesOfCard)
            {
                Debug.LogError("Putting " + numberToAdd + " cards in would go over the limit for that card: " + maxCopiesOfCard.ToString());
                return;
            }
            else
            {
                deck.Add(cardID, numberToAdd);
                cardCount += numberToAdd;
            }
        }
    }
コード例 #4
0
    private void RpcPlayerSuccessfullyPlaysCard(int cardID, bool playedByHost)
    {
        CardDefinition card = CardDefinition.GetCardDefinitionWithID(cardID);

        NetworkedGameManager.SingletonGameManager.PlayerStatusChanged();
    }