Added 3 more sounds. Added function calls to test sounds, some still untested
This commit is contained in:
parent
f5a0f8c9fe
commit
626ae041e5
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -102,6 +102,7 @@ public class BoardDisplay extends JPanel {
|
||||||
} else if (SwingUtilities.isLeftMouseButton(e)) {
|
} else if (SwingUtilities.isLeftMouseButton(e)) {
|
||||||
Point o = new Point(x, y);
|
Point o = new Point(x, y);
|
||||||
handleFieldClick(o);
|
handleFieldClick(o);
|
||||||
|
SoundHandler.playSound("plop");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -222,13 +223,16 @@ public class BoardDisplay extends JPanel {
|
||||||
switch (hit.getType()) {
|
switch (hit.getType()) {
|
||||||
case HIT:
|
case HIT:
|
||||||
fields[i][j].setBackground(Color.ORANGE);
|
fields[i][j].setBackground(Color.ORANGE);
|
||||||
|
SoundHandler.playSound("hit");
|
||||||
break;
|
break;
|
||||||
case SUNK:
|
case SUNK:
|
||||||
case VICTORY:
|
case VICTORY:
|
||||||
|
SoundHandler.playSound("destroyed");
|
||||||
fields[i][j].setBackground(Color.RED);
|
fields[i][j].setBackground(Color.RED);
|
||||||
break;
|
break;
|
||||||
case MISS:
|
case MISS:
|
||||||
if (this.enemyBoard) {
|
if (this.enemyBoard) {
|
||||||
|
SoundHandler.playSound("miss");
|
||||||
fields[i][j].setBackground(Color.BLUE);
|
fields[i][j].setBackground(Color.BLUE);
|
||||||
} else {
|
} else {
|
||||||
fields[i][j].setBackground(Color.CYAN);
|
fields[i][j].setBackground(Color.CYAN);
|
||||||
|
|
|
@ -7,8 +7,8 @@ public class HalloSchiffeVersenken {
|
||||||
System.out.println("HelloSchiffeVersenekn");
|
System.out.println("HelloSchiffeVersenekn");
|
||||||
|
|
||||||
|
|
||||||
System.out.println("sound");
|
//System.out.println("sound");
|
||||||
SoundHandler.playSound("hit");
|
//SoundHandler.playSound("hit");
|
||||||
|
|
||||||
Thread.sleep(10000);
|
Thread.sleep(10000);
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,6 @@ import java.net.InetSocketAddress;
|
||||||
/**
|
/**
|
||||||
* Das JoinGame Panel dient zum setzten des Ports/IP-Adresse.
|
* Das JoinGame Panel dient zum setzten des Ports/IP-Adresse.
|
||||||
* Anschließend kann das Verbinden Panel gezeigt werden.
|
* Anschließend kann das Verbinden Panel gezeigt werden.
|
||||||
* 51525
|
|
||||||
* ssh.lgc.sh
|
|
||||||
*/
|
*/
|
||||||
public class JoinGame extends JPanel {
|
public class JoinGame extends JPanel {
|
||||||
// Grafiken
|
// Grafiken
|
||||||
|
|
|
@ -16,7 +16,10 @@ public class SoundHandler {
|
||||||
|
|
||||||
// Wenn fehler beim erstellen von .jar mit sound hier gucken
|
// Wenn fehler beim erstellen von .jar mit sound hier gucken
|
||||||
private static HashMap<String, String> sounds = new HashMap<String, String>(Map.of(
|
private static HashMap<String, String> sounds = new HashMap<String, String>(Map.of(
|
||||||
"hit", "./Sound/water-drip.mp3"
|
"miss", "./Sound/water-drip.mp3",
|
||||||
|
"hit", "./Sound/hit.mp3",
|
||||||
|
"destroyed", "./Sound/hit.mp3",
|
||||||
|
"plop", "./Sound/plop.mp3"
|
||||||
));
|
));
|
||||||
|
|
||||||
public static void playSound(String soundName) {
|
public static void playSound(String soundName) {
|
||||||
|
|
Loading…
Reference in New Issue