refactor(Phase10Game): remove trailing whitespace and align object properties
- Remove trailing whitespace throughout the file. - Align object properties and ternary operators for improved readability. - Adjust button positioning offset in staging laydown UI.
This commit is contained in:
parent
238c744e93
commit
731937bb82
|
|
@ -254,10 +254,10 @@ export default class Phase10Game extends Phaser.Scene {
|
||||||
.setStrokeStyle(2, COLORS.accent).setDepth(D.pile)
|
.setStrokeStyle(2, COLORS.accent).setDepth(D.pile)
|
||||||
.setInteractive({ useHandCursor: true });
|
.setInteractive({ useHandCursor: true });
|
||||||
drawRect.on('pointerdown', () => this.onDrawDeckClick());
|
drawRect.on('pointerdown', () => this.onDrawDeckClick());
|
||||||
this.add.text(DRAW_POS.x, DRAW_POS.y - CARD_H/2 - 18, 'DRAW', {
|
this.add.text(DRAW_POS.x, DRAW_POS.y - CARD_H / 2 - 18, 'DRAW', {
|
||||||
fontFamily: '"Julius Sans One"', fontSize: '14px', color: COLORS.mutedHex,
|
fontFamily: '"Julius Sans One"', fontSize: '14px', color: COLORS.mutedHex,
|
||||||
}).setOrigin(0.5).setDepth(D.ui);
|
}).setOrigin(0.5).setDepth(D.ui);
|
||||||
this.drawPileText = this.add.text(DRAW_POS.x, DRAW_POS.y + CARD_H/2 + 16, '', {
|
this.drawPileText = this.add.text(DRAW_POS.x, DRAW_POS.y + CARD_H / 2 + 16, '', {
|
||||||
fontFamily: '"Julius Sans One"', fontSize: '14px', color: COLORS.accentHex,
|
fontFamily: '"Julius Sans One"', fontSize: '14px', color: COLORS.accentHex,
|
||||||
}).setOrigin(0.5).setDepth(D.ui);
|
}).setOrigin(0.5).setDepth(D.ui);
|
||||||
this.drawPileRect = drawRect;
|
this.drawPileRect = drawRect;
|
||||||
|
|
@ -267,7 +267,7 @@ export default class Phase10Game extends Phaser.Scene {
|
||||||
.setStrokeStyle(2, COLORS.muted).setDepth(D.pile)
|
.setStrokeStyle(2, COLORS.muted).setDepth(D.pile)
|
||||||
.setInteractive({ useHandCursor: true });
|
.setInteractive({ useHandCursor: true });
|
||||||
discRect.on('pointerdown', () => this.onDiscardPileClick());
|
discRect.on('pointerdown', () => this.onDiscardPileClick());
|
||||||
this.add.text(DISCARD_POS.x, DISCARD_POS.y - CARD_H/2 - 18, 'DISCARD', {
|
this.add.text(DISCARD_POS.x, DISCARD_POS.y - CARD_H / 2 - 18, 'DISCARD', {
|
||||||
fontFamily: '"Julius Sans One"', fontSize: '14px', color: COLORS.mutedHex,
|
fontFamily: '"Julius Sans One"', fontSize: '14px', color: COLORS.mutedHex,
|
||||||
}).setOrigin(0.5).setDepth(D.ui);
|
}).setOrigin(0.5).setDepth(D.ui);
|
||||||
this.discardPileRect = discRect;
|
this.discardPileRect = discRect;
|
||||||
|
|
@ -1143,7 +1143,7 @@ export default class Phase10Game extends Phaser.Scene {
|
||||||
this.cardObjs.set(`hand-${seat}-${card.id}`, c);
|
this.cardObjs.set(`hand-${seat}-${card.id}`, c);
|
||||||
if (seat === 0) {
|
if (seat === 0) {
|
||||||
this.localHandCards.push(c);
|
this.localHandCards.push(c);
|
||||||
c.setInteractive(new Phaser.Geom.Rectangle(-CARD_W/2, -CARD_H/2, CARD_W, CARD_H), Phaser.Geom.Rectangle.Contains);
|
c.setInteractive(new Phaser.Geom.Rectangle(-CARD_W / 2, -CARD_H / 2, CARD_W, CARD_H), Phaser.Geom.Rectangle.Contains);
|
||||||
c.input.cursor = 'pointer';
|
c.input.cursor = 'pointer';
|
||||||
c.on('pointerdown', (pointer) => this.onHandPointerDown(i, pointer));
|
c.on('pointerdown', (pointer) => this.onHandPointerDown(i, pointer));
|
||||||
}
|
}
|
||||||
|
|
@ -1260,7 +1260,7 @@ export default class Phase10Game extends Phaser.Scene {
|
||||||
}
|
}
|
||||||
const panelX = laidStart.x - 14;
|
const panelX = laidStart.x - 14;
|
||||||
const panelW = totalW + 28;
|
const panelW = totalW + 28;
|
||||||
const btnX = panelX + panelW + 160;
|
const btnX = panelX + panelW + 200;
|
||||||
this.submitBtn = new Button(this, btnX, laidStart.y - 18, 'Submit Phase', () => this.submitStagingLaydown(), {
|
this.submitBtn = new Button(this, btnX, laidStart.y - 18, 'Submit Phase', () => this.submitStagingLaydown(), {
|
||||||
width: 200, height: 44, fontSize: 18,
|
width: 200, height: 44, fontSize: 18,
|
||||||
}).setDepth(D.ui);
|
}).setDepth(D.ui);
|
||||||
|
|
@ -1400,7 +1400,7 @@ export default class Phase10Game extends Phaser.Scene {
|
||||||
const w = 560, h = 280;
|
const w = 560, h = 280;
|
||||||
const panel = this.add.rectangle(CX, CY, w, h, COLORS.panel, 1)
|
const panel = this.add.rectangle(CX, CY, w, h, COLORS.panel, 1)
|
||||||
.setStrokeStyle(2, COLORS.accent).setDepth(D.modal);
|
.setStrokeStyle(2, COLORS.accent).setDepth(D.modal);
|
||||||
const title = this.add.text(CX, CY - h/2 + 40, 'Skip which player?', {
|
const title = this.add.text(CX, CY - h / 2 + 40, 'Skip which player?', {
|
||||||
fontFamily: 'Righteous', fontSize: '28px', color: COLORS.goldHex,
|
fontFamily: 'Righteous', fontSize: '28px', color: COLORS.goldHex,
|
||||||
}).setOrigin(0.5).setDepth(D.modal);
|
}).setOrigin(0.5).setDepth(D.modal);
|
||||||
|
|
||||||
|
|
@ -1434,7 +1434,7 @@ export default class Phase10Game extends Phaser.Scene {
|
||||||
}, { width: 160, height: 56, fontSize: 18 }).setDepth(D.modal);
|
}, { width: 160, height: 56, fontSize: 18 }).setDepth(D.modal);
|
||||||
buttons.push(btn);
|
buttons.push(btn);
|
||||||
});
|
});
|
||||||
const cancelBtn = new Button(this, CX, CY + h/2 - 40, 'Cancel', () => {
|
const cancelBtn = new Button(this, CX, CY + h / 2 - 40, 'Cancel', () => {
|
||||||
overlay.destroy(); panel.destroy(); title.destroy();
|
overlay.destroy(); panel.destroy(); title.destroy();
|
||||||
for (const b of buttons) b.destroy();
|
for (const b of buttons) b.destroy();
|
||||||
cancelBtn.destroy();
|
cancelBtn.destroy();
|
||||||
|
|
@ -1549,16 +1549,16 @@ export default class Phase10Game extends Phaser.Scene {
|
||||||
|
|
||||||
const summary = this.gs.lastRoundSummary;
|
const summary = this.gs.lastRoundSummary;
|
||||||
const winnerName = this.nameForSeat(summary.winnerSeat);
|
const winnerName = this.nameForSeat(summary.winnerSeat);
|
||||||
const title = this.add.text(CX, CY - h/2 + 40, `Round ${summary.roundNum} — ${winnerName} went out`, {
|
const title = this.add.text(CX, CY - h / 2 + 40, `Round ${summary.roundNum} — ${winnerName} went out`, {
|
||||||
fontFamily: 'Righteous', fontSize: '26px', color: COLORS.goldHex,
|
fontFamily: 'Righteous', fontSize: '26px', color: COLORS.goldHex,
|
||||||
}).setOrigin(0.5).setDepth(D.modal);
|
}).setOrigin(0.5).setDepth(D.modal);
|
||||||
items.push(title);
|
items.push(title);
|
||||||
|
|
||||||
summary.rows.forEach((row, i) => {
|
summary.rows.forEach((row, i) => {
|
||||||
const y = CY - h/2 + 100 + i * 50;
|
const y = CY - h / 2 + 100 + i * 50;
|
||||||
const name = this.nameForSeat(row.seat);
|
const name = this.nameForSeat(row.seat);
|
||||||
const status = row.cleared10 ? 'cleared phase 10!' : row.advanced ? `→ phase ${row.phaseNext}` : `still phase ${row.phaseNext}`;
|
const status = row.cleared10 ? 'cleared phase 10!' : row.advanced ? `→ phase ${row.phaseNext}` : `still phase ${row.phaseNext}`;
|
||||||
const t = this.add.text(CX - w/2 + 36, y, `${name}`, {
|
const t = this.add.text(CX - w / 2 + 36, y, `${name}`, {
|
||||||
fontFamily: 'Righteous', fontSize: '20px', color: COLORS.textHex,
|
fontFamily: 'Righteous', fontSize: '20px', color: COLORS.textHex,
|
||||||
}).setDepth(D.modal);
|
}).setDepth(D.modal);
|
||||||
const sc = this.add.text(CX - 100, y, `+${row.pointsThisRound} (total ${row.totalScore})`, {
|
const sc = this.add.text(CX - 100, y, `+${row.pointsThisRound} (total ${row.totalScore})`, {
|
||||||
|
|
@ -1573,12 +1573,12 @@ export default class Phase10Game extends Phaser.Scene {
|
||||||
|
|
||||||
const tieNote = this.gs.matchTied ? 'Tie among phase 10 finishers — extra round!' : null;
|
const tieNote = this.gs.matchTied ? 'Tie among phase 10 finishers — extra round!' : null;
|
||||||
if (tieNote) {
|
if (tieNote) {
|
||||||
items.push(this.add.text(CX, CY + h/2 - 90, tieNote, {
|
items.push(this.add.text(CX, CY + h / 2 - 90, tieNote, {
|
||||||
fontFamily: '"Julius Sans One"', fontSize: '16px', color: COLORS.dangerHex,
|
fontFamily: '"Julius Sans One"', fontSize: '16px', color: COLORS.dangerHex,
|
||||||
}).setOrigin(0.5).setDepth(D.modal));
|
}).setOrigin(0.5).setDepth(D.modal));
|
||||||
}
|
}
|
||||||
|
|
||||||
const btn = new Button(this, CX, CY + h/2 - 50, 'Next round', () => {
|
const btn = new Button(this, CX, CY + h / 2 - 50, 'Next round', () => {
|
||||||
for (const o of items) o.destroy();
|
for (const o of items) o.destroy();
|
||||||
btn.destroy();
|
btn.destroy();
|
||||||
this.gs = startNextRound(this.gs);
|
this.gs = startNextRound(this.gs);
|
||||||
|
|
@ -1607,7 +1607,7 @@ export default class Phase10Game extends Phaser.Scene {
|
||||||
const w = 720, h = 360;
|
const w = 720, h = 360;
|
||||||
this.add.rectangle(CX, CY, w, h, COLORS.panel, 1)
|
this.add.rectangle(CX, CY, w, h, COLORS.panel, 1)
|
||||||
.setStrokeStyle(2, COLORS.accent).setDepth(D.modal);
|
.setStrokeStyle(2, COLORS.accent).setDepth(D.modal);
|
||||||
this.add.text(CX, CY - h/2 + 56, msg, {
|
this.add.text(CX, CY - h / 2 + 56, msg, {
|
||||||
fontFamily: 'Righteous', fontSize: '42px',
|
fontFamily: 'Righteous', fontSize: '42px',
|
||||||
color: youWon ? COLORS.goldHex : COLORS.textHex,
|
color: youWon ? COLORS.goldHex : COLORS.textHex,
|
||||||
}).setOrigin(0.5).setDepth(D.modal);
|
}).setOrigin(0.5).setDepth(D.modal);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue