feat(chat): add function to clear game chat before starting a new game and on exit
This commit is contained in:
parent
24e457885d
commit
79267cb3d2
|
|
@ -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');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue