斗地主流程设计

流程:
玩家点击出牌按钮
MainInterface::on_playhand_clicked()
    MainInterface->PlayerStartPlayingHand()
    Player::playHand()
        emit TellPlayingHand(this,cards);
        GameProcess::PlayerPlayHand()
            GameProcess::TellPlayerPlayHand()播放声音信号
            判断输赢
            转移牌权
            Player::beginPlayingHand()
                Player::playHand()

3分叫地主流程

void MainInterface::on_bet3_clicked()
{
    m_gameprocess->getDownPlayer()->callingLord(3);
}

void Player::callingLord(int bet)
{
  emit TellCallingLord(this,bet);
}


void GameProcess::PlayerCallLord(Player *player, int bet)
{
    emit TellPlayerCallLord(player,bet); (显示3分叫地主)


    //叫3分直接当地主
    if(bet==3)
    {
        //设置角色
        player->setRole(Player::Lord);
        player->getNextPlayer()->setRole(Player::Farmer);
        player->getNextPlayer()->getNextPlayer()->setRole(Player::Farmer);

        /*暂停1秒钟后开始打牌*/
        QTime dieTime = QTime::currentTime().addMSecs(1000);
        while( QTime::currentTime() < dieTime )
            QCoreApplication::processEvents(QEventLoop::AllEvents, 100);

        emit TellGameProcess(PlayingHand);
        beginPlayHand();
        return;
    }

void MainInterface::StartProcess(GameProcess::GameStatus status)

{

        //添加剩余三张牌
        for(int i=0;i<3;i++)
        {
            m_gameprocess->getCurrentPlayer()->addCard(restthreecards[i]);
            CardPicture* cardpic=new CardPicture(this);
            cardpic->setPic(m_Cards.value(restthreecards[i])->getPic());

            m_restThreeCards.append(cardpic);
            m_restThreeCards[i]->move(360+i*100,5);
            m_restThreeCards[i]->setTurn(true);
            m_restThreeCards[i]->show();
        }

//地主发牌

}

void GameProcess::beginPlayHand()
{
    emit TellPlayerStatus(m_currentPlayer,Player::waitingPlayingHand);
    m_currentPlayer->beginPlayingHand();
}

void MainInterface::SetPlayerStatus(Player *player, Player::PlayerStatus status)

{

            m_playhand->show();
            m_tip->show();

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值