Added check for button combo (will exit app in future)

This commit is contained in:
Vaclav Siml 2023-02-24 20:35:04 +01:00
parent 9412091524
commit d6154ad3f5

View file

@ -1,5 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
@ -7,138 +8,149 @@
<link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="style.css">
<title>UI</title> <title>UI</title>
</head> </head>
<body> <body>
<script src ="Vars.js"> <script src="Vars.js">
</script> <!--Loadne Vars.js--> </script> <!--Loadne Vars.js-->
<div class="hlavnidiv"> <div class="hlavnidiv">
<div class="container"> <div class="container">
<button class="move" type="button" id="sdvx3-button" onclick="vers=3;sdvx()"> <button class="move" type="button" id="sdvx3-button" onclick="vers=3;sdvx()">
<img src="JPGS/sound-voltex-iii-gravity-wars-1.png" alt=""> <img src="JPGS/sound-voltex-iii-gravity-wars-1.png" alt="">
<h1 class="sex">Sound Voltex III: Gravity Wars</h1> <h1 class="sex">Sound Voltex III: Gravity Wars</h1>
</button> <!--SDVX3--> </button> <!--SDVX3-->
<button class="move" type="button" id="sdvx4-button" onclick="vers=4;sdvx()"> <button class="move" type="button" id="sdvx4-button" onclick="vers=4;sdvx()">
<img src="JPGS/maxresdefault3.jpg" alt=""> <img src="JPGS/maxresdefault3.jpg" alt="">
<h1 class="sex">Sound Voltex IV: Heavenly Haven</h1> <h1 class="sex">Sound Voltex IV: Heavenly Haven</h1>
</button> <!--SDVX4--> </button> <!--SDVX4-->
<button class="move" type="button" id="sdvx5-button" onclick="vers=5;sdvx()"> <button class="move" type="button" id="sdvx5-button" onclick="vers=5;sdvx()">
<img src="JPGS/SDVX5scaled.jpg" alt=""> <img src="JPGS/SDVX5scaled.jpg" alt="">
<h1 class="sex">Sound Voltex V: Vivid Wave</h1> <h1 class="sex">Sound Voltex V: Vivid Wave</h1>
</button> </button>
<button class="move" type="button" id="sdvx6-button" onclick="vers=6;sdvx()"> <button class="move" type="button" id="sdvx6-button" onclick="vers=6;sdvx()">
<img src="JPGS/exceed gear.jpg" alt=""> <img src="JPGS/exceed gear.jpg" alt="">
<h1 class="sex">Sound Voltex VI: Exceed GEAR</h1> <h1 class="sex">Sound Voltex VI: Exceed GEAR</h1>
</button> <!--SDVX5--> </button> <!--SDVX5-->
<button class="move" type="button" id="sdvx7-button" onclick="vers=7;sdvx()"> <button class="move" type="button" id="sdvx7-button" onclick="vers=7;sdvx()">
<img src="" alt=""> <img src="" alt="">
<h1 class="sex">GAME1</h1> <h1 class="sex">GAME1</h1>
</button> <!--SDVX5--> </button> <!--SDVX5-->
<button class="move" type="button" id="sdvx6-button" onclick="vers=8;sdvx()"> <button class="move" type="button" id="sdvx6-button" onclick="vers=8;sdvx()">
<img src="" alt=""> <img src="" alt="">
<h1 class="sex">GAME2</h1> <h1 class="sex">GAME2</h1>
</button> <!--SDVX5--> </button> <!--SDVX5-->
</div>
</div> </div>
</div>
<!-- <audio id="Switchfocus"> <script>
<source src="Audio/switchfocus.mp3" type="audio/mpeg">
</audio>
<audio id="Audiostart">
<source src="Audio/audiostart.mp3" type="audio/mpeg">
</audio> -->
<script> const prvnihra = [...document.querySelectorAll("button")]
// for (i = 0; i < prvnihra.length; i++) {
const prvnihra = [...document.querySelectorAll("button")] //console.log(prvnihra[i]);
// for (i = 0; i < prvnihra.length; i++) { //}
//console.log(prvnihra[i]); console.log(prvnihra[0])
//}
console.log(prvnihra[0])
prvnihra[0].focus(); /* Handles interaction with bindable buttons and focus*/ prvnihra[0].focus(); /* Handles interaction with bindable buttons and focus*/
</script> </script>
<script> <script>
/**/ /**/
var i = 0; var i = 0;
const switchfocus = new Audio("Audio/switchfocus.mp3"); const switchfocus = new Audio("Audio/switchfocus.mp3");
const startaudio = new Audio("Audio/audiostart.mp3") const startaudio = new Audio("Audio/audiostart.mp3")
document.addEventListener("keydown", function (KeypressD) { document.addEventListener("keydown", function (KeypressD) {
if (KeypressD.code === KeyRight) { if (KeypressD.code === KeyRight) {
if (i >= prvnihra.length - 1) i = -1; if (i >= prvnihra.length - 1) i = -1;
switchfocus.play(); switchfocus.play();
i++; i++;
prvnihra[i].focus(); prvnihra[i].focus();
console.log("right", i); console.log("right", i);
console.log("array je", prvnihra.length); console.log("array je", prvnihra.length);
} }
}) })
document.addEventListener("keydown", function (Keypress) { document.addEventListener("keydown", function (Keypress) {
if (Keypress.code === KeyLeft) { if (Keypress.code === KeyLeft) {
switchfocus.play(); switchfocus.play();
if (i <= 0) i = prvnihra.length if (i <= 0) i = prvnihra.length
i--; i--;
prvnihra[i].focus() prvnihra[i].focus()
console.log("left", i); console.log("left", i);
} }
if (Keypress.code === KeyStart) { if (Keypress.code === KeyStart) {
startaudio.play(); startaudio.play();
console.log(document.activeElement); console.log(document.activeElement);
document.activeElement.click(); document.activeElement.click();
} }
if (Keypress.code === KeyDown && i + 3 < prvnihra.length) { if (Keypress.code === KeyDown && i + 3 < prvnihra.length) {
switchfocus.play(); switchfocus.play();
console.log(i); console.log(i);
i = i + 3; i = i + 3;
prvnihra[i].focus(); prvnihra[i].focus();
} }
if (Keypress.code === KeyUp && i - 3 >= 0) { if (Keypress.code === KeyUp && i - 3 >= 0) {
switchfocus.play(); switchfocus.play();
console.log(i); console.log(i);
i = i - 3; i = i - 3;
prvnihra[i].focus(); prvnihra[i].focus();
} }
//document.body.requestFullscreen(); //document.body.requestFullscreen();
}) })
</script> let keysPressed = {};
<script> document.addEventListener('keydown', (event) => {
keysPressed[event.key] = true;
if (keysPressed[ExitKey1] && event.key == ExitKey2) {
alert(event.key);
}
});
document.addEventListener('keyup', (event) => {
delete keysPressed[event.key];
});
</script>
<script>
var vers = 0; /* Handles Running of apps */ var vers = 0; /* Handles Running of apps */
const { execFile, exec, spawn } = require('child_process'); const { execFile, exec, spawn } = require('child_process');
function sdvx() { function sdvx() {
console.log("promenna", vers); console.log("promenna", vers);
switch (vers) { switch (vers) {
case 3: case 3:
execFile(AsphyxiaPath); execFile(AsphyxiaPath);
exec("start /b " + SDVX3Path); exec("start /b " + SDVX3Path);
setTimeout(function () { setTimeout(function () {
exec("taskkill /im " + browser) exec("taskkill /im " + browser)
}, 2000) }, 2000)
//console.log(vers); //console.log(vers);
break; break;
case 4: case 4:
execFile(AsphyxiaPath); execFile(AsphyxiaPath);
exec("start /b " + SDVX4Path); exec("start /b " + SDVX4Path);
setTimeout(function () { setTimeout(function () {
exec("taskkill /im " + browser) exec("taskkill /im " + browser)
}, 1200) }, 1200)
break; break;
case 5: case 5:
execFile(AsphyxiaPath); execFile(AsphyxiaPath);
exec("start /b " + SDVX5Path); exec("start /b " + SDVX5Path);
setTimeout(function () { setTimeout(function () {
exec("taskkill /im " + browser) exec("taskkill /im " + browser)
}, 1200) }, 1200)
break; break;
case 6: case 6:
default: default:
break; break;
}
} }
} </script>
</script>
</body> </body>
</html> </html>