Improved display of log messages.
parent
37b2b0ac22
commit
bc60f14700
|
@ -13,7 +13,8 @@ Otherwise you will see a lot of question marks. The application stops automatica
|
|||
Magarena supports the following keyboard shortcuts :
|
||||
- Space or Right key : action button
|
||||
- Escape or Left key : undo button
|
||||
- Enter : switch between graphical and text mode
|
||||
- Enter key : switch between graphical and text mode
|
||||
- F1 key : show or hide game messages
|
||||
|
||||
The UI of Magarena can be customized with downloadable themes coming in zip files.
|
||||
A theme pack with five color themes can be downloaded on the project page.
|
||||
|
@ -36,9 +37,10 @@ Release 1.11 (April 11, 2011)
|
|||
- all cube (875 cards)
|
||||
|
||||
- renamed the two standard cubes to default and all
|
||||
- added AI selection in preferences (default is same as MiniMax AI, random AI does random moves)
|
||||
- improved displaying of messages with scroll bar and toggle button + F1 shortcut to show or hide messages
|
||||
- improved mana cost images (if already installed, delete symbols folder in Magarena data folder and load images)
|
||||
- improved card definition files, they now also contain the image url and cube information
|
||||
- added AI selection in preferences (default is same as MiniMax AI, random AI does random moves)
|
||||
|
||||
- fixed Lightning Helix, it can now target your own permanents with filter legal targets enabled
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ import java.awt.event.MouseAdapter;
|
|||
import java.awt.event.MouseEvent;
|
||||
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JToggleButton;
|
||||
import javax.swing.KeyStroke;
|
||||
|
@ -47,6 +46,7 @@ public class GamePanel extends JPanel {
|
|||
private static final String ACTION_KEY="action";
|
||||
private static final String UNDO_KEY="undo";
|
||||
private static final String SWITCH_KEY="switch";
|
||||
private static final String LOG_KEY="log";
|
||||
|
||||
private final MagicFrame frame;
|
||||
private final MagicGame game;
|
||||
|
@ -58,7 +58,7 @@ public class GamePanel extends JPanel {
|
|||
private final CardViewer cardViewer;
|
||||
private final GameTournamentViewer gameTournamentViewer;
|
||||
private final LogBookViewer logBookViewer;
|
||||
private final JLabel logBookButton;
|
||||
private final JToggleButton logBookButton;
|
||||
private final JToggleButton textViewButton;
|
||||
private final GameControllerThread thread;
|
||||
private final StackCombatViewer stackCombatViewer;
|
||||
|
@ -110,28 +110,32 @@ public class GamePanel extends JPanel {
|
|||
controller.setGameViewer(gameTournamentViewer.getGameViewer());
|
||||
add(gameTournamentViewer);
|
||||
|
||||
logBookButton=new JLabel(theme.getIcon(Theme.ICON_MESSAGE));
|
||||
logBookButton=new JToggleButton(theme.getIcon(Theme.ICON_MESSAGE),false);
|
||||
logBookButton.setFocusable(false);
|
||||
logBookButton.setOpaque(false);
|
||||
add(logBookButton);
|
||||
logBookButton.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent event) {
|
||||
|
||||
logBookViewer.setVisible(logBookButton.isSelected());
|
||||
}
|
||||
});
|
||||
logBookButton.addMouseListener(new MouseAdapter() {
|
||||
|
||||
@Override
|
||||
public void mouseEntered(final MouseEvent event) {
|
||||
|
||||
logBookViewer.update();
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
logBookViewer.setVisible(true);
|
||||
}
|
||||
});
|
||||
showLogBook(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseExited(final MouseEvent event) {
|
||||
|
||||
logBookViewer.setVisible(false);
|
||||
if (!logBookButton.isSelected()) {
|
||||
showLogBook(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -184,11 +188,25 @@ public class GamePanel extends JPanel {
|
|||
}
|
||||
});
|
||||
|
||||
getActionMap().put(LOG_KEY, new AbstractAction() {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
|
||||
final boolean selected=!logBookButton.isSelected();
|
||||
logBookButton.setSelected(selected);
|
||||
showLogBook(selected);
|
||||
}
|
||||
});
|
||||
|
||||
getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0),ACTION_KEY);
|
||||
getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0),ACTION_KEY);
|
||||
getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0),UNDO_KEY);
|
||||
getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),UNDO_KEY);
|
||||
getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),SWITCH_KEY);
|
||||
getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0), LOG_KEY);
|
||||
|
||||
stackCombatViewer=new StackCombatViewer(viewerInfo,controller);
|
||||
handGraveyardViewer=new HandGraveyardExileViewer(viewerInfo,controller);
|
||||
|
@ -234,6 +252,23 @@ public class GamePanel extends JPanel {
|
|||
}
|
||||
}
|
||||
|
||||
void showLogBook(final boolean visible) {
|
||||
|
||||
if (visible) {
|
||||
logBookViewer.update();
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
logBookViewer.setVisible(true);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
logBookViewer.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isTextView() {
|
||||
|
||||
return GeneralConfig.getInstance().getTextView();
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.awt.Color;
|
|||
import javax.swing.BorderFactory;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.border.Border;
|
||||
|
||||
import magic.model.MagicLogBook;
|
||||
|
@ -23,10 +24,12 @@ public class LogBookViewer extends JPanel {
|
|||
FontsAndBorders.EMPTY_BORDER
|
||||
);
|
||||
|
||||
private static final int MAX_LINES=30;
|
||||
private static final int MAX_LINES=200;
|
||||
private static final int INCREMENT=108;
|
||||
|
||||
private final MagicLogBook logBook;
|
||||
private final JPanel messagePanel;
|
||||
private final JScrollPane scrollPane;
|
||||
|
||||
public LogBookViewer(final MagicLogBook logBook) {
|
||||
|
||||
|
@ -37,15 +40,23 @@ public class LogBookViewer extends JPanel {
|
|||
setOpaque(true);
|
||||
|
||||
add(new TitleBar("Messages"),BorderLayout.NORTH);
|
||||
|
||||
|
||||
final JPanel centerPanel=new JPanel();
|
||||
centerPanel.setLayout(new BorderLayout());
|
||||
centerPanel.setBorder(FontsAndBorders.BLACK_BORDER_2);
|
||||
add(centerPanel,BorderLayout.CENTER);
|
||||
|
||||
messagePanel=new JPanel();
|
||||
messagePanel.setLayout(new BoxLayout(messagePanel,BoxLayout.Y_AXIS));
|
||||
centerPanel.add(messagePanel,BorderLayout.NORTH);
|
||||
|
||||
scrollPane=new JScrollPane();
|
||||
scrollPane.getViewport().setView(centerPanel);
|
||||
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
|
||||
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
|
||||
scrollPane.getVerticalScrollBar().setUnitIncrement(INCREMENT);
|
||||
scrollPane.getVerticalScrollBar().setBlockIncrement(INCREMENT);
|
||||
scrollPane.setBorder(FontsAndBorders.BLACK_BORDER_2);
|
||||
add(scrollPane,BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
public MagicLogBook getLogBook() {
|
||||
|
@ -72,5 +83,6 @@ public class LogBookViewer extends JPanel {
|
|||
messagePanel.add(panel);
|
||||
}
|
||||
revalidate();
|
||||
scrollPane.getVerticalScrollBar().setValue(0);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue