-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
37 lines (33 loc) · 1.56 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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- served by the server ( running on port 1337 here ) -->
<script src="http://localhost:1337/socket.io/socket.io.js"></script>
<!-- game code -->
<script type="text/javascript" src="src/gamelogic/card.js"></script>
<script type="text/javascript" src="src/gamelogic/deck.js"></script>
<script type="text/javascript" src="src/gamelogic/player.js"></script>
<script type="text/javascript" src="src/gamelogic/round.js"></script>
<script type="text/javascript" src="src/gamelogic/game.js"></script>
</head>
<body>
<script>
//connect to server
var socket = io.connect('http://localhost:1337');
var id = -1;
var name = "";
socket.on('connected', function () {
id = socket.socket.sessionid;
console.log( "Client " + id + " connected." );
});
socket.on( 'askUserInfo', function() {
name = prompt( "Enter your name", "User" + Math.round( ( Math.random()*1000000 ) ) );
if ( name === null ) {
name = "User" + Math.round( ( Math.random()*1000000 ) );
}
socket.emit( "userInfo", { name : name } );
});
</script>
</body>
</html>