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