game: add: support multiplayer

This commit is contained in:
2024-02-28 17:49:12 +01:00
parent f567943894
commit 9f30f5c3d1
5 changed files with 26 additions and 19 deletions

View File

@ -290,8 +290,11 @@ class Game
leave()
{
this._socket.close();
this._socket = undefined;
if (this._socket)
{
this._socket.close();
this._socket = undefined;
}
}
}

View File

@ -91,7 +91,7 @@ export default class extends AbstractAuthenticatedView {
});
let update = () => {
if (input.value < 2)
if (input.value < 2 || input.value > 4)
button.disabled = true;
else
button.disabled = false;
@ -106,7 +106,7 @@ export default class extends AbstractAuthenticatedView {
async getHtml() {
return `
<h1>Select mode</h1>
<input type="number" value="2" min="1" id="nb_players-input">
<input type="number" value="2" min="1" max="4" id="nb_players-input">
<input type="button" value="Find a game" id="button">
<input type="button" value="2D" id="game-mode">
<span id="detail"></span>