diff --git a/TODO.txt b/TODO.txt index 8e2046012..90983c2bf 100644 --- a/TODO.txt +++ b/TODO.txt @@ -79,9 +79,8 @@ * make mediterranion ocean, fix panama canal DONE 9/1/2024 * remove tiny islands DONE 9/1/2024 * Create exit to menu button DONE 9/2/2024 -* show next game in menu +* show next game in menu DONE 9/2/2024 * BUG: attacks starts slow but gets faster -* BUG: sometimes doesn't connect to lobby * test & deploy game --- v2 Release diff --git a/src/client/Client.ts b/src/client/Client.ts index 0ea80c6e5..fa1d50de3 100644 --- a/src/client/Client.ts +++ b/src/client/Client.ts @@ -11,26 +11,15 @@ import favicon from '../../resources/images/Favicon.png'; import './styles.css'; - -// import WebSocket from 'ws'; - class Client { - private hasJoined = false - - private socket: WebSocket | null = null; private terrainMap: Promise private game: ClientGame - - private lobbiesContainer: HTMLElement | null; private lobbiesInterval: NodeJS.Timeout | null = null; private isLobbyHighlighted: boolean = false; - private random = new PseudoRandom(1234) - private ip: Promise = null constructor() { - this.lobbiesContainer = document.getElementById('lobbies-container'); } initialize(): void { @@ -86,6 +75,13 @@ class Client { timerElement.textContent = `Starts in: ${timeRemaining}s`; } if (playerCountElement) playerCountElement.textContent = `Players: ${lobby.numClients}`; + + if (lobbies.length > 1) { + const nextLobby = lobbies[1] + const nextGame = document.getElementById('next-game'); + nextGame.textContent = `Next Game: ${nextLobby.id}` + } + } async fetchLobbies(): Promise { @@ -161,7 +157,6 @@ function setupUsernameCallback(callback: (username: string) => void): void { } } - async function getClientIP(timeoutMs: number = 1000): Promise { const controller = new AbortController(); const timeoutId = setTimeout(() => controller.abort(), timeoutMs); @@ -193,8 +188,6 @@ async function getClientIP(timeoutMs: number = 1000): Promise { } } - - // Initialize the client when the DOM is loaded document.addEventListener('DOMContentLoaded', () => { new Client().initialize(); diff --git a/src/client/index.html b/src/client/index.html index 74a9af7b0..3cf6e96d0 100644 --- a/src/client/index.html +++ b/src/client/index.html @@ -21,29 +21,7 @@
- +