Compare commits

..

No commits in common. "main" and "ole" have entirely different histories.
main ... ole

24 changed files with 40 additions and 219 deletions

View File

@ -29,9 +29,6 @@ test-jar: jar
# $(JR) -cp "$(OUT_DIR)/:$(LIB_DIR)/*" $(MAIN_CLASS)
$(JR) -jar $(OUT_DIR)/$(JAR_NAME)
docs:
javadoc -cp "$(LIB_DIR)/*" -d "docs" $(SRC_DIR)/*.java
test: classfiles
$(JR) -cp "$(OUT_DIR)$(SEPERATOR)$(LIB_DIR)/*" $(MAIN_CLASS)

View File

@ -1,12 +1,14 @@
/**
* Die Klasse AiPlayer ist die Basis für alle Ki Spieler und jede Spezifische Ki erweitert diese Klasse.
* @author Florian und Florian
* */
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
/**
* Die Klasse AiPlayer ist die Basis für alle Ki Spieler und jede Spezifische Ki erweitert diese Klasse.
* @author Florian Alexy und Florian Hantzschel
* */
public abstract class AiPlayer extends LocalPlayer implements Runnable {
/**
@ -16,7 +18,6 @@ public abstract class AiPlayer extends LocalPlayer implements Runnable {
/**
* Konstruktor
* @author Florian Alexy und Florian Hantzschel
*/
public AiPlayer() {
this.setName("AI Player");
@ -26,7 +27,6 @@ public abstract class AiPlayer extends LocalPlayer implements Runnable {
/**
* Gibt einen zufälligen Punkt im Spielfeld zurück.
* @return Ein zufälliger Punkt
* @author Florian Alexy und Florian Hantzschel
*/
public Point RandomPoint() {
Random random = new Random(); // Pseudo Random für zufallszahlen
@ -38,7 +38,6 @@ public abstract class AiPlayer extends LocalPlayer implements Runnable {
/**
* Initialisiert das Board.
* @param size größe des Boards
* @author Florian Alexy und Florian Hantzschel
*/
@Override
public void createBoard(int size) {
@ -49,7 +48,6 @@ public abstract class AiPlayer extends LocalPlayer implements Runnable {
/**
* Ki Methode zum zufälligen Setzten der Schiffe
* @author Florian Alexy und Florian Hantzschel
*/
public void aiSetShips() {
for(int i = 0; i < super.board.getShips().size(); i++) { // Interiert durch alle Shiffe
@ -60,7 +58,6 @@ public abstract class AiPlayer extends LocalPlayer implements Runnable {
}
/**
* Ki Methode zum zufälligen Schießen auf das gegnerische Board.
* @author Florian Alexy und Florian Hantzschel
*/
public void aiShoot() {
if (!this.myTurn) return;
@ -68,12 +65,7 @@ public abstract class AiPlayer extends LocalPlayer implements Runnable {
return;
}
/**
* Nachdem receiveShoot beim gegner den schuss verarbeitet hat,
* wird diese Methode mit der antwort aufgerufen.
* @param hitResponse the hitresponse
* @author Florian Alexy und Florian Hantzschel und Luca Conte
*/
@Override
public synchronized void receiveHit(HitResponse hitResponse) {
// Eltern-Klasse LocalPlayer updatet myTurn
@ -87,11 +79,6 @@ public abstract class AiPlayer extends LocalPlayer implements Runnable {
}
/**
* Erhält einen schuss vom gegner und verarbeitet ihn.
* @param point the location to be shot
* @author Florian Alexy und Florian Hantzschel und Luca Conte
*/
@Override
public synchronized void receiveShoot(Point point) {
super.receiveShoot(point);
@ -105,7 +92,6 @@ public abstract class AiPlayer extends LocalPlayer implements Runnable {
/**
* Wird aufgerufen, wenn in determineCoinToss festgestellt wurde das die Ki anfängt.
* Erster Schuss wird gestartet.
* @author Florian Alexy und Florian Hantzschel und Luca Conte
*/
@Override
public void beginTurn() {
@ -116,7 +102,7 @@ public abstract class AiPlayer extends LocalPlayer implements Runnable {
/**
* Closes past threads and tries firing a shot.
* @author Luca Conte, Florian Alexy und Florian Hantzschel
* @author Luca Conte
*/
public void run() {
Iterator<Thread> i = this.shootThreads.iterator();
@ -155,7 +141,6 @@ public abstract class AiPlayer extends LocalPlayer implements Runnable {
while(i.hasNext()) {
Thread thread = i.next();
try {
thread.interrupt();
thread.join();
i.remove();
} catch (InterruptedException e) {

View File

@ -9,7 +9,7 @@ import java.net.Socket;
/**
* Provides an Interface to communicate using a socket asynchronously
* @author Luca Conte, Peer Ole Wachtel
* @author Luca Conte
*/
public class AsyncSocket {
private Socket socket;

View File

@ -1,5 +1,4 @@
/**
* defines a message listener for AsyncSockets
* @author Luca Conte
*/
public interface AsyncSocketListener {

View File

@ -1,12 +1,13 @@
import java.util.ArrayList;
import java.util.List;
/**
* Diese Klasse ist das Board von eimem spieler und enthält alle logischen operationen.
* Sprich ist das Backend Board.
*
* @author Peer Ole Wachtel, Florian Alexy und Florian Hantzschel
*/
import java.util.ArrayList;
import java.util.List;
public class Board {
/**
@ -40,7 +41,7 @@ public class Board {
}
/**
* Nimmt einen punkt entgegen und Gibt einen HitResponse zurück.
* Nimmt einen punkt entgegen und Gibt einen Hitrespons zurück.
* @param point auf den geschossen wurde
* @return
* @author Peer Ole Wachtel
@ -103,9 +104,7 @@ public class Board {
}
/**
* returns a list of all the Ships on the board
* @return a list of all the Ships on the board
* @author Peer Ole Wachtel
*/
public List<Ship> getShips() {
return ships;
@ -118,7 +117,7 @@ public class Board {
* to all adjacened hit responses with type HIT using `propagateSunk`.
* @param hitResponse the HitResponse to be added
* @return true when the hit response was added, otherwise false
* @author Peer Ole Wachtel, Luca Conte
*
*/
public synchronized boolean addHits(HitResponse hitResponse) {
if (this.getHitResponseOnPoint(hitResponse.getPoint()) == null){
@ -150,9 +149,7 @@ public class Board {
}
/**
* returns the size of the board
* @return the size of the board
* @author Florian Alexy, Florian Hantzschel
*/
public int getSize() {
return this.size;

View File

@ -39,7 +39,7 @@ public class BoardDisplay extends JPanel {
}
/**
* Konstruktor des Board Displays
* Konstruktor der startLocalGame.
* @param gridSize Die Größe des Spielfelds
* @param player Der Spieler
* @author Lucas Bronson
@ -174,7 +174,6 @@ public class BoardDisplay extends JPanel {
if(currentShip != null) {
test = currentShip.getVirtualOccupiedPoints(mousePosition, horizontal);
}
if (player == null || player.getBoard() == null) return;
for(int i = 0; i < gridSize; i++) {
for(int j = 0; j < gridSize; j++) {
if(fields[i][j] == null) {

View File

@ -23,7 +23,7 @@ public class GameBoard extends JPanel {
ImageIcon gameBoardX = new ImageIcon("graphics/gameboardx.png");
// kontextText Text-Strings
String kT1 = "Bitte Schiffe setzten - Rechtsclick zum drehen";
String kT1 = "Bitte Schiffe setzten";
String kT2 = "Warte auf Gegner";
String kT3 = "Du fängst an";
String kT4 = "Dein Gegner fängt an";
@ -155,7 +155,7 @@ public class GameBoard extends JPanel {
public void actionPerformed(ActionEvent e) {
kontextText.setText(kT2);
p1.ready();
if(p1.isReady()) {
if(true) {
remove(readyButton);
remove(resetButton);
remove(rightButtonsPanel);
@ -225,11 +225,6 @@ public class GameBoard extends JPanel {
public Player getP1() {
return p1;
}
/**
* Getter für Player2
* @return Player 2
* @author Luca Conte
*/
public Player getP2() {
return p2;
}

View File

@ -14,7 +14,6 @@ public class GameController {
private static MainFrame mainFrame;
/**
* returns the current MainFrame
* @return the current MainFrame
* @author Luca Conte
*/
@ -22,7 +21,6 @@ public class GameController {
return GameController.mainFrame;
}
/**
* sets the current MainFrame
* @param mainFrame the current MainFrame
* @author Luca Conte
*/
@ -126,7 +124,7 @@ public class GameController {
/**
* finds the largest common version in two lists of version strings
* @return null if no common versions are found otherwise returns the most recent version present in both lists
* @return null if no common versions are found
* @author Luca Conte
*/
public static String findMostRecentVersion(List<String> versions1, List<String> versions2) {

View File

@ -1,6 +1,6 @@
/**
* Hauptklasse über die der MainFrame gestartet wird
* @author Lucas Bronson, Peer Ole Wachtel, Joshua Kuklok
* @author Lucas Bronson, Ole Wachtel, Joshua Kuklok
*/
public class HalloSchiffeVersenken {
@ -8,7 +8,6 @@ public class HalloSchiffeVersenken {
* Erstellt und setzt den Mainframe
* @param args Argumente an Main durch Konsole etc.
* @throws InterruptedException
* @author Peer Ole Wachtel
*/
public static void main(String[] args) throws InterruptedException {
MainFrame mf = new MainFrame();

View File

@ -1,10 +1,5 @@
/**
* Eine Antwort auf einen Schuss
* enthält einen Punkt, auf den geschossen wurde, sowie einen typen,
* der angibt, ob es sich bei dem Schuss um einen Treffer handelt
* @author Peer Ole Wachtel
*/
public class HitResponse {
/**
* Speichert den typ der HitResponse.
@ -42,20 +37,10 @@ public class HitResponse {
}
}
/**
* returns the type of the HitResponse
* @return the type of the HitResponse
* @author Florian Hantzschel
*/
public HitResponseType getHitResponse() {
return this.type;
}
/**
* returns the point of the HitResponse
* @return the point of the HitResponse
* @author Florian Hantzschel
*/
public Point getPoint() {
return this.point;
}

View File

@ -1,8 +1,4 @@
/**
* Repräsentiert einen menschlichen Spieler
* @author Luca Conte, Florian Hantzschel
*/
public class HumanPlayer extends LocalPlayer {
/**
* shoots a shot onto the provided point on the enemy board

View File

@ -1,10 +1,5 @@
import java.util.Random;
/**
* repräsentiert einen Player, der Lokal an dem Gerät spielt,
* auf dem dieses Programm läuft
* @author Luca Conte, Peer Ole Wachtel, Florian Hantzschel
*/
public class LocalPlayer extends Player {
@ -82,7 +77,6 @@ public class LocalPlayer extends Player {
/**
* sends shot to enemy player.
* should ONLY be called on HumanPlayer
* @author Luca Conte
*/
@Override
public void shoot(Point point){

View File

@ -6,7 +6,6 @@ import javax.swing.*;
/**
* Klasse für Erstellung von looseScreen Objekten
* Dient zur Anzeige das ein Spiel verloren wurde
* @author Joshua Kuklok, Luca Bronson
*/
public class LoseScreen extends JPanel {
JLabel loseLabel = new JLabel("Du hast Verloren");

View File

@ -126,10 +126,10 @@ public class MainFrame extends JFrame {
* Spezifische ShowPanel für WinScreen Klasse
* @param panelName Name des anzuzeigenden Panels
* @param player Player von dem die funktion aufgerufen worden ist
* @author Lucas Bronson, Peer Ole Wachtel, Luca Conte
* @author Lucas Bronson, Peer Ole Wachtel
*/
public void showPanelWin(String panelName, Player player){
if(gameBoard == null || player != gameBoard.getP1()){
if(player != gameBoard.getP1()){
return;
}
@ -149,10 +149,10 @@ public class MainFrame extends JFrame {
* Spezifische ShowPanel für LooseScreen Klasse
* @param panelName Name des anzuzeigenden Panels
* @param player Player von dem die funktion aufgerufen worden ist
* @author Lucas Bronson, Peer Ole Wachtel, Luca Conte
* @author Lucas Bronson, Peer Ole Wachtel
*/
public void showPanelLose(String panelName, Player player){
if(gameBoard == null || player != gameBoard.getP1()){
if(player != gameBoard.getP1()){
return;
}
@ -169,7 +169,7 @@ public class MainFrame extends JFrame {
}
/**
* Aktualisiert das Spielfeld
* Aktualisiert das Spielfeld (kontextText)
* @author Luca Conte
*/
public void refreshGameBoard() {

View File

@ -1,8 +1,3 @@
/**
* Abstrakte Repräsentation eines Spielers, der an einem anderen gerät spielt
* und durch eine Online Verbindung mit dieser Instanz kommuniziert
* @author Luca Conte, Peer Ole Wachtel
*/
public abstract class OnlinePlayer extends Player implements AsyncSocketListener {
protected AsyncSocket socket;
protected int wantedBoardSize;
@ -14,33 +9,19 @@ public abstract class OnlinePlayer extends Player implements AsyncSocketListener
* @param size the size of the board the enemy player wants to play with
* the actual board size will be determined once the semester of the online partner is known
* @param socket an AsyncSocket to communicate with the enemy through
* @author Peer Ole Wachtel, Luca Conte
*/
public OnlinePlayer(Integer size, AsyncSocket socket) {
this.socket = socket;
this.wantedBoardSize = size;
this.myCoin = null;
socket.setHandler(this);
//TODO Auto-generated constructor stub
}
/**
* sends the IAM Package for introduction
* @author Luca Conte
*/
public abstract void sendIAM();
/**
* receives a message from the AsyncSocket
* satisfies AsyncSocketListener interface
* @author Luca Conte
*/
public abstract void receive(String message);
/**
* receives the coin toss result from the enemy
* @param coin the result of the coin toss
* @author Peer Ole Wachtel
*/
@Override
public abstract void receiveCoin(boolean coin);

View File

@ -1,18 +1,6 @@
import java.util.List;
/**
* eine Implementierung des Kommunikationsprotokoll nach Version 1.1.0 des Netzwerkstandards
* https://github.com/lgc-4/ProgProjekt-Netzwerkstandard
* @author Peer Ole Wachtel, Luca Conte
*/
public class OnlinePlayer_1_1_0 extends OnlinePlayer {
/**
* Erstellt einen Online Player
* @param size die maximale Größe des Spielfelds
* @param socket der Socket zur Kommunikation mit dem Online Partner
*/
public OnlinePlayer_1_1_0(Integer size, AsyncSocket socket) {
super(size, socket);
}
@ -119,7 +107,7 @@ public class OnlinePlayer_1_1_0 extends OnlinePlayer {
* receives a shot from the enemy and sends it to the online partner
* if it is not the enemies turn, this method does nothing.
* @param point the point to be shot
* @author Peer Ole Wachtel, Luca Conte
* @author Peer Ole Wachtel
*/
@Override
public synchronized void receiveShoot(Point point){
@ -130,7 +118,7 @@ public class OnlinePlayer_1_1_0 extends OnlinePlayer {
/**
* receives a hitresponse from the enemy player and sends it to the online partner
* @param hitResponse the hitresponse to be sent
* @author Peer Ole Wachtel, Luca Conte
* @author Peer Ole Wachtel
*/
@Override
public synchronized void receiveHit(HitResponse hitResponse) {
@ -164,22 +152,12 @@ public class OnlinePlayer_1_1_0 extends OnlinePlayer {
}
}
/**
* für Online Player nicht zu implementieren
* nur für HumanPlayer relevant
* @author Luca Conte, Peer Ole Wachtel
*/
@Override
public synchronized void shoot(Point point) {
// SHOULD NEVER BE CALLED ON ONLINE PLAYER. ONLY ON HUMAN PLAYER
return;
}
/**
* empfängt Withdraw vom Gegner und leitet es an den Online Partner weiter
* beendet das Spiel
* @author Luca Conte
*/
@Override
public void receiveWithdraw() {
this.socket.send(new SocketPackage("WITHDRAW"));

View File

@ -1,7 +1,3 @@
/**
* abstrakte repräsentation eines Spielers
* @author Peer Ole Wachtel, Luca Conte, Lucas Bronson
*/
public abstract class Player {
protected boolean myTurn;
protected boolean isServer;
@ -16,10 +12,6 @@ public abstract class Player {
protected boolean hasReceivedCoin;
/**
* Konstruktor
* @author Peer Ole Wachtel, Luca Conte
*/
public Player() {
this.setName("Player");
this.hasReceivedCoin = false;
@ -37,25 +29,10 @@ public abstract class Player {
this.board = new Board(size);
}
/**
* receives a shot onto a point from the enemy
* @param point the location to be shot
* @author Luca Conte, Peer Ole Wachtel
*/
public abstract void receiveShoot(Point point);
/**
* receives a hit response from the enemy as a response to a receiveShoot call
* @param hitResponse the hitresponse
* @author Peer Ole Wachtel
*/
public abstract void receiveHit(HitResponse hitResponse);
/**
* sends shot to enemy player.
* should ONLY be called on HumanPlayer
* @author Luca Conte
*/
public abstract void shoot(Point point);
/**
@ -83,7 +60,6 @@ public abstract class Player {
public void setName(String name) {
this.name = name;
}
/**
* returns the name of this player
* @return the name of this player
@ -150,7 +126,6 @@ public abstract class Player {
/**
* returns whether this player is ready and has sent their coin to the enemy player
* @return the player's ready state
* @author Lucas Bronson
*/
public boolean isReady() {
return this.sentCoin;
@ -162,6 +137,7 @@ public abstract class Player {
* and players
*
* This method should be called at the end of a game
* This method should be called at the end of a game
*
* @author Luca Conte
*/
@ -172,39 +148,18 @@ public abstract class Player {
this.enemy = null;
}
/**
* the player wins
* ends the game
* @author Luca Conte
*/
public void win() {
GameController.getMainFrame().showPanelWin("", this);
}
/**
* the player loses
* ends the game
* @author Luca Conte
*/
public void lose() {
GameController.getMainFrame().showPanelLose("", this);
}
/**
* the player loses by withdrawal
* ends the game
* @author Luca Conte
*/
public void withdraw() {
this.enemy.receiveWithdraw();
this.lose();
}
/**
* the enemy player withdraws
* ends the game
* @author Luca Conte
*/
public void receiveWithdraw(){
this.win();
}

View File

@ -1,7 +1,3 @@
/**
* repräsentation der Koordinaten eines Feldes auf dem Spielfeld
* @author Peer Ole Wachtel, Luca Conte
*/
public class Point {
private int x;
private int y;

View File

@ -5,10 +5,6 @@ import java.util.List;
record ShipData (int size, String name){}
/**
* repräsentation eines Schiffes auf dem Spielfeld
* @author Peer Ole Wachtel, Lucas Bronson, Florian Hanzschel
*/
public class Ship {
static List<List<ShipData>> semeterList =
Arrays.asList(
@ -193,7 +189,7 @@ public class Ship {
/**
* returns the position of this ship
* @return the position of this ship
* @author Peer Ole Wachtel
* @author Peer Ole Wachte
*/
public Point getPosition() {
return position;

View File

@ -1,8 +1,6 @@
import java.util.Arrays;
import java.util.List;
/**
* beschreibt ein Package das durch einen AsyncSocket gesendet werden kann nach Netzwerkstandard
* https://github.com/lgc-4/ProgProjekt-Netzwerkstandard
* @author Luca Conte
*/
public class SocketPackage {
@ -90,7 +88,6 @@ public class SocketPackage {
* parses the package into a string according to https://github.com/lgc-4/ProgProjekt-Netzwerkstandard
* the package name and data are joined using a space " " `0x20`
* @return the package in string format
* @author Luca Conte
*/
public String toString() {
if (this.data == null || this.data.length() == 0) {

View File

@ -1,10 +1,10 @@
import java.util.ArrayList;
// import java.util.Random; wird nicht mehr verwendet
/**
* Diese Klasse implementiert den Harten Ki Spieler.
* @author Florian Alexy und Florian Hantzschel
* */
import java.util.ArrayList;
// import java.util.Random; wird nicht mehr verwendet
public class SpecificAiPlayerHard extends AiPlayer{
private int gridSize;
@ -21,8 +21,7 @@ public class SpecificAiPlayerHard extends AiPlayer{
VERTIKAL
}
private Orientierung orientierung;
// Speichert den ersten Treffer zur Bestimmung der Orientierung
private Point firstHit;
private Point firstHit; // Speichert den ersten Treffer zur Bestimmung der Orientierung
/**

View File

@ -1,10 +1,10 @@
import java.util.ArrayList;
import java.util.List;
/**
* Diese Klasse implementiert den Medium Ki Spieler.
* @author Florian Alexy und Florian Hantzschel
* */
import java.util.ArrayList;
import java.util.List;
public class SpecificAiPlayerMedium extends AiPlayer{
/**
* Liste an Punkten die beschossen werden sollen. (Mögliche weitere Segmente vom schiff)
@ -48,7 +48,7 @@ public class SpecificAiPlayerMedium extends AiPlayer{
/**
* Die Methode bestimmt welche Position als nächstes beschossen werden soll.
* @return der Punkt auf den als nächtest geschossen werden soll
* @return
* @author Florian Alexy und Florian Hantzschel
*/
public Point ComputeNextShot() {
@ -72,7 +72,7 @@ public class SpecificAiPlayerMedium extends AiPlayer{
/**
* Diese Methode erweitert die hitsQueue um die umliegenden Punkte die Schiffe seien könnten.
* @param point der Punkt dessen nachbarn zur hitQueue hinzugefügt werden sollen
* @param point
* @author Florian Alexy und Florian Hantzschel
*/
private void addAdjacentPoints(Point point) {

View File

@ -225,13 +225,10 @@ public class startLocalGame extends JPanel {
private void toggleLeftPlayerIconLeft() {
if (leftPlayerIcon.getIcon() == humanPlayerIcon) {
leftPlayerIcon.setIcon(aiPlayerHardIcon);
} else if (leftPlayerIcon.getIcon() == aiPlayerEasyIcon){
leftPlayerIcon.setIcon(humanPlayerIcon);
} else if (leftPlayerIcon.getIcon() == aiPlayerNormalIcon) {
leftPlayerIcon.setIcon(aiPlayerEasyIcon);
} else if (leftPlayerIcon.getIcon() == aiPlayerHardIcon) {
leftPlayerIcon.setIcon(aiPlayerNormalIcon);
}
@ -244,13 +241,10 @@ public class startLocalGame extends JPanel {
private void toggleLeftPlayerIconRight() {
if (leftPlayerIcon.getIcon() == humanPlayerIcon) {
leftPlayerIcon.setIcon(aiPlayerEasyIcon);
} else if (leftPlayerIcon.getIcon() == aiPlayerEasyIcon){
leftPlayerIcon.setIcon(aiPlayerNormalIcon);
} else if (leftPlayerIcon.getIcon() == aiPlayerNormalIcon) {
leftPlayerIcon.setIcon(aiPlayerHardIcon);
} else if (leftPlayerIcon.getIcon() == aiPlayerHardIcon) {
leftPlayerIcon.setIcon(humanPlayerIcon);
}
@ -263,10 +257,8 @@ public class startLocalGame extends JPanel {
private void toggleRightPlayerIconLeft() {
if (rightPlayerIcon.getIcon() == aiPlayerEasyIcon) {
rightPlayerIcon.setIcon(aiPlayerHardIcon);
} else if (rightPlayerIcon.getIcon() == aiPlayerNormalIcon){
rightPlayerIcon.setIcon(aiPlayerEasyIcon);
} else if (rightPlayerIcon.getIcon() == aiPlayerHardIcon) {
rightPlayerIcon.setIcon(aiPlayerNormalIcon);
}
@ -279,10 +271,8 @@ public class startLocalGame extends JPanel {
private void toggleRightPlayerIconRight() {
if (rightPlayerIcon.getIcon() == aiPlayerEasyIcon) {
rightPlayerIcon.setIcon(aiPlayerNormalIcon);
} else if (rightPlayerIcon.getIcon() == aiPlayerNormalIcon){
rightPlayerIcon.setIcon(aiPlayerHardIcon);
} else if (rightPlayerIcon.getIcon() == aiPlayerHardIcon) {
rightPlayerIcon.setIcon(aiPlayerEasyIcon);
}
@ -296,13 +286,10 @@ public class startLocalGame extends JPanel {
// Für Linken Spieler
if (leftPlayerIcon.getIcon() == humanPlayerIcon) {
leftPlayerTextField.setText(leftPlayerNickname);
} else if (leftPlayerIcon.getIcon() == aiPlayerEasyIcon){
leftPlayerTextField.setText("Einfach");
} else if (leftPlayerIcon.getIcon() == aiPlayerNormalIcon) {
leftPlayerTextField.setText("Mittel");
} else if (leftPlayerIcon.getIcon() == aiPlayerHardIcon) {
leftPlayerTextField.setText("Schwer");
}
@ -310,10 +297,8 @@ public class startLocalGame extends JPanel {
// Für Rechten Spieler
if (rightPlayerIcon.getIcon() == aiPlayerEasyIcon){
rightPlayerTextField.setText("Einfach");
} else if (rightPlayerIcon.getIcon() == aiPlayerNormalIcon) {
rightPlayerTextField.setText("Mittel");
} else if (rightPlayerIcon.getIcon() == aiPlayerHardIcon) {
rightPlayerTextField.setText("Schwer");
}

View File

@ -192,13 +192,10 @@ public class startMultiplayerGame extends JPanel {
private void togglePlayerIconLeft() {
if (PlayerIcon.getIcon() == humanPlayerIcon) {
PlayerIcon.setIcon(aiPlayerHardIcon);
} else if (PlayerIcon.getIcon() == aiPlayerEasyIcon){
PlayerIcon.setIcon(humanPlayerIcon);
} else if (PlayerIcon.getIcon() == aiPlayerNormalIcon) {
PlayerIcon.setIcon(aiPlayerEasyIcon);
} else if (PlayerIcon.getIcon() == aiPlayerHardIcon) {
PlayerIcon.setIcon(aiPlayerNormalIcon);
}
@ -211,13 +208,10 @@ public class startMultiplayerGame extends JPanel {
private void togglePlayerIconRight() {
if (PlayerIcon.getIcon() == humanPlayerIcon) {
PlayerIcon.setIcon(aiPlayerEasyIcon);
} else if (PlayerIcon.getIcon() == aiPlayerEasyIcon){
PlayerIcon.setIcon(aiPlayerNormalIcon);
} else if (PlayerIcon.getIcon() == aiPlayerNormalIcon) {
PlayerIcon.setIcon(aiPlayerHardIcon);
} else if (PlayerIcon.getIcon() == aiPlayerHardIcon) {
PlayerIcon.setIcon(humanPlayerIcon);
}
@ -230,13 +224,10 @@ public class startMultiplayerGame extends JPanel {
private void updateTextFields() {
if (PlayerIcon.getIcon() == humanPlayerIcon) {
PlayerTextField.setText(PlayerNickname);
} else if (PlayerIcon.getIcon() == aiPlayerEasyIcon){
PlayerTextField.setText("Einfach");
} else if (PlayerIcon.getIcon() == aiPlayerNormalIcon) {
PlayerTextField.setText("Mittel");
} else if (PlayerIcon.getIcon() == aiPlayerHardIcon) {
PlayerTextField.setText("Schwer");
}