This repository has been archived on 2021-10-15. You can view files and clone it, but cannot push or open issues or pull requests.
2020-coding-projects/uno/client/menu.js

36 lines
1012 B
JavaScript
Raw Normal View History

2020-05-05 20:35:48 +00:00
import {
triggerCreateGame,
triggerJoinGame,
} from './uno.js';
const btnCreateGame = document.getElementById('btnCreateGame');
const btnJoinGame = document.getElementById('btnJoinGame');
const btnJoinGameConfirm = document.getElementById('btnJoinGameConfirm');
const inputGameCode = document.getElementById('inputGameCode');
btnCreateGame.addEventListener('click', () => {
triggerCreateGame();
fadeOutTitleScreen();
});
btnJoinGame.addEventListener('click', () => {
showJoinDialog();
});
btnJoinGameConfirm.addEventListener('click', () => {
const gameCode = inputGameCode.value;
triggerJoinGame(gameCode);
fadeOutTitleScreen();
closeJoinDialog();
})
function showJoinDialog() {
document.getElementById('dialogJoinGame').classList.remove('hidden');
}
function closeJoinDialog() {
document.getElementById('dialogJoinGame').classList.add('hidden');
}
function fadeOutTitleScreen() {
document.getElementsByClassName('title-screen')[0].classList.add('hidden');
}