feat(chat): add function to clear game chat before starting a new game and on exit

This commit is contained in:
ur002 2026-02-01 19:14:07 +03:00
parent 24e457885d
commit 79267cb3d2
2 changed files with 14 additions and 0 deletions

BIN
poker.db

Binary file not shown.

View File

@ -194,6 +194,9 @@ function startSinglePlayer() {
// Сохраняем имя // Сохраняем имя
localStorage.setItem('playerName', playerName); localStorage.setItem('playerName', playerName);
// Очищаем чат перед началом новой игры
clearGameChat();
// Создаём игру // Создаём игру
game = new PokerGame({ game = new PokerGame({
smallBlind: 5, smallBlind: 5,
@ -1502,6 +1505,16 @@ function toggleChat() {
document.getElementById('game-chat').classList.toggle('expanded'); document.getElementById('game-chat').classList.toggle('expanded');
} }
/**
* Очистить игровой чат
*/
function clearGameChat() {
const container = document.getElementById('game-chat-messages');
if (container) {
container.innerHTML = '';
}
}
// ============================================================================= // =============================================================================
// НАСТРОЙКИ // НАСТРОЙКИ
// ============================================================================= // =============================================================================
@ -1966,6 +1979,7 @@ function leaveGame() {
leaveRoom(); leaveRoom();
} }
game = null; game = null;
clearGameChat(); // Очищаем чат при выходе из игры
showScreen('main-menu'); showScreen('main-menu');
} }
} }