1 Star 0 Fork 88

momo/Landlords

forked from ibc-dabing/Landlords 
Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
gamecontrol.h 1.80 KB
Copy Edit Raw Blame History
kevin authored 2021-12-16 00:16 . 代码优化, 提高程序的健壮性
#ifndef GAMECONTROL_H
#define GAMECONTROL_H
#include <QObject>
#include "robot.h"
#include "userplayer.h"
#include "cards.h"
struct BetRecord
{
BetRecord()
{
reset();
}
void reset()
{
player = nullptr;
bet = 0;
times = 0;
}
Player* player;
int bet;
int times;
};
class GameControl : public QObject
{
Q_OBJECT
public:
enum GameStatus
{
DispatchCard,
CallingLord,
PlayingHand
};
enum PlayerStatus
{
ThinkingForCallLord,
ThinkingForPlayHand,
Winning
};
explicit GameControl(QObject *parent = nullptr);
void playerInit();
Robot* getLeftRobot();
Robot* getRightRobot();
UserPlayer* getUserPlayer();
void setCurrentPlayer(Player* player);
Player* getCurrentPlayer();
Player* getPendPlayer();
Cards getPendCards();
void initAllCards();
Card takeOneCard();
Cards getSurplusCards();
void resetCardData();
void startLordCard();
void becomeLord(Player *player, int bet);
void clearPlayerScore();
int getPlayerMaxBet();
void onGrabBet(Player* player, int bet);
void onPlayHand(Player *player, const Cards &card);
signals:
void playerStatusChanged(Player* player, PlayerStatus status);
void notifyGrabLordBet(Player* player, int bet, bool flag);
void gameStatusChanged(GameStatus status);
void notifyPlayHand(Player* player, const Cards& card);
void pendingInfo(Player* player, const Cards& card);
private:
Robot* m_robotLeft = nullptr;
Robot* m_robotRight = nullptr;
UserPlayer* m_user = nullptr;
Player* m_currPlayer = nullptr;
Player* m_pendPlayer = nullptr;
Cards m_pendCards;
Cards m_allCards;
BetRecord m_betRecord;
int m_curBet = 0;
};
#endif // GAMECONTROL_H
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/dataoffical/landlords.git
git@gitee.com:dataoffical/landlords.git
dataoffical
landlords
Landlords
master

Search