mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-18 16:32:16 -07:00
* Player refactor. Took 1 hour 43 minutes Took 1 minute Took 23 seconds * Tiny lint. Took 3 minutes * Hook up tap logic again. Took 13 minutes * Fix an include. Took 3 minutes * Stuff. Took 6 minutes * Fix typo. Took 7 minutes * Include. Took 1 minute * Reorganize method/variable definitions, remove unused ones. Took 1 hour 8 minutes Took 24 seconds * Clean up some unused imports. Took 6 minutes * Player holds the deck, emits deckChanged(), other elements player->getDeck() to respond to changes. Took 37 minutes * Connect player->openDeckEditor signal directly in the player constructor Took 6 minutes * Emit openDeckEditor signal in player_actions again. Took 3 minutes * Do to-do's Took 3 hours 32 minutes * Lint. Took 3 minutes * Lint again. Took 2 minutes * Fix include. Took 32 minutes * The stack should ensure card visibility. Took 21 minutes * Fine, the game can remember the tab. Took 10 minutes Took 21 seconds Took 9 seconds * zoneId is a dynamic gameplay property and thus belongs in player.cpp Took 11 minutes Took 19 seconds * Signal view removal, addition. Took 5 minutes * Ensure all players are considered local in local game. Took 10 minutes * ENSURE they are. Took 8 minutes * Bounds check data sent by QAction() Took 54 minutes * Move comment. Took 20 seconds * Reimplement logging category for game_event_handler.cpp, remove linebreaks. Took 36 seconds * PlayerGraphicsItem is responsible for retranslateUi, not Player. Took 14 seconds * Set menu for sideboard again, translate some menu titles, reimplement actIncPT action Took 54 seconds * Comment spacing. Took 43 seconds * Change message_log_widget.cpp slots to take CardZoneLogic parameters as emitted by PlayerEventHandler. Took 7 minutes Took 14 seconds * Remove unused player_logger.cpp Took 2 minutes * Query local game state correctly from tab_supervisor again Took 3 minutes * Revert Deck legality checker. Took 3 minutes * Instantiate menu before graphics item. Took 1 hour 5 minutes Took 55 minutes * Differentiate games and replays. Took 9 seconds * Lint. Took 10 minutes --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
125 lines
2.7 KiB
C++
125 lines
2.7 KiB
C++
#ifndef COCKATRICE_PLAYER_GRAPHICS_ITEM_H
|
|
#define COCKATRICE_PLAYER_GRAPHICS_ITEM_H
|
|
#include "../game_scene.h"
|
|
#include "player.h"
|
|
|
|
#include <QGraphicsObject>
|
|
|
|
class HandZone;
|
|
class PileZone;
|
|
class PlayerTarget;
|
|
class StackZone;
|
|
class TableZone;
|
|
class ZoneViewZone;
|
|
|
|
class PlayerGraphicsItem : public QGraphicsObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
enum
|
|
{
|
|
Type = typeOther
|
|
};
|
|
int type() const override
|
|
{
|
|
return Type;
|
|
}
|
|
|
|
static constexpr int counterAreaWidth = 55;
|
|
|
|
explicit PlayerGraphicsItem(Player *player);
|
|
void initializeZones();
|
|
|
|
[[nodiscard]] QRectF boundingRect() const override;
|
|
qreal getMinimumWidth() const;
|
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
|
void processSceneSizeChange(int newPlayerWidth);
|
|
|
|
void setMirrored(bool _mirrored);
|
|
|
|
bool getMirrored() const
|
|
{
|
|
return mirrored;
|
|
}
|
|
|
|
GameScene *getGameScene() const
|
|
{
|
|
return static_cast<GameScene *>(scene());
|
|
}
|
|
|
|
Player *getPlayer() const
|
|
{
|
|
return player;
|
|
}
|
|
|
|
PlayerArea *getPlayerArea() const
|
|
{
|
|
return playerArea;
|
|
}
|
|
|
|
PlayerTarget *getPlayerTarget() const
|
|
{
|
|
return playerTarget;
|
|
}
|
|
|
|
[[nodiscard]] PileZone *getDeckZoneGraphicsItem() const
|
|
{
|
|
return deckZoneGraphicsItem;
|
|
}
|
|
|
|
[[nodiscard]] PileZone *getSideboardZoneGraphicsItem() const
|
|
{
|
|
return sideboardGraphicsItem;
|
|
}
|
|
|
|
[[nodiscard]] PileZone *getGraveyardZoneGraphicsItem() const
|
|
{
|
|
return graveyardZoneGraphicsItem;
|
|
}
|
|
[[nodiscard]] PileZone *getRfgZoneGraphicsItem() const
|
|
{
|
|
return rfgZoneGraphicsItem;
|
|
}
|
|
[[nodiscard]] TableZone *getTableZoneGraphicsItem() const
|
|
{
|
|
return tableZoneGraphicsItem;
|
|
}
|
|
[[nodiscard]] StackZone *getStackZoneGraphicsItem() const
|
|
{
|
|
return stackZoneGraphicsItem;
|
|
}
|
|
[[nodiscard]] HandZone *getHandZoneGraphicsItem() const
|
|
{
|
|
return handZoneGraphicsItem;
|
|
}
|
|
|
|
public slots:
|
|
void onPlayerActiveChanged(bool _active);
|
|
void retranslateUi();
|
|
|
|
signals:
|
|
void sizeChanged();
|
|
void playerCountChanged();
|
|
|
|
private:
|
|
Player *player;
|
|
PlayerArea *playerArea;
|
|
PlayerTarget *playerTarget;
|
|
PileZone *deckZoneGraphicsItem;
|
|
PileZone *sideboardGraphicsItem;
|
|
PileZone *graveyardZoneGraphicsItem;
|
|
PileZone *rfgZoneGraphicsItem;
|
|
TableZone *tableZoneGraphicsItem;
|
|
StackZone *stackZoneGraphicsItem;
|
|
HandZone *handZoneGraphicsItem;
|
|
QRectF bRect;
|
|
bool mirrored;
|
|
|
|
private slots:
|
|
void updateBoundingRect();
|
|
void rearrangeZones();
|
|
void rearrangeCounters();
|
|
};
|
|
|
|
#endif // COCKATRICE_PLAYER_GRAPHICS_ITEM_H
|