(function(global, undef) {
	$(function() {
		window.snake = new Snake;
		snake.config({
			containerId: 'hehe'
		});

		snake.init();

		var socket = io.connect('http://172.16.121.205:5566');
		//初始化房间信息
		socket.on('open', function(data) {
			console.log(data.roomstatus);
			console.log(data.id + ' is in the room');
		});

		socket.on('system', function(json) {
			if (json.type === 'new') {
				socket.emit('status', function(data) {
					var users = [];
					for (var i in data) {
                        var user = data[i];
                        console.log(user.head);
						users.push({
							name: user.id,
							head: user.head
						});
					}
					snake.addPlayers(users);
				});
			}
			if (json.type === 'disconnect') {
				console.log('id ' + json.data + ' is out');
			}
			if (json.type == 'top') {
				snake.setDirection(snake.players[json.id], 'up');
			}
			if (json.type == 'right') {
				snake.setDirection(snake.players[json.id], 'right');
			}
			if (json.type == 'down') {
				snake.setDirection(snake.players[json.id], 'down');
			}
			if (json.type == 'left') {
				snake.setDirection(snake.players[json.id], 'left');
			}
		});
	});
})(this);


@@ -105,24 +105,46 @@
 'hehe'%0A%09%09%7D);
+%0A        var serverid;
 %0A%0A%09%09snake.in
@@ -449,24 +449,67 @@
 ion(data) %7B%0A
+                    delete data%5Bserverid%5D;%0A
 %09%09%09%09%09var use

fix serverid