refactor: Add optional refresh control to _buildPanel in SkirmishDeckSelectScene

- Pass `refresh` flag (default `true`) to `_buildPanel` calls for both player and opponent panels
- Skip `_refreshPanelHighlights()` call within `_buildPanel` when `refresh=false`
- Call `_refreshPanelHighlights()` once after building both panels to avoid redundant updates
This commit is contained in:
Brian Fertig 2026-04-01 20:34:19 -06:00
parent a5598bfcd0
commit 762dc77556
1 changed files with 6 additions and 4 deletions

View File

@ -28,10 +28,10 @@ export class SkirmishDeckSelectScene extends Phaser.Scene {
this.opponentChoice = 'draft';
// ── Left panel: Your Deck ──
this._buildPanel(160, 'Your Deck', 'player');
this._buildPanel(160, 'Your Deck', 'player', false);
// ── Right panel: Opponent Deck ──
this._buildPanel(1040, 'Opponent Deck', 'opponent');
this._buildPanel(1040, 'Opponent Deck', 'opponent', false);
// ── Divider ──
this.add.rectangle(width / 2, height / 2, 3, height - 200, 0x334466, 0.5);
@ -42,9 +42,11 @@ export class SkirmishDeckSelectScene extends Phaser.Scene {
this._updateActionButton();
this._makeBackButton();
this._refreshPanelHighlights();
}
_buildPanel(startX, title, side) {
_buildPanel(startX, title, side, refresh = true) {
const panelW = 720;
const panelCX = startX + panelW / 2;
const { height } = this.scale;
@ -127,7 +129,7 @@ export class SkirmishDeckSelectScene extends Phaser.Scene {
this[panelKey].deckEntries.push({ bg, titleTxt, cmdTxt, summaryTxt, countTxt, deckId: deck.id });
});
this._refreshPanelHighlights();
if (refresh) this._refreshPanelHighlights();
}
_refreshPanelHighlights() {