3D working

This commit is contained in:
Kbz-8
2024-02-22 06:01:56 +01:00
committed by AdrienLSH
parent b6936751b1
commit 668ab9ff2e
13 changed files with 106 additions and 52 deletions

View File

@ -51,7 +51,7 @@ export default class extends AbstractAuthenticatedView {
{
if (data.detail === "game_found")
{
navigateTo(`/games/${this.game_mode}/${data.game_id}`);
navigateTo(`/games/${data.game_id}/${this.game_mode}`);
return;
}
this.display_data(data);
@ -65,8 +65,37 @@ export default class extends AbstractAuthenticatedView {
async postInit()
{
document.getElementById("button").onclick = this.press_button.bind(this)
document.getElementById("game-mode").onclick = this.press_button_game_mode.bind(this)
let button = document.getElementById("button");
button.onclick = this.press_button.bind(this);
let input = document.getElementById("nb_players-input");
input.addEventListener('keydown', async ev => {
if (ev.key !== 'Enter')
return;
if (client.matchmaking.searching)
client.matchmaking.stop();
let nb_players = document.getElementById("nb_players-input").value;
await client.matchmaking.start(this.onreceive.bind(this), this.ondisconnect.bind(this), nb_players);
document.getElementById("button").value = "Stop matchmaking";
});
let update = () => {
if (input.value < 2)
button.disabled = true;
else
button.disabled = false;
};
["change", "oninput"].forEach((event_name) => {
input.addEventListener(event_name, update);
});
document.getElementById("game-mode").onclick = this.press_button_game_mode.bind(this);
}
async getHtml() {