mirror of
https://github.com/wassname/GarageServer.IO.git
synced 2026-07-11 00:30:08 +08:00
Minor cleanup...
This commit is contained in:
@@ -19,35 +19,37 @@ GarageServer.prototype.registerSocketEvents = function (options) {
|
||||
});
|
||||
|
||||
socket.on('input', function (input) {
|
||||
self.onPlayerInput(socket, options);
|
||||
console.log('garageserver.io:: socket input');
|
||||
self.onPlayerInput(socket, input, options);
|
||||
});
|
||||
|
||||
socket.on('ping', function () {
|
||||
console.log('garageserver.io:: socket ping');
|
||||
self.onPlayerInput(socket, options);
|
||||
});
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
GarageServer.prototype.onPlayerConnect = function (socket, callback) {
|
||||
GarageServer.prototype.onPlayerConnect = function (socket, options) {
|
||||
this.game.addPlayer(socket);
|
||||
if(callback.onPlayerConnect) {
|
||||
callback(socket);
|
||||
if(options.onPlayerConnect) {
|
||||
options(socket);
|
||||
}
|
||||
};
|
||||
|
||||
GarageServer.prototype.onPlayerDisconnect = function (socket, callback) {
|
||||
GarageServer.prototype.onPlayerDisconnect = function (socket, options) {
|
||||
this.game.removePlayer(socket);
|
||||
if(callback.onPlayerDisconnect) {
|
||||
callback(socket);
|
||||
if(options.onPlayerDisconnect) {
|
||||
options(socket);
|
||||
}
|
||||
};
|
||||
|
||||
GarageServer.prototype.onPlayerInput = function (socket, input, callback) {
|
||||
GarageServer.prototype.onPlayerInput = function (socket, input, options) {
|
||||
|
||||
};
|
||||
|
||||
GarageServer.prototype.onPing = function(socket, callback) {
|
||||
GarageServer.prototype.onPing = function(socket, options) {
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user