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
2 changed files with 19 additions and 6 deletions
Showing only changes of commit f151a89ea4 - Show all commits

View File

@ -1,4 +1,4 @@
import javafx.scene.control.ToggleGroup; //import javafx.scene.control.ToggleGroup;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;

View File

@ -2,12 +2,14 @@ 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
Also die startMultiplayerGame muss JoinGame mit parametern für (HumanPlayer/AiEasy/AiNormal/AiHard, Semesteranzahl, Spielername) (3 Parameter) erhalten Also die startMultiplayerGame muss JoinGame mit parametern für (HumanPlayer/AiEasy/AiNormal/AiHard, Semesteranzahl, Spielername) (3 Parameter) erhalten
*/ */
public class JoinGame extends JPanel { public class JoinGame extends JPanel {
@ -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);
}
} }
} }
}); });
*/
} }
} }