Beispiel #1
0
        public bool GetActiveCard(out int slotIdx, out TriadCard card)
        {
            bool bResult = false;

            slotIdx = -1;
            card    = null;

            if (deck != null && cardClickOwner != null)
            {
                slotIdx = (int)cardClickOwner.Tag;
                card    = deck.GetCard(slotIdx);
                bResult = true;
            }

            return(bResult);
        }
Beispiel #2
0
        public void SetDeck(TriadDeck deck)
        {
            if ((clickAction == EDeckCtrlAction.Highlight) && (cardClickOwner != null))
            {
                cardClickOwner.SetHighlighted(false);
                cardClickOwner = null;
            }

            if (cardCtrls != null)
            {
                int prevCtrlCount = cardCtrls.Length;
                int numCards      = deck.knownCards.Count + deck.unknownCardPool.Count;
                if (prevCtrlCount == numCards)
                {
                    this.deck = null;
                    for (int Idx = 0; Idx < cardCtrls.Length; Idx++)
                    {
                        setDeckCard(Idx, deck.GetCard(Idx), true);
                    }

                    this.deck = deck;
                    return;
                }
            }

            if (deck.unknownCardPool.Count == 0)
            {
                SetDeck(deck.knownCards);
            }
            else
            {
                List <TriadCard> allCards = new List <TriadCard>();
                allCards.AddRange(deck.knownCards);
                allCards.AddRange(deck.unknownCardPool);
                SetDeck(allCards);
            }

            this.deck = deck;
        }