mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-18 00:12:15 -07:00
Take hand visibility into account when calculating bounding boxes.
Took 34 minutes Took 7 minutes Took 8 seconds
This commit is contained in:
parent
1cce0df0fa
commit
631903d605
4 changed files with 35 additions and 8 deletions
|
|
@ -30,10 +30,12 @@
|
|||
#include <QtConcurrent>
|
||||
|
||||
Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, AbstractGame *_parent)
|
||||
: QObject(_parent), game(_parent), playerInfo(new PlayerInfo(info, _id, _local, _judge)),
|
||||
playerEventHandler(new PlayerEventHandler(this)), playerActions(new PlayerActions(this)), active(false),
|
||||
conceded(false), handVisible(false), deck(nullptr), zoneId(0), dialogSemaphore(false)
|
||||
: QObject(_parent), game(_parent), playerEventHandler(new PlayerEventHandler(this)),
|
||||
playerActions(new PlayerActions(this)), active(false), conceded(false), handVisible(_local), deck(nullptr),
|
||||
zoneId(0), dialogSemaphore(false)
|
||||
{
|
||||
playerInfo = new PlayerInfo(info, _id, _local, _judge);
|
||||
|
||||
initializeZones();
|
||||
|
||||
playerMenu = new PlayerMenu(this);
|
||||
|
|
|
|||
|
|
@ -54,10 +54,19 @@ void HandZone::handleDropEvent(const QList<CardDragItem *> &dragItems,
|
|||
|
||||
QRectF HandZone::boundingRect() const
|
||||
{
|
||||
if (SettingsCache::instance().getHorizontalHand())
|
||||
return QRectF(0, 0, width, CARD_HEIGHT + 10);
|
||||
else
|
||||
return QRectF(0, 0, 100, zoneHeight);
|
||||
if (SettingsCache::instance().getHorizontalHand()) {
|
||||
if (getLogic()->getPlayer()->getHandVisible()) {
|
||||
return QRectF(0, 0, width, CARD_HEIGHT + 10);
|
||||
} else {
|
||||
return QRectF(0, 0, width, 0);
|
||||
}
|
||||
} else {
|
||||
if (getLogic()->getPlayer()->getHandVisible()) {
|
||||
return QRectF(0, 0, 100, zoneHeight);
|
||||
} else {
|
||||
return QRectF(0, 0, 0, zoneHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HandZone::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)
|
||||
|
|
|
|||
|
|
@ -30,7 +30,13 @@ TableZone::TableZone(TableZoneLogic *_logic, QGraphicsItem *parent) : SelectZone
|
|||
|
||||
updateBg();
|
||||
|
||||
height = MARGIN_TOP + MARGIN_BOTTOM + TABLEROWS * CARD_HEIGHT + (TABLEROWS - 1) * PADDING_Y;
|
||||
connect(getLogic()->getPlayer(), &Player::handVisibleChanged, this, &TableZone::updateHeight);
|
||||
|
||||
if (getLogic()->getPlayer()->getHandVisible()) {
|
||||
height = MARGIN_TOP + MARGIN_BOTTOM + TABLEROWS * CARD_HEIGHT + (TABLEROWS - 1) * PADDING_Y;
|
||||
} else {
|
||||
height = MARGIN_TOP + MARGIN_BOTTOM + TABLEROWS * CARD_HEIGHT * PADDING_Y;
|
||||
}
|
||||
width = MIN_WIDTH;
|
||||
currentMinimumWidth = width;
|
||||
|
||||
|
|
@ -43,6 +49,15 @@ void TableZone::updateBg()
|
|||
update();
|
||||
}
|
||||
|
||||
void TableZone::updateHeight()
|
||||
{
|
||||
if (getLogic()->getPlayer()->getHandVisible()) {
|
||||
height = MARGIN_TOP + MARGIN_BOTTOM + TABLEROWS * CARD_HEIGHT + (TABLEROWS - 1) * PADDING_Y;
|
||||
} else {
|
||||
height = MARGIN_TOP + MARGIN_BOTTOM + TABLEROWS * CARD_HEIGHT * PADDING_Y;
|
||||
}
|
||||
}
|
||||
|
||||
QRectF TableZone::boundingRect() const
|
||||
{
|
||||
return QRectF(0, 0, width, height);
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@ private slots:
|
|||
Loads in any found custom background and updates
|
||||
*/
|
||||
void updateBg();
|
||||
void updateHeight();
|
||||
|
||||
public slots:
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue