fixing merge conflicts

This commit is contained in:
Kbz-8
2024-02-21 16:43:44 +01:00
12 changed files with 457 additions and 17 deletions

View File

@ -6,7 +6,8 @@ export default class extends AbstractAuthenticatedView {
constructor(params)
{
super(params, "Matchmaking");
super(params, "Matchmaking");
this.game_mode = 0; // 0 -> 2D; 1 -> 3D
}
async press_button()
@ -27,6 +28,20 @@ export default class extends AbstractAuthenticatedView {
}
}
async press_button_game_mode()
{
if(this.game_mode === 0)
{
document.getElementById("game-mode").value = "3D";
this.game_mode = 1;
}
else
{
document.getElementById("game-mode").value = "2D";
this.game_mode = 0;
}
}
ondisconnect(event)
{
document.getElementById("button").value = "Find a game";
@ -36,7 +51,7 @@ export default class extends AbstractAuthenticatedView {
{
if (data.detail === "game_found")
{
navigateTo(`/games/${data.game_id}`);
navigateTo(`/games/${this.game_mode}/${data.game_id}`);
return;
}
this.display_data(data);
@ -80,6 +95,7 @@ export default class extends AbstractAuthenticatedView {
["change", "oninput"].forEach((event_name) => {
input.addEventListener(event_name, update);
});
document.getElementById("game-mode").onclick = this.press_button_game_mode.bind(this)
}
async getHtml() {
@ -87,6 +103,7 @@ export default class extends AbstractAuthenticatedView {
<h1>Select mode</h1>
<input type="number" value="2" min="1" 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>
`;
}