Exemplo n.º 1
0
//------------------------------------------------------------------------------
// PlayTrick - Player plays a single trick.
//------------------------------------------------------------------------------
void Player::PlayTrick(void)
{
    // Set the UI to the Trick state.
    emit SetUI(TRICK);

    // Enable the players cards to be movable.
    emit SetCardsMoveable(true);

    // Prep the user's hand so their choice will always be valid.
    emit PrepForTrick();

    // Wait for user to make a response.
    QEventLoop* loop = new QEventLoop();
    connect(this, SIGNAL(TrickPlayed()), loop, SLOT(quit()));
    connect(this, SIGNAL(ExitLoop()), loop, SLOT(quit()));
    loop->exec();
    delete loop;

    // Finish up the exchange.
    emit RequestCardTransfer(CardArray::PLAYERHAND,
                             CardArray::PLAYERTRICK,
                             0);

    // Disable the players cards to not be moveable.
    emit SetCardsMoveable(false);
}
Exemplo n.º 2
0
//------------------------------------------------------------------------------
// ExecuteDeal - Player executes a deal.
//------------------------------------------------------------------------------
void Player::ExecuteDeal(void)
{
    // Set the UI.
    emit SetUI(DEAL);

    // Wait for the user to select 'Deal'.
    QEventLoop* loop = new QEventLoop();
    connect(this, SIGNAL(BeginDeal()), loop, SLOT(quit()));
    connect(this, SIGNAL(ExitLoop()), loop, SLOT(quit()));
    loop->exec();
    delete loop;

    // Begin dealing out the cards.
    if ( !restarting )
    {
        emit RequestCardTransfer(CardArray::DECK, CardArray::CPUHAND,    3);
        emit RequestCardTransfer(CardArray::DECK, CardArray::PLAYERHAND, 3);
        emit RequestCardTransfer(CardArray::DECK, CardArray::CPUHAND,    3);
        emit RequestCardTransfer(CardArray::DECK, CardArray::PLAYERHAND, 3);
        emit RequestCardTransfer(CardArray::DECK, CardArray::CPUHAND,    3);
        emit RequestCardTransfer(CardArray::DECK, CardArray::PLAYERHAND, 3);
        emit RequestCardTransfer(CardArray::DECK, CardArray::CPUHAND,    3);
        emit RequestCardTransfer(CardArray::DECK, CardArray::PLAYERHAND, 3);
        emit RequestCardTransfer(CardArray::DECK, CardArray::TALON,      8);

        emit DealComplete();
    }
}
Exemplo n.º 3
0
//------------------------------------------------------------------------------
// ExecuteExchange - Player executes an exchange.
//------------------------------------------------------------------------------
void Player::ExecuteExchange(void)
{
    // Perform the Carte Blanche declaration if necessary.
    if ( declarationResults->carteBlancheWinner == playerNumber )
        ExecuteCarteBlanche();

    // Set the UI.
    emit SetUI(EXCHANGE);

    // Wait for the user to select 'Exchange'.
    QEventLoop* loop = new QEventLoop();
    connect(this, SIGNAL(BeginExchange()), loop, SLOT(quit()));
    connect(this, SIGNAL(ExitLoop()), loop, SLOT(quit()));
    loop->exec();
    delete loop;

    // Transfer the cards.
    emit RequestCardTransfer(CardArray::PLAYERHAND,
                             CardArray::PLAYERDISCARDS,
                             0);
    emit RequestCardTransfer(CardArray::TALON,
                             CardArray::PLAYERHAND,
                             0);

    // Inform the StateManager if all exchanges have finished.
    if ( younger == playerNumber)
        emit ExchangeComplete();
}
Exemplo n.º 4
0
Widget::Widget(QWidget *parent) : QWidget(parent)
{
    SetUI();
    SetConnect();
    //初始化星座
    GetDateData();
}
Exemplo n.º 5
0
//------------------------------------------------------------------------------
// SelectElder - Player executes an Elder selection.
//------------------------------------------------------------------------------
void Player::SelectElder(void)
{
    // Set the UI.
    emit SetUI(ELDERSELECT);

    // Wait for the user to select 'Randomize'.
    QEventLoop* loop = new QEventLoop();
    connect(this, SIGNAL(BeginElderSelect()), loop, SLOT(quit()));
    connect(this, SIGNAL(ExitLoop()), loop, SLOT(quit()));
    loop->exec();
    delete loop;
}
Exemplo n.º 6
0
//------------------------------------------------------------------------------
// CarteBlanche - Ask player if they wish to declare Carte Blanche.
//------------------------------------------------------------------------------
void Player::CarteBlanche(void)
{
    // Set the UI to the Response state.
    emit SetUI(BLANCHE);

    // Wait for user to make a response.
    QEventLoop* loop = new QEventLoop();
    connect(this, SIGNAL(Blanche()), loop, SLOT(quit()));
    connect(this, SIGNAL(ExitLoop()), loop, SLOT(quit()));
    loop->exec();
    delete loop;
}
Exemplo n.º 7
0
//------------------------------------------------------------------------------
// Summary - Player selects continue/new game.
//------------------------------------------------------------------------------
void Player::Summary(void)
{
    // Set the UI.
    emit SetUI(SUMMARY);

    // Wait for the user to select 'New Game/Continue'.
    QEventLoop* loop = new QEventLoop();
    connect(this, SIGNAL(Continue()), loop, SLOT(quit()));
    connect(this, SIGNAL(ExitLoop()), loop, SLOT(quit()));
    loop->exec();
    delete loop;
}
Exemplo n.º 8
0
//------------------------------------------------------------------------------
// Respond - Player responds to a declaration.
//------------------------------------------------------------------------------
void Player::Respond(State)
{
    // Set the UI to the Response state.
    emit SetUI(RESPOND);

    // Wait for user to make a response.
    QEventLoop* loop = new QEventLoop();
    connect(this, SIGNAL(Declare()), loop, SLOT(quit()));
    connect(this, SIGNAL(ExitLoop()), loop, SLOT(quit()));
    loop->exec();
    delete loop;
}
Exemplo n.º 9
0
//------------------------------------------------------------------------------
// AnnouceDeclaration - Player prepares to make a declaration.
//------------------------------------------------------------------------------
void Player::AnnounceDeclaration(State phase)
{
    // Set the UI.
    emit SetUI(phase);

    // Wait for the user to select 'Declare' or 'Skip'.
    QEventLoop* loop = new QEventLoop();
    connect(this, SIGNAL(Declare()), loop, SLOT(quit()));
    connect(this, SIGNAL(ExitLoop()), loop, SLOT(quit()));
    loop->exec();
    delete loop;
}