From 7035f0457b903051a7202cf5d6399f282a8ec008 Mon Sep 17 00:00:00 2001 From: sokol Date: Sat, 21 Feb 2026 17:48:38 +0300 Subject: [PATCH] Remove Player 2 stats from UI - show only current player info --- public/game.js | 35 ++++++++++++++++++----------------- public/index.html | 32 ++++++++++++++------------------ public/styles.css | 26 ++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 35 deletions(-) diff --git a/public/game.js b/public/game.js index 21056fc..42d9c42 100644 --- a/public/game.js +++ b/public/game.js @@ -491,24 +491,15 @@ class GameUI { } updateUI() { - // Update player stats - const p1Cells = this.map.getPlayerCells(1); - const p2Cells = this.map.getPlayerCells(2); + // Update current player stats + const currentCells = this.map.getPlayerCells(this.currentPlayer); + const currentStrength = currentCells.reduce((sum, c) => sum + c.getStrength(), 0); + const currentSupply = this.map.calculateSupply(this.currentPlayer); - const p1Strength = p1Cells.reduce((sum, c) => sum + c.getStrength(), 0); - const p2Strength = p2Cells.reduce((sum, c) => sum + c.getStrength(), 0); - - document.getElementById('player1-cells').textContent = p1Cells.length; - document.getElementById('player1-supply').textContent = this.map.calculateSupply(1); - document.getElementById('player1-strength').textContent = p1Strength; - - document.getElementById('player2-cells').textContent = p2Cells.length; - document.getElementById('player2-supply').textContent = this.map.calculateSupply(2); - document.getElementById('player2-strength').textContent = p2Strength; - - // Update active player - document.getElementById('player1-card').classList.toggle('active', this.currentPlayer === 1); - document.getElementById('player2-card').classList.toggle('active', this.currentPlayer === 2); + // Update player 1 card (only player for now) + document.getElementById('player1-cells').textContent = currentCells.length; + document.getElementById('player1-supply').textContent = currentSupply; + document.getElementById('player1-strength').textContent = currentStrength; // Update game info document.getElementById('current-turn').textContent = this.currentPlayer; @@ -522,6 +513,16 @@ class GameUI { instruction.textContent = 'Select a cell with dice to move'; } + // Update selected cell info + const cellInfo = document.getElementById('selected-cell-info'); + if (this.selectedCell) { + cellInfo.style.display = 'block'; + document.getElementById('cell-strength').textContent = this.selectedCell.getStrength(); + document.getElementById('cell-dice').textContent = this.selectedCell.dice.length; + } else { + cellInfo.style.display = 'none'; + } + // Update buttons const cancelBtn = document.getElementById('cancel-btn'); const endTurnBtn = document.getElementById('end-turn-btn'); diff --git a/public/index.html b/public/index.html index 2944d2a..81eafe0 100644 --- a/public/index.html +++ b/public/index.html @@ -36,24 +36,6 @@ -
-

Player 2

-
-
- Cells: - 0 -
-
- Supply: - 0 -
-
- Total Strength: - 0 -
-
-
-

Game Info

@@ -86,6 +68,20 @@
+ +

Battle Log

diff --git a/public/styles.css b/public/styles.css index b86a09c..c089359 100644 --- a/public/styles.css +++ b/public/styles.css @@ -231,6 +231,32 @@ body { min-height: 40px; } +/* Selected Cell Info */ +.selected-cell-info { + background: var(--bg-panel); + border-radius: 8px; + padding: 12px; + margin-top: 10px; +} + +.selected-cell-info h3 { + font-size: 0.9rem; + margin-bottom: 10px; + color: var(--text-secondary); +} + +.cell-stats { + display: flex; + flex-direction: column; + gap: 6px; +} + +.cell-stats .stat { + display: flex; + justify-content: space-between; + font-size: 0.85rem; +} + .action-buttons { display: flex; gap: 8px;