change sound effect

This commit is contained in:
Romain MURPHY 2025-05-07 16:19:00 +02:00
parent f1e22e6b14
commit e9f00ec16f
2 changed files with 5 additions and 4 deletions

View File

@ -11,7 +11,7 @@ public class Game extends Thread {
private int LINE_NUM = 8; private int LINE_NUM = 8;
private int loopDelay = 250; private int loopDelay = 250;
boolean[] activationAIFlags; boolean[] activationAIFlags;
private SoundEffect soundEffect = new SoundEffect();
public Game(MyInterface mjfParam) { public Game(MyInterface mjfParam) {
mjf = mjfParam; mjf = mjfParam;
board = new Board(COL_NUM, LINE_NUM); board = new Board(COL_NUM, LINE_NUM);
@ -120,6 +120,9 @@ public class Game extends Thread {
public void toggleAI(boolean isWhite) { public void toggleAI(boolean isWhite) {
// System.out.println(isWhite); // System.out.println(isWhite);
this.activationAIFlags[isWhite?1:0] = !this.activationAIFlags[isWhite?1:0]; this.activationAIFlags[isWhite?1:0] = !this.activationAIFlags[isWhite?1:0];
if (this.activationAIFlags[isWhite?1:0]) {
soundEffect.aiSound();
}
} }
public void setTurnNumber(int turnNumber) { public void setTurnNumber(int turnNumber) {

View File

@ -1,5 +1,5 @@
package windowInterface; package windowInterface;
import backend.SoundEffect;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.GridLayout; import java.awt.GridLayout;
@ -44,7 +44,6 @@ public class MyInterface extends JFrame {
private JLabel actionLabel; private JLabel actionLabel;
private JCheckBox chckbxBlackAI; private JCheckBox chckbxBlackAI;
private JCheckBox chckbxWhiteAI; private JCheckBox chckbxWhiteAI;
private SoundEffect soundEffect = new SoundEffect();
/** /**
* Create the frame. * Create the frame.
@ -195,7 +194,6 @@ public class MyInterface extends JFrame {
} else { } else {
game.toggleAI(isWhite); game.toggleAI(isWhite);
} }
soundEffect.aiSound();
} }
public void clicLoadFileButton() { public void clicLoadFileButton() {