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:
parent
a5598bfcd0
commit
762dc77556
|
|
@ -28,10 +28,10 @@ export class SkirmishDeckSelectScene extends Phaser.Scene {
|
||||||
this.opponentChoice = 'draft';
|
this.opponentChoice = 'draft';
|
||||||
|
|
||||||
// ── Left panel: Your Deck ──
|
// ── Left panel: Your Deck ──
|
||||||
this._buildPanel(160, 'Your Deck', 'player');
|
this._buildPanel(160, 'Your Deck', 'player', false);
|
||||||
|
|
||||||
// ── Right panel: Opponent Deck ──
|
// ── Right panel: Opponent Deck ──
|
||||||
this._buildPanel(1040, 'Opponent Deck', 'opponent');
|
this._buildPanel(1040, 'Opponent Deck', 'opponent', false);
|
||||||
|
|
||||||
// ── Divider ──
|
// ── Divider ──
|
||||||
this.add.rectangle(width / 2, height / 2, 3, height - 200, 0x334466, 0.5);
|
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._updateActionButton();
|
||||||
|
|
||||||
this._makeBackButton();
|
this._makeBackButton();
|
||||||
|
|
||||||
|
this._refreshPanelHighlights();
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildPanel(startX, title, side) {
|
_buildPanel(startX, title, side, refresh = true) {
|
||||||
const panelW = 720;
|
const panelW = 720;
|
||||||
const panelCX = startX + panelW / 2;
|
const panelCX = startX + panelW / 2;
|
||||||
const { height } = this.scale;
|
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[panelKey].deckEntries.push({ bg, titleTxt, cmdTxt, summaryTxt, countTxt, deckId: deck.id });
|
||||||
});
|
});
|
||||||
|
|
||||||
this._refreshPanelHighlights();
|
if (refresh) this._refreshPanelHighlights();
|
||||||
}
|
}
|
||||||
|
|
||||||
_refreshPanelHighlights() {
|
_refreshPanelHighlights() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue