voice update
This commit is contained in:
@@ -7,6 +7,7 @@ var skipDlg = false;
|
|||||||
var answers;
|
var answers;
|
||||||
var keys;
|
var keys;
|
||||||
var allowNextDlg = true;
|
var allowNextDlg = true;
|
||||||
|
var voice;
|
||||||
|
|
||||||
function load() {
|
function load() {
|
||||||
fetch("text_horror/dialogue.json") //Load json file here
|
fetch("text_horror/dialogue.json") //Load json file here
|
||||||
@@ -31,7 +32,6 @@ function changeDlg(dlgKey) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateDlg() {
|
function updateDlg() {
|
||||||
console.log(dlgLines[dlgPointer]);
|
|
||||||
typeindex = 0;
|
typeindex = 0;
|
||||||
document.getElementById("dlg-text").innerHTML = "";
|
document.getElementById("dlg-text").innerHTML = "";
|
||||||
document.getElementById("triangle").hidden = true;
|
document.getElementById("triangle").hidden = true;
|
||||||
@@ -41,6 +41,10 @@ function updateDlg() {
|
|||||||
function typeWriter() {
|
function typeWriter() {
|
||||||
if (typeindex < dlgLines[dlgPointer].length) {
|
if (typeindex < dlgLines[dlgPointer].length) {
|
||||||
document.getElementById("dlg-text").innerHTML += dlgLines[dlgPointer].charAt(typeindex);
|
document.getElementById("dlg-text").innerHTML += dlgLines[dlgPointer].charAt(typeindex);
|
||||||
|
if (voice != null && typeindex % 3 == 1) {
|
||||||
|
voice.load();
|
||||||
|
voice.play();
|
||||||
|
}
|
||||||
typeindex++;
|
typeindex++;
|
||||||
setTimeout(typeWriter, speed);
|
setTimeout(typeWriter, speed);
|
||||||
} else if (allowNextDlg)
|
} else if (allowNextDlg)
|
||||||
@@ -65,6 +69,13 @@ function nextDlg(dlgPointerIncrease = true) {
|
|||||||
document.getElementById("title").innerHTML = dlgLines[dlgPointer].split(':')[1];
|
document.getElementById("title").innerHTML = dlgLines[dlgPointer].split(':')[1];
|
||||||
nextDlg();
|
nextDlg();
|
||||||
}
|
}
|
||||||
|
if (dlgLines[dlgPointer].split(":")[0] === "_voice") {
|
||||||
|
if (dlgLines[dlgPointer].split(':')[1].length != 0)
|
||||||
|
voice = new Audio("text_horror/assets/voices/" + dlgLines[dlgPointer].split(':')[1] + ".wav");
|
||||||
|
else
|
||||||
|
voice = null;
|
||||||
|
nextDlg();
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
updateDlg();
|
updateDlg();
|
||||||
}
|
}
|
||||||
|
BIN
text_horror/assets/voices/spitzkopf.wav
Normal file
BIN
text_horror/assets/voices/spitzkopf.wav
Normal file
Binary file not shown.
@@ -15,6 +15,7 @@
|
|||||||
],
|
],
|
||||||
"Also Yes": [
|
"Also Yes": [
|
||||||
"_title:Spitzkopf",
|
"_title:Spitzkopf",
|
||||||
|
"_voice:spitzkopf",
|
||||||
"That was a weird answer... Is anything wrong with you?",
|
"That was a weird answer... Is anything wrong with you?",
|
||||||
{
|
{
|
||||||
"Yes my name is Peter": [
|
"Yes my name is Peter": [
|
||||||
|
Reference in New Issue
Block a user