forked from DanielaLevezinho/Chess
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
212 lines (194 loc) · 7.61 KB
/
index.html
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="styling.css">
<script src="https://kit.fontawesome.com/8d9214c896.js" crossorigin="anonymous"></script>
<script src="./lib/colyseus.js"></script>
<script src="./lib/js-chess-engine.js"></script>
<script src="game.js"></script>
<script src="board.js"></script>
<script src="manager.js"></script>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"
integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
crossorigin="anonymous"></script>
<title>Chess</title>
</head>
<body>
<div id="login" class="modal" tabindex="-1" role="dialog" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header modalpop">
<h5 class="modal-title">Login</h5>
</div>
<div class="modal-body">
<div class='form-uname'>
<label id='nameLable' for='nameField'>Create a username:</label>
<input id='nameField' type='text' maxlength='25' value="Guest"></input>
</div>
<div class='form-sub'>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" onclick="loginModalAction()">Next</button>
</div>
</div>
</div>
</div>
<section id="menuStart">
Select Game Mode
<div class="divGameModes">
<button class="gameMode" id="online" onclick="joinRoomOnline()">
<img class="gameModeImg" src="images/checkmate.svg">
vs Online
</button>
<button class="gameMode" id="offline" onclick="playComputer()">
<img class="gameModeImg" src="images/pc.svg">
vs Computer
</button>
</div>
</section>
<div id="popup" class="modal" tabindex="-1" role="dialog" data-backdrop="static">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header modalpop">
<h5 class="modal-title">Chess</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<p id="modalTexto"></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" onclick="modalAction()">New Game</button>
</div>
</div>
</div>
</div>
<div id="waitForOpponent" class="modal" tabindex="-1" role="dialog" data-backdrop="static">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header modalpop">
<h5 class="modal-title">Chess</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<p id="modalTexto">Waiting for opponent to connect</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" onclick="goToMenu()">Go Back To Menu</button>
</div>
</div>
</div>
</div>
<div id="requestNewGame" class="modal" tabindex="-1" role="dialog" data-backdrop="static">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header modalpop">
<h5 class="modal-title">Chess</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<p id="modalTextoRequest">Waiting for opponent to respond</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" onclick="goToMenu()">Go Back To Menu</button>
<button type="button" class="btn btn-primary" onclick="closeRequestModal()">Ok</button>
</div>
</div>
</div>
</div>
<div id="requestNewGameAnswer" class="modal" tabindex="-1" role="dialog" data-backdrop="static">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header modalpop">
<h5 class="modal-title">Chess</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<p id="modalTextoRequest">Your opponent requested to restart the game.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" onclick="game.answerNewGameRequest(true)">Accept</button>
<button type="button" class="btn btn-primary" onclick="game.answerNewGameRequest(false)">Refuse</button>
</div>
</div>
</div>
</div>
<section id="gameSection">
<div id="canvasDiv">
<canvas id="canvas" width="800" height="800">
</canvas>
</div>
<div id="gameMenu">
<div id="playerBlack" class="users">
<img class="gamePanelImg" src="images/pc.svg">
<span id="playerBlackName">
</span>
</div>
<div class="buttonsMenu">
<button id="restartGame" onclick="game.requestNewGame()">
<i class="fas fa-redo"></i>
Restart Game
</button>
<button id="goMenu" onclick="goToMenu()">
<i class="fas fa-list"></i>
Go back to Menu
</button>
</div>
<div id="playerWhite" class="users">
<img class="gamePanelImg" src="images/man.svg">
<span id="playerWhiteName">
</span>
</div>
</div>
</section>
<section id="chooseDifficulty">
<div class="pickDif">
<div class="text">
Select Difficulty
</div>
<button class="buttonDif" id="easy" onclick="changeDifficulty(0)">
<i class="fas fa-star" style="font-size: 14px; color: rgba(255,255,255,0.8); margin-right: 10px;"></i>
Easy
</button>
<button class="buttonDif" id="medium" onclick="changeDifficulty(1)">
<i class="fas fa-star" style="font-size: 18px; color: rgba(255,255,255,0.8); margin-right: 10px;"></i>
Medium
</button>
<button class="buttonDif" id="hard" onclick="changeDifficulty(2)">
<i class="fas fa-star" style="font-size: 22px; color: rgba(255,255,255,0.8); margin-right: 10px;"></i>
Hard
</button>
<button class="buttonDif" id="expert" onclick="changeDifficulty(3)">
<i class="fas fa-star" style="font-size: 26px; color: rgba(255,255,255,0.8); margin-right: 10px;"></i>
Expert
</button>
<div class="divPlay">
<button id="play" onclick="startGame()">
<i class="fas fa-play" class="buttonDisabled"
style="font-size: 26px; color: inherit; margin-right: 10px;"></i></i>
Play
</button>
</div>
</div>
</section>
<script>
window.onload = main();
</script>
</body>
</html>