Closed #168 : Enhance priority hot keys

This commit is contained in:
magenoxx 2013-03-29 17:18:12 +04:00
parent a1e16942cd
commit 05191e8793
20 changed files with 475 additions and 151 deletions

View file

@ -34,18 +34,19 @@
package mage.client.chat;
import java.awt.*;
import java.awt.event.KeyEvent;
import java.util.*;
import java.util.List;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import javax.swing.table.AbstractTableModel;
import mage.client.MageFrame;
import mage.client.components.ColorPane;
import mage.remote.Session;
import mage.view.ChatMessage.MessageColor;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import javax.swing.table.AbstractTableModel;
import java.awt.*;
import java.awt.event.KeyEvent;
import java.util.*;
import java.util.List;
/**
*
* @author BetaSteward_at_googlemail.com, nantuko
@ -166,17 +167,26 @@ public class ChatPanel extends javax.swing.JPanel {
public void receiveMessage(String username, String message, String time, MessageColor color) {
if (extendedViewMode.equals(VIEW_MODE.GAME)) {
this.txtConversation.append(TIMESTAMP_COLOR, time + " ");
this.txtConversation.append(MESSAGE_COLOR, (username.isEmpty() ? "" : username + ":") + message + "\n");
Color textColor = MESSAGE_COLOR;
if (color.equals(MessageColor.ORANGE)) {
textColor = Color.ORANGE;
}
this.txtConversation.append(textColor, (username.isEmpty() ? "" : username + ":") + message + "\n");
} else {
this.txtConversation.append(TIMESTAMP_COLOR, time + " ");
Color userColor;
Color textColor = MESSAGE_COLOR;
if (parentChatRef != null) {
userColor = parentChatRef.session.getUserName().equals(username) ? MY_COLOR : OPPONENT_COLOR;
} else {
userColor = session.getUserName().equals(username) ? MY_COLOR : OPPONENT_COLOR;
if (color.equals(MessageColor.ORANGE)) {
userColor = Color.ORANGE;
textColor = userColor;
}
}
this.txtConversation.append(userColor, username + ": ");
this.txtConversation.append(MESSAGE_COLOR, message + "\n");
this.txtConversation.append(textColor, message + "\n");
}
}
@ -192,6 +202,14 @@ public class ChatPanel extends javax.swing.JPanel {
this.parentChatRef = parentChatRef;
}
public ChatPanel getParentChatRef() {
return parentChatRef;
}
public void setParentChatRef(ChatPanel parentChatRef) {
this.parentChatRef = parentChatRef;
}
public void disableInput() {
this.txtMessage.setVisible(false);
}

View file

@ -23,9 +23,9 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jTabbedPane1" alignment="0" pref="439" max="32767" attributes="0"/>
<Component id="jTabbedPane1" alignment="0" max="32767" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<EmptySpace pref="311" max="32767" attributes="0"/>
<EmptySpace pref="316" max="32767" attributes="0"/>
<Component id="saveButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="exitButton" min="-2" pref="55" max="-2" attributes="0"/>
@ -109,7 +109,7 @@
<Component id="showToolTipsInAnyZone" min="-2" max="-2" attributes="0"/>
<Component id="displayBigCardsInHand" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="161" max="32767" attributes="0"/>
<EmptySpace pref="166" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -163,7 +163,7 @@
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="nonLandPermanentsInOnePile" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="199" max="32767" attributes="0"/>
<EmptySpace pref="204" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -261,7 +261,7 @@
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace pref="100" max="32767" attributes="0"/>
<EmptySpace pref="105" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -486,7 +486,7 @@
<Component id="saveToZipFiles" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="32767" attributes="0"/>
<EmptySpace pref="15" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -548,6 +548,46 @@
</Container>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel22">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
<JTabbedPaneConstraints tabName="Sounds">
<Property name="tabTitle" type="java.lang.String" value="Sounds"/>
</JTabbedPaneConstraints>
</Constraint>
</Constraints>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="19" max="-2" attributes="0"/>
<Component id="jEnableSounds" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="325" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="24" max="-2" attributes="0"/>
<Component id="jEnableSounds" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="217" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JCheckBox" name="jEnableSounds">
<Properties>
<Property name="text" type="java.lang.String" value="enable sounds"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jEnableSoundsActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel6">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
@ -662,7 +702,7 @@
<Component id="txtPasswordField" alignment="0" max="32767" attributes="1"/>
<Component id="txtProxyUserName" alignment="0" min="-2" pref="148" max="-2" attributes="1"/>
</Group>
<Component id="txtProxyServer" alignment="0" pref="295" max="32767" attributes="1"/>
<Component id="txtProxyServer" alignment="0" pref="300" max="32767" attributes="1"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
@ -770,7 +810,7 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane1" alignment="0" pref="434" max="32767" attributes="0"/>
<Component id="jScrollPane1" alignment="0" pref="439" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">

View file

@ -72,6 +72,8 @@ public class PreferencesDialog extends javax.swing.JDialog {
public static final String KEY_CARD_IMAGES_CHECK = "cardImagesCheck";
public static final String KEY_CARD_IMAGES_SAVE_TO_ZIP = "cardImagesSaveToZip";
public static final String KEY_SOUNDS_ON = "soundsOn";
public static final String KEY_BIG_CARD_TOGGLED = "bigCardToggled";
public static final String KEY_GAMEPANEL_LAST_SIZE = "gamepanelLastSize";
@ -186,6 +188,8 @@ public class PreferencesDialog extends javax.swing.JDialog {
browseButton = new javax.swing.JButton();
checkForNewImages = new javax.swing.JCheckBox();
saveToZipFiles = new javax.swing.JCheckBox();
jPanel22 = new javax.swing.JPanel();
jEnableSounds = new javax.swing.JCheckBox();
jPanel6 = new javax.swing.JPanel();
lblProxyType = new javax.swing.JLabel();
cbProxyType = new javax.swing.JComboBox();
@ -250,7 +254,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(showToolTipsInAnyZone)
.addComponent(displayBigCardsInHand))
.addContainerGap(161, Short.MAX_VALUE))
.addContainerGap(166, Short.MAX_VALUE))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -278,7 +282,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
.addGroup(jPanel7Layout.createSequentialGroup()
.addContainerGap()
.addComponent(nonLandPermanentsInOnePile)
.addContainerGap(199, Short.MAX_VALUE))
.addContainerGap(204, Short.MAX_VALUE))
);
jPanel7Layout.setVerticalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -380,7 +384,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)))
.addContainerGap(100, Short.MAX_VALUE))
.addContainerGap(105, Short.MAX_VALUE))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -490,7 +494,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
.addGroup(jPanel5Layout.createSequentialGroup()
.addContainerGap()
.addComponent(saveToZipFiles)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(15, Short.MAX_VALUE))
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -527,6 +531,32 @@ public class PreferencesDialog extends javax.swing.JDialog {
jTabbedPane1.addTab("Images", jPanel4);
jEnableSounds.setText("enable sounds");
jEnableSounds.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jEnableSoundsActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel22Layout = new javax.swing.GroupLayout(jPanel22);
jPanel22.setLayout(jPanel22Layout);
jPanel22Layout.setHorizontalGroup(
jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel22Layout.createSequentialGroup()
.addGap(19, 19, 19)
.addComponent(jEnableSounds)
.addContainerGap(325, Short.MAX_VALUE))
);
jPanel22Layout.setVerticalGroup(
jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel22Layout.createSequentialGroup()
.addGap(24, 24, 24)
.addComponent(jEnableSounds)
.addContainerGap(217, Short.MAX_VALUE))
);
jTabbedPane1.addTab("Sounds", jPanel22);
lblProxyType.setText("Proxy:");
cbProxyType.addActionListener(new java.awt.event.ActionListener() {
@ -590,7 +620,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
.addGroup(pnlProxyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(txtPasswordField, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtProxyUserName, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(txtProxyServer, javax.swing.GroupLayout.DEFAULT_SIZE, 295, Short.MAX_VALUE))
.addComponent(txtProxyServer, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE))
.addContainerGap())
);
pnlProxyLayout.setVerticalGroup(
@ -905,7 +935,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
jPanel8.setLayout(jPanel8Layout);
jPanel8Layout.setHorizontalGroup(
jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 434, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 439, Short.MAX_VALUE)
);
jPanel8Layout.setVerticalGroup(
jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -932,9 +962,9 @@ public class PreferencesDialog extends javax.swing.JDialog {
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 439, Short.MAX_VALUE)
.addComponent(jTabbedPane1)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(311, Short.MAX_VALUE)
.addContainerGap(316, Short.MAX_VALUE)
.addComponent(saveButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(exitButton, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
@ -985,6 +1015,9 @@ public class PreferencesDialog extends javax.swing.JDialog {
save(prefs, dialog.checkForNewImages, KEY_CARD_IMAGES_CHECK, "true", "false", UPDATE_CACHE_POLICY);
save(prefs, dialog.saveToZipFiles, KEY_CARD_IMAGES_SAVE_TO_ZIP, "true", "false", UPDATE_CACHE_POLICY);
// sounds
save(prefs, dialog.jEnableSounds, KEY_SOUNDS_ON, "true", "false", UPDATE_CACHE_POLICY);
// connection
save(prefs, dialog.cbProxyType, KEY_PROXY_TYPE);
save(prefs, dialog.txtProxyServer, KEY_PROXY_ADDRESS);
@ -1002,8 +1035,6 @@ public class PreferencesDialog extends javax.swing.JDialog {
updateCache(KEY_AVATAR, String.valueOf(selectedId));
}
try {
prefs.flush();
} catch (BackingStoreException ex) {
@ -1078,6 +1109,10 @@ public class PreferencesDialog extends javax.swing.JDialog {
// TODO add your handling code here:
}//GEN-LAST:event_checkForNewImagesActionPerformed
private void jEnableSoundsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jEnableSoundsActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jEnableSoundsActionPerformed
private void showProxySettings() {
if (cbProxyType.getSelectedItem() == Connection.ProxyType.SOCKS) {
this.pnlProxy.setVisible(true);
@ -1122,7 +1157,10 @@ public class PreferencesDialog extends javax.swing.JDialog {
loadSelectedAvatar(prefs);
// Images
loadImages(prefs);
loadImagesSettings(prefs);
// Images
loadSoundSettings(prefs);
// open specified tab before displaying
openTab(openedTab);
@ -1159,7 +1197,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
load(prefs, dialog.nonLandPermanentsInOnePile, KEY_PERMANENTS_IN_ONE_PILE, "true");
}
private static void loadImages(Preferences prefs) {
private static void loadImagesSettings(Preferences prefs) {
String prop = prefs.get(KEY_CARD_IMAGES_USE_DEFAULT, "true");
if (prop.equals("true")) {
dialog.useDefaultImageFolder.setSelected(true);
@ -1175,6 +1213,15 @@ public class PreferencesDialog extends javax.swing.JDialog {
load(prefs, dialog.saveToZipFiles, KEY_CARD_IMAGES_SAVE_TO_ZIP, "true");
}
private static void loadSoundSettings(Preferences prefs) {
String prop = prefs.get(KEY_SOUNDS_ON, "true");
if (prop.equals("true")) {
dialog.jEnableSounds.setSelected(true);
} else {
dialog.jEnableSounds.setSelected(false);
}
}
private static void loadProxySettings(Preferences prefs) {
dialog.cbProxyType.setSelectedItem(Connection.ProxyType.valueOf(MageFrame.getPreferences().get(KEY_PROXY_TYPE, "NONE").toUpperCase()));
@ -1391,6 +1438,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
private javax.swing.JCheckBox displayBigCardsInHand;
private javax.swing.JButton exitButton;
private javax.swing.JTextField imageFolderPath;
private javax.swing.JCheckBox jEnableSounds;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
@ -1418,6 +1466,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel20;
private javax.swing.JPanel jPanel21;
private javax.swing.JPanel jPanel22;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;

View file

@ -34,15 +34,6 @@
package mage.client.game;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.io.Serializable;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import javax.swing.*;
import mage.client.MageFrame;
import mage.client.chat.ChatPanel;
import mage.client.components.MageTextArea;
@ -52,6 +43,16 @@ import mage.client.util.gui.ArrowBuilder;
import mage.remote.Session;
import org.apache.log4j.Logger;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.io.Serializable;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
/**
*
@ -433,6 +434,14 @@ public class FeedbackPanel extends javax.swing.JPanel {
public void setConnectedChatPanel(ChatPanel chatPanel) {
this.connectedChatPanel = chatPanel;
}
public void pressOKYesOrDone() {
if (btnLeft.getText().equals("OK") || btnLeft.getText().equals("Yes")) {
btnLeft.doClick();
} else if (btnRight.getText().equals("OK") || btnRight.getText().equals("Yes") || btnRight.getText().equals("Done")) {
btnRight.doClick();
}
}
private javax.swing.JButton btnLeft;
private javax.swing.JButton btnRight;

View file

@ -798,17 +798,35 @@ public final class GamePanel extends javax.swing.JPanel {
}
});
KeyStroke ks8 = KeyStroke.getKeyStroke(KeyEvent.VK_F9, 0);
this.getInputMap(c).put(ks8, "F9_PRESS");
KeyStroke ks9 = KeyStroke.getKeyStroke(KeyEvent.VK_F9, 0);
this.getInputMap(c).put(ks9, "F9_PRESS");
this.getActionMap().put("F9_PRESS", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
if (feedbackPanel != null && FeedbackMode.SELECT.equals(feedbackPanel.getMode())) {
session.sendPlayerInteger(gameId, -9999);
btnPassPriorityUntilNextYourTurnActionPerformed(actionEvent);
}
});
KeyStroke ks2 = KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0);
this.getInputMap(c).put(ks2, "F2_PRESS");
this.getActionMap().put("F2_PRESS", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
if (feedbackPanel != null) {
feedbackPanel.pressOKYesOrDone();
}
}
});
KeyStroke ks3 = KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0);
this.getInputMap(c).put(ks3, "F3_PRESS");
this.getActionMap().put("F3_PRESS", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
restorePriorityActionPerformed(actionEvent);
}
});
KeyStroke ksAltE = KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.ALT_MASK);
this.getInputMap(c).put(ksAltE, "ENLARGE");
this.getActionMap().put("ENLARGE", new AbstractAction() {
@ -1123,7 +1141,19 @@ public final class GamePanel extends javax.swing.JPanel {
private void btnEndTurnActionPerformed(java.awt.event.ActionEvent evt) {
if (feedbackPanel != null && FeedbackMode.SELECT.equals(feedbackPanel.getMode())) {
session.sendPlayerInteger(gameId, 0);
session.passTurnPriority(gameId);
}
}
private void btnPassPriorityUntilNextYourTurnActionPerformed(java.awt.event.ActionEvent evt) {
if (feedbackPanel != null && FeedbackMode.SELECT.equals(feedbackPanel.getMode())) {
session.passPriorityUntilNextYourTurn(gameId);
}
}
private void restorePriorityActionPerformed(java.awt.event.ActionEvent evt) {
if (feedbackPanel != null) {
session.restorePriority(gameId);
}
}

View file

@ -28,6 +28,7 @@
package mage.client.remote;
import mage.Constants;
import mage.cards.decks.Deck;
import mage.client.MageFrame;
import mage.client.chat.ChatPanel;
@ -58,12 +59,12 @@ public class CallbackClientImpl implements CallbackClient {
private UUID clientId;
private MageFrame frame;
private int messageId = 0;
private boolean firstRun;
public CallbackClientImpl(MageFrame frame) {
this.clientId = UUID.randomUUID();
this.frame = frame;
this.firstRun = true;
}
@Override
@ -99,10 +100,18 @@ public class CallbackClientImpl implements CallbackClient {
ChatMessage message = (ChatMessage) callback.getData();
ChatPanel panel = frame.getChat(callback.getObjectId());
if (panel != null) {
if (message.isUserMessage() && panel.getConnectedChat() != null) {
panel.getConnectedChat().receiveMessage(message.getUsername(), message.getMessage(), message.getTime(), ChatMessage.MessageColor.BLACK);
if (message.getMessage().equals(Constants.MSG_TIP_HOT_KEYS_CODE)) {
panel.receiveMessage("[Tips] ", "You may use hot keys to play faster: " + "" +
"\nF2 - press Ok, Yes or Done" +
"\nF4 - skip current turn but stop on declare attackers" +
"\nF9 - skip everything until you next turn" +
"\nF2 - undo F4/F9", "", ChatMessage.MessageColor.ORANGE);
} else {
panel.receiveMessage(message.getUsername(), message.getMessage(), message.getTime(), message.getColor());
if (message.isUserMessage() && panel.getConnectedChat() != null) {
panel.getConnectedChat().receiveMessage(message.getUsername(), message.getMessage(), message.getTime(), ChatMessage.MessageColor.BLACK);
} else {
panel.receiveMessage(message.getUsername(), message.getMessage(), message.getTime(), message.getColor());
}
}
}
} else if (callback.getMethod().equals("serverMessage")) {
@ -138,7 +147,6 @@ public class CallbackClientImpl implements CallbackClient {
GamePanel panel = frame.getGame(callback.getObjectId());
if (panel != null) {
panel.init((GameView) callback.getData());
}
}
else if (callback.getMethod().equals("gameOver")) {

View file

@ -1,6 +1,7 @@
package mage.client.util;
import mage.client.constants.Constants;
import mage.client.dialog.PreferencesDialog;
import org.apache.log4j.Logger;
import javax.sound.sampled.*;
@ -116,7 +117,10 @@ public class AudioManager {
private static void checkAndPlayClip(Clip clip) {
try {
if (clip != null) {
audioManager.play(clip);
String soundsOn = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_SOUNDS_ON, "true");
if (soundsOn.equals("true")) {
audioManager.play(clip);
}
}
} catch (Exception e) {
e.printStackTrace();