show and hide introduction view

This commit is contained in:
Djalim Simaila 2023-01-14 14:57:58 +01:00
parent 03ce844c6a
commit a7a428357d

View File

@ -16,18 +16,32 @@ function hideEmotionAndCulpritChoices(){
document.getElementsByClassName("emotion_and_culprit_choices")[0].classList.add("hidden"); document.getElementsByClassName("emotion_and_culprit_choices")[0].classList.add("hidden");
} }
function showIntroduction(){
document.getElementsByClassName("introduction")[0].classList.remove("hidden");
}
function hideIntroduction(){
document.getElementsByClassName("introduction")[0].classList.add("hidden");
}
function setListenerToIntroductionNextBtn(){
document.getElementById("introduction_next_btn").addEventListener("click", showInterogation)
}
function setListenerToInterrogationNextBtn(){ function setListenerToInterrogationNextBtn(){
document.getElementById("interrogation_next_btn").addEventListener("click", showInterogationView) document.getElementById("interrogation_next_btn").addEventListener("click", showEmotionAndCulpritChoicesView)
} }
function showInterogationView(){ function showInterogationView(){
hideIntroduction();
showInterogation();
}
function showEmotionAndCulpritChoicesView(){
hideInterogation(); hideInterogation();
showEmotionAndCulpritChoices(); showEmotionAndCulpritChoices();
} }
function renderAnswerSelectionPanel() { function renderAnswerSelectionPanel() {
npcs_ids.forEach(element => { npcs_ids.forEach(element => {
console.log(element);
let suspect = document.createElement("div"); let suspect = document.createElement("div");
suspect.classList.add("suspect"); suspect.classList.add("suspect");
@ -98,8 +112,8 @@ async function initGame(){
//initSock(); //initSock();
renderAnswerSelectionPanel(); renderAnswerSelectionPanel();
renderInterogation(); renderInterogation();
setListenerToIntroductionNextBtn()
setListenerToInterrogationNextBtn(); setListenerToInterrogationNextBtn();
showInterogation(); showIntroduction();
} }
initGame(); initGame();