Remove Player 2 stats from UI - show only current player info

This commit is contained in:
sokol
2026-02-21 17:48:38 +03:00
parent f19e178217
commit 7035f0457b
3 changed files with 58 additions and 35 deletions

View File

@@ -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');

View File

@@ -36,24 +36,6 @@
</div>
</div>
<div class="player-card player-2" id="player2-card">
<h3>Player 2</h3>
<div class="player-stats">
<div class="stat">
<span class="stat-label">Cells:</span>
<span class="stat-value" id="player2-cells">0</span>
</div>
<div class="stat">
<span class="stat-label">Supply:</span>
<span class="stat-value" id="player2-supply">0</span>
</div>
<div class="stat">
<span class="stat-label">Total Strength:</span>
<span class="stat-value" id="player2-strength">0</span>
</div>
</div>
</div>
<div class="game-info">
<h3>Game Info</h3>
<div class="info-item">
@@ -86,6 +68,20 @@
<button class="btn btn-action" id="cancel-btn" style="width:100%" disabled>Cancel</button>
</div>
<div class="selected-cell-info" id="selected-cell-info" style="display:none;">
<h3>Selected Cell</h3>
<div class="cell-stats">
<div class="stat">
<span class="stat-label">Strength:</span>
<span class="stat-value" id="cell-strength">0</span>
</div>
<div class="stat">
<span class="stat-label">Dice:</span>
<span class="stat-value" id="cell-dice">0</span>
</div>
</div>
</div>
<div class="battle-log">
<h3>Battle Log</h3>
<div class="log-entries" id="battle-log">

View File

@@ -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;