mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-09 15:54:47 -07:00
phases + small message log fix
This commit is contained in:
parent
5f110af562
commit
05f63bb631
6 changed files with 235 additions and 170 deletions
|
|
@ -14,7 +14,7 @@
|
|||
#include "counter.h"
|
||||
|
||||
Game::Game(CardDatabase *_db, Client *_client, QGraphicsScene *_scene, QMenu *_actionsMenu, QMenu *_cardMenu, int playerId, const QString &playerName, QObject *parent)
|
||||
: QObject(parent), actionsMenu(_actionsMenu), cardMenu(_cardMenu), db(_db), client(_client), scene(_scene), started(false)
|
||||
: QObject(parent), actionsMenu(_actionsMenu), cardMenu(_cardMenu), db(_db), client(_client), scene(_scene), started(false), currentPhase(-1)
|
||||
{
|
||||
QRectF sr = scene->sceneRect();
|
||||
localPlayer = addPlayer(playerId, playerName, QPointF(0, sr.y() + sr.height() / 2 + 2), true);
|
||||
|
|
@ -53,6 +53,16 @@ Game::Game(CardDatabase *_db, Client *_client, QGraphicsScene *_scene, QMenu *_a
|
|||
aCreateToken->setShortcut(tr("Ctrl+T"));
|
||||
connect(aCreateToken, SIGNAL(triggered()), this, SLOT(actCreateToken()));
|
||||
|
||||
aNextPhase = new QAction(tr("Next &phase"), this);
|
||||
aNextPhase->setShortcut(tr("Ctrl+Space"));
|
||||
connect(aNextPhase, SIGNAL(triggered()), this, SLOT(actNextPhase()));
|
||||
aNextTurn = new QAction(tr("Next &turn"), this);
|
||||
aNextTurn->setShortcut(tr("Ctrl+Enter"));
|
||||
connect(aNextTurn, SIGNAL(triggered()), this, SLOT(actNextTurn()));
|
||||
|
||||
actionsMenu->addAction(aNextPhase);
|
||||
actionsMenu->addAction(aNextTurn);
|
||||
actionsMenu->addSeparator();
|
||||
actionsMenu->addAction(aUntapAll);
|
||||
actionsMenu->addSeparator();
|
||||
actionsMenu->addAction(aDecLife);
|
||||
|
|
@ -240,6 +250,7 @@ void Game::gameEvent(const ServerEventData &msg)
|
|||
case eventSetActivePhase: {
|
||||
QStringList data = msg.getEventData();
|
||||
int phase = data[0].toInt();
|
||||
currentPhase = phase;
|
||||
emit setActivePhase(phase);
|
||||
break;
|
||||
}
|
||||
|
|
@ -284,6 +295,19 @@ void Game::gameEvent(const ServerEventData &msg)
|
|||
}
|
||||
}
|
||||
|
||||
void Game::actNextPhase()
|
||||
{
|
||||
int phase = currentPhase;
|
||||
if (++phase >= phaseCount)
|
||||
phase = 0;
|
||||
client->setActivePhase(phase);
|
||||
}
|
||||
|
||||
void Game::actNextTurn()
|
||||
{
|
||||
client->nextTurn();
|
||||
}
|
||||
|
||||
void Game::actUntapAll()
|
||||
{
|
||||
client->setCardAttr("table", -1, "tapped", "false");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue