This repository has been archived by the owner on Aug 9, 2018. It is now read-only.
forked from Litarvan/ClientServer
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathServerLogic.js
56 lines (45 loc) · 1.5 KB
/
ServerLogic.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
var NetworkManager = require('./NetworkManager');
var GamesNetworkManager = require('./GamesNetworkManager');
var LobbyManager = require('./LobbyManager');
var Utility = require('./Utility/Utility');
const bcrypt = require('bcrypt');
const mysql = require('mysql');
const cors = require('cors');
var CreateFunction = Utility.CreateFunction;
var mysqlSettings = {
host: "",
user: "",
password: "",
database: ""
}
function ServerLogic() {
this.networkManager = new NetworkManager(this);
this.lobbyManager = new LobbyManager(this);
this.gamesNetworkManager = new GamesNetworkManager(this);
this.gameServerRepositories = ["LeagueSandbox"];
this.gameServers = [{ repository: "LeagueSandbox", branch: "indev" }, { repository: "LeagueSandbox", branch: "master" }];
this.totalLaunchedGameServers = 0;
this.runningGames = [];
}
ServerLogic.prototype.login = function (nickname, password, callback) {
callback(true);
}
ServerLogic.prototype.checkKey = function (key) {
if (key == "9FEHOONMdwwk24K6") {
console.log("correct key");
return "vip2";
}
if (key == "rSFrIBLzbvvkRQSF") {
console.log("correct key2");
return "dev";
}
return "none";
}
ServerLogic.prototype.startGameServer = function (repository, branch, gameJSON, lobbyID) {
this.gamesNetworkManager.orderGameStart(JSON.stringify(JSON.stringify(gameJSON)), lobbyID)
}
function RunningGame() {
var id = -1;
var gameExec = null;
}
var serverInstance = new ServerLogic();