feat(SCOPONE-0005): complete iteration 3 — restore labels, move turn bar below cards
This commit is contained in:
@@ -409,10 +409,10 @@ export class GameScene extends Phaser.Scene {
|
|||||||
private buildPlayerLabels(W: number, H: number): void {
|
private buildPlayerLabels(W: number, H: number): void {
|
||||||
const defs: Array<{ idx: PlayerIndex; x: number; y: number; color: string;
|
const defs: Array<{ idx: PlayerIndex; x: number; y: number; color: string;
|
||||||
txt: string; originX: number; originY: number }> = [
|
txt: string; originX: number; originY: number }> = [
|
||||||
{ idx: 0, x: W / 2, y: H - 8, color: '#aaffaa', txt: 'Tu [Team A]', originX: 0.5, originY: 1 },
|
{ idx: 0, x: W / 2, y: H - CH_H - 28, color: '#aaffaa', txt: 'Tu [Team A]', originX: 0.5, originY: 1 },
|
||||||
{ idx: 1, x: 6, y: H / 2 + SCOREBAR_H / 2, color: '#ffaaaa', txt: 'AI\nOvest\n[B]', originX: 0, originY: 0.5 },
|
{ idx: 1, x: CH_A + 20, y: H / 2 + SCOREBAR_H / 2, color: '#ffaaaa', txt: 'AI\nOvest\n[B]', originX: 0, originY: 0.5 },
|
||||||
{ idx: 2, x: W / 2, y: SCOREBAR_H + 8, color: '#aaffaa', txt: 'Compagno [Team A]', originX: 0.5, originY: 0 },
|
{ idx: 2, x: W / 2, y: SCOREBAR_H + CH_A + 44, color: '#aaffaa', txt: 'Compagno [Team A]', originX: 0.5, originY: 0 },
|
||||||
{ idx: 3, x: W - 6, y: H / 2 + SCOREBAR_H / 2, color: '#ffaaaa', txt: 'AI\nEst\n[B]', originX: 1, originY: 0.5 },
|
{ idx: 3, x: W - CH_A - 20, y: H / 2 + SCOREBAR_H / 2, color: '#ffaaaa', txt: 'AI\nEst\n[B]', originX: 1, originY: 0.5 },
|
||||||
];
|
];
|
||||||
for (const d of defs) {
|
for (const d of defs) {
|
||||||
const lbl = this.add.text(d.x, d.y, d.txt, {
|
const lbl = this.add.text(d.x, d.y, d.txt, {
|
||||||
@@ -435,16 +435,30 @@ export class GameScene extends Phaser.Scene {
|
|||||||
this.activeHighlightRect = null;
|
this.activeHighlightRect = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw glow rectangle behind active player label
|
// Draw turn indicator bar below/outside player's cards
|
||||||
const lbl = this.playerLabels.get(playerIdx)!;
|
const W = this.scale.width;
|
||||||
const bounds = lbl.getBounds();
|
const H = this.scale.height;
|
||||||
const pad = 6;
|
|
||||||
const color = teamOf(playerIdx) === 0 ? 0x00ff44 : 0xff4444;
|
const color = teamOf(playerIdx) === 0 ? 0x00ff44 : 0xff4444;
|
||||||
const gfx = this.add.graphics().setDepth(1);
|
const gfx = this.add.graphics().setDepth(10);
|
||||||
gfx.fillStyle(color, 0.25);
|
const barThick = 4;
|
||||||
gfx.fillRoundedRect(bounds.x - pad, bounds.y - pad, bounds.width + pad * 2, bounds.height + pad * 2, 6);
|
switch (playerIdx) {
|
||||||
gfx.lineStyle(2, color, 0.8);
|
case 0: // South — horizontal bar below hand
|
||||||
gfx.strokeRoundedRect(bounds.x - pad, bounds.y - pad, bounds.width + pad * 2, bounds.height + pad * 2, 6);
|
gfx.fillStyle(color, 0.9);
|
||||||
|
gfx.fillRoundedRect(W * 0.15, H - barThick - 2, W * 0.7, barThick, 2);
|
||||||
|
break;
|
||||||
|
case 1: // West — vertical bar left of cards
|
||||||
|
gfx.fillStyle(color, 0.9);
|
||||||
|
gfx.fillRoundedRect(2, SCOREBAR_H + 60, barThick, H - SCOREBAR_H - CH_H - 80, 2);
|
||||||
|
break;
|
||||||
|
case 2: // North — horizontal bar above partner cards
|
||||||
|
gfx.fillStyle(color, 0.9);
|
||||||
|
gfx.fillRoundedRect(W * 0.18, SCOREBAR_H + 2, W * 0.64, barThick, 2);
|
||||||
|
break;
|
||||||
|
case 3: // East — vertical bar right of cards
|
||||||
|
gfx.fillStyle(color, 0.9);
|
||||||
|
gfx.fillRoundedRect(W - barThick - 2, SCOREBAR_H + 60, barThick, H - SCOREBAR_H - CH_H - 80, 2);
|
||||||
|
break;
|
||||||
|
}
|
||||||
this.activeHighlightRect = gfx;
|
this.activeHighlightRect = gfx;
|
||||||
|
|
||||||
// Pulse the glow
|
// Pulse the glow
|
||||||
@@ -455,8 +469,9 @@ export class GameScene extends Phaser.Scene {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Pulse the label
|
// Pulse the label
|
||||||
|
const activeLbl = this.playerLabels.get(playerIdx)!;
|
||||||
this.tweens.add({
|
this.tweens.add({
|
||||||
targets: lbl,
|
targets: activeLbl,
|
||||||
scaleX: 1.2, scaleY: 1.2,
|
scaleX: 1.2, scaleY: 1.2,
|
||||||
duration: 300, yoyo: true, ease: 'Sine.InOut',
|
duration: 300, yoyo: true, ease: 'Sine.InOut',
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user