diff --git a/client/src/main/java/agolf/LobbySelectPanel.java b/client/src/main/java/agolf/LobbySelectPanel.java index 79bb3711..86923668 100644 --- a/client/src/main/java/agolf/LobbySelectPanel.java +++ b/client/src/main/java/agolf/LobbySelectPanel.java @@ -8,7 +8,6 @@ import java.awt.Color; import java.awt.Graphics; -import java.awt.LayoutManager; import java.awt.Panel; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -34,6 +33,7 @@ public class LobbySelectPanel extends Panel implements ActionListener, MouseList private ColorButton buttonQuit; private ColorCheckbox checkboxPlayHidden; private Choicer choicerGraphics; + private Choicer audioChoicer; private int[] lobbyNumPlayers; private LobbySelectRNOPspammer lobbySelectRNOP; private static final String[] aStringArray544 = new String[22]; @@ -139,7 +139,12 @@ else if (evtSource == this.buttonDual) { } public void itemStateChanged(ItemEvent evt) { - this.gameContainer.graphicsQualityIndex = this.choicerGraphics.getSelectedIndex(); + Object source = evt.getSource(); + if (source == this.choicerGraphics) { + this.gameContainer.graphicsQualityIndex = this.choicerGraphics.getSelectedIndex(); + } else if (source == this.audioChoicer) { + this.gameContainer.soundManager.audioChoicerIndex = this.audioChoicer.getSelectedIndex(); + } } public static String getLobbySelectMessage(int lobbyId) { @@ -209,7 +214,7 @@ protected void writeData(String var1) { } private void create() { - this.setLayout((LayoutManager) null); + this.setLayout(null); this.checkboxPlayHidden = new ColorCheckbox(this.gameContainer.textManager.getGame("LobbySelect_PlayHidden")); this.checkboxPlayHidden.setBounds(this.width / 6 - 75 - 10, this.height - 124, 220, 18); this.checkboxPlayHidden.setBackground(GameApplet.colourGameBackground); @@ -226,34 +231,43 @@ private void create() { this.add(this.buttonSingleQuick); } - - //this.buttonDual = new ColorButton(this.gameContainer.textManager.getGame("LobbySelect_DualPlayer")); this.buttonDual = new ColorButton("Coming soon..."); this.buttonDual.setBounds(this.width * 3 / 6 - 75, this.height - 150, 150, 25); //this.buttonDual.addActionListener(this); this.add(this.buttonDual); - this.buttonMulti = new ColorButton(this.gameContainer.textManager.getGame("LobbySelect_MultiPlayer")); this.buttonMulti.setBounds(this.width * 5 / 6 - 75, this.height - 150, 150, 25); this.buttonMulti.addActionListener(this); this.add(this.buttonMulti); + this.buttonMultiQuick = new ColorButton(this.gameContainer.textManager.getGame("LobbySelect_QuickStart")); this.buttonMultiQuick.setBackground(GameApplet.colourButtonBlue); this.buttonMultiQuick.setBounds(this.width * 5 / 6 - 50, this.height - 95, 100, 20); this.buttonMultiQuick.addActionListener(this); this.add(this.buttonMultiQuick); - String text = this.gameContainer.textManager.getGame("LobbySelect_Gfx"); + + String graphicsOptionText = this.gameContainer.textManager.getGame("LobbySelect_Gfx"); this.choicerGraphics = new Choicer(); - this.choicerGraphics.addItem(text + " " + this.gameContainer.textManager.getGame("LobbySelect_Gfx0")); - this.choicerGraphics.addItem(text + " " + this.gameContainer.textManager.getGame("LobbySelect_Gfx1")); - this.choicerGraphics.addItem(text + " " + this.gameContainer.textManager.getGame("LobbySelect_Gfx2")); - this.choicerGraphics.addItem(text + " " + this.gameContainer.textManager.getGame("LobbySelect_Gfx3")); + this.choicerGraphics.addItem(graphicsOptionText + " " + this.gameContainer.textManager.getGame("LobbySelect_Gfx0")); + this.choicerGraphics.addItem(graphicsOptionText + " " + this.gameContainer.textManager.getGame("LobbySelect_Gfx1")); + this.choicerGraphics.addItem(graphicsOptionText + " " + this.gameContainer.textManager.getGame("LobbySelect_Gfx2")); + this.choicerGraphics.addItem(graphicsOptionText + " " + this.gameContainer.textManager.getGame("LobbySelect_Gfx3")); this.choicerGraphics.select(this.gameContainer.graphicsQualityIndex); - this.choicerGraphics.setBounds(this.width / 3 - 100, this.height - 10 - 20, 200, 20); + this.choicerGraphics.setBounds(this.width / 3 - 100, this.height - 10 - 50, 200, 20); this.choicerGraphics.addItemListener(this); this.add(this.choicerGraphics); + + String audioOptionsText = "Audio:"; + this.audioChoicer = new Choicer(); + this.audioChoicer.addItem(audioOptionsText + " On"); + this.audioChoicer.addItem(audioOptionsText + " Off"); + this.audioChoicer.select(this.gameContainer.soundManager.audioChoicerIndex); + this.audioChoicer.setBounds(this.width / 3 - 100, this.height - 10 - 20, 200, 20); + this.audioChoicer.addItemListener(this); + this.add(this.audioChoicer); + this.buttonQuit = new ColorButton(this.gameContainer.textManager.getGame("LobbySelect_Quit")); this.buttonQuit.setBackground(GameApplet.colourButtonRed); this.buttonQuit.setBounds(this.width * 2 / 3 - 50, this.height - 10 - 20, 100, 20); diff --git a/client/src/main/java/com/aapeli/client/SoundManager.java b/client/src/main/java/com/aapeli/client/SoundManager.java index 4449569f..1e60f723 100644 --- a/client/src/main/java/com/aapeli/client/SoundManager.java +++ b/client/src/main/java/com/aapeli/client/SoundManager.java @@ -18,6 +18,7 @@ public final class SoundManager implements Runnable { private Hashtable clientSounds; private Hashtable sharedSounds; private boolean clipLoaderThreadRunning; + public int audioChoicerIndex; public SoundManager(AApplet applet) { @@ -33,6 +34,7 @@ public SoundManager(AApplet applet, boolean loadClipsOnRegister, boolean debug) this.applet = applet; this.loadSoundClipsOnRegister = loadClipsOnRegister; this.debug = debug; + this.audioChoicerIndex = 0; this.loadClientSounds(); this.sharedSoundDir = this.getClass().getResource("/sound/shared/"); @@ -231,7 +233,7 @@ private synchronized void loadAllSoundClips() { private void playAudioClip(int id) { SoundClip soundClip = this.clientSounds.get(new Integer(id)); - if (soundClip != null) { + if (soundClip != null && this.audioChoicerIndex != 1) { AudioClip audioClip = soundClip.getAudioClip(); if (audioClip != null) { audioClip.play();