Esempio n. 1
0
//------------------------------------------------------------------------------
// SetCardsSelectable - Enable/Disable the user's cards to be selected.
//------------------------------------------------------------------------------
void CardManager::SetCardsSelectable(bool setSelectable, PlayerNum player)
{
    Card* card;
    CardArray* hand = (player == PLAYER1) ? playerHand : cpuHand;

    // Loop through the array setting the ItemIsSelectable property.
    for ( int index = 0; index < hand->GetSize(); index++ )
    {
        card = hand->GetCard(index);

        if ( setSelectable )
        {
            card->setFlag(QGraphicsItem::ItemIsSelectable, true);
        }
        else
        {
            if ( card->isSelected() )
            {
                card->setFlag(QGraphicsItem::ItemIsSelectable, true);
                card->setSelected(false);
            }

            card->UpdateSelection();
            card->setFlag(QGraphicsItem::ItemIsSelectable, false);
        }
    }
}
Esempio n. 2
0
//------------------------------------------------------------------------------
// DeselectCards - Deselect all user cards, called when a skip is requested.
//------------------------------------------------------------------------------
void CardManager::DeselectCards(void)
{
    Card* card;

    for ( int i = 0; i < playerHand->GetSize(); i++ )
    {
        card = playerHand->GetCard(i);

        if ( card->isSelected() )
        {
            card->setSelected(false);
            card->UpdateSelection();
        }
    }
}