This repository has been archived by the owner on Dec 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
player.h
84 lines (68 loc) · 1.72 KB
/
player.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#ifndef PLAYER_H
#define PLAYER_H
#include <QWidget>
#include <QGraphicsView>
#include <QPushButton>
#include <QMessageBox>
#include "opponent.h"
#include "card.h"
#include "role.h"
#include "carditem.h"
#include "handcategory.h"
#include "cardscene.h"
namespace Ui {
class Player;
}
class Player : public QWidget
{
Q_OBJECT
typedef DDZ::CardType Card;
public:
enum State {UNKNOWN, BIDDING, CONFIRMATION, PLAYING, FINISHED};
Q_ENUM(State);
explicit Player(QWidget *parent = nullptr);
~Player();
void bwDecisionReceived(const bool &black);
void takeover(Opponent *b, Opponent *c, const bool &lastToJoin);
void snatch();
private:
Ui::Player *ui;
QPushButton *bidButton;
QPushButton *noBidButton;
QPushButton *dealButton;
QPushButton *passButton;
Opponent *nextPlayer;
Opponent *prevPlayer;
QVector<Card> m_cards;
QVector<Card> publicCards;
DDZ::Role m_role;
bool firstBidder;
bool defaultBidder;
bool needSnatchBid;
State gameState;
QVector<bool> blacks;
HandCategory hand;
int oppoReady;
void createButtons();
void playBW();
void makeBid(const bool &bid);
void shuffleDistribute();
void play();
void displayCards();
void updateLastDeal(const HandCategory &latestHand);
void gameStartInit();
private slots:
void receiveCards(const QVector<Card> &visible, const QVector<Card> &hidden);
void processBid(const bool &bid);
void confirmRoles();
void chooseCard(const Card &c, const bool &select);
void dealHand();
void opponentDealt();
void lostGame();
void playerReadyForBW();
signals:
void beginGame();
void bidDecided(bool bid);
void quitGame();
};
#endif // PLAYER_H