mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-01 19:13:55 -07:00
optionally destroy tokens on zone change; added multi arrows; card menu changes; arrow fixes; initial commit for attachCard code
This commit is contained in:
parent
9a44413e16
commit
cbf201ed9b
23 changed files with 504 additions and 247 deletions
|
|
@ -101,6 +101,11 @@ ArrowDragItem::ArrowDragItem(CardItem *_startItem, const QColor &_color)
|
|||
{
|
||||
}
|
||||
|
||||
void ArrowDragItem::addChildArrow(ArrowDragItem *childArrow)
|
||||
{
|
||||
childArrows.append(childArrow);
|
||||
}
|
||||
|
||||
void ArrowDragItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
QPointF endPos = event->scenePos();
|
||||
|
|
@ -124,9 +129,12 @@ void ArrowDragItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
|||
updatePath();
|
||||
}
|
||||
update();
|
||||
|
||||
for (int i = 0; i < childArrows.size(); ++i)
|
||||
childArrows[i]->mouseMoveEvent(event);
|
||||
}
|
||||
|
||||
void ArrowDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent * /*event*/)
|
||||
void ArrowDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (targetItem && (targetItem != startItem)) {
|
||||
targetItem->setBeingPointedAt(false);
|
||||
|
|
@ -144,4 +152,7 @@ void ArrowDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent * /*event*/)
|
|||
));
|
||||
}
|
||||
deleteLater();
|
||||
|
||||
for (int i = 0; i < childArrows.size(); ++i)
|
||||
childArrows[i]->mouseReleaseEvent(event);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ public:
|
|||
ArrowItem(Player *_player, int _id, CardItem *_startItem, CardItem *_targetItem, const QColor &color);
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||
QRectF boundingRect() const { return path.boundingRect(); }
|
||||
QPainterPath shape() const { return path; }
|
||||
void updatePath();
|
||||
void updatePath(const QPointF &endPoint);
|
||||
|
||||
|
|
@ -36,8 +37,11 @@ public:
|
|||
|
||||
class ArrowDragItem : public ArrowItem {
|
||||
Q_OBJECT
|
||||
private:
|
||||
QList<ArrowDragItem *> childArrows;
|
||||
public:
|
||||
ArrowDragItem(CardItem *_startItem, const QColor &_color);
|
||||
void addChildArrow(ArrowDragItem *childArrow);
|
||||
protected:
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
|
||||
|
|
|
|||
|
|
@ -12,16 +12,135 @@
|
|||
#include "settingscache.h"
|
||||
|
||||
CardItem::CardItem(Player *_owner, const QString &_name, int _cardid, QGraphicsItem *parent)
|
||||
: AbstractCardItem(_name, parent), owner(_owner), id(_cardid), attacking(false), facedown(false), doesntUntap(false), beingPointedAt(false), dragItem(NULL)
|
||||
: AbstractCardItem(_name, parent), owner(_owner), id(_cardid), attacking(false), facedown(false), destroyOnZoneChange(false), doesntUntap(false), beingPointedAt(false), dragItem(NULL)
|
||||
{
|
||||
owner->addCard(this);
|
||||
|
||||
if (owner->getLocal()) {
|
||||
aTap = new QAction(this);
|
||||
aTap->setData(0);
|
||||
connect(aTap, SIGNAL(triggered()), owner, SLOT(cardMenuAction()));
|
||||
aUntap = new QAction(this);
|
||||
aUntap->setData(1);
|
||||
connect(aUntap, SIGNAL(triggered()), owner, SLOT(cardMenuAction()));
|
||||
aDoesntUntap = new QAction(this);
|
||||
aDoesntUntap->setData(2);
|
||||
connect(aDoesntUntap, SIGNAL(triggered()), owner, SLOT(cardMenuAction()));
|
||||
aAttach = new QAction(this);
|
||||
connect(aAttach, SIGNAL(triggered()), owner, SLOT(actAttach()));
|
||||
aUnattach = new QAction(this);
|
||||
connect(aUnattach, SIGNAL(triggered()), owner, SLOT(actUnattach()));
|
||||
aSetPT = new QAction(this);
|
||||
connect(aSetPT, SIGNAL(triggered()), owner, SLOT(actSetPT()));
|
||||
aSetAnnotation = new QAction(this);
|
||||
connect(aSetAnnotation, SIGNAL(triggered()), owner, SLOT(actSetAnnotation()));
|
||||
aFlip = new QAction(this);
|
||||
aFlip->setData(3);
|
||||
connect(aFlip, SIGNAL(triggered()), owner, SLOT(cardMenuAction()));
|
||||
aClone = new QAction(this);
|
||||
aClone->setData(4);
|
||||
connect(aClone, SIGNAL(triggered()), owner, SLOT(cardMenuAction()));
|
||||
aMoveToTopLibrary = new QAction(this);
|
||||
aMoveToTopLibrary->setData(5);
|
||||
aMoveToBottomLibrary = new QAction(this);
|
||||
aMoveToBottomLibrary->setData(6);
|
||||
aMoveToGraveyard = new QAction(this);
|
||||
aMoveToGraveyard->setData(7);
|
||||
aMoveToExile = new QAction(this);
|
||||
aMoveToExile->setData(8);
|
||||
connect(aMoveToTopLibrary, SIGNAL(triggered()), owner, SLOT(cardMenuAction()));
|
||||
connect(aMoveToBottomLibrary, SIGNAL(triggered()), owner, SLOT(cardMenuAction()));
|
||||
connect(aMoveToGraveyard, SIGNAL(triggered()), owner, SLOT(cardMenuAction()));
|
||||
connect(aMoveToExile, SIGNAL(triggered()), owner, SLOT(cardMenuAction()));
|
||||
|
||||
|
||||
cardMenu = new QMenu;
|
||||
cardMenu->addAction(aTap);
|
||||
cardMenu->addAction(aUntap);
|
||||
cardMenu->addAction(aDoesntUntap);
|
||||
cardMenu->addAction(aFlip);
|
||||
cardMenu->addSeparator();
|
||||
cardMenu->addAction(aAttach);
|
||||
cardMenu->addAction(aUnattach);
|
||||
cardMenu->addSeparator();
|
||||
cardMenu->addAction(aSetPT);
|
||||
cardMenu->addAction(aSetAnnotation);
|
||||
cardMenu->addSeparator();
|
||||
cardMenu->addAction(aClone);
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
QAction *tempAddCounter = new QAction(this);
|
||||
tempAddCounter->setData(9 + i * 1000);
|
||||
QAction *tempRemoveCounter = new QAction(this);
|
||||
tempRemoveCounter->setData(10 + i * 1000);
|
||||
QAction *tempSetCounter = new QAction(this);
|
||||
tempSetCounter->setData(11 + i * 1000);
|
||||
aAddCounter.append(tempAddCounter);
|
||||
aRemoveCounter.append(tempRemoveCounter);
|
||||
aSetCounter.append(tempSetCounter);
|
||||
connect(tempAddCounter, SIGNAL(triggered()), owner, SLOT(actCardCounterTrigger()));
|
||||
connect(tempRemoveCounter, SIGNAL(triggered()), owner, SLOT(actCardCounterTrigger()));
|
||||
connect(tempSetCounter, SIGNAL(triggered()), owner, SLOT(actCardCounterTrigger()));
|
||||
|
||||
cardMenu->addSeparator();
|
||||
cardMenu->addAction(tempAddCounter);
|
||||
cardMenu->addAction(tempRemoveCounter);
|
||||
cardMenu->addAction(tempSetCounter);
|
||||
}
|
||||
cardMenu->addSeparator();
|
||||
|
||||
moveMenu = cardMenu->addMenu(QString());
|
||||
moveMenu->addAction(aMoveToTopLibrary);
|
||||
moveMenu->addAction(aMoveToBottomLibrary);
|
||||
moveMenu->addAction(aMoveToGraveyard);
|
||||
moveMenu->addAction(aMoveToExile);
|
||||
|
||||
|
||||
retranslateUi();
|
||||
} else
|
||||
cardMenu = 0;
|
||||
}
|
||||
|
||||
CardItem::~CardItem()
|
||||
{
|
||||
if (owner->getCardMenu() == cardMenu)
|
||||
owner->setCardMenu(0);
|
||||
delete cardMenu;
|
||||
|
||||
deleteDragItem();
|
||||
}
|
||||
|
||||
void CardItem::retranslateUi()
|
||||
{
|
||||
if (owner->getLocal()) {
|
||||
aTap->setText(tr("&Tap"));
|
||||
aUntap->setText(tr("&Untap"));
|
||||
aDoesntUntap->setText(tr("Toggle &normal untapping"));
|
||||
aFlip->setText(tr("&Flip"));
|
||||
aClone->setText(tr("&Clone"));
|
||||
aAttach->setText(tr("Attach to card..."));
|
||||
aUnattach->setText(tr("Unattach"));
|
||||
aSetPT->setText(tr("Set &P/T..."));
|
||||
aSetAnnotation->setText(tr("&Set annotation..."));
|
||||
QStringList counterColors;
|
||||
counterColors.append(tr("red"));
|
||||
counterColors.append(tr("yellow"));
|
||||
counterColors.append(tr("green"));
|
||||
for (int i = 0; i < aAddCounter.size(); ++i)
|
||||
aAddCounter[i]->setText(tr("&Add counter (%1)").arg(counterColors[i]));
|
||||
for (int i = 0; i < aRemoveCounter.size(); ++i)
|
||||
aRemoveCounter[i]->setText(tr("&Remove counter (%1)").arg(counterColors[i]));
|
||||
for (int i = 0; i < aSetCounter.size(); ++i)
|
||||
aSetCounter[i]->setText(tr("&Set counters (%1)...").arg(counterColors[i]));
|
||||
aMoveToTopLibrary->setText(tr("&top of library"));
|
||||
aMoveToBottomLibrary->setText(tr("&bottom of library"));
|
||||
aMoveToGraveyard->setText(tr("&graveyard"));
|
||||
aMoveToGraveyard->setShortcut(tr("Ctrl+Del"));
|
||||
aMoveToExile->setText(tr("&exile"));
|
||||
|
||||
moveMenu->setTitle(tr("&Move to"));
|
||||
}
|
||||
}
|
||||
|
||||
void CardItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
{
|
||||
painter->save();
|
||||
|
|
@ -125,7 +244,9 @@ void CardItem::processCardInfo(ServerInfo_Card *info)
|
|||
setAttacking(info->getAttacking());
|
||||
setPT(info->getPT());
|
||||
setAnnotation(info->getAnnotation());
|
||||
setColor(info->getColor());
|
||||
setTapped(info->getTapped());
|
||||
setDestroyOnZoneChange(info->getDestroyOnZoneChange());
|
||||
}
|
||||
|
||||
CardDragItem *CardItem::createDragItem(int _id, const QPointF &_pos, const QPointF &_scenePos, bool faceDown)
|
||||
|
|
@ -161,6 +282,19 @@ void CardItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
|||
ArrowDragItem *arrow = new ArrowDragItem(this, arrowColor);
|
||||
scene()->addItem(arrow);
|
||||
arrow->grabMouse();
|
||||
|
||||
QListIterator<QGraphicsItem *> itemIterator(scene()->selectedItems());
|
||||
while (itemIterator.hasNext()) {
|
||||
CardItem *c = qgraphicsitem_cast<CardItem *>(itemIterator.next());
|
||||
if (!c)
|
||||
continue;
|
||||
if (c->parentItem() != parentItem())
|
||||
continue;
|
||||
|
||||
ArrowDragItem *childArrow = new ArrowDragItem(c, arrowColor);
|
||||
scene()->addItem(childArrow);
|
||||
arrow->addChildArrow(childArrow);
|
||||
}
|
||||
} else {
|
||||
if ((event->screenPos() - event->buttonDownScreenPos(Qt::LeftButton)).manhattanLength() < 2 * QApplication::startDragDistance())
|
||||
return;
|
||||
|
|
@ -216,9 +350,10 @@ void CardItem::playCard(QGraphicsSceneMouseEvent *event)
|
|||
|
||||
void CardItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::RightButton)
|
||||
qgraphicsitem_cast<CardZone *>(parentItem())->getPlayer()->showCardMenu(event->screenPos());
|
||||
else if ((event->button() == Qt::LeftButton) && !settingsCache->getDoubleClickToPlay())
|
||||
if (event->button() == Qt::RightButton) {
|
||||
if (cardMenu)
|
||||
cardMenu->exec(event->screenPos());
|
||||
} else if ((event->button() == Qt::LeftButton) && !settingsCache->getDoubleClickToPlay())
|
||||
playCard(event);
|
||||
|
||||
setCursor(Qt::OpenHandCursor);
|
||||
|
|
@ -230,3 +365,14 @@ void CardItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
|
|||
playCard(event);
|
||||
event->accept();
|
||||
}
|
||||
|
||||
QVariant CardItem::itemChange(GraphicsItemChange change, const QVariant &value)
|
||||
{
|
||||
if (change == ItemSelectedHasChanged) {
|
||||
if (value == true)
|
||||
owner->setCardMenu(cardMenu);
|
||||
else if (owner->getCardMenu() == cardMenu)
|
||||
owner->setCardMenu(0);
|
||||
}
|
||||
return QGraphicsItem::itemChange(change, value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ class CardDragItem;
|
|||
class CardZone;
|
||||
class ServerInfo_Card;
|
||||
class Player;
|
||||
class QAction;
|
||||
|
||||
const int MAX_COUNTERS_ON_CARD = 999;
|
||||
|
||||
|
|
@ -21,17 +22,25 @@ private:
|
|||
QMap<int, int> counters;
|
||||
QString annotation;
|
||||
QString pt;
|
||||
bool destroyOnZoneChange;
|
||||
bool doesntUntap;
|
||||
QPoint gridPoint;
|
||||
bool beingPointedAt;
|
||||
CardDragItem *dragItem;
|
||||
|
||||
QList<QAction *> aAddCounter, aSetCounter, aRemoveCounter;
|
||||
QAction *aTap, *aUntap, *aDoesntUntap, *aAttach, *aUnattach, *aSetPT, *aSetAnnotation, *aFlip, *aClone,
|
||||
*aMoveToTopLibrary, *aMoveToBottomLibrary, *aMoveToGraveyard, *aMoveToExile;
|
||||
QMenu *cardMenu, *moveMenu;
|
||||
|
||||
void playCard(QGraphicsSceneMouseEvent *event);
|
||||
public:
|
||||
enum { Type = typeCard };
|
||||
int type() const { return Type; }
|
||||
CardItem(Player *_owner, const QString &_name = QString(), int _cardid = -1, QGraphicsItem *parent = 0);
|
||||
~CardItem();
|
||||
void retranslateUi();
|
||||
QMenu *getCardMenu() const { return cardMenu; }
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||
QPoint getGridPoint() const { return gridPoint; }
|
||||
void setGridPoint(const QPoint &_gridPoint) { gridPoint = _gridPoint; }
|
||||
|
|
@ -51,6 +60,8 @@ public:
|
|||
void setDoesntUntap(bool _doesntUntap);
|
||||
QString getPT() const { return pt; }
|
||||
void setPT(const QString &_pt);
|
||||
bool getDestroyOnZoneChange() const { return destroyOnZoneChange; }
|
||||
void setDestroyOnZoneChange(bool _destroy) { destroyOnZoneChange = _destroy; }
|
||||
void setBeingPointedAt(bool _beingPointedAt);
|
||||
void resetState();
|
||||
void processCardInfo(ServerInfo_Card *info);
|
||||
|
|
@ -61,6 +72,7 @@ protected:
|
|||
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
|
||||
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
|
||||
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -19,6 +19,12 @@ CardZone::~CardZone()
|
|||
clearContents();
|
||||
}
|
||||
|
||||
void CardZone::retranslateUi()
|
||||
{
|
||||
for (int i = 0; i < cards.size(); ++i)
|
||||
cards[i]->retranslateUi();
|
||||
}
|
||||
|
||||
void CardZone::clearContents()
|
||||
{
|
||||
for (int i = 0; i < cards.size(); i++)
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ public:
|
|||
virtual void handleDropEvent(int cardId, CardZone *startZone, const QPoint &dropPoint, bool faceDown) = 0;
|
||||
CardZone(Player *_player, const QString &_name, bool _hasCardAttr, bool _isShufflable, bool _contentsKnown, QGraphicsItem *parent = 0, bool isView = false);
|
||||
~CardZone();
|
||||
void retranslateUi();
|
||||
void clearContents();
|
||||
bool getHasCardAttr() const { return hasCardAttr; }
|
||||
bool getIsShufflable() const { return isShufflable; }
|
||||
|
|
|
|||
|
|
@ -26,6 +26,9 @@ DlgCreateToken::DlgCreateToken(QWidget *parent)
|
|||
annotationLabel = new QLabel(tr("&Annotation:"));
|
||||
annotationEdit = new QLineEdit;
|
||||
annotationLabel->setBuddy(annotationEdit);
|
||||
|
||||
destroyCheckBox = new QCheckBox(tr("&Destroy token when it leaves the table"));
|
||||
destroyCheckBox->setChecked(true);
|
||||
|
||||
okButton = new QPushButton(tr("&OK"));
|
||||
okButton->setDefault(true);
|
||||
|
|
@ -40,6 +43,7 @@ DlgCreateToken::DlgCreateToken(QWidget *parent)
|
|||
grid->addWidget(ptEdit, 2, 1);
|
||||
grid->addWidget(annotationLabel, 3, 0);
|
||||
grid->addWidget(annotationEdit, 3, 1);
|
||||
grid->addWidget(destroyCheckBox, 4, 0, 1, 2);
|
||||
|
||||
QHBoxLayout *buttonLayout = new QHBoxLayout;
|
||||
buttonLayout->addStretch();
|
||||
|
|
@ -83,3 +87,8 @@ QString DlgCreateToken::getAnnotation() const
|
|||
{
|
||||
return annotationEdit->text();
|
||||
}
|
||||
|
||||
bool DlgCreateToken::getDestroy() const
|
||||
{
|
||||
return destroyCheckBox->isChecked();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
class QLabel;
|
||||
class QComboBox;
|
||||
class QCheckBox;
|
||||
class QPushButton;
|
||||
|
||||
class DlgCreateToken : public QDialog {
|
||||
|
|
@ -16,12 +17,14 @@ public:
|
|||
QString getColor() const;
|
||||
QString getPT() const;
|
||||
QString getAnnotation() const;
|
||||
bool getDestroy() const;
|
||||
private slots:
|
||||
void actOk();
|
||||
private:
|
||||
QLabel *nameLabel, *colorLabel, *ptLabel, *annotationLabel;
|
||||
QComboBox *colorEdit;
|
||||
QLineEdit *nameEdit, *ptEdit, *annotationEdit;
|
||||
QCheckBox *destroyCheckBox;
|
||||
QPushButton *okButton, *cancelButton;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -202,9 +202,14 @@ void MessageLogWidget::logMoveCard(Player *player, QString cardName, CardZone *s
|
|||
append(finalStr.arg(sanitizeHtml(player->getName())).arg(cardStr).arg(fromStr).arg(newX));
|
||||
}
|
||||
|
||||
void MessageLogWidget::logDestroyCard(Player *player, QString cardName)
|
||||
{
|
||||
append(tr("%1 destroys %2.").arg(sanitizeHtml(player->getName())).arg(QString("<font color=\"blue\">%1</font>").arg(sanitizeHtml(cardName))));
|
||||
}
|
||||
|
||||
void MessageLogWidget::logCreateToken(Player *player, QString cardName, QString pt)
|
||||
{
|
||||
append(tr("%1 creates token: %2 (%3).").arg(sanitizeHtml(player->getName())).arg(QString("<font color=\"blue\">%1</font>").arg(sanitizeHtml(cardName))).arg(sanitizeHtml(pt)));
|
||||
append(tr("%1 creates token: %2%3.").arg(sanitizeHtml(player->getName())).arg(QString("<font color=\"blue\">%1</font>").arg(sanitizeHtml(cardName))).arg(pt.isEmpty() ? QString() : QString(" (%1)").arg(sanitizeHtml(pt))));
|
||||
}
|
||||
|
||||
void MessageLogWidget::logCreateArrow(Player *player, Player *startPlayer, QString startCard, Player *targetPlayer, QString targetCard)
|
||||
|
|
@ -327,6 +332,7 @@ void MessageLogWidget::connectToPlayer(Player *player)
|
|||
connect(player, SIGNAL(logSetPT(Player *, QString, QString)), this, SLOT(logSetPT(Player *, QString, QString)));
|
||||
connect(player, SIGNAL(logSetAnnotation(Player *, QString, QString)), this, SLOT(logSetAnnotation(Player *, QString, QString)));
|
||||
connect(player, SIGNAL(logMoveCard(Player *, QString, CardZone *, int, CardZone *, int)), this, SLOT(logMoveCard(Player *, QString, CardZone *, int, CardZone *, int)));
|
||||
connect(player, SIGNAL(logDestroyCard(Player *, QString)), this, SLOT(logDestroyCard(Player *, QString)));
|
||||
connect(player, SIGNAL(logDumpZone(Player *, CardZone *, int)), this, SLOT(logDumpZone(Player *, CardZone *, int)));
|
||||
connect(player, SIGNAL(logStopDumpZone(Player *, CardZone *)), this, SLOT(logStopDumpZone(Player *, CardZone *)));
|
||||
connect(player, SIGNAL(logDrawCards(Player *, int)), this, SLOT(logDrawCards(Player *, int)));
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ public slots:
|
|||
void logRollDie(Player *player, int sides, int roll);
|
||||
void logDrawCards(Player *player, int number);
|
||||
void logMoveCard(Player *player, QString cardName, CardZone *startZone, int oldX, CardZone *targetZone, int newX);
|
||||
void logDestroyCard(Player *player, QString cardName);
|
||||
void logCreateToken(Player *player, QString cardName, QString pt);
|
||||
void logCreateArrow(Player *player, Player *startPlayer, QString startCard, Player *targetPlayer, QString targetCard);
|
||||
void logSetCardCounter(Player *player, QString cardName, int counterId, int value, int oldValue);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
#include <QMenu>
|
||||
|
||||
Player::Player(const QString &_name, int _id, bool _local, Client *_client, TabGame *_parent)
|
||||
: QObject(_parent), defaultNumberTopCards(3), name(_name), id(_id), active(false), local(_local), mirrored(false), client(_client)
|
||||
: QObject(_parent), defaultNumberTopCards(3), lastTokenDestroy(true), name(_name), id(_id), active(false), local(_local), mirrored(false), client(_client)
|
||||
{
|
||||
setCacheMode(DeviceCoordinateCache);
|
||||
|
||||
|
|
@ -200,76 +200,12 @@ Player::Player(const QString &_name, int _id, bool _local, Client *_client, TabG
|
|||
sayMenu = playerMenu->addMenu(QString());
|
||||
initSayMenu();
|
||||
|
||||
// Card menu
|
||||
aTap = new QAction(this);
|
||||
aUntap = new QAction(this);
|
||||
aDoesntUntap = new QAction(this);
|
||||
aSetPT = new QAction(this);
|
||||
connect(aSetPT, SIGNAL(triggered()), this, SLOT(actSetPT()));
|
||||
aSetAnnotation = new QAction(this);
|
||||
connect(aSetAnnotation, SIGNAL(triggered()), this, SLOT(actSetAnnotation()));
|
||||
aFlip = new QAction(this);
|
||||
aMoveToTopLibrary = new QAction(this);
|
||||
aMoveToBottomLibrary = new QAction(this);
|
||||
aMoveToGraveyard = new QAction(this);
|
||||
aMoveToExile = new QAction(this);
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
QMenu *menu = new QMenu;
|
||||
QAction *tempAddCounter = new QAction(this);
|
||||
QAction *tempRemoveCounter = new QAction(this);
|
||||
QAction *tempSetCounter = new QAction(this);
|
||||
menu->addAction(tempAddCounter);
|
||||
menu->addAction(tempRemoveCounter);
|
||||
menu->addAction(tempSetCounter);
|
||||
aAddCounter.append(tempAddCounter);
|
||||
aRemoveCounter.append(tempRemoveCounter);
|
||||
aSetCounter.append(tempSetCounter);
|
||||
connect(menu, SIGNAL(triggered(QAction *)), this, SLOT(actCardCounterTrigger(QAction *)));
|
||||
cardCounterMenus.append(menu);
|
||||
}
|
||||
|
||||
cardMenu = new QMenu;
|
||||
cardMenu->addAction(aTap);
|
||||
cardMenu->addAction(aUntap);
|
||||
cardMenu->addAction(aDoesntUntap);
|
||||
cardMenu->addSeparator();
|
||||
cardMenu->addAction(aSetPT);
|
||||
cardMenu->addAction(aSetAnnotation);
|
||||
cardMenu->addSeparator();
|
||||
cardMenu->addAction(aFlip);
|
||||
cardMenu->addSeparator();
|
||||
for (int i = 0; i < cardCounterMenus.size(); ++i)
|
||||
cardMenu->addMenu(cardCounterMenus[i]);
|
||||
cardMenu->addSeparator();
|
||||
moveMenu = cardMenu->addMenu(QString());
|
||||
|
||||
aCardMenu = new QAction(this);
|
||||
playerMenu->addSeparator();
|
||||
playerMenu->addMenu(cardMenu);
|
||||
|
||||
moveMenu->addAction(aMoveToTopLibrary);
|
||||
moveMenu->addAction(aMoveToBottomLibrary);
|
||||
moveMenu->addAction(aMoveToGraveyard);
|
||||
moveMenu->addAction(aMoveToExile);
|
||||
|
||||
cardMenuHandlers.insert(aTap, &Player::actTap);
|
||||
cardMenuHandlers.insert(aUntap, &Player::actUntap);
|
||||
cardMenuHandlers.insert(aDoesntUntap, &Player::actDoesntUntap);
|
||||
cardMenuHandlers.insert(aFlip, &Player::actFlip);
|
||||
cardMenuHandlers.insert(aMoveToTopLibrary, &Player::actMoveToTopLibrary);
|
||||
cardMenuHandlers.insert(aMoveToBottomLibrary, &Player::actMoveToBottomLibrary);
|
||||
cardMenuHandlers.insert(aMoveToGraveyard, &Player::actMoveToGraveyard);
|
||||
cardMenuHandlers.insert(aMoveToExile, &Player::actMoveToExile);
|
||||
|
||||
QHashIterator<QAction *, CardMenuHandler> i(cardMenuHandlers);
|
||||
while (i.hasNext()) {
|
||||
i.next();
|
||||
connect(i.key(), SIGNAL(triggered()), this, SLOT(cardMenuAction()));
|
||||
}
|
||||
playerMenu->addAction(aCardMenu);
|
||||
} else {
|
||||
countersMenu = 0;
|
||||
sbMenu = 0;
|
||||
cardMenu = 0;
|
||||
aCreateAnotherToken = 0;
|
||||
}
|
||||
|
||||
|
|
@ -290,7 +226,6 @@ Player::~Player()
|
|||
clearCounters();
|
||||
clearArrows();
|
||||
delete playerMenu;
|
||||
delete cardMenu;
|
||||
}
|
||||
|
||||
void Player::rearrangeZones()
|
||||
|
|
@ -391,30 +326,12 @@ void Player::retranslateUi()
|
|||
while (counterIterator.hasNext())
|
||||
counterIterator.next().value()->retranslateUi();
|
||||
|
||||
cardMenu->setTitle(tr("C&ard"));
|
||||
aTap->setText(tr("&Tap"));
|
||||
aUntap->setText(tr("&Untap"));
|
||||
aDoesntUntap->setText(tr("Toggle &normal untapping"));
|
||||
aSetPT->setText(tr("Set &P/T..."));
|
||||
aSetAnnotation->setText(tr("&Set annotation..."));
|
||||
aFlip->setText(tr("&Flip"));
|
||||
cardCounterMenus[0]->setTitle(tr("Counters (red)"));
|
||||
cardCounterMenus[1]->setTitle(tr("Counters (yellow)"));
|
||||
cardCounterMenus[2]->setTitle(tr("Counters (green)"));
|
||||
for (int i = 0; i < aAddCounter.size(); ++i)
|
||||
aAddCounter[i]->setText(tr("&Add counter"));
|
||||
for (int i = 0; i < aRemoveCounter.size(); ++i)
|
||||
aRemoveCounter[i]->setText(tr("&Remove counter"));
|
||||
for (int i = 0; i < aSetCounter.size(); ++i)
|
||||
aSetCounter[i]->setText(tr("&Set counters..."));
|
||||
aMoveToTopLibrary->setText(tr("&top of library"));
|
||||
aMoveToBottomLibrary->setText(tr("&bottom of library"));
|
||||
aMoveToGraveyard->setText(tr("&graveyard"));
|
||||
aMoveToGraveyard->setShortcut(tr("Ctrl+Del"));
|
||||
aMoveToExile->setText(tr("&exile"));
|
||||
|
||||
moveMenu->setTitle(tr("&Move to"));
|
||||
aCardMenu->setText(tr("C&ard"));
|
||||
}
|
||||
|
||||
QMapIterator<QString, CardZone *> zoneIterator(zones);
|
||||
while (zoneIterator.hasNext())
|
||||
zoneIterator.next().value()->retranslateUi();
|
||||
}
|
||||
|
||||
void Player::initSayMenu()
|
||||
|
|
@ -508,14 +425,15 @@ void Player::actCreateToken()
|
|||
lastTokenColor = dlg.getColor();
|
||||
lastTokenPT = dlg.getPT();
|
||||
lastTokenAnnotation = dlg.getAnnotation();
|
||||
lastTokenDestroy = dlg.getDestroy();
|
||||
aCreateAnotherToken->setEnabled(true);
|
||||
|
||||
sendGameCommand(new Command_CreateToken(-1, "table", dlg.getName(), dlg.getColor(), dlg.getPT(), dlg.getAnnotation(), -1, 0));
|
||||
sendGameCommand(new Command_CreateToken(-1, "table", dlg.getName(), dlg.getColor(), dlg.getPT(), dlg.getAnnotation(), dlg.getDestroy(), -1, 0));
|
||||
}
|
||||
|
||||
void Player::actCreateAnotherToken()
|
||||
{
|
||||
sendGameCommand(new Command_CreateToken(-1, "table", lastTokenName, lastTokenColor, lastTokenPT, lastTokenAnnotation, -1, 0));
|
||||
sendGameCommand(new Command_CreateToken(-1, "table", lastTokenName, lastTokenColor, lastTokenPT, lastTokenAnnotation, lastTokenDestroy, -1, 0));
|
||||
}
|
||||
|
||||
void Player::actSayMessage()
|
||||
|
|
@ -591,6 +509,7 @@ void Player::eventCreateToken(Event_CreateToken *event)
|
|||
card->setColor(event->getColor());
|
||||
card->setPT(event->getPt());
|
||||
card->setAnnotation(event->getAnnotation());
|
||||
card->setDestroyOnZoneChange(event->getDestroyOnZoneChange());
|
||||
|
||||
emit logCreateToken(this, card->getName(), card->getPT());
|
||||
zone->addCard(card, true, event->getX(), event->getY());
|
||||
|
|
@ -732,6 +651,21 @@ void Player::eventMoveCard(Event_MoveCard *event)
|
|||
}
|
||||
}
|
||||
|
||||
void Player::eventDestroyCard(Event_DestroyCard *event)
|
||||
{
|
||||
CardZone *zone = zones.value(event->getZone(), 0);
|
||||
if (!zone)
|
||||
return;
|
||||
|
||||
CardItem *card = zone->getCard(event->getCardId(), QString());
|
||||
if (!card)
|
||||
return;
|
||||
|
||||
emit logDestroyCard(this, card->getName());
|
||||
zone->takeCard(-1, event->getCardId(), QString(), true);
|
||||
delete card;
|
||||
}
|
||||
|
||||
void Player::eventDrawCards(Event_DrawCards *event)
|
||||
{
|
||||
CardZone *deck = zones.value("deck");
|
||||
|
|
@ -766,6 +700,7 @@ void Player::processGameEvent(GameEvent *event, GameEventContext *context)
|
|||
case ItemId_Event_DumpZone: eventDumpZone(qobject_cast<Event_DumpZone *>(event)); break;
|
||||
case ItemId_Event_StopDumpZone: eventStopDumpZone(qobject_cast<Event_StopDumpZone *>(event)); break;
|
||||
case ItemId_Event_MoveCard: eventMoveCard(qobject_cast<Event_MoveCard *>(event)); break;
|
||||
case ItemId_Event_DestroyCard: eventDestroyCard(qobject_cast<Event_DestroyCard *>(event)); break;
|
||||
case ItemId_Event_DrawCards: eventDrawCards(qobject_cast<Event_DrawCards *>(event)); break;
|
||||
default: {
|
||||
qDebug() << "unhandled game event";
|
||||
|
|
@ -773,12 +708,6 @@ void Player::processGameEvent(GameEvent *event, GameEventContext *context)
|
|||
}
|
||||
}
|
||||
|
||||
void Player::showCardMenu(const QPoint &p)
|
||||
{
|
||||
if (cardMenu)
|
||||
cardMenu->exec(p);
|
||||
}
|
||||
|
||||
void Player::setActive(bool _active)
|
||||
{
|
||||
active = _active;
|
||||
|
|
@ -978,36 +907,49 @@ void Player::sendCommandContainer(CommandContainer *cont)
|
|||
|
||||
void Player::cardMenuAction()
|
||||
{
|
||||
// Determine the appropriate handler function.
|
||||
CardMenuHandler handler = cardMenuHandlers.value(static_cast<QAction *>(sender()));
|
||||
|
||||
// The list of selected items is randomly shuffled.
|
||||
QAction *a = static_cast<QAction *>(sender());
|
||||
QList<QGraphicsItem *> sel = scene()->selectedItems();
|
||||
while (!sel.isEmpty()) {
|
||||
unsigned int i = (unsigned int) (((double) sel.size()) * qrand() / (RAND_MAX + 1.0));
|
||||
CardItem *card = qgraphicsitem_cast<CardItem *>(sel.takeAt(i));
|
||||
// For each item, the handler function is called.
|
||||
(this->*handler)(card);
|
||||
|
||||
switch (a->data().toInt()) {
|
||||
case 0:
|
||||
if (!card->getTapped())
|
||||
sendGameCommand(new Command_SetCardAttr(-1, qgraphicsitem_cast<CardZone *>(card->parentItem())->getName(), card->getId(), "tapped", "1"));
|
||||
break;
|
||||
case 1:
|
||||
if (card->getTapped())
|
||||
sendGameCommand(new Command_SetCardAttr(-1, qgraphicsitem_cast<CardZone *>(card->parentItem())->getName(), card->getId(), "tapped", "0"));
|
||||
break;
|
||||
case 2:
|
||||
sendGameCommand(new Command_SetCardAttr(-1, qgraphicsitem_cast<CardZone *>(card->parentItem())->getName(), card->getId(), "doesnt_untap", QString::number(!card->getDoesntUntap())));
|
||||
break;
|
||||
case 3: {
|
||||
QString zone = qgraphicsitem_cast<CardZone *>(card->parentItem())->getName();
|
||||
sendGameCommand(new Command_MoveCard(-1, zone, card->getId(), zone, card->getGridPoint().x(), card->getGridPoint().y(), !card->getFaceDown()));
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
sendGameCommand(new Command_CreateToken(-1, static_cast<CardZone *>(card->parentItem())->getName(), card->getName(), card->getColor(), card->getPT(), card->getAnnotation(), card->getDestroyOnZoneChange(), -1, card->getGridPoint().y()));
|
||||
break;
|
||||
case 5:
|
||||
sendGameCommand(new Command_MoveCard(-1, static_cast<CardZone *>(card->parentItem())->getName(), card->getId(), "deck", 0, 0, false));
|
||||
break;
|
||||
case 6:
|
||||
sendGameCommand(new Command_MoveCard(-1, static_cast<CardZone *>(card->parentItem())->getName(), card->getId(), "deck", -1, 0, false));
|
||||
break;
|
||||
case 7:
|
||||
sendGameCommand(new Command_MoveCard(-1, static_cast<CardZone *>(card->parentItem())->getName(), card->getId(), "grave", 0, 0, false));
|
||||
break;
|
||||
case 8:
|
||||
sendGameCommand(new Command_MoveCard(-1, static_cast<CardZone *>(card->parentItem())->getName(), card->getId(), "rfg", 0, 0, false));
|
||||
break;
|
||||
default: ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Player::actTap(CardItem *card)
|
||||
{
|
||||
if (!card->getTapped())
|
||||
sendGameCommand(new Command_SetCardAttr(-1, qgraphicsitem_cast<CardZone *>(card->parentItem())->getName(), card->getId(), "tapped", "1"));
|
||||
}
|
||||
|
||||
void Player::actUntap(CardItem *card)
|
||||
{
|
||||
if (card->getTapped())
|
||||
sendGameCommand(new Command_SetCardAttr(-1, qgraphicsitem_cast<CardZone *>(card->parentItem())->getName(), card->getId(), "tapped", "0"));
|
||||
}
|
||||
|
||||
void Player::actDoesntUntap(CardItem *card)
|
||||
{
|
||||
sendGameCommand(new Command_SetCardAttr(-1, qgraphicsitem_cast<CardZone *>(card->parentItem())->getName(), card->getId(), "doesnt_untap", QString::number(!card->getDoesntUntap())));
|
||||
}
|
||||
|
||||
void Player::actSetPT()
|
||||
{
|
||||
QString oldPT;
|
||||
|
|
@ -1051,67 +993,64 @@ void Player::actSetAnnotation()
|
|||
}
|
||||
}
|
||||
|
||||
void Player::actFlip(CardItem *card)
|
||||
void Player::actAttach()
|
||||
{
|
||||
QString zone = qgraphicsitem_cast<CardZone *>(card->parentItem())->getName();
|
||||
sendGameCommand(new Command_MoveCard(-1, zone, card->getId(), zone, card->getGridPoint().x(), card->getGridPoint().y(), !card->getFaceDown()));
|
||||
}
|
||||
|
||||
void Player::actCardCounterTrigger(QAction *a)
|
||||
void Player::actUnattach()
|
||||
{
|
||||
QMenu *menu = static_cast<QMenu *>(sender());
|
||||
int counterId = cardCounterMenus.indexOf(menu);
|
||||
}
|
||||
|
||||
void Player::actCardCounterTrigger()
|
||||
{
|
||||
QAction *a = static_cast<QAction *>(sender());
|
||||
|
||||
if (aAddCounter.contains(a)) {
|
||||
QListIterator<QGraphicsItem *> i(scene()->selectedItems());
|
||||
while (i.hasNext()) {
|
||||
CardItem *card = static_cast<CardItem *>(i.next());
|
||||
if (card->getCounters().value(counterId, 0) < MAX_COUNTERS_ON_CARD)
|
||||
sendGameCommand(new Command_SetCardCounter(-1, qgraphicsitem_cast<CardZone *>(card->parentItem())->getName(), card->getId(), counterId, card->getCounters().value(counterId, 0) + 1));
|
||||
int counterId = a->data().toInt() / 1000;
|
||||
int action = a->data().toInt() % 1000;
|
||||
switch (action) {
|
||||
case 9: {
|
||||
QListIterator<QGraphicsItem *> i(scene()->selectedItems());
|
||||
while (i.hasNext()) {
|
||||
CardItem *card = static_cast<CardItem *>(i.next());
|
||||
if (card->getCounters().value(counterId, 0) < MAX_COUNTERS_ON_CARD)
|
||||
sendGameCommand(new Command_SetCardCounter(-1, qgraphicsitem_cast<CardZone *>(card->parentItem())->getName(), card->getId(), counterId, card->getCounters().value(counterId, 0) + 1));
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else if (aRemoveCounter.contains(a)) {
|
||||
QListIterator<QGraphicsItem *> i(scene()->selectedItems());
|
||||
while (i.hasNext()) {
|
||||
CardItem *card = static_cast<CardItem *>(i.next());
|
||||
if (card->getCounters().value(counterId, 0))
|
||||
sendGameCommand(new Command_SetCardCounter(-1, qgraphicsitem_cast<CardZone *>(card->parentItem())->getName(), card->getId(), counterId, card->getCounters().value(counterId, 0) - 1));
|
||||
case 10: {
|
||||
QListIterator<QGraphicsItem *> i(scene()->selectedItems());
|
||||
while (i.hasNext()) {
|
||||
CardItem *card = static_cast<CardItem *>(i.next());
|
||||
if (card->getCounters().value(counterId, 0))
|
||||
sendGameCommand(new Command_SetCardCounter(-1, qgraphicsitem_cast<CardZone *>(card->parentItem())->getName(), card->getId(), counterId, card->getCounters().value(counterId, 0) - 1));
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else if (aSetCounter.contains(a)) {
|
||||
bool ok;
|
||||
int number = QInputDialog::getInteger(0, tr("Set counters"), tr("Number:"), 0, 0, MAX_COUNTERS_ON_CARD, 1, &ok);
|
||||
if (!ok)
|
||||
return;
|
||||
|
||||
QListIterator<QGraphicsItem *> i(scene()->selectedItems());
|
||||
while (i.hasNext()) {
|
||||
CardItem *card = static_cast<CardItem *>(i.next());
|
||||
sendGameCommand(new Command_SetCardCounter(-1, qgraphicsitem_cast<CardZone *>(card->parentItem())->getName(), card->getId(), counterId, number));
|
||||
case 11: {
|
||||
bool ok;
|
||||
int number = QInputDialog::getInteger(0, tr("Set counters"), tr("Number:"), 0, 0, MAX_COUNTERS_ON_CARD, 1, &ok);
|
||||
if (!ok)
|
||||
return;
|
||||
|
||||
QListIterator<QGraphicsItem *> i(scene()->selectedItems());
|
||||
while (i.hasNext()) {
|
||||
CardItem *card = static_cast<CardItem *>(i.next());
|
||||
sendGameCommand(new Command_SetCardCounter(-1, qgraphicsitem_cast<CardZone *>(card->parentItem())->getName(), card->getId(), counterId, number));
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: ;
|
||||
}
|
||||
}
|
||||
|
||||
void Player::actMoveToTopLibrary(CardItem *card)
|
||||
void Player::setCardMenu(QMenu *menu)
|
||||
{
|
||||
CardZone *startZone = qgraphicsitem_cast<CardZone *>(card->parentItem());
|
||||
sendGameCommand(new Command_MoveCard(-1, startZone->getName(), card->getId(), "deck", 0, 0, false));
|
||||
aCardMenu->setMenu(menu);
|
||||
}
|
||||
|
||||
void Player::actMoveToBottomLibrary(CardItem *card)
|
||||
QMenu *Player::getCardMenu() const
|
||||
{
|
||||
CardZone *startZone = qgraphicsitem_cast<CardZone *>(card->parentItem());
|
||||
sendGameCommand(new Command_MoveCard(-1, startZone->getName(), card->getId(), "deck", -1, 0, false));
|
||||
}
|
||||
|
||||
void Player::actMoveToGraveyard(CardItem *card)
|
||||
{
|
||||
CardZone *startZone = qgraphicsitem_cast<CardZone *>(card->parentItem());
|
||||
sendGameCommand(new Command_MoveCard(-1, startZone->getName(), card->getId(), "grave", 0, 0, false));
|
||||
}
|
||||
|
||||
void Player::actMoveToExile(CardItem *card)
|
||||
{
|
||||
CardZone *startZone = qgraphicsitem_cast<CardZone *>(card->parentItem());
|
||||
sendGameCommand(new Command_MoveCard(-1, startZone->getName(), card->getId(), "rfg", 0, 0, false));
|
||||
return aCardMenu->menu();
|
||||
}
|
||||
|
||||
qreal Player::getMinimumWidth() const
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ class Event_DelCounter;
|
|||
class Event_DumpZone;
|
||||
class Event_StopDumpZone;
|
||||
class Event_MoveCard;
|
||||
class Event_DestroyCard;
|
||||
class Event_DrawCards;
|
||||
|
||||
class Player : public QObject, public QGraphicsItem {
|
||||
|
|
@ -52,6 +53,7 @@ signals:
|
|||
void logCreateToken(Player *player, QString cardName, QString pt);
|
||||
void logDrawCards(Player *player, int number);
|
||||
void logMoveCard(Player *player, QString cardName, CardZone *startZone, int oldX, CardZone *targetZone, int newX);
|
||||
void logDestroyCard(Player *player, QString cardName);
|
||||
void logSetCardCounter(Player *player, QString cardName, int counterId, int value, int oldValue);
|
||||
void logSetTapped(Player *player, QString cardName, bool tapped);
|
||||
void logSetCounter(Player *player, QString counterName, int value, int oldValue);
|
||||
|
|
@ -79,44 +81,35 @@ public slots:
|
|||
void actViewSideboard();
|
||||
|
||||
void actSayMessage();
|
||||
private slots:
|
||||
|
||||
void actAttach();
|
||||
void actUnattach();
|
||||
void actSetPT();
|
||||
void actSetAnnotation();
|
||||
void cardMenuAction();
|
||||
void actCardCounterTrigger();
|
||||
|
||||
private slots:
|
||||
|
||||
void updateBgPixmap();
|
||||
void updateBoundingRect();
|
||||
void cardMenuAction();
|
||||
void actCardCounterTrigger(QAction *a);
|
||||
void rearrangeZones();
|
||||
private:
|
||||
QList<QMenu *> cardCounterMenus;
|
||||
QList<QAction *> aAddCounter, aSetCounter, aRemoveCounter;
|
||||
QMenu *playerMenu, *handMenu, *graveMenu, *rfgMenu, *libraryMenu, *sbMenu, *countersMenu, *sayMenu;
|
||||
QAction *aMoveHandToTopLibrary, *aMoveHandToBottomLibrary, *aMoveHandToGrave, *aMoveHandToRfg,
|
||||
*aMoveGraveToTopLibrary, *aMoveGraveToBottomLibrary, *aMoveGraveToHand, *aMoveGraveToRfg,
|
||||
*aMoveRfgToTopLibrary, *aMoveRfgToBottomLibrary, *aMoveRfgToHand, *aMoveRfgToGrave,
|
||||
*aViewLibrary, *aViewTopCards, *aViewGraveyard, *aViewRfg, *aViewSideboard,
|
||||
*aDrawCard, *aDrawCards, *aMulligan, *aShuffle,
|
||||
*aUntapAll, *aRollDie, *aCreateToken, *aCreateAnotherToken;
|
||||
*aUntapAll, *aRollDie, *aCreateToken, *aCreateAnotherToken,
|
||||
*aCardMenu;
|
||||
|
||||
typedef void (Player::*CardMenuHandler)(CardItem *card);
|
||||
QHash<QAction *, CardMenuHandler> cardMenuHandlers;
|
||||
|
||||
QMenu *cardMenu, *moveMenu;
|
||||
QAction *aTap, *aUntap, *aDoesntUntap, *aSetPT, *aSetAnnotation, *aFlip,
|
||||
*aMoveToTopLibrary, *aMoveToBottomLibrary, *aMoveToGraveyard, *aMoveToExile;
|
||||
|
||||
void actTap(CardItem *card);
|
||||
void actUntap(CardItem *card);
|
||||
void actDoesntUntap(CardItem *card);
|
||||
void actFlip(CardItem *card);
|
||||
void actMoveToTopLibrary(CardItem *card);
|
||||
void actMoveToBottomLibrary(CardItem *card);
|
||||
void actMoveToGraveyard(CardItem *card);
|
||||
void actMoveToExile(CardItem *card);
|
||||
|
||||
int defaultNumberTopCards;
|
||||
QString lastTokenName, lastTokenColor, lastTokenPT, lastTokenAnnotation;
|
||||
bool lastTokenDestroy;
|
||||
QString name;
|
||||
int id;
|
||||
bool active;
|
||||
|
|
@ -152,6 +145,7 @@ private:
|
|||
void eventDumpZone(Event_DumpZone *event);
|
||||
void eventStopDumpZone(Event_StopDumpZone *event);
|
||||
void eventMoveCard(Event_MoveCard *event);
|
||||
void eventDestroyCard(Event_DestroyCard *event);
|
||||
void eventDrawCards(Event_DrawCards *event);
|
||||
public:
|
||||
static const int counterAreaWidth = 65;
|
||||
|
|
@ -186,7 +180,8 @@ public:
|
|||
const QMap<QString, CardZone *> &getZones() const { return zones; }
|
||||
const QMap<int, ArrowItem *> &getArrows() const { return arrows; }
|
||||
TableZone *getTable() const { return table; }
|
||||
void showCardMenu(const QPoint &p);
|
||||
void setCardMenu(QMenu *menu);
|
||||
QMenu *getCardMenu() const;
|
||||
bool getActive() const { return active; }
|
||||
void setActive(bool _active);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue