Server Coments
This commit is contained in:
@@ -404,6 +404,7 @@ public class MainGame extends Game implements ClientCallback {
|
||||
}
|
||||
} else if (data instanceof MoveData) {
|
||||
MoveData moveData = (MoveData) data;
|
||||
System.out.println(moveData);
|
||||
if (moveData.getUsername().equals(this.username)) {
|
||||
moveData.getTile().visit(team.get(moveData.getCharacterName()));
|
||||
} else {
|
||||
|
||||
@@ -1,32 +1,15 @@
|
||||
package netwerkprog.game.server;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class Server {
|
||||
private Thread sessionThread;
|
||||
private HashMap<String, Thread> gameThreads;
|
||||
|
||||
public void start() {
|
||||
SessionController sessionController = new SessionController();
|
||||
|
||||
this.gameThreads = new HashMap<>();
|
||||
this.sessionThread = new Thread(sessionController);
|
||||
|
||||
run();
|
||||
}
|
||||
|
||||
private void run() {
|
||||
setTestGames();
|
||||
this.sessionThread.start();
|
||||
}
|
||||
|
||||
private void setTestGames() {
|
||||
// for (int i = 0; i < 10; i++) {
|
||||
// gameThreads.put("game " + i, new Thread(new GameController(i)));
|
||||
// }
|
||||
//
|
||||
// for (String game : gameThreads.keySet()) {
|
||||
// gameThreads.get(game).start();
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user