start game in frontend
This commit is contained in:
parent
6118d480d9
commit
9ff0958fbc
|
@ -25,6 +25,9 @@ public class GameController {
|
|||
public static int semesterToBoardSize(int semester) {
|
||||
return semester + 13;
|
||||
}
|
||||
public static int boardSizeToSemester(int size) {
|
||||
return size - 13;
|
||||
}
|
||||
|
||||
public static HashMap<String, Class<? extends OnlinePlayer>> supportedVersions = new HashMap<>(Map.of(
|
||||
"1.1.0", OnlinePlayer_1_1_0.class
|
||||
|
@ -93,7 +96,7 @@ public class GameController {
|
|||
localPlayer.isServer = localPlayerIsServer;
|
||||
onlinePlayer.isServer = !localPlayerIsServer;
|
||||
|
||||
startGameWithInstancedPlayers(localPlayer, onlinePlayer);
|
||||
startGameWithInstancedPlayers(localPlayer, onlinePlayer, size);
|
||||
|
||||
} else {
|
||||
throw new RuntimeException("Unexpected Package received before game initialisation");
|
||||
|
@ -178,13 +181,15 @@ public class GameController {
|
|||
localPlayer.createBoard(size);
|
||||
aiPlayer.createBoard(size);
|
||||
|
||||
startGameWithInstancedPlayers(localPlayer, aiPlayer);
|
||||
startGameWithInstancedPlayers(localPlayer, aiPlayer, size);
|
||||
}
|
||||
|
||||
private static void startGameWithInstancedPlayers(LocalPlayer p1, Player p2) {
|
||||
private static void startGameWithInstancedPlayers(LocalPlayer p1, Player p2, int boardSize) {
|
||||
p1.setEnemy(p2);
|
||||
p2.setEnemy(p1);
|
||||
|
||||
mainFrame.showPanelSLG("GameBoard", boardSizeToSemester(boardSize), p1, p2);
|
||||
|
||||
// TODO: frontend configuration
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue