start game stuff - both online and offline #13

Merged
lgc merged 24 commits from start-game into main 2024-12-13 16:27:43 +00:00
1 changed files with 8 additions and 3 deletions
Showing only changes of commit 9ff0958fbc - Show all commits

View File

@ -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
}