Skip to content
This repository has been archived by the owner on Sep 3, 2022. It is now read-only.

Commit

Permalink
Basic Structure
Browse files Browse the repository at this point in the history
Implemented a basic server structure
  • Loading branch information
chutch1122 committed Apr 11, 2016
1 parent 20c70ac commit 90882fe
Show file tree
Hide file tree
Showing 11 changed files with 92 additions and 0 deletions.
Empty file added app/controllers/.gitkeep
Empty file.
Empty file added app/factories/.gitkeep
Empty file.
20 changes: 20 additions & 0 deletions app/factories/LobbyFactory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
function LobbyFactory(){

return {
createLobby: createLobby
}

function createLobby(name){
var lobby;

lobby = {
name: name || "",
hostSettings: [],
playerSettings: []
};

return lobby;
}
}

module.exports = LobbyFactory();
Empty file added app/models/.gitkeep
Empty file.
Empty file added app/services/.gitkeep
Empty file.
18 changes: 18 additions & 0 deletions app/services/ClientManagerService.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
function ClientManagerService(){
var clients = [];

return {
connected: connected,
disconnected: disconnected,
};

function connected(client){
clients.push(client);
}

function disconnected(client){
clients.splice(clients.indexOf(client), 1);
}
}

module.exports = ClientManagerService();
Empty file added config/.gitkeep
Empty file.
17 changes: 17 additions & 0 deletions config/gamemodes.example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"gameModes": {
"LeagueSandbox-Default": [
"Dev",
"1.0.2",
"1.0.1",
"1.0.0"
],
"Mythic-Dev": [
"Dev"
],
"SomeGuy-SomeMode": [
"0.0.2",
"0.0.1"
]
}
}
19 changes: 19 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "lobby-server",
"version": "1.0.0",
"description": "League Sandbox Lobby Server",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/LeagueSandbox/LobbyServer.git"
},
"author": "League Sandbox",
"license": "GPL-3.0",
"bugs": {
"url": "https://github.com/LeagueSandbox/LobbyServer/issues"
},
"homepage": "https://github.com/LeagueSandbox/LobbyServer#readme"
}
18 changes: 18 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
var port = 9090;
var io = require('socket.io')(port);
var ClientManagerService = require('./app/services/ClientManagerService');

console.log("League Sandbox Lobby Server");
console.log("---------------------------");
console.log("Listening on port " + port);


io.on('connection', function(client){
console.log("Client connected");
ClientManagerService.connected(client);

client.on('disconnect', function(){
console.log("Client disconnected");
ClientManagerService.disconnected(client);
});
});
Empty file added tests/.gitkeep
Empty file.

0 comments on commit 90882fe

Please sign in to comment.