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 18 additions and 5 deletions
Showing only changes of commit 9ab97b5f0c - Show all commits

View File

@ -2,12 +2,14 @@ import java.awt.*;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.net.InetSocketAddress;
/*
TODO: evtl an Lucas: die "JoinGame" muss noch informationen erhalten, welche Spieler erstellt wurden und welches Semester
Also die startMultiplayerGame muss JoinGame mit parametern für (HumanPlayer/AiEasy/AiNormal/AiHard, Semesteranzahl, Spielername) (3 Parameter) erhalten
*/
*/
public class JoinGame extends JPanel {
@ -60,19 +62,30 @@ public class JoinGame extends JPanel {
backButton.addActionListener(e -> frame.showPanel("MultiplayerGame"));
losButton.addActionListener(e -> frame.showPanel("Verbinden"));
/*
losButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String ipAddress = ipTextField.getText();
String portText = portTextField.getText();
int port = Integer.parseInt(portText);
InetSocketAddress address = new InetSocketAddress(ipAddress, port);
frame.showPanel("Verbinden");
//public static void startOnlineGame(Class<? extends LocalPlayer> localPlayerClass, String localPlayerName, InetSocketAddress
// address, int size) throws IOException {
if(playerType == 1) { //Beispiel (für playertape wäre z.B. 1 humanPlayer etc.)
GameController.startOnlineGame(HumanPlayer.class, playerName, adress); //
if(true) { //Beispiel (für playertape wäre z.B. 1 humanPlayer etc.)
try {
GameController.startOnlineGame(HumanPlayer.class, "TollerTest", address,GameController.semesterToBoardSize(2)); //
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
}
});
*/
}
}