3D working
This commit is contained in:
@ -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() {
|
||||
|
Reference in New Issue
Block a user