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