36 lines
1012 B
JavaScript
36 lines
1012 B
JavaScript
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');
|
|
} |