remove untap option, combine w/ tap (#2964)
This commit is contained in:
parent
7e80f4b4ae
commit
297f1f2555
4 changed files with 57 additions and 60 deletions
|
@ -379,9 +379,6 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, TabGame *_pare
|
||||||
aTap = new QAction(this);
|
aTap = new QAction(this);
|
||||||
aTap->setData(cmTap);
|
aTap->setData(cmTap);
|
||||||
connect(aTap, SIGNAL(triggered()), this, SLOT(cardMenuAction()));
|
connect(aTap, SIGNAL(triggered()), this, SLOT(cardMenuAction()));
|
||||||
aUntap = new QAction(this);
|
|
||||||
aUntap->setData(cmUntap);
|
|
||||||
connect(aUntap, SIGNAL(triggered()), this, SLOT(cardMenuAction()));
|
|
||||||
aDoesntUntap = new QAction(this);
|
aDoesntUntap = new QAction(this);
|
||||||
aDoesntUntap->setData(cmDoesntUntap);
|
aDoesntUntap->setData(cmDoesntUntap);
|
||||||
connect(aDoesntUntap, SIGNAL(triggered()), this, SLOT(cardMenuAction()));
|
connect(aDoesntUntap, SIGNAL(triggered()), this, SLOT(cardMenuAction()));
|
||||||
|
@ -694,8 +691,7 @@ void Player::retranslateUi()
|
||||||
aPlay->setText(tr("&Play"));
|
aPlay->setText(tr("&Play"));
|
||||||
aHide->setText(tr("&Hide"));
|
aHide->setText(tr("&Hide"));
|
||||||
aPlayFacedown->setText(tr("Play &Face Down"));
|
aPlayFacedown->setText(tr("Play &Face Down"));
|
||||||
aTap->setText(tr("&Tap"));
|
aTap->setText(tr("&Tap / Untap"));
|
||||||
aUntap->setText(tr("&Untap"));
|
|
||||||
aDoesntUntap->setText(tr("Toggle &normal untapping"));
|
aDoesntUntap->setText(tr("Toggle &normal untapping"));
|
||||||
aFlip->setText(tr("&Flip"));
|
aFlip->setText(tr("&Flip"));
|
||||||
aPeek->setText(tr("&Peek at card face"));
|
aPeek->setText(tr("&Peek at card face"));
|
||||||
|
@ -745,7 +741,6 @@ void Player::setShortcutsActive()
|
||||||
|
|
||||||
aPlay->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aPlay"));
|
aPlay->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aPlay"));
|
||||||
aTap->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aTap"));
|
aTap->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aTap"));
|
||||||
aUntap->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aUntap"));
|
|
||||||
aDoesntUntap->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aDoesntUntap"));
|
aDoesntUntap->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aDoesntUntap"));
|
||||||
aFlip->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aFlip"));
|
aFlip->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aFlip"));
|
||||||
aPeek->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aPeek"));
|
aPeek->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aPeek"));
|
||||||
|
@ -905,13 +900,13 @@ void Player::actOpenDeckInDeckEditor()
|
||||||
|
|
||||||
void Player::actViewGraveyard()
|
void Player::actViewGraveyard()
|
||||||
{
|
{
|
||||||
static_cast<GameScene *>(scene())->toggleZoneView(this, "grave", -1);
|
dynamic_cast<GameScene *>(scene())->toggleZoneView(this, "grave", -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::actRevealRandomGraveyardCard()
|
void Player::actRevealRandomGraveyardCard()
|
||||||
{
|
{
|
||||||
Command_RevealCards cmd;
|
Command_RevealCards cmd;
|
||||||
QAction *action = static_cast<QAction *>(sender());
|
QAction *action = dynamic_cast<QAction *>(sender());
|
||||||
const int otherPlayerId = action->data().toInt();
|
const int otherPlayerId = action->data().toInt();
|
||||||
if (otherPlayerId != -1)
|
if (otherPlayerId != -1)
|
||||||
cmd.set_player_id(otherPlayerId);
|
cmd.set_player_id(otherPlayerId);
|
||||||
|
@ -2119,7 +2114,7 @@ void Player::actMoveCardXCardsFromTop()
|
||||||
|
|
||||||
void Player::cardMenuAction()
|
void Player::cardMenuAction()
|
||||||
{
|
{
|
||||||
QAction *a = static_cast<QAction *>(sender());
|
QAction *a = dynamic_cast<QAction *>(sender());
|
||||||
QList<QGraphicsItem *> sel = scene()->selectedItems();
|
QList<QGraphicsItem *> sel = scene()->selectedItems();
|
||||||
QList<CardItem *> cardList;
|
QList<CardItem *> cardList;
|
||||||
while (!sel.isEmpty())
|
while (!sel.isEmpty())
|
||||||
|
@ -2127,30 +2122,26 @@ void Player::cardMenuAction()
|
||||||
|
|
||||||
QList< const ::google::protobuf::Message * > commandList;
|
QList< const ::google::protobuf::Message * > commandList;
|
||||||
if (a->data().toInt() <= (int) cmClone)
|
if (a->data().toInt() <= (int) cmClone)
|
||||||
for (int i = 0; i < cardList.size(); ++i) {
|
{
|
||||||
|
for (int i = 0; i < cardList.size(); ++i)
|
||||||
|
{
|
||||||
CardItem *card = cardList[i];
|
CardItem *card = cardList[i];
|
||||||
switch (static_cast<CardMenuActionType>(a->data().toInt())) {
|
switch (static_cast<CardMenuActionType>(a->data().toInt()))
|
||||||
case cmTap:
|
{
|
||||||
if (!card->getTapped()) {
|
// Leaving both for compatibility with server
|
||||||
Command_SetCardAttr *cmd = new Command_SetCardAttr;
|
|
||||||
cmd->set_zone(card->getZone()->getName().toStdString());
|
|
||||||
cmd->set_card_id(card->getId());
|
|
||||||
cmd->set_attribute(AttrTapped);
|
|
||||||
cmd->set_attr_value("1");
|
|
||||||
commandList.append(cmd);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case cmUntap:
|
case cmUntap:
|
||||||
if (card->getTapped()) {
|
case cmTap:
|
||||||
|
{
|
||||||
Command_SetCardAttr *cmd = new Command_SetCardAttr;
|
Command_SetCardAttr *cmd = new Command_SetCardAttr;
|
||||||
cmd->set_zone(card->getZone()->getName().toStdString());
|
cmd->set_zone(card->getZone()->getName().toStdString());
|
||||||
cmd->set_card_id(card->getId());
|
cmd->set_card_id(card->getId());
|
||||||
cmd->set_attribute(AttrTapped);
|
cmd->set_attribute(AttrTapped);
|
||||||
cmd->set_attr_value("0");
|
cmd->set_attr_value(std::to_string(1 - static_cast<int>(card->getTapped())));
|
||||||
commandList.append(cmd);
|
commandList.append(cmd);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case cmDoesntUntap: {
|
}
|
||||||
|
case cmDoesntUntap:
|
||||||
|
{
|
||||||
Command_SetCardAttr *cmd = new Command_SetCardAttr;
|
Command_SetCardAttr *cmd = new Command_SetCardAttr;
|
||||||
cmd->set_zone(card->getZone()->getName().toStdString());
|
cmd->set_zone(card->getZone()->getName().toStdString());
|
||||||
cmd->set_card_id(card->getId());
|
cmd->set_card_id(card->getId());
|
||||||
|
@ -2159,7 +2150,8 @@ void Player::cardMenuAction()
|
||||||
commandList.append(cmd);
|
commandList.append(cmd);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case cmFlip: {
|
case cmFlip:
|
||||||
|
{
|
||||||
Command_FlipCard *cmd = new Command_FlipCard;
|
Command_FlipCard *cmd = new Command_FlipCard;
|
||||||
cmd->set_zone(card->getZone()->getName().toStdString());
|
cmd->set_zone(card->getZone()->getName().toStdString());
|
||||||
cmd->set_card_id(card->getId());
|
cmd->set_card_id(card->getId());
|
||||||
|
@ -2167,7 +2159,8 @@ void Player::cardMenuAction()
|
||||||
commandList.append(cmd);
|
commandList.append(cmd);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case cmPeek: {
|
case cmPeek:
|
||||||
|
{
|
||||||
Command_RevealCards *cmd = new Command_RevealCards;
|
Command_RevealCards *cmd = new Command_RevealCards;
|
||||||
cmd->set_zone_name(card->getZone()->getName().toStdString());
|
cmd->set_zone_name(card->getZone()->getName().toStdString());
|
||||||
cmd->set_card_id(card->getId());
|
cmd->set_card_id(card->getId());
|
||||||
|
@ -2175,7 +2168,8 @@ void Player::cardMenuAction()
|
||||||
commandList.append(cmd);
|
commandList.append(cmd);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case cmClone: {
|
case cmClone:
|
||||||
|
{
|
||||||
Command_CreateToken *cmd = new Command_CreateToken;
|
Command_CreateToken *cmd = new Command_CreateToken;
|
||||||
cmd->set_zone("table");
|
cmd->set_zone("table");
|
||||||
cmd->set_card_name(card->getName().toStdString());
|
cmd->set_card_name(card->getName().toStdString());
|
||||||
|
@ -2188,18 +2182,25 @@ void Player::cardMenuAction()
|
||||||
commandList.append(cmd);
|
commandList.append(cmd);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: break;
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ListOfCardsToMove idList;
|
ListOfCardsToMove idList;
|
||||||
for (int i = 0; i < cardList.size(); ++i)
|
for (int i = 0; i < cardList.size(); i++)
|
||||||
|
{
|
||||||
idList.add_card()->set_card_id(cardList[i]->getId());
|
idList.add_card()->set_card_id(cardList[i]->getId());
|
||||||
|
}
|
||||||
int startPlayerId = cardList[0]->getZone()->getPlayer()->getId();
|
int startPlayerId = cardList[0]->getZone()->getPlayer()->getId();
|
||||||
QString startZone = cardList[0]->getZone()->getName();
|
QString startZone = cardList[0]->getZone()->getName();
|
||||||
|
|
||||||
switch (static_cast<CardMenuActionType>(a->data().toInt())) {
|
switch (static_cast<CardMenuActionType>(a->data().toInt()))
|
||||||
case cmMoveToTopLibrary: {
|
{
|
||||||
|
case cmMoveToTopLibrary:
|
||||||
|
{
|
||||||
Command_MoveCard *cmd = new Command_MoveCard;
|
Command_MoveCard *cmd = new Command_MoveCard;
|
||||||
cmd->set_start_player_id(startPlayerId);
|
cmd->set_start_player_id(startPlayerId);
|
||||||
cmd->set_start_zone(startZone.toStdString());
|
cmd->set_start_zone(startZone.toStdString());
|
||||||
|
@ -2211,7 +2212,8 @@ void Player::cardMenuAction()
|
||||||
commandList.append(cmd);
|
commandList.append(cmd);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case cmMoveToBottomLibrary: {
|
case cmMoveToBottomLibrary:
|
||||||
|
{
|
||||||
Command_MoveCard *cmd = new Command_MoveCard;
|
Command_MoveCard *cmd = new Command_MoveCard;
|
||||||
cmd->set_start_player_id(startPlayerId);
|
cmd->set_start_player_id(startPlayerId);
|
||||||
cmd->set_start_zone(startZone.toStdString());
|
cmd->set_start_zone(startZone.toStdString());
|
||||||
|
@ -2223,7 +2225,8 @@ void Player::cardMenuAction()
|
||||||
commandList.append(cmd);
|
commandList.append(cmd);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case cmMoveToHand: {
|
case cmMoveToHand:
|
||||||
|
{
|
||||||
Command_MoveCard *cmd = new Command_MoveCard;
|
Command_MoveCard *cmd = new Command_MoveCard;
|
||||||
cmd->set_start_player_id(startPlayerId);
|
cmd->set_start_player_id(startPlayerId);
|
||||||
cmd->set_start_zone(startZone.toStdString());
|
cmd->set_start_zone(startZone.toStdString());
|
||||||
|
@ -2235,7 +2238,8 @@ void Player::cardMenuAction()
|
||||||
commandList.append(cmd);
|
commandList.append(cmd);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case cmMoveToGraveyard: {
|
case cmMoveToGraveyard:
|
||||||
|
{
|
||||||
Command_MoveCard *cmd = new Command_MoveCard;
|
Command_MoveCard *cmd = new Command_MoveCard;
|
||||||
cmd->set_start_player_id(startPlayerId);
|
cmd->set_start_player_id(startPlayerId);
|
||||||
cmd->set_start_zone(startZone.toStdString());
|
cmd->set_start_zone(startZone.toStdString());
|
||||||
|
@ -2247,7 +2251,8 @@ void Player::cardMenuAction()
|
||||||
commandList.append(cmd);
|
commandList.append(cmd);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case cmMoveToExile: {
|
case cmMoveToExile:
|
||||||
|
{
|
||||||
Command_MoveCard *cmd = new Command_MoveCard;
|
Command_MoveCard *cmd = new Command_MoveCard;
|
||||||
cmd->set_start_player_id(startPlayerId);
|
cmd->set_start_player_id(startPlayerId);
|
||||||
cmd->set_start_zone(startZone.toStdString());
|
cmd->set_start_zone(startZone.toStdString());
|
||||||
|
@ -2259,14 +2264,20 @@ void Player::cardMenuAction()
|
||||||
commandList.append(cmd);
|
commandList.append(cmd);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: ;
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (local)
|
if (local)
|
||||||
|
{
|
||||||
sendGameCommand(prepareGameCommand(commandList));
|
sendGameCommand(prepareGameCommand(commandList));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
game->sendGameCommand(prepareGameCommand(commandList));
|
game->sendGameCommand(prepareGameCommand(commandList));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Player::actIncPT(int deltaP, int deltaT)
|
void Player::actIncPT(int deltaP, int deltaT)
|
||||||
{
|
{
|
||||||
|
@ -2586,7 +2597,6 @@ void Player::updateCardMenu(const CardItem *card)
|
||||||
}
|
}
|
||||||
|
|
||||||
cardMenu->addAction(aTap);
|
cardMenu->addAction(aTap);
|
||||||
cardMenu->addAction(aUntap);
|
|
||||||
cardMenu->addAction(aDoesntUntap);
|
cardMenu->addAction(aDoesntUntap);
|
||||||
cardMenu->addAction(aFlip);
|
cardMenu->addAction(aFlip);
|
||||||
if (card->getFaceDown()) {
|
if (card->getFaceDown()) {
|
||||||
|
|
|
@ -184,7 +184,7 @@ private:
|
||||||
QList<QAction *> aAddCounter, aSetCounter, aRemoveCounter;
|
QList<QAction *> aAddCounter, aSetCounter, aRemoveCounter;
|
||||||
QAction *aPlay, *aPlayFacedown,
|
QAction *aPlay, *aPlayFacedown,
|
||||||
*aHide,
|
*aHide,
|
||||||
*aTap, *aUntap, *aDoesntUntap, *aAttach, *aUnattach, *aDrawArrow, *aSetPT, *aIncP, *aDecP, *aIncT, *aDecT, *aIncPT, *aDecPT, *aSetAnnotation, *aFlip, *aPeek, *aClone,
|
*aTap, *aDoesntUntap, *aAttach, *aUnattach, *aDrawArrow, *aSetPT, *aIncP, *aDecP, *aIncT, *aDecT, *aIncPT, *aDecPT, *aSetAnnotation, *aFlip, *aPeek, *aClone,
|
||||||
*aMoveToTopLibrary, *aMoveToBottomLibrary, *aMoveToHand, *aMoveToGraveyard, *aMoveToExile, *aMoveToXfromTopOfLibrary;
|
*aMoveToTopLibrary, *aMoveToBottomLibrary, *aMoveToHand, *aMoveToGraveyard, *aMoveToExile, *aMoveToXfromTopOfLibrary;
|
||||||
|
|
||||||
bool shortcutsActive;
|
bool shortcutsActive;
|
||||||
|
|
|
@ -245,7 +245,6 @@ public:
|
||||||
QGridLayout *gridLayout_13;
|
QGridLayout *gridLayout_13;
|
||||||
QLabel *lbl_Player_aTap;
|
QLabel *lbl_Player_aTap;
|
||||||
SequenceEdit *Player_aTap;
|
SequenceEdit *Player_aTap;
|
||||||
QLabel *lbl_Player_aUntap;
|
|
||||||
SequenceEdit *Player_aUntap;
|
SequenceEdit *Player_aUntap;
|
||||||
QLabel *lbl_Player_aUntapAll;
|
QLabel *lbl_Player_aUntapAll;
|
||||||
SequenceEdit *Player_aUntapAll;
|
SequenceEdit *Player_aUntapAll;
|
||||||
|
@ -1247,16 +1246,6 @@ public:
|
||||||
|
|
||||||
gridLayout_13->addWidget(Player_aTap, 0, 1, 1, 1);
|
gridLayout_13->addWidget(Player_aTap, 0, 1, 1, 1);
|
||||||
|
|
||||||
lbl_Player_aUntap = new QLabel(groupBox_13);
|
|
||||||
lbl_Player_aUntap->setObjectName("lbl_Player_aUntap");
|
|
||||||
|
|
||||||
gridLayout_13->addWidget(lbl_Player_aUntap, 1, 0, 1, 1);
|
|
||||||
|
|
||||||
Player_aUntap = new SequenceEdit("Player/aUntap",groupBox_13);
|
|
||||||
Player_aUntap->setObjectName("Player_aUntap");
|
|
||||||
|
|
||||||
gridLayout_13->addWidget(Player_aUntap, 1, 1, 1, 1);
|
|
||||||
|
|
||||||
lbl_Player_aUntapAll = new QLabel(groupBox_13);
|
lbl_Player_aUntapAll = new QLabel(groupBox_13);
|
||||||
lbl_Player_aUntapAll->setObjectName("lbl_Player_aUntapAll");
|
lbl_Player_aUntapAll->setObjectName("lbl_Player_aUntapAll");
|
||||||
|
|
||||||
|
@ -1843,8 +1832,7 @@ public:
|
||||||
lbl_TabGame_aNextPhase->setText(QApplication::translate("shortcutsTab", "Next phase", 0));
|
lbl_TabGame_aNextPhase->setText(QApplication::translate("shortcutsTab", "Next phase", 0));
|
||||||
lbl_TabGame_aNextTurn->setText(QApplication::translate("shortcutsTab", "Next turn", 0));
|
lbl_TabGame_aNextTurn->setText(QApplication::translate("shortcutsTab", "Next turn", 0));
|
||||||
groupBox_13->setTitle(QApplication::translate("shortcutsTab", "Playing Area", 0));
|
groupBox_13->setTitle(QApplication::translate("shortcutsTab", "Playing Area", 0));
|
||||||
lbl_Player_aTap->setText(QApplication::translate("shortcutsTab", "Tap Card", 0));
|
lbl_Player_aTap->setText(QApplication::translate("shortcutsTab", "Tap / Untap Card", 0));
|
||||||
lbl_Player_aUntap->setText(QApplication::translate("shortcutsTab", "Untap Card", 0));
|
|
||||||
lbl_Player_aUntapAll->setText(QApplication::translate("shortcutsTab", "Untap all", 0));
|
lbl_Player_aUntapAll->setText(QApplication::translate("shortcutsTab", "Untap all", 0));
|
||||||
lbl_Player_aDoesntUntap->setText(QApplication::translate("shortcutsTab", "Toggle untap", 0));
|
lbl_Player_aDoesntUntap->setText(QApplication::translate("shortcutsTab", "Toggle untap", 0));
|
||||||
lbl_Player_aFlip->setText(QApplication::translate("shortcutsTab", "Flip card", 0));
|
lbl_Player_aFlip->setText(QApplication::translate("shortcutsTab", "Flip card", 0));
|
||||||
|
|
|
@ -218,7 +218,6 @@ void ShortcutsSettings::fillDefaultShorcuts()
|
||||||
defaultShortCuts["Player/aTap"] = parseSequenceString("");
|
defaultShortCuts["Player/aTap"] = parseSequenceString("");
|
||||||
defaultShortCuts["Player/aUnattach"] = parseSequenceString("");
|
defaultShortCuts["Player/aUnattach"] = parseSequenceString("");
|
||||||
defaultShortCuts["Player/aUndoDraw"] = parseSequenceString("Ctrl+Shift+D");
|
defaultShortCuts["Player/aUndoDraw"] = parseSequenceString("Ctrl+Shift+D");
|
||||||
defaultShortCuts["Player/aUntap"] = parseSequenceString("");
|
|
||||||
defaultShortCuts["Player/aUntapAll"] = parseSequenceString("Ctrl+U");
|
defaultShortCuts["Player/aUntapAll"] = parseSequenceString("Ctrl+U");
|
||||||
defaultShortCuts["Player/aViewGraveyard"] = parseSequenceString("F4");
|
defaultShortCuts["Player/aViewGraveyard"] = parseSequenceString("F4");
|
||||||
defaultShortCuts["Player/aViewLibrary"] = parseSequenceString("F3");
|
defaultShortCuts["Player/aViewLibrary"] = parseSequenceString("F3");
|
||||||
|
|
Loading…
Reference in a new issue