JoinGame now calls GameController.startOnlineGame(...) correctly.

This commit is contained in:
Joshua 2024-12-23 18:35:22 +01:00
parent 529178f4db
commit 3ad7233383
3 changed files with 9 additions and 9 deletions

View File

@ -42,9 +42,9 @@ public class JoinGame extends JPanel {
* @param playerName Name des Spielers
* @author Lucas Bronson, Joshua Kuklok
*/
public JoinGame(MainFrame frame,int g,int playerType,String playerName) {
public JoinGame(MainFrame frame,int g,int playerType,String playerName, int semesterCounter) {
setLayout(null);
buildPanel(frame,g,playerType,playerName);
buildPanel(frame,g,playerType,playerName, semesterCounter);
}
/**
@ -55,7 +55,7 @@ public class JoinGame extends JPanel {
* @param playerName Name des Spielers
* @author Lucas Bronson, Joshua Kuklok
*/
private void buildPanel(MainFrame frame,int g,int playerType,String playerName) {
private void buildPanel(MainFrame frame,int g,int playerType,String playerName, int semesterCounter) {
if(g==1){
spielBeitretenLabel= new JLabel("Spiel beitreten");
}else{
@ -114,13 +114,13 @@ public class JoinGame extends JPanel {
try {
if(playerType == 0) {
GameController.startOnlineGame(HumanPlayer.class, playerName, address,GameController.semesterToBoardSize(2));
GameController.startOnlineGame(HumanPlayer.class, playerName, address,GameController.semesterToBoardSize(semesterCounter));
} else if(playerType == 1) {
GameController.startOnlineGame(SpecificAiPlayerEasy.class, playerName, address,GameController.semesterToBoardSize(2));
GameController.startOnlineGame(SpecificAiPlayerEasy.class, playerName, address,GameController.semesterToBoardSize(semesterCounter));
} else if (playerType == 2) {
GameController.startOnlineGame(SpecificAiPlayerMedium.class, playerName, address,GameController.semesterToBoardSize(2));
GameController.startOnlineGame(SpecificAiPlayerMedium.class, playerName, address,GameController.semesterToBoardSize(semesterCounter));
} else if (playerType == 3) {
GameController.startOnlineGame(SpecificAiPlayerHard.class, playerName, address,GameController.semesterToBoardSize(2));
GameController.startOnlineGame(SpecificAiPlayerHard.class, playerName, address,GameController.semesterToBoardSize(semesterCounter));
}
} catch (IOException ex) {
throw new RuntimeException(ex);

View File

@ -83,7 +83,7 @@ public class MainFrame extends JFrame {
public void showPanelSMG(String panelName, int num, int playerType,String playerName) {
this.localMult = num;
JoinGame joinGame = new JoinGame(this, localMult, playerType, playerName);
JoinGame joinGame = new JoinGame(this, localMult, playerType, playerName, semesterCounter);
mainPanel.add(joinGame, panelName);
mainPanel.revalidate();
mainPanel.repaint();

View File

@ -7,7 +7,7 @@ import java.util.HashMap;
/**
* Das startLocalGame Panel dient dem Erstellen eines lokalen Spiels.
* Hier kann der Benutzer Spieler inklusive Namen und das Semester, in dem sich der Benutzer befindet, einstellen.
* @author Lucas Bronson, Joshua Kuklok
* @author Lucas Bronson, Joshua Kuklok, Luca Conte
*/
public class startLocalGame extends JPanel {
// Player