mirror of
https://github.com/wassname/GarageServer.IO.git
synced 2026-08-11 11:12:33 +08:00
Progress...
This commit is contained in:
@@ -1,19 +1,35 @@
|
||||
function GarageServer (io) {
|
||||
this.io = io;
|
||||
var garageServerGame = require('./garageservergame');
|
||||
|
||||
function GarageServer (socketio, options) {
|
||||
this.io = socketio;
|
||||
this.registerSocketEvents(this.io);
|
||||
this.game = new garageServerGame.createGame(options);
|
||||
}
|
||||
|
||||
GarageServer.prototype.PlayerConnect = function (callback) {
|
||||
this.io.sockets.on('connection', function (socket) {
|
||||
callback(socket);
|
||||
});
|
||||
GarageServer.prototype.registerSocketEvents = function () {
|
||||
this.io.of('/garageserver.io').on('connection', function (socket) {
|
||||
this.onPlayerConnect(socket);
|
||||
}.bind(this));
|
||||
|
||||
this.io.of('/garageserver.io').on('disconnect', function (socket) {
|
||||
this.onPlayerDisconnect(socket);
|
||||
}.bind(this));
|
||||
|
||||
this.io.of('/garageserver.io').on('input', function (socket) {
|
||||
this.onPlayerInput(socket);
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
GarageServer.prototype.PlayerDisconnect = function (callback) {
|
||||
this.io.sockets.on('connection', function (socket) {
|
||||
callback(socket);
|
||||
});
|
||||
GarageServer.prototype.onPlayerConnect = function (socket, callback) {
|
||||
|
||||
};
|
||||
|
||||
exports.createGameServer = function (io, options){
|
||||
return new GarageServer(io);
|
||||
GarageServer.prototype.onPlayerDisconnect = function (socket, callback) {
|
||||
};
|
||||
|
||||
GarageServer.prototype.onPlayerInput = function (socket, callback) {
|
||||
};
|
||||
|
||||
exports.createGarageServer = function (io, options){
|
||||
return new GarageServer(io, options);
|
||||
};
|
||||
@@ -0,0 +1,11 @@
|
||||
function GarageServerGame (options) {
|
||||
|
||||
}
|
||||
|
||||
GarageServerGame.prototype.update = function () {
|
||||
|
||||
};
|
||||
|
||||
exports.createGame = function (options){
|
||||
return new GarageServerGame(options);
|
||||
};
|
||||
Reference in New Issue
Block a user