[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:
BruebachL
2026-06-10 10:58:28 +02:00
committed by GitHub
parent 6be9cec6e2
commit b17d879da8
2 changed files with 23 additions and 0 deletions
@@ -59,6 +59,9 @@ PlayerGraphicsItem::PlayerGraphicsItem(PlayerLogic *_player) : player(_player)
initializeZones();
connect(player, &PlayerLogic::addViewCustomZoneActionToCustomZoneMenu, this,
&PlayerGraphicsItem::onCustomZoneAdded);
playerMenu->setMenusForGraphicItems();
connect(tableZoneGraphicsItem, &TableZone::sizeChanged, this, &PlayerGraphicsItem::updateBoundingRect);
@@ -121,6 +124,19 @@ void PlayerGraphicsItem::initializeZones()
connect(handZoneGraphicsItem->getLogic(), &HandZoneLogic::cardCountChanged, handCounter,
&HandCounter::updateNumber);
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
@@ -77,6 +77,11 @@ public:
return playerTarget;
}
CardZone *getZoneGraphicsItem(const QString &name) const
{
return zoneGraphicsItems.value(name, nullptr);
}
[[nodiscard]] PileZone *getDeckZoneGraphicsItem() const
{
return deckZoneGraphicsItem;
@@ -110,6 +115,7 @@ public:
public slots:
void onPlayerActiveChanged(bool _active);
void onCustomZoneAdded(QString customZoneName);
void onCounterAdded(CounterState *state);
void onCounterRemoved(int counterId);
void rearrangeCounters();
@@ -128,6 +134,7 @@ private:
PlayerArea *playerArea;
PlayerTarget *playerTarget;
QMap<int, AbstractCounter *> counterWidgets;
QMap<QString, CardZone *> zoneGraphicsItems;
PileZone *deckZoneGraphicsItem;
PileZone *sideboardGraphicsItem;
PileZone *graveyardZoneGraphicsItem;