Added and integrated new sounds.

Added standardPort to be default value of port field.
This commit is contained in:
Joshua 2024-12-21 16:26:10 +01:00
parent 4dd1c9b39b
commit cb9b110621
11 changed files with 28 additions and 13 deletions

Binary file not shown.

BIN
Sound/loosescreenlaugh.mp3 Normal file

Binary file not shown.

BIN
Sound/win.mp3 Normal file

Binary file not shown.

BIN
Sound/yourturn.mp3 Normal file

Binary file not shown.

View File

@ -205,11 +205,14 @@ public class GameBoard extends JPanel {
/** /**
* Aktualisiert Zustand(kontextText) je nach Zug * Aktualisiert Zustand(kontextText) je nach Zug
* @author Luca Conte * @author Luca Conte, Joshua Kuklok
*/ */
public void refresh() { public void refresh() {
if (this.p1.myTurn) { if (this.p1.myTurn) {
if (!kontextText.getText().equals(kT5)) {
this.kontextText.setText(kT5); this.kontextText.setText(kT5);
SoundHandler.playSound("yourturn");
}
} else { } else {
this.kontextText.setText(kT6); this.kontextText.setText(kT6);
} }

View File

@ -12,6 +12,9 @@ import java.net.InetSocketAddress;
*/ */
public class JoinGame extends JPanel { public class JoinGame extends JPanel {
// Funktionshilfen
String standardPort = "1234";
// Grafiken // Grafiken
ImageIcon backButtonIcon = new ImageIcon("graphics/backButton.png"); ImageIcon backButtonIcon = new ImageIcon("graphics/backButton.png");
@ -71,6 +74,7 @@ public class JoinGame extends JPanel {
} }
portTextField.setBounds(50, 225, 250, 50); portTextField.setBounds(50, 225, 250, 50);
portTextField.setText(standardPort);
spielBeitretenLabel.setFont(robotoFont.deriveFont(50f)); spielBeitretenLabel.setFont(robotoFont.deriveFont(50f));
@ -100,6 +104,7 @@ public class JoinGame extends JPanel {
if (ipAddress.isEmpty()) { if (ipAddress.isEmpty()) {
ipAddress = "0.0.0.0"; ipAddress = "0.0.0.0";
} }
System.out.println(portTextField.getText());
String portText = portTextField.getText(); String portText = portTextField.getText();
int port = Integer.parseInt(portText); int port = Integer.parseInt(portText);

View File

@ -25,13 +25,16 @@ public class LoseScreen extends JPanel {
/** /**
* Panel bauen/Objekte hinzufügen * Panel bauen/Objekte hinzufügen
* @param frame Der Mainframe der Anwendung über den alle Panels angezeigt werden. * @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) { public void buildPanel(MainFrame frame) {
add(loseLabel); add(loseLabel);
okButton.setBounds(650,525,200,50); okButton.setBounds(625,525,200,50);
loseLabel.setBounds(550,450,500,50); loseLabel.setBounds(550,450,500,50);
loseLabel.setFont(robotoFont); loseLabel.setFont(robotoFont);
SoundHandler.playSound("loose");
// Zurückkehren zum Hauptmenü, wenn okButton gedrückt wird
okButton.addActionListener(new ActionListener() { okButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {

View File

@ -25,7 +25,9 @@ public class SoundHandler {
"hit", "./Sound/hit.mp3", "hit", "./Sound/hit.mp3",
"destroyed", "./Sound/hit.mp3", "destroyed", "./Sound/hit.mp3",
"plop", "./Sound/plop.mp3", "plop", "./Sound/plop.mp3",
"loose", "./Sound/loosescreenWAH.mp3" "loose", "./Sound/loosescreenlaugh.mp3",
"win", "./Sound/win.mp3",
"yourturn", "./Sound/yourturn.mp3"
)); ));
/** /**

View File

@ -26,7 +26,7 @@ public class WinScreen extends JPanel {
/** /**
* Panel bauen/Objekte hinzufuegen * Panel bauen/Objekte hinzufuegen
* @param frame Der Mainframe der Anwendung über den alle Panels angezeigt werden. * @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) { public void buildPanel(MainFrame frame) {
Timer timer = new Timer(5, new ActionListener() { Timer timer = new Timer(5, new ActionListener() {
@ -50,7 +50,9 @@ public class WinScreen extends JPanel {
timer.start(); // Timer starten timer.start(); // Timer starten
winLabel.setFont(robotoFont); winLabel.setFont(robotoFont);
winLabel.setHorizontalAlignment(SwingConstants.CENTER); 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() { okButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {

View File

@ -83,7 +83,7 @@ public class startLocalGame extends JPanel {
rightPlayerIcon.setBounds(1225, 400, 200, 128); rightPlayerIcon.setBounds(1225, 400, 200, 128);
add(rightPlayerIcon); add(rightPlayerIcon);
semesterCounterLabel.setBounds(725, 475, 50, 50); semesterCounterLabel.setBounds(705, 475, 50, 50);
semesterCounterLabel.setHorizontalAlignment(SwingConstants.CENTER); semesterCounterLabel.setHorizontalAlignment(SwingConstants.CENTER);
add(semesterCounterLabel); add(semesterCounterLabel);
@ -96,10 +96,10 @@ public class startLocalGame extends JPanel {
leftPlayerRightButton.setBounds(250, 450, 50, 50); leftPlayerRightButton.setBounds(250, 450, 50, 50);
add(leftPlayerRightButton); add(leftPlayerRightButton);
semesterUpButton.setBounds(725, 400, 50, 50); semesterUpButton.setBounds(705, 400, 50, 50);
add(semesterUpButton); add(semesterUpButton);
semesterDownButton.setBounds(725, 550, 50, 50); semesterDownButton.setBounds(705, 550, 50, 50);
add(semesterDownButton); add(semesterDownButton);
rightPlayerLeftButton.setBounds(1200, 450, 50, 50); rightPlayerLeftButton.setBounds(1200, 450, 50, 50);

View File

@ -68,7 +68,7 @@ public class startMultiplayerGame extends JPanel {
PlayerIcon.setBounds(75, 400, 200, 128); PlayerIcon.setBounds(75, 400, 200, 128);
add(PlayerIcon); 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); semesterCounterLabel.setHorizontalAlignment(SwingConstants.CENTER);
add(semesterCounterLabel); add(semesterCounterLabel);
@ -81,10 +81,10 @@ public class startMultiplayerGame extends JPanel {
PlayerRightButton.setBounds(250, 450, 50, 50); PlayerRightButton.setBounds(250, 450, 50, 50);
add(PlayerRightButton); add(PlayerRightButton);
semesterUpButton.setBounds(725, 400, 50, 50); semesterUpButton.setBounds(705, 400, 50, 50);
add(semesterUpButton); add(semesterUpButton);
semesterDownButton.setBounds(725, 550, 50, 50); semesterDownButton.setBounds(705, 550, 50, 50);
add(semesterDownButton); add(semesterDownButton);
joinGameButton.setBounds(1100, 350, 200, 50); joinGameButton.setBounds(1100, 350, 200, 50);