mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-21 18:02:14 -07:00
Introduce UUID attribute to abstract_card_item, card_item, deck_view_card, server_card and serverinfo_card.
This commit is contained in:
parent
c6a7b17d22
commit
90c4b223dd
9 changed files with 27 additions and 9 deletions
|
|
@ -68,8 +68,8 @@ void DeckViewCardDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||
event->accept();
|
||||
}
|
||||
|
||||
DeckViewCard::DeckViewCard(const QString &_name, const QString &_originZone, QGraphicsItem *parent)
|
||||
: AbstractCardItem(_name, 0, -1, parent), originZone(_originZone), dragItem(0)
|
||||
DeckViewCard::DeckViewCard(const QString &_name, const QString &_uuid, const QString &_originZone, QGraphicsItem *parent)
|
||||
: AbstractCardItem(_name, _uuid, 0, -1, parent), originZone(_originZone), dragItem(0)
|
||||
{
|
||||
setAcceptHoverEvents(true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ private:
|
|||
|
||||
public:
|
||||
DeckViewCard(const QString &_name = QString(),
|
||||
const QString &_uuid = QString(),
|
||||
const QString &_originZone = QString(),
|
||||
QGraphicsItem *parent = nullptr);
|
||||
~DeckViewCard();
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@
|
|||
#include <QPainter>
|
||||
#include <algorithm>
|
||||
|
||||
AbstractCardItem::AbstractCardItem(const QString &_name, Player *_owner, int _id, QGraphicsItem *parent)
|
||||
: ArrowTarget(_owner, parent), id(_id), name(_name), tapped(false), facedown(false), tapAngle(0),
|
||||
AbstractCardItem::AbstractCardItem(const QString &_name, const QString &_uuid, Player *_owner, int _id, QGraphicsItem *parent)
|
||||
: ArrowTarget(_owner, parent), id(_id), name(_name), uuid(_uuid), tapped(false), facedown(false), tapAngle(0),
|
||||
bgColor(Qt::transparent), isHovered(false), realZValue(0)
|
||||
{
|
||||
setCursor(Qt::OpenHandCursor);
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ protected:
|
|||
CardInfoPtr info;
|
||||
int id;
|
||||
QString name;
|
||||
QString uuid;
|
||||
bool tapped;
|
||||
bool facedown;
|
||||
int tapAngle;
|
||||
|
|
@ -49,6 +50,7 @@ public:
|
|||
return Type;
|
||||
}
|
||||
AbstractCardItem(const QString &_name = QString(),
|
||||
const QString &_uuid = QString(),
|
||||
Player *_owner = nullptr,
|
||||
int _id = -1,
|
||||
QGraphicsItem *parent = nullptr);
|
||||
|
|
@ -75,6 +77,14 @@ public:
|
|||
return name;
|
||||
}
|
||||
void setName(const QString &_name = QString());
|
||||
QString getUUID() const
|
||||
{
|
||||
return uuid;
|
||||
}
|
||||
void setUUID(QString _uuid)
|
||||
{
|
||||
uuid = _uuid;
|
||||
}
|
||||
qreal getRealZValue() const
|
||||
{
|
||||
return realZValue;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
#include "card_item.h"
|
||||
|
||||
#include "../../client/tabs/tab_game.h"
|
||||
#include "../../main.h"
|
||||
#include "../../settings/cache_settings.h"
|
||||
#include "../board/arrow_item.h"
|
||||
#include "../game_scene.h"
|
||||
|
|
@ -20,11 +19,12 @@
|
|||
|
||||
CardItem::CardItem(Player *_owner,
|
||||
const QString &_name,
|
||||
const QString &_uuid,
|
||||
int _cardid,
|
||||
bool _revealedCard,
|
||||
QGraphicsItem *parent,
|
||||
CardZone *_zone)
|
||||
: AbstractCardItem(_name, _owner, _cardid, parent), zone(_zone), revealedCard(_revealedCard), attacking(false),
|
||||
: AbstractCardItem(_name, _uuid, _owner, _cardid, parent), zone(_zone), revealedCard(_revealedCard), attacking(false),
|
||||
destroyOnZoneChange(false), doesntUntap(false), dragItem(nullptr), attachedTo(nullptr)
|
||||
{
|
||||
owner->addCard(this);
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ public:
|
|||
}
|
||||
CardItem(Player *_owner,
|
||||
const QString &_name = QString(),
|
||||
const QString &_uuid = QString(),
|
||||
int _cardid = -1,
|
||||
bool revealedCard = false,
|
||||
QGraphicsItem *parent = nullptr,
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import "serverinfo_cardcounter.proto";
|
|||
message ServerInfo_Card {
|
||||
optional sint32 id = 1 [default = -1];
|
||||
optional string name = 2;
|
||||
optional string uuid = 17;
|
||||
optional sint32 x = 3 [default = -1];
|
||||
optional sint32 y = 4 [default = -1];
|
||||
optional bool face_down = 5;
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@
|
|||
|
||||
#include <QVariant>
|
||||
|
||||
Server_Card::Server_Card(QString _name, int _id, int _coord_x, int _coord_y, Server_CardZone *_zone)
|
||||
: zone(_zone), id(_id), coord_x(_coord_x), coord_y(_coord_y), name(_name), tapped(false), attacking(false),
|
||||
Server_Card::Server_Card(QString _name, QString _uuid, int _id, int _coord_x, int _coord_y, Server_CardZone *_zone)
|
||||
: zone(_zone), id(_id), coord_x(_coord_x), coord_y(_coord_y), name(_name), uuid(_uuid), tapped(false), attacking(false),
|
||||
facedown(false), color(), ptString(), annotation(), destroyOnZoneChange(false), doesntUntap(false), parentCard(0),
|
||||
stashedCard(nullptr)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ private:
|
|||
int id;
|
||||
int coord_x, coord_y;
|
||||
QString name;
|
||||
QString uuid;
|
||||
QMap<int, int> counters;
|
||||
bool tapped;
|
||||
bool attacking;
|
||||
|
|
@ -54,7 +55,7 @@ private:
|
|||
Server_Card *stashedCard;
|
||||
|
||||
public:
|
||||
Server_Card(QString _name, int _id, int _coord_x, int _coord_y, Server_CardZone *_zone = nullptr);
|
||||
Server_Card(QString _name, QString _uuid, int _id, int _coord_x, int _coord_y, Server_CardZone *_zone = nullptr);
|
||||
~Server_Card() override;
|
||||
|
||||
Server_CardZone *getZone() const
|
||||
|
|
@ -70,6 +71,10 @@ public:
|
|||
{
|
||||
return id;
|
||||
}
|
||||
QString getUUID() const
|
||||
{
|
||||
return uuid;
|
||||
}
|
||||
int getX() const
|
||||
{
|
||||
return coord_x;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue