mirror of
https://github.com/wassname/GarageServer.IO.git
synced 2026-09-09 11:14:19 +08:00
Progress: Server loops & player input;
This commit is contained in:
@@ -27,26 +27,28 @@ GarageServer.prototype.registerSocketEvents = function (options) {
|
||||
console.log('garageserver.io:: socket ping');
|
||||
self.onPlayerInput(socket, options);
|
||||
});
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
GarageServer.prototype.onPlayerConnect = function (socket, options) {
|
||||
this.game.addPlayer(socket);
|
||||
if(options.onPlayerConnect) {
|
||||
options(socket);
|
||||
options.onPlayerConnect(socket);
|
||||
}
|
||||
};
|
||||
|
||||
GarageServer.prototype.onPlayerDisconnect = function (socket, options) {
|
||||
this.game.removePlayer(socket);
|
||||
if(options.onPlayerDisconnect) {
|
||||
options(socket);
|
||||
options.onPlayerDisconnect(socket);
|
||||
}
|
||||
};
|
||||
|
||||
GarageServer.prototype.onPlayerInput = function (socket, input, options) {
|
||||
|
||||
this.game.addPlayerInput(socket, input);
|
||||
if(options.onPlayerInput) {
|
||||
options.onPlayerInput(socket, input);
|
||||
}
|
||||
};
|
||||
|
||||
GarageServer.prototype.onPing = function(socket, options) {
|
||||
|
||||
Reference in New Issue
Block a user