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,6 +2,8 @@ import java.awt.*;
import javax.swing.*; import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; 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 TODO: evtl an Lucas: die "JoinGame" muss noch informationen erhalten, welche Spieler erstellt wurden und welches Semester
@ -60,19 +62,30 @@ public class JoinGame extends JPanel {
backButton.addActionListener(e -> frame.showPanel("MultiplayerGame")); backButton.addActionListener(e -> frame.showPanel("MultiplayerGame"));
losButton.addActionListener(e -> frame.showPanel("Verbinden")); losButton.addActionListener(e -> frame.showPanel("Verbinden"));
/*
losButton.addActionListener(new ActionListener() { losButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { 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"); frame.showPanel("Verbinden");
//public static void startOnlineGame(Class<? extends LocalPlayer> localPlayerClass, String localPlayerName, InetSocketAddress //public static void startOnlineGame(Class<? extends LocalPlayer> localPlayerClass, String localPlayerName, InetSocketAddress
// address, int size) throws IOException { // address, int size) throws IOException {
if(playerType == 1) { //Beispiel (für playertape wäre z.B. 1 humanPlayer etc.) if(true) { //Beispiel (für playertape wäre z.B. 1 humanPlayer etc.)
GameController.startOnlineGame(HumanPlayer.class, playerName, adress); // try {
GameController.startOnlineGame(HumanPlayer.class, "TollerTest", address,GameController.semesterToBoardSize(2)); //
} catch (IOException ex) {
throw new RuntimeException(ex);
}
} }
} }
}); });
*/
} }
} }