-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnavigation.js
More file actions
101 lines (81 loc) · 2.01 KB
/
navigation.js
File metadata and controls
101 lines (81 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
var user = { userName: "p", password: "p", firstName: "p", lastName: "p", email: "p@gmail.com", date: "2020-01-01" }
var allUsers = [];
allUsers.push(user);
var currentSection= "#welcome";
var gaming= false;
function gameFunc() {
gaming= true;
$(currentSection).hide();
currentSection="#mainGame";
$(currentSection).show();
Start();
}
function loginForm() {
if(gaming){
exitGame();
gaming=false;
}
$(currentSection).hide();
currentSection= "#login";
$(currentSection).show();
}
function signupForm() {
if(gaming){
exitGame();
gaming=false;
}
$(currentSection).hide();
currentSection ="#signup";
$(currentSection).show();
}
function welcome() {
if(gaming){
exitGame();
gaming=false;
}
$(currentSection).hide();
currentSection= "#welcome";
$(currentSection).show();
}
function settings() {
if(gaming){
exitGame();
gaming=false;
}
$("#rightButtonCode").css("color", "black");
$("#leftButtonCode").css("color", "black");
$("#upButtonCode").css("color", "black");
$("#downButtonCode").css("color", "black");
$(currentSection).hide();
currentSection= "#settings";
$(currentSection).show();
}
function play() {
var label = document.getElementById("connected");
if(label.textContent== "welcome guest"){
alert("Please login first");
}
else{
alert("You start the game! \n break a leg!");
settings();
}
}
function aboutForm() {
$("#about").show();
var modal = document.getElementById("about");
// When the user clicks anywhere outside of the modal, close it
window.onclick = function (event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
addEventListener('keyup', function (event) {
if (event.keyCode == 27) {
closeAbout();
}
})
}
function closeAbout() {
var modal = document.getElementById("about");
modal.style.display = "none";
}