feat(dominion): display opponent hand cards near portraits
- Add face-down mini card sprites for opponents below their portraits - Implement layout logic to center and space cards based on hand size - Update card asset textures
This commit is contained in:
parent
1196d3ba5b
commit
e6db79afbb
|
|
@ -355,6 +355,22 @@ export default class DominionGame extends Phaser.Scene {
|
|||
color: active ? COLORS.goldHex : COLORS.mutedHex, align: 'center',
|
||||
backgroundColor: 'rgba(0,0,0,0.55)', padding: { x: 8, y: 4 },
|
||||
}).setOrigin(0.5).setDepth(D.hud));
|
||||
|
||||
// Mini face-down cards representing the opponent's hand
|
||||
const OPP_W = 36, OPP_H = 52;
|
||||
const handSize = p.hand.length;
|
||||
if (handSize > 0) {
|
||||
const gap = Math.min(4, (200 - handSize * OPP_W) / Math.max(1, handSize - 1));
|
||||
const step = OPP_W + Math.max(-OPP_W * 0.6, gap);
|
||||
const totalW = (handSize - 1) * step + OPP_W;
|
||||
const startX = s.x - totalW / 2 + OPP_W / 2;
|
||||
const cardY = s.y + s.r + 75;
|
||||
for (let j = 0; j < handSize; j++) {
|
||||
const mini = this.buildCardFace(OPP_W, OPP_H, null, { faceDown: true });
|
||||
mini.setPosition(startX + j * step, cardY).setDepth(D.hud + j);
|
||||
this.dynamicLayer.add(mini);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue