refactor: remove debug logging from handleConnected and renderRoom functions
All checks were successful
Build and Push Docker Image / docker (push) Successful in 7s
All checks were successful
Build and Push Docker Image / docker (push) Successful in 7s
This commit is contained in:
@@ -33,7 +33,6 @@ function shortName(id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function handleConnected(msg) {
|
export function handleConnected(msg) {
|
||||||
console.debug('handleConnected', msg);
|
|
||||||
state.playerId = msg.playerId;
|
state.playerId = msg.playerId;
|
||||||
try {
|
try {
|
||||||
if (msg.playerId) localStorage.setItem('playerId', msg.playerId);
|
if (msg.playerId) localStorage.setItem('playerId', msg.playerId);
|
||||||
@@ -168,7 +167,6 @@ export function onMessage(ev) {
|
|||||||
switch (msg.type) {
|
switch (msg.type) {
|
||||||
case 'resume_result': {
|
case 'resume_result': {
|
||||||
if (msg.ok) {
|
if (msg.ok) {
|
||||||
console.debug('handleResumeResult', msg);
|
|
||||||
if (msg.playerId) {
|
if (msg.playerId) {
|
||||||
state.playerId = msg.playerId;
|
state.playerId = msg.playerId;
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -104,24 +104,12 @@ export function renderRoom(room) {
|
|||||||
}
|
}
|
||||||
$readyChk.parentElement.classList.toggle('hidden', room.state.status !== 'lobby');
|
$readyChk.parentElement.classList.toggle('hidden', room.state.status !== 'lobby');
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('room host id:', room.hostId, 'my id:', state.playerId);
|
|
||||||
const isHost = state.playerId === room.hostId;
|
const isHost = state.playerId === room.hostId;
|
||||||
const activePlayers = room.players.filter((p) => !p.spectator && p.connected);
|
const activePlayers = room.players.filter((p) => !p.spectator && p.connected);
|
||||||
const allReady = activePlayers.length > 0 && activePlayers.every((p) => p.ready);
|
const allReady = activePlayers.length > 0 && activePlayers.every((p) => p.ready);
|
||||||
|
|
||||||
console.log('room state status:', room.state.status, 'host:', isHost, 'allReady:', allReady);
|
|
||||||
const canStart = room.state.status === 'lobby' && isHost && allReady;
|
const canStart = room.state.status === 'lobby' && isHost && allReady;
|
||||||
|
|
||||||
console.log(
|
|
||||||
`Rendering room ${room.id}, players: ${room.players.length}, active: ${activePlayers.length}, ready: ${allReady}, isHost: ${isHost}`
|
|
||||||
);
|
|
||||||
console.log('Me:', me);
|
|
||||||
console.log('Pending ready:', state.pendingReady);
|
|
||||||
console.log('Room state:', room.state);
|
|
||||||
console.log('My timeline:', myTl);
|
|
||||||
console.log('CanStart:', canStart);
|
|
||||||
|
|
||||||
if ($startGame) $startGame.classList.toggle('hidden', !canStart);
|
if ($startGame) $startGame.classList.toggle('hidden', !canStart);
|
||||||
|
|
||||||
const isMyTurn =
|
const isMyTurn =
|
||||||
|
|||||||
Reference in New Issue
Block a user