Merge branch 'lucasjoshua' into wip-fix-ai-players
This commit is contained in:
commit
be6b50739f
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 396 B |
|
@ -66,7 +66,7 @@ public class Board {
|
|||
* @param semester the semester to be played in
|
||||
*/
|
||||
private void createShip(int semester){
|
||||
List<ShipData> shipData = Ship.semeterList.get(semester -1);
|
||||
List<ShipData> shipData = Ship.semeterList.get(semester);
|
||||
for (int i = 0; i < shipData.size(); i++) {
|
||||
this.ships.add(new Ship(shipData.get(i).size(), shipData.get(i).name()));
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ public class BoardDisplay extends JPanel {
|
|||
|
||||
/**
|
||||
* Fügt Buttons zu Liste hinzu und aktualisiert Feld durch Aufruf von paintFields
|
||||
* @param button
|
||||
* @param button Jeweiliger Button der hinzugefügt werden soll
|
||||
* @author Joshua Kuklok
|
||||
*/
|
||||
public void addShipButton(ShipButton button) {
|
||||
|
@ -31,8 +31,8 @@ public class BoardDisplay extends JPanel {
|
|||
|
||||
/**
|
||||
* Gibt currentShip zurück
|
||||
* @return currentShip
|
||||
* @author Lucas Bronson, Luca Conte, Joshua Kuklok
|
||||
* @return currentShip Objekt der Klasse Schiff
|
||||
* @author Lucas Bronson Luca Conte
|
||||
*/
|
||||
public Ship getCurrentShip() {
|
||||
return currentShip;
|
||||
|
@ -55,8 +55,8 @@ public class BoardDisplay extends JPanel {
|
|||
// Erstellung vom Spielfeld
|
||||
for (int i = 0; i <= gridSize; i++) {
|
||||
for (int j = 0; j <= gridSize; j++) {
|
||||
final int x = j - 1; // Temporäre Variable
|
||||
final int y = i - 1; // Temporäre Variable
|
||||
final int x = j - 1; // Temporäre Variable für überspringen von Rahmenzeile-/spalte
|
||||
final int y = i - 1; // Temporäre Variable für überspringen von Rahmenzeile-/spalte
|
||||
if (i == 0 && j == 0) {
|
||||
add(new JLabel(" "));
|
||||
} else if (i == 0) {
|
||||
|
@ -67,7 +67,7 @@ public class BoardDisplay extends JPanel {
|
|||
} else if (j == 0) {
|
||||
JLabel rowLabel = new JLabel(String.valueOf((char) ('A' + i - 1)));
|
||||
rowLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
rowLabel.setFont(new Font("Arial", Font.BOLD, 14));
|
||||
rowLabel.setFont(new Font("Roboto", Font.BOLD, 14));
|
||||
add(rowLabel);
|
||||
} else {
|
||||
// Spielfeld (interaktive Zellen)
|
||||
|
@ -211,7 +211,7 @@ public class BoardDisplay extends JPanel {
|
|||
}
|
||||
for(Ship ship: player.getBoard().getShips()) {
|
||||
if(ship.isShipOnPos(new Point(i,j))) {
|
||||
fields[i][j].setBackground(Color.LIGHT_GRAY);
|
||||
fields[i][j].setBackground(Color.WHITE);
|
||||
}
|
||||
}
|
||||
HitResponse hit = this.player.getBoard().getHitResponseOnPoint(new Point(i, j));
|
||||
|
|
|
@ -40,6 +40,7 @@ public class GameBoard extends JPanel {
|
|||
// Buttons
|
||||
JButton giveUpButton = new JButton("Aufgeben");
|
||||
|
||||
|
||||
/**
|
||||
* Konstruktor von GameBoard.
|
||||
* @param frame Der Mainframe der Anwendung über den alle Panels angezeigt werden.
|
||||
|
@ -136,7 +137,6 @@ public class GameBoard extends JPanel {
|
|||
opponentBoardPanel.addShipButton(shipButton);
|
||||
shipButton.setEnabled(false);
|
||||
}
|
||||
|
||||
JToggleButton readyButton = new JToggleButton("Bereit");
|
||||
readyButton.setBackground(Color.GREEN);
|
||||
rightButtonsPanel.add(readyButton);
|
||||
|
@ -159,6 +159,10 @@ public class GameBoard extends JPanel {
|
|||
kontextText.setText(kT2);
|
||||
p1.ready();
|
||||
if(true) {
|
||||
remove(readyButton);
|
||||
remove(resetButton);
|
||||
remove(rightButtonsPanel);
|
||||
remove(leftButtonsPanel);
|
||||
readyButton.setEnabled(false);
|
||||
resetButton.setEnabled(false);
|
||||
}
|
||||
|
@ -201,11 +205,14 @@ public class GameBoard extends JPanel {
|
|||
|
||||
/**
|
||||
* Aktualisiert Zustand(kontextText) je nach Zug
|
||||
* @author Luca Conte
|
||||
* @author Luca Conte, Joshua Kuklok
|
||||
*/
|
||||
public void refresh() {
|
||||
if (this.p1.myTurn) {
|
||||
this.kontextText.setText(kT5);
|
||||
if (!kontextText.getText().equals(kT5)) {
|
||||
this.kontextText.setText(kT5);
|
||||
SoundHandler.playSound("yourturn");
|
||||
}
|
||||
} else {
|
||||
this.kontextText.setText(kT6);
|
||||
}
|
||||
|
|
|
@ -12,6 +12,9 @@ import java.net.InetSocketAddress;
|
|||
*/
|
||||
public class JoinGame extends JPanel {
|
||||
|
||||
// Funktionshilfen
|
||||
String standardPort = "1234";
|
||||
|
||||
// Grafiken
|
||||
ImageIcon backButtonIcon = new ImageIcon("graphics/backButton.png");
|
||||
|
||||
|
@ -39,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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -52,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{
|
||||
|
@ -71,6 +74,7 @@ public class JoinGame extends JPanel {
|
|||
}
|
||||
|
||||
portTextField.setBounds(50, 225, 250, 50);
|
||||
portTextField.setText(standardPort);
|
||||
|
||||
spielBeitretenLabel.setFont(robotoFont.deriveFont(50f));
|
||||
|
||||
|
@ -100,6 +104,7 @@ public class JoinGame extends JPanel {
|
|||
if (ipAddress.isEmpty()) {
|
||||
ipAddress = "0.0.0.0";
|
||||
}
|
||||
System.out.println(portTextField.getText());
|
||||
String portText = portTextField.getText();
|
||||
|
||||
int port = Integer.parseInt(portText);
|
||||
|
@ -109,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);
|
||||
|
|
|
@ -29,7 +29,7 @@ public class LocalPlayer extends Player {
|
|||
switch (hitResponse.getType()) {
|
||||
case HIT, SUNK -> this.myTurn = false;
|
||||
case MISS -> this.myTurn = true;
|
||||
case VICTORY -> GameController.getMainFrame().showPanelLoose("", this); //TODO Was halt bei victory passiert ist hier wurder verloheren
|
||||
case VICTORY -> GameController.getMainFrame().showPanelLose("", this); //TODO Was halt bei victory passiert ist hier wurder verloheren
|
||||
}
|
||||
GameController.getMainFrame().refreshGameBoard();
|
||||
}
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Klasse für Erstellung von looseScreen Objekten
|
||||
* Dient zur Anzeige das ein Spiel verloren wurde
|
||||
*/
|
||||
public class LooseScreen extends JPanel {
|
||||
JLabel looseLabel = new JLabel("Du hast Verloren");
|
||||
JButton okButton = new JButton("Zurück zum Hauptmenü");
|
||||
Font robotoFont = new Font("Roboto", Font.BOLD, 45);
|
||||
|
||||
/**
|
||||
* Konstruktor der LooseScreen Klasse
|
||||
* @param frame Der Mainframe der Anwendung über den alle Panels angezeigt werden.
|
||||
* @author Lucas Bronson
|
||||
*/
|
||||
public LooseScreen(MainFrame frame) {
|
||||
setLayout(new BorderLayout());
|
||||
buildPanel(frame);
|
||||
}
|
||||
|
||||
/**
|
||||
* Panel bauen/Objekte hinzufügen
|
||||
* @param frame Der Mainframe der Anwendung über den alle Panels angezeigt werden.
|
||||
* @author Lucas Bronson
|
||||
*/
|
||||
public void buildPanel(MainFrame frame) {
|
||||
add(looseLabel);
|
||||
okButton.setBounds(650,525,200,50);
|
||||
looseLabel.setBounds(500,450,500,50);
|
||||
looseLabel.setFont(robotoFont);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Klasse für Erstellung von looseScreen Objekten
|
||||
* Dient zur Anzeige das ein Spiel verloren wurde
|
||||
*/
|
||||
public class LoseScreen extends JPanel {
|
||||
JLabel loseLabel = new JLabel("Du hast Verloren");
|
||||
JButton okButton = new JButton("Zurück zum Hauptmenü");
|
||||
Font robotoFont = new Font("Roboto", Font.BOLD, 45);
|
||||
|
||||
/**
|
||||
* Konstruktor der LoseScreen Klasse
|
||||
* @param frame Der Mainframe der Anwendung über den alle Panels angezeigt werden.
|
||||
* @author Lucas Bronson
|
||||
*/
|
||||
public LoseScreen(MainFrame frame) {
|
||||
setLayout(null);
|
||||
buildPanel(frame);
|
||||
}
|
||||
|
||||
/**
|
||||
* Panel bauen/Objekte hinzufügen
|
||||
* @param frame Der Mainframe der Anwendung über den alle Panels angezeigt werden.
|
||||
* @author Lucas Bronson, Joshua Kuklok
|
||||
*/
|
||||
public void buildPanel(MainFrame frame) {
|
||||
add(loseLabel);
|
||||
okButton.setBounds(625,525,200,50);
|
||||
loseLabel.setBounds(550,450,500,50);
|
||||
loseLabel.setFont(robotoFont);
|
||||
SoundHandler.playSound("loose");
|
||||
|
||||
// Zurückkehren zum Hauptmenü, wenn okButton gedrückt wird
|
||||
okButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
frame.showPanel("MainMenu");
|
||||
}
|
||||
});
|
||||
add(loseLabel);
|
||||
add(okButton);
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
|
@ -147,13 +147,13 @@ public class MainFrame extends JFrame {
|
|||
* @param player Player von dem die funktion aufgerufen worden ist
|
||||
* @author Lucas Bronson, Peer Ole Wachtel
|
||||
*/
|
||||
public void showPanelLoose(String panelName, Player player){
|
||||
public void showPanelLose(String panelName, Player player){
|
||||
if(player != gameBoard.getP1()){
|
||||
return;
|
||||
}
|
||||
this.gameBoard.getP1().destroy();
|
||||
this.gameBoard.getP2().destroy();
|
||||
LooseScreen looseScreen = new LooseScreen(this);
|
||||
LoseScreen looseScreen = new LoseScreen(this);
|
||||
mainPanel.add(looseScreen,panelName);
|
||||
mainPanel.revalidate();
|
||||
mainPanel.repaint();
|
||||
|
@ -170,4 +170,4 @@ public class MainFrame extends JFrame {
|
|||
}
|
||||
this.gameBoard.refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,9 @@ public class SoundHandler {
|
|||
"hit", "./Sound/hit.mp3",
|
||||
"destroyed", "./Sound/hit.mp3",
|
||||
"plop", "./Sound/plop.mp3",
|
||||
"loose", "./Sound/loosescreenWAH.mp3"
|
||||
"loose", "./Sound/loosescreenlaugh.mp3",
|
||||
"win", "./Sound/win.mp3",
|
||||
"yourturn", "./Sound/yourturn.mp3"
|
||||
));
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,7 +7,7 @@ import java.awt.*;
|
|||
*/
|
||||
public class Verbinden extends JPanel{
|
||||
|
||||
ImageIcon backButtonIcon = new ImageIcon("graphics/backButton.png");
|
||||
//ImageIcon backButtonIcon = new ImageIcon("graphics/backButton.png");
|
||||
|
||||
JLabel verbindenLabel = new JLabel("Verbinde . . .",SwingConstants.CENTER);
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ public class WinScreen extends JPanel {
|
|||
/**
|
||||
* Panel bauen/Objekte hinzufuegen
|
||||
* @param frame Der Mainframe der Anwendung über den alle Panels angezeigt werden.
|
||||
* @author Lucas Bronson
|
||||
* @author Lucas Bronson, Joshua Kuklok
|
||||
*/
|
||||
public void buildPanel(MainFrame frame) {
|
||||
Timer timer = new Timer(5, new ActionListener() {
|
||||
|
@ -50,13 +50,14 @@ public class WinScreen extends JPanel {
|
|||
timer.start(); // Timer starten
|
||||
winLabel.setFont(robotoFont);
|
||||
winLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
//Zurückkehren zum Hauptmenü, wenn okButton gedrückt wird
|
||||
SoundHandler.playSound("win");
|
||||
|
||||
// Zurückkehren zum Hauptmenü, wenn okButton gedrückt wird
|
||||
okButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
frame.showPanel("MainMenu");
|
||||
}
|
||||
|
||||
});
|
||||
add(winLabel);
|
||||
add(okButton);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.HashMap;
|
||||
|
@ -6,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
|
||||
|
@ -44,12 +45,12 @@ public class startLocalGame extends JPanel {
|
|||
JButton rightPlayerLeftButton = new JButton("<-");
|
||||
JButton rightPlayerRightButton = new JButton("->");
|
||||
JButton startButton = new JButton("Start!");
|
||||
JButton testButton = new JButton("Test");
|
||||
|
||||
// Textfelder
|
||||
JTextField leftPlayerTextField = new JTextField(20);
|
||||
JTextField rightPlayerTextField = new JTextField(20);
|
||||
|
||||
Font robotoFont = new Font("Roboto", Font.BOLD, 45);
|
||||
/**
|
||||
* Konstruktor der startLocalGame.
|
||||
* Fügt Buttons, Textfelder und Label hinzu.
|
||||
|
@ -63,7 +64,8 @@ public class startLocalGame extends JPanel {
|
|||
setLayout(null);
|
||||
|
||||
// Setze Komponentenpositionen
|
||||
frameTitle.setBounds(20, 20, 200, 30);
|
||||
frameTitle.setBounds(20, 20, 500, 60);
|
||||
frameTitle.setFont(robotoFont.deriveFont(50f));
|
||||
add(frameTitle);
|
||||
|
||||
semesterLabel.setBounds(700, 300, 200, 30);
|
||||
|
@ -81,13 +83,10 @@ public class startLocalGame extends JPanel {
|
|||
rightPlayerIcon.setBounds(1225, 400, 200, 128);
|
||||
add(rightPlayerIcon);
|
||||
|
||||
semesterCounterLabel.setBounds(725, 475, 50, 50);
|
||||
semesterCounterLabel.setBounds(705, 475, 50, 50);
|
||||
semesterCounterLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
add(semesterCounterLabel);
|
||||
|
||||
testButton.setBounds(500,800,50,50);
|
||||
add(testButton);
|
||||
|
||||
backButton.setBounds(1380, 20, 80, 80);
|
||||
add(backButton);
|
||||
|
||||
|
@ -97,10 +96,10 @@ public class startLocalGame extends JPanel {
|
|||
leftPlayerRightButton.setBounds(250, 450, 50, 50);
|
||||
add(leftPlayerRightButton);
|
||||
|
||||
semesterUpButton.setBounds(725, 400, 50, 50);
|
||||
semesterUpButton.setBounds(705, 400, 50, 50);
|
||||
add(semesterUpButton);
|
||||
|
||||
semesterDownButton.setBounds(725, 550, 50, 50);
|
||||
semesterDownButton.setBounds(705, 550, 50, 50);
|
||||
add(semesterDownButton);
|
||||
|
||||
rightPlayerLeftButton.setBounds(1200, 450, 50, 50);
|
||||
|
@ -196,14 +195,6 @@ public class startLocalGame extends JPanel {
|
|||
}
|
||||
});
|
||||
|
||||
// Um zum Gameboard zu wechseln.
|
||||
testButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
//frame.showPanelWin("WinPanel");
|
||||
}
|
||||
});
|
||||
|
||||
// Um zum startLocalGameLoadingScreen zu wechseln und Daten an Backend weiterzureichen.
|
||||
startButton.addActionListener(new ActionListener() {
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -225,41 +216,6 @@ public class startLocalGame extends JPanel {
|
|||
rightPlayerClass,
|
||||
GameController.semesterToBoardSize(semesterCounter)
|
||||
);
|
||||
|
||||
// if (leftPlayerIcon.getIcon() == humanPlayerIcon) {// TODO Wird name wirklich weitergegeben?
|
||||
// if (rightPlayerIcon.getIcon() == aiPlayerEasyIcon) {
|
||||
// GameController.startLocalGame(HumanPlayer.class, leftPlayerNickname, SpecificAiPlayerEasy.class, GameController.semesterToBoardSize(semesterCounter));
|
||||
// } else if (rightPlayerIcon.getIcon() == aiPlayerNormalIcon) {
|
||||
// GameController.startLocalGame(HumanPlayer.class, leftPlayerNickname, SpecificAiPlayerMedium.class, GameController.semesterToBoardSize(semesterCounter));
|
||||
// } else if (rightPlayerIcon.getIcon() == aiPlayerHardIcon) {
|
||||
// GameController.startLocalGame(HumanPlayer.class, leftPlayerNickname, SpecificAiPlayerHard.class, GameController.semesterToBoardSize(semesterCounter));
|
||||
// }
|
||||
// } else if (leftPlayerIcon.getIcon() == aiPlayerEasyIcon) {
|
||||
// if (rightPlayerIcon.getIcon() == aiPlayerEasyIcon) {
|
||||
// GameController.startLocalGame(SpecificAiPlayerEasy.class, leftPlayerNickname, SpecificAiPlayerEasy.class, GameController.semesterToBoardSize(semesterCounter));
|
||||
// } else if (rightPlayerIcon.getIcon() == aiPlayerNormalIcon) {
|
||||
// GameController.startLocalGame(SpecificAiPlayerEasy.class, leftPlayerNickname, SpecificAiPlayerMedium.class, GameController.semesterToBoardSize(semesterCounter));
|
||||
// } else if (rightPlayerIcon.getIcon() == aiPlayerHardIcon) {
|
||||
// GameController.startLocalGame(SpecificAiPlayerEasy.class, leftPlayerNickname, SpecificAiPlayerHard.class, GameController.semesterToBoardSize(semesterCounter));
|
||||
// }
|
||||
// } else if (rightPlayerIcon.getIcon() == aiPlayerNormalIcon) {
|
||||
// if (rightPlayerIcon.getIcon() == aiPlayerEasyIcon) {
|
||||
// GameController.startLocalGame(SpecificAiPlayerMedium.class, leftPlayerNickname, SpecificAiPlayerEasy.class, GameController.semesterToBoardSize(semesterCounter));
|
||||
// } else if (rightPlayerIcon.getIcon() == aiPlayerNormalIcon) {
|
||||
// GameController.startLocalGame(SpecificAiPlayerMedium.class, leftPlayerNickname, SpecificAiPlayerMedium.class, GameController.semesterToBoardSize(semesterCounter));
|
||||
// } else if (rightPlayerIcon.getIcon() == aiPlayerHardIcon) {
|
||||
// GameController.startLocalGame(SpecificAiPlayerMedium.class, leftPlayerNickname, SpecificAiPlayerHard.class, GameController.semesterToBoardSize(semesterCounter));
|
||||
// }
|
||||
// } else if (rightPlayerIcon.getIcon() == aiPlayerHardIcon) {
|
||||
// if (rightPlayerIcon.getIcon() == aiPlayerEasyIcon) {
|
||||
// GameController.startLocalGame(SpecificAiPlayerHard.class, leftPlayerNickname, SpecificAiPlayerEasy.class, GameController.semesterToBoardSize(semesterCounter));
|
||||
// } else if (rightPlayerIcon.getIcon() == aiPlayerNormalIcon) {
|
||||
// GameController.startLocalGame(SpecificAiPlayerHard.class, leftPlayerNickname, SpecificAiPlayerMedium.class, GameController.semesterToBoardSize(semesterCounter));
|
||||
// } else if (rightPlayerIcon.getIcon() == aiPlayerHardIcon) {
|
||||
// GameController.startLocalGame(SpecificAiPlayerHard.class, leftPlayerNickname, SpecificAiPlayerHard.class, GameController.semesterToBoardSize(semesterCounter));
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
|
@ -39,12 +40,14 @@ public class startMultiplayerGame extends JPanel {
|
|||
// Textfelder
|
||||
JTextField PlayerTextField = new JTextField(20);
|
||||
|
||||
Font robotoFont = new Font("Roboto", Font.BOLD, 45);
|
||||
|
||||
/**
|
||||
* Konstruktor der startLocalGame.
|
||||
* Fügt Buttons, Textfelder und Label hinzu.
|
||||
* Fügt ebenfalls ActionListeners hinzu, damit Buttons etc. ihre gewünschte Funktion haben
|
||||
* @param frame Der Mainframe der Anwendung über den alle Panels angezeigt werden.
|
||||
* @author Joshua Kuklok
|
||||
* @author Joshua Kuklok, Lucas Bronson
|
||||
*/
|
||||
startMultiplayerGame(MainFrame frame) {
|
||||
|
||||
|
@ -52,7 +55,8 @@ public class startMultiplayerGame extends JPanel {
|
|||
setLayout(null);
|
||||
|
||||
// Setze Komponentenpositionen
|
||||
frameTitle.setBounds(20, 20, 200, 30);
|
||||
frameTitle.setBounds(20, 20, 500, 60);
|
||||
frameTitle.setFont(robotoFont.deriveFont(50f));
|
||||
add(frameTitle);
|
||||
|
||||
semesterLabel.setBounds(700, 300, 200, 30);
|
||||
|
@ -64,7 +68,7 @@ public class startMultiplayerGame extends JPanel {
|
|||
PlayerIcon.setBounds(75, 400, 200, 128);
|
||||
add(PlayerIcon);
|
||||
|
||||
semesterCounterLabel.setBounds(725, 475, 50, 50); // zwischen den Up/Down-Buttons
|
||||
semesterCounterLabel.setBounds(705, 475, 50, 50); // zwischen den Up/Down-Buttons
|
||||
semesterCounterLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
add(semesterCounterLabel);
|
||||
|
||||
|
@ -77,10 +81,10 @@ public class startMultiplayerGame extends JPanel {
|
|||
PlayerRightButton.setBounds(250, 450, 50, 50);
|
||||
add(PlayerRightButton);
|
||||
|
||||
semesterUpButton.setBounds(725, 400, 50, 50);
|
||||
semesterUpButton.setBounds(705, 400, 50, 50);
|
||||
add(semesterUpButton);
|
||||
|
||||
semesterDownButton.setBounds(725, 550, 50, 50);
|
||||
semesterDownButton.setBounds(705, 550, 50, 50);
|
||||
add(semesterDownButton);
|
||||
|
||||
joinGameButton.setBounds(1100, 350, 200, 50);
|
||||
|
|
Loading…
Reference in New Issue