mirror of
https://github.com/DeNNiiInc/Connect-5.git
synced 2026-04-17 22:46:00 +00:00
Add debug logging and fix registerPlayer UI feedback
This commit is contained in:
@@ -201,17 +201,21 @@ class MultiplayerClient {
|
||||
modal.classList.remove('active');
|
||||
}
|
||||
|
||||
// Show loading state if connecting
|
||||
// Show loading state
|
||||
const loading = document.querySelector('.loading');
|
||||
if (loading && !this.socket) {
|
||||
loading.textContent = 'Connecting to server...';
|
||||
if (loading) {
|
||||
loading.textContent = 'Registering...';
|
||||
}
|
||||
|
||||
if (!this.socket || !this.socket.connected) {
|
||||
console.log('Socket not ready yet, username saved and will be sent on connect.');
|
||||
if (loading) {
|
||||
loading.textContent = 'Connecting to server...';
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('Emitting register_player for:', username);
|
||||
this.socket.emit('register_player', { username });
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,9 @@ io.on('connection', (socket) => {
|
||||
|
||||
// Player registration
|
||||
socket.on('register_player', async (data) => {
|
||||
console.log('📝 Registration request from', socket.id, 'username:', data.username);
|
||||
const result = await gameManager.registerPlayer(socket, data.username);
|
||||
console.log('📝 Registration result:', result);
|
||||
socket.emit('registration_result', result);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user