forked from External/mage
GUI: improved feedback needed sound notifications (plays only for inactive game or app, see #6853);
This commit is contained in:
parent
c343767e8e
commit
610baac6ab
6 changed files with 828 additions and 804 deletions
|
|
@ -1,19 +1,5 @@
|
|||
/*
|
||||
* FeedbackPanel.java
|
||||
*
|
||||
* Created on 23-Dec-2009, 9:54:01 PM
|
||||
*/
|
||||
package mage.client.game;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.SessionHandler;
|
||||
import mage.client.chat.ChatPanelBasic;
|
||||
|
|
@ -21,15 +7,22 @@ import mage.client.dialog.MageDialog;
|
|||
import mage.client.util.GUISizeHelper;
|
||||
import mage.client.util.audio.AudioManager;
|
||||
import mage.client.util.gui.ArrowBuilder;
|
||||
import static mage.constants.Constants.Option.ORIGINAL_ID;
|
||||
import static mage.constants.Constants.Option.SECOND_MESSAGE;
|
||||
import static mage.constants.Constants.Option.SPECIAL_BUTTON;
|
||||
import mage.constants.PlayerAction;
|
||||
import mage.constants.TurnPhase;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
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 static mage.constants.Constants.Option.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class FeedbackPanel extends javax.swing.JPanel {
|
||||
|
|
@ -45,7 +38,6 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
private MageDialog connectedDialog;
|
||||
private ChatPanelBasic connectedChatPanel;
|
||||
private int lastMessageId;
|
||||
private LocalDateTime lastResponse;
|
||||
|
||||
private static final ScheduledExecutorService WORKER = Executors.newSingleThreadScheduledExecutor();
|
||||
|
||||
|
|
@ -86,12 +78,6 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
this.helper.setTextArea(lblText);
|
||||
//this.lblMessage.setText(lblText);
|
||||
|
||||
// Alert user when needing feedback if last dialog was informative, and it has been over 2 seconds since last input
|
||||
if (this.mode == FeedbackMode.INFORM && mode != FeedbackMode.INFORM
|
||||
&& (this.lastResponse == null || this.lastResponse.isBefore(LocalDateTime.now().minusSeconds(2)))) {
|
||||
AudioManager.playFeedbackNeeded();
|
||||
}
|
||||
|
||||
this.mode = mode;
|
||||
switch (this.mode) {
|
||||
case INFORM:
|
||||
|
|
@ -251,7 +237,6 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
}
|
||||
|
||||
private void btnRightActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRightActionPerformed
|
||||
setLastResponse();
|
||||
if (connectedDialog != null) {
|
||||
connectedDialog.removeDialog();
|
||||
connectedDialog = null;
|
||||
|
|
@ -270,18 +255,15 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
}//GEN-LAST:event_btnRightActionPerformed
|
||||
|
||||
private void btnLeftActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLeftActionPerformed
|
||||
setLastResponse();
|
||||
SessionHandler.sendPlayerBoolean(gameId, true);
|
||||
AudioManager.playButtonCancel();
|
||||
}//GEN-LAST:event_btnLeftActionPerformed
|
||||
|
||||
private void btnSpecialActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSpecialActionPerformed
|
||||
setLastResponse();
|
||||
SessionHandler.sendPlayerString(gameId, "special");
|
||||
}//GEN-LAST:event_btnSpecialActionPerformed
|
||||
|
||||
private void btnUndoActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
setLastResponse();
|
||||
SessionHandler.sendPlayerAction(PlayerAction.UNDO, gameId, null);
|
||||
}
|
||||
|
||||
|
|
@ -313,10 +295,6 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
this.helper.setUndoEnabled(false);
|
||||
}
|
||||
|
||||
public void setLastResponse() {
|
||||
this.lastResponse = LocalDateTime.now();
|
||||
}
|
||||
|
||||
private javax.swing.JButton btnLeft;
|
||||
private javax.swing.JButton btnRight;
|
||||
private javax.swing.JButton btnSpecial;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue