mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-12 11:01:29 -07:00
[Game][Graphics][Player] Add named zone lookup-map to player graphics. (#6984)
Took 16 minutes Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
@@ -59,6 +59,9 @@ PlayerGraphicsItem::PlayerGraphicsItem(PlayerLogic *_player) : player(_player)
|
|||||||
|
|
||||||
initializeZones();
|
initializeZones();
|
||||||
|
|
||||||
|
connect(player, &PlayerLogic::addViewCustomZoneActionToCustomZoneMenu, this,
|
||||||
|
&PlayerGraphicsItem::onCustomZoneAdded);
|
||||||
|
|
||||||
playerMenu->setMenusForGraphicItems();
|
playerMenu->setMenusForGraphicItems();
|
||||||
|
|
||||||
connect(tableZoneGraphicsItem, &TableZone::sizeChanged, this, &PlayerGraphicsItem::updateBoundingRect);
|
connect(tableZoneGraphicsItem, &TableZone::sizeChanged, this, &PlayerGraphicsItem::updateBoundingRect);
|
||||||
@@ -121,6 +124,19 @@ void PlayerGraphicsItem::initializeZones()
|
|||||||
connect(handZoneGraphicsItem->getLogic(), &HandZoneLogic::cardCountChanged, handCounter,
|
connect(handZoneGraphicsItem->getLogic(), &HandZoneLogic::cardCountChanged, handCounter,
|
||||||
&HandCounter::updateNumber);
|
&HandCounter::updateNumber);
|
||||||
connect(handCounter, &HandCounter::showContextMenu, handZoneGraphicsItem, &HandZone::showContextMenu);
|
connect(handCounter, &HandCounter::showContextMenu, handZoneGraphicsItem, &HandZone::showContextMenu);
|
||||||
|
|
||||||
|
zoneGraphicsItems.insert(player->getDeckZone()->getName(), deckZoneGraphicsItem);
|
||||||
|
zoneGraphicsItems.insert(player->getGraveZone()->getName(), graveyardZoneGraphicsItem);
|
||||||
|
zoneGraphicsItems.insert(player->getRfgZone()->getName(), rfgZoneGraphicsItem);
|
||||||
|
zoneGraphicsItems.insert(player->getSideboardZone()->getName(), sideboardGraphicsItem);
|
||||||
|
zoneGraphicsItems.insert(player->getTableZone()->getName(), tableZoneGraphicsItem);
|
||||||
|
zoneGraphicsItems.insert(player->getStackZone()->getName(), stackZoneGraphicsItem);
|
||||||
|
zoneGraphicsItems.insert(player->getHandZone()->getName(), handZoneGraphicsItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerGraphicsItem::onCustomZoneAdded(QString customZoneName)
|
||||||
|
{
|
||||||
|
zoneGraphicsItems.insert(customZoneName, nullptr); // Custom zone view goes here, if we ever implement it.
|
||||||
}
|
}
|
||||||
|
|
||||||
QRectF PlayerGraphicsItem::boundingRect() const
|
QRectF PlayerGraphicsItem::boundingRect() const
|
||||||
|
|||||||
@@ -77,6 +77,11 @@ public:
|
|||||||
return playerTarget;
|
return playerTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CardZone *getZoneGraphicsItem(const QString &name) const
|
||||||
|
{
|
||||||
|
return zoneGraphicsItems.value(name, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] PileZone *getDeckZoneGraphicsItem() const
|
[[nodiscard]] PileZone *getDeckZoneGraphicsItem() const
|
||||||
{
|
{
|
||||||
return deckZoneGraphicsItem;
|
return deckZoneGraphicsItem;
|
||||||
@@ -110,6 +115,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void onPlayerActiveChanged(bool _active);
|
void onPlayerActiveChanged(bool _active);
|
||||||
|
void onCustomZoneAdded(QString customZoneName);
|
||||||
void onCounterAdded(CounterState *state);
|
void onCounterAdded(CounterState *state);
|
||||||
void onCounterRemoved(int counterId);
|
void onCounterRemoved(int counterId);
|
||||||
void rearrangeCounters();
|
void rearrangeCounters();
|
||||||
@@ -128,6 +134,7 @@ private:
|
|||||||
PlayerArea *playerArea;
|
PlayerArea *playerArea;
|
||||||
PlayerTarget *playerTarget;
|
PlayerTarget *playerTarget;
|
||||||
QMap<int, AbstractCounter *> counterWidgets;
|
QMap<int, AbstractCounter *> counterWidgets;
|
||||||
|
QMap<QString, CardZone *> zoneGraphicsItems;
|
||||||
PileZone *deckZoneGraphicsItem;
|
PileZone *deckZoneGraphicsItem;
|
||||||
PileZone *sideboardGraphicsItem;
|
PileZone *sideboardGraphicsItem;
|
||||||
PileZone *graveyardZoneGraphicsItem;
|
PileZone *graveyardZoneGraphicsItem;
|
||||||
|
|||||||
Reference in New Issue
Block a user