mirror of
https://github.com/wassname/GarageServer.IO.git
synced 2026-09-09 11:14:19 +08:00
Progress: Client Updates
This commit is contained in:
@@ -15,11 +15,14 @@ window.GarageServerIO = (function (window, socketio) {
|
|||||||
// TODO: DONE CALLBACK
|
// TODO: DONE CALLBACK
|
||||||
connectToGarageServer = function (path, options) {
|
connectToGarageServer = function (path, options) {
|
||||||
socket = io.connect(path + '/garageserver.io');
|
socket = io.connect(path + '/garageserver.io');
|
||||||
registerSocketEvents();
|
registerSocketEvents(options);
|
||||||
},
|
},
|
||||||
|
|
||||||
registerSocketEvents = function () {
|
registerSocketEvents = function (options) {
|
||||||
socket.on('update', function(data) {
|
socket.on('update', function(data) {
|
||||||
|
if(options.logging) {
|
||||||
|
console.log('garageserver.io:: socket update ' + ' ' + data.id + ' ' + data.state + ' ' + data.seq);
|
||||||
|
}
|
||||||
updatePlayerInput(data);
|
updatePlayerInput(data);
|
||||||
});
|
});
|
||||||
socket.on('ping', function(data) {
|
socket.on('ping', function(data) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
$(function () {
|
$(function () {
|
||||||
GarageServerIO.connectToGarageServer('http://garageserver_io.jbillmann.c9.io');
|
GarageServerIO.connectToGarageServer('http://garageserver_io.jbillmann.c9.io', { logging: true });
|
||||||
|
|
||||||
var gameCanvas = document.getElementById('gameCanvas'),
|
var gameCanvas = document.getElementById('gameCanvas'),
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user