流程:
玩家点击出牌按钮
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();
}