mirror of
https://github.com/wassname/GarageServer.IO.git
synced 2026-10-02 11:50:38 +08:00
Minor cleanup...
This commit is contained in:
1 parent
2f0fe7a121
commit
8516041c8b
1 file changed
+11
-9
@@ -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