mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 20:11:59 -08:00
Possible fix for Issue 256
This commit is contained in:
parent
015ea665af
commit
a4fd5e6fb7
3 changed files with 29 additions and 1 deletions
|
|
@ -43,6 +43,7 @@ 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;
|
||||
|
||||
|
|
@ -182,6 +183,10 @@ public class ChatPanel extends javax.swing.JPanel {
|
|||
this.txtMessage.setVisible(false);
|
||||
}
|
||||
|
||||
public JTextField getTxtMessageInputComponent() {
|
||||
return this.txtMessage;
|
||||
}
|
||||
|
||||
public void useExtendedView(VIEW_MODE extendedViewMode) {
|
||||
this.extendedViewMode = extendedViewMode;
|
||||
this.txtConversation.setExtBackgroundColor(new Color(0,0,0,100));
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ import java.util.UUID;
|
|||
import javax.swing.*;
|
||||
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.chat.ChatPanel;
|
||||
import mage.client.components.MageTextArea;
|
||||
import mage.client.dialog.MageDialog;
|
||||
import mage.remote.Session;
|
||||
|
|
@ -67,6 +68,7 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
private Session session;
|
||||
private FeedbackMode mode;
|
||||
private MageDialog connectedDialog;
|
||||
private ChatPanel connectedChatPanel;
|
||||
|
||||
/** Creates new form FeedbackPanel */
|
||||
public FeedbackPanel() {
|
||||
|
|
@ -125,14 +127,16 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
}
|
||||
this.btnSpecial.setVisible(special);
|
||||
this.btnSpecial.setText("Special");
|
||||
this.btnRight.requestFocus();
|
||||
this.helper.setSpecial("Special", special);
|
||||
if (message.contains("P}")) {
|
||||
this.btnSpecial.setVisible(true);
|
||||
this.btnSpecial.setText("Pay 2 life");
|
||||
this.helper.setSpecial("Pay 2 life", true);
|
||||
}
|
||||
|
||||
requestFocusIfPossible();
|
||||
handleOptions(options);
|
||||
|
||||
this.revalidate();
|
||||
this.repaint();
|
||||
this.helper.setLinks(btnLeft, btnRight, btnSpecial);
|
||||
|
|
@ -156,6 +160,19 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
}
|
||||
}
|
||||
|
||||
// Issue 256: Chat+Feedback panel: request focus prevents players from chatting
|
||||
private void requestFocusIfPossible() {
|
||||
boolean requestFocusAllowed = true;
|
||||
if (connectedChatPanel != null && connectedChatPanel.getTxtMessageInputComponent() != null) {
|
||||
if (connectedChatPanel.getTxtMessageInputComponent().hasFocus()) {
|
||||
requestFocusAllowed = false;
|
||||
}
|
||||
}
|
||||
if (requestFocusAllowed) {
|
||||
this.btnRight.requestFocus();
|
||||
}
|
||||
}
|
||||
|
||||
public void doClick() {
|
||||
this.btnRight.doClick();
|
||||
}
|
||||
|
|
@ -382,6 +399,10 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
return this.mode;
|
||||
}
|
||||
|
||||
public void setConnectedChatPanel(ChatPanel chatPanel) {
|
||||
this.connectedChatPanel = chatPanel;
|
||||
}
|
||||
|
||||
private javax.swing.JButton btnLeft;
|
||||
private javax.swing.JButton btnRight;
|
||||
private javax.swing.JButton btnSpecial;
|
||||
|
|
|
|||
|
|
@ -112,6 +112,8 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
combat.hideDialog();
|
||||
MageFrame.getDesktop().add(pickNumber, JLayeredPane.POPUP_LAYER);
|
||||
|
||||
this.feedbackPanel.setConnectedChatPanel(this.gameChatPanel);
|
||||
|
||||
//FIXME: remove from here
|
||||
try {
|
||||
// Override layout (I can't edit generated code)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue